forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
craft.lic
579 lines (531 loc) · 29.7 KB
/
craft.lic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#craft
=end
custom_require.call(%w[drinfomon equipmanager common common-crafting common-items common-money common-travel])
class Craft
def initialize
arg_definitions = [
[
{ name: 'craft', options: %w[forging outfitting engineering alchemy enchanting], description: 'What craft to train' }
]
]
args = parse_args(arg_definitions)
@settings = get_settings
@hometown = @settings.hometown
@worn_trashcan = @settings.worn_trashcan
@worn_trashcan_verb = @settings.worn_trashcan_verb
@training_room = (@settings.training_rooms || [@settings.safe_room]).sample
@settings.storage_containers.each { |container| fput("open my #{container}") }
@equipment_manager = EquipmentManager.new(@settings)
@craft_max_mindstate = @settings.craft_max_mindstate
@yarn_quantity = @settings.yarn_quantity
@bag = @settings.crafting_container
@bag_items = @settings.crafting_items_in_container
@belt = @settings.enchanting_belt
@overrides = @settings.craft_overrides
if args.craft == 'engineering'
exit if DRSkill.getxp('Engineering') > @craft_max_mindstate
train_engineering
end
if args.craft == 'outfitting'
exit if DRSkill.getxp('Outfitting') > @craft_max_mindstate
train_outfitting
end
if args.craft == 'forging'
exit if DRSkill.getxp('Forging') > @craft_max_mindstate
train_forging
end
if args.craft == 'alchemy'
exit if DRSkill.getxp('Alchemy') > @craft_max_mindstate
train_alchemy
end
if args.craft == 'enchanting'
exit if DRSkill.getxp('Enchanting') > @craft_max_mindstate
train_enchanting
end
end
def train_outfitting
rank = DRSkill.getrank('Outfitting')
info = @overrides['Outfitting']
if info
if info['type'].downcase.eql? 'sew'
sew(info['chapter'], info['item'], info['item'].split.last, info['volumes'])
else
knit(info['chapter'], info['item'], info['item'].split.last)
end
elsif rank <= 25 # Tier 1 Extremely Easy
knit(5, 'some knitted socks', 'socks')
elsif rank <= 50 # Tier 2 Very Easy
knit(5, 'some knitted mittens', 'mittens')
elsif rank <= 100 # Tier 3 Easy
knit(5, 'a knitted hat', 'hat')
elsif rank <= 175 # Tier 4 Simple
knit(5, 'some knitted gloves', 'gloves')
elsif rank <= 300 # Tier 5 Basic
knit(5, 'some knitted hose', 'hose')
elsif rank <= 425 # Tier 6 Somewhat Challenging
knit(5, 'a knitted cloak', 'cloak')
elsif rank <= 650 # Tier 7 Challenging
knit(5, 'a knitted blanket', 'blanket')
elsif rank <= 750 # Tier 8, Complicated
sew(3, 'a small cloth rucksack', 'rucksack', 7)
elsif rank <= 850 # Tier 10, difficult
sew(3, 'a cloth rucksack', 'rucksack', 8)
else # Tier 12 Extremely Difficult
echo('*** NOT YET IMPLEMENTED ***')
end
end
def train_engineering
rank = DRSkill.getrank('Engineering')
info = @overrides['Engineering']
if info
shape(info['chapter'], info['item'], info['item'].split.last)
elsif rank <= 25 # Tier 1 Extremely Easy
shape(7, 'a wood band', 'band')
elsif rank <= 50 # Tier 2 Very Easy
shape(7, 'a wood bracelet', 'bracelet')
elsif rank <= 100 # Tier 3 Easy
shape(7, 'a wood cloak pin', 'cloak pin')
elsif rank <= 175 # Tier 4 Simple
shape(7, 'a wood amulet', 'amulet')
elsif rank <= 300 # Tier 5 Basic
shape(7, 'a wood brooch', 'brooch')
elsif rank <= 425 # Tier 6 Somewhat Challenging
shape(7, 'a wood armband', 'armband')
elsif rank <= 600 # Tier 7 Challenging
shape(7, 'a wood choker', 'choker')
elsif rank <= 700 # Tier 8 - Complicated
shape(7, 'an articulated wood necklace', 'necklace')
elsif rank <= 850 # Tier 9 - Intricate
shape(7, 'a wood crown', 'crown')
elsif rank <= 1175 # Tier 10 - Difficult
shape(7, 'a wood comb', 'comb')
elsif rank <= 1400 # Tier 11 - Very Difficult
shape(7, 'a wood haircomb', 'haircomb')
else # Tier 12 Extremely Difficult
echo('*** NOT YET IMPLEMENTED ***')
end
end
def train_forging
rank = DRSkill.getrank('Forging')
info = @overrides['Forging']
if info
smith(info['item'])
elsif rank <= 25 # Tier 1 - Extremely Easy
smith('a shallow metal cup')
elsif rank <= 50 # Tier 2 - Very Easy
smith('a short metal mug')
elsif rank <= 100 # Tier 3 - Easy
smith('a back scratcher')
elsif rank <= 175 # Tier 4 - Simple
smith('a metal ankle band')
elsif rank <= 300 # Tier 5 - Basic
smith('a metal lockpick ring')
elsif rank <= 425 # Tier 6 - Somewhat Challenging
smith('a metal armband')
elsif rank <= 550 # Tier 7 - Challenging
smith('some metal clippers')
elsif rank <= 700 # Tier 8 - Complicated
smith('some squat knitting needles')
elsif rank <= 850 # Tier 9 - Intricate
smith('a serrated hide scraper')
elsif rank <= 1175 # Tier 10 - Difficult
smith('some serrated scissors')
elsif rank <= 1400 # Tier 11 - Very Difficult
smith('some thin sewing needles')
else # Tier 12 - Extremely Difficult
smith('trapezoidal wire sieve')
end
end
def train_alchemy
crafting_data = get_data('crafting')
rank = DRSkill.getrank('Alchemy')
if rank <= 25 # Tier 1 Extremely Easy
# Buy red flowers and nemoih root
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some blister cream/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb2_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], recipe['herb2'], crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('cream', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 50 # Tier 2 - Very Easy
# Buy red flowers and plovik leaf
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some moisturizing ointment/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb2_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], recipe['herb2'], crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('ointment', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 100 # Tier 3 - Easy
# Buy plovik leaves
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some chest salve/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('salve', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 175 # Tier 4 - Simple
# Buy riolur leaves
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /a neck potion/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('potion', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 300 # Tier 5 - Basic
# Buy jadice flower
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some limb salve/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('salve', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 425 # Tier 6 - Somewhat Challenging
# Buy plovik leaves
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some chest ungent/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('ungent', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 550 # Tier 7 - Challenging
# Buy riolur leaves
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some neck tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('tonic', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 700 # Tier 8 - Complicated
# Buy aevaes leaves
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some eye tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('tonic', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 850 # Tier 9 - Intricate
# Buy ojhenik root
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /a body elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('elixir', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 1175 # Tier 10 - Difficult
# Forage belradi moss
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /a general elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRC.wait_for_script_to_complete('alchemy',['belradi', 'forage', '25'])
DRC.wait_for_script_to_complete('alchemy',['belradi', 'prepare'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], 'na', crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('elixir', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 1400 # Tier 11 Very Difficult
# Forage blue flowers and belradi moss
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some refreshment elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRC.wait_for_script_to_complete('alchemy',['blue', 'forage', '25'])
DRC.wait_for_script_to_complete('alchemy',['belradi', 'forage', '5'])
DRC.wait_for_script_to_complete('alchemy',['blue', 'prepare'])
DRC.wait_for_script_to_complete('alchemy',['belradi', 'prepare'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], recipe['herb2'], crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('elixir', @worn_trashcan, @worn_trashcan_verb)
else # Tier 12 - Extremely Difficult
# Buy red flowers and forage dioica sap
recipe = get_data('recipes').crafting_recipes.find { |recipe| recipe['name'] =~ /some vigor poultices/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRC.wait_for_script_to_complete('alchemy',['dioica', 'forage', '5'])
DRC.wait_for_script_to_complete('alchemy',['dioica', 'prepare'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('remedy', ['remedies', recipe['chapter'], recipe['name'], recipe['herb1'], recipe['herb2'], crafting_data['remedies'][@hometown]['catalyst'], recipe['container'], recipe['noun']])
DRCI.dispose_trash('poultices', @worn_trashcan, @worn_trashcan_verb)
end
end
def train_enchanting
crafting_data = get_data('crafting')
rank = DRSkill.getrank('Enchanting')
if rank <= 25 # Tier 1 Extremely Easy
# Buy an abolition sigil and bone totem
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 2) unless DRCI.exists?("abolition sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 6) unless DRCI.exists?("bone totem")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [2, 'a radiant trinket', 'totem'])
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 50 # Tier 2 - Very Easy
# Buy an induction sigil and bone totem
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 1) unless DRCI.exists?("induction sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 6) unless DRCI.exists?("bone totem")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [2, 'a flash trinket', 'totem'])
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 100 # Tier 3 - Easy
# Buy an rarefaction sigil and bone totem
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 5) unless DRCI.exists?("rarefaction sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 6) unless DRCI.exists?("bone totem")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [2, 'a wind trinket', 'totem'])
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 175 # Tier 4 - Simple
# Buy an permutation sigil and bone totem
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 4) unless DRCI.exists?("permutation sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 6) unless DRCI.exists?("bone totem")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [2, 'an earth trinket', 'totem'])
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 300 # Tier 5 - Basic
# Buy an abolition and congruence sigils and bone totem
DRCM.ensure_copper_on_hand(2000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 3) unless DRCI.exists?("congruence sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 2) unless DRCI.exists?("abolition sigil-scroll")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 6) unless DRCI.exists?("bone totem")
DRCC.stow_crafting_item('totem', @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [3, 'basic holy ritual focus', 'totem'])
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 425 # Tier 6 - Somewhat Challenging
# Buy a permutation and rarefaction sigils and basic runestone
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 4) unless DRCI.exists?("permutation sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 5) unless DRCI.exists?("rarefaction sigil-scroll")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], 'runestone') unless DRCI.exists?("basic runestone")
DRCC.stow_crafting_item('runestone', @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [6, 'strange arrow runestone', 'runestone'])
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 550 # Tier 7 - Challenging
# Buy a abolition and induction sigils and basic runestone
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 2) unless DRCI.exists?("abolition sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 1) unless DRCI.exists?("induction sigil-scroll")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], 'runestone') unless DRCI.exists?("basic runestone")
DRCC.stow_crafting_item('runestone', @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag,@bag_items,@belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [6, 'gauge flow runestone', 'runestone'])
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 700 # Tier 8 - Complicated
# Buy a rarefaction and induction sigils and basic runestone
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 5) unless DRCI.exists?("rarefaction sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 1) unless DRCI.exists?("induction sigil-scroll")
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], 'runestone') unless DRCI.exists?("basic runestone")
DRCC.stow_crafting_item('runestone', @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant', [6, 'dispel runestone', 'runestone'])
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 850 # Tier 9 - Intricate
# Buy a induction and rarefaction sigils and basic runestone
DRCM.ensure_copper_on_hand(4000, @settings)
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 1) unless DRCI.exists?("induction sigil-scroll")
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], 5) unless DRCI.exists?("rarefaction sigil-scroll")
DRCC.stow_crafting_item((DRC.right_hand), @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], 'runestone') unless DRCI.exists?("basic runestone")
DRCC.stow_crafting_item('runestone', @bag, @belt)
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'],1,crafting_data['artificing'][@hometown]['fount'],2,@bag, @bag_items, @belt)
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('enchant',[6,'lay ward runestone','runestone'])
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 1175 # Tier 10 - Difficult
echo('*** NOT YET IMPLEMENTED ***')
else # Tier 11 Very Difficult
echo('*** NOT YET IMPLEMENTED ***')
end
end
def money_for_training?(amount, skill)
if DRCM.ensure_copper_on_hand(amount, @settings)
true
else
echo("Low on funds, removing #{skill} from training")
@settings.crossing_training.delete(skill)
false
end
end
def knit(chapter, unique_name, item)
check_yarn
DRCT.walk_to(@training_room)
check_listening
check_teaching
DRC.wait_for_script_to_complete('sew', ['trash', 'knitting', chapter, unique_name, 'yarn', item])
DRCI.put_away_item?('yarn', @bag)
end
def sew(chapter, unique_name, item, fabric_volumes)
check_thread
check_fabric(fabric_volumes)
DRCT.walk_to(@training_room)
check_listening
check_teaching
DRC.wait_for_script_to_complete('sew', ['trash', 'sewing', chapter, unique_name, 'burlap', item])
DRCI.put_away_item?('thread', @bag)
end
def shape(chapter, unique_name, item)
check_wood
DRCC.find_shaping_room(@hometown, @training_room)
check_listening
check_teaching
DRC.wait_for_script_to_complete('shape', ['trash', chapter, unique_name, 'maple', item])
DRC.bput('get my lumber', 'You get some', 'You pick up')
DRCI.dispose_trash('lumber', @worn_trashcan, @worn_trashcan_verb)
end
def smith(full_name)
DRC.wait_for_script_to_complete('smith', ['bronze', full_name, 'buy'])
DRCI.dispose_trash(DRC.left_hand, @worn_trashcan, @worn_trashcan_verb) if DRC.left_hand && full_name.sub("metal ", "").include?(DRC.left_hand)
end
def buy_wood
crafting_data = get_data('crafting')
return unless money_for_training?(1000, 'Engineering')
DRCT.order_item(crafting_data['shaping'][@hometown]['stock-room'], 10)
DRCI.put_away_item?('lumber', @bag)
end
def buy_yarn(skipcoin = false)
crafting_data = get_data('crafting')
DRCM.ensure_copper_on_hand(3000, @settings) unless skipcoin
DRCT.order_item(crafting_data['tailoring'][@hometown]['stock-room'], 13)
DRC.bput('combine my yarn', 'You combine', 'You must be holding both')
count = DRC.bput('count my yarn', 'You count out \d+ yards').scan(/\d+/).first.to_i
buy_yarn(true) if count < @yarn_quantity
DRCC.stow_crafting_item('yarn', @bag, @belt)
end
def buy_thread(skipcoin = false)
crafting_data = get_data('crafting')
DRCM.ensure_copper_on_hand(1000, @settings) unless skipcoin
DRCT.order_item(crafting_data['tailoring'][@hometown]['stock-room'], 6)
DRCC.stow_crafting_item('thread', @bag, @belt)
end
def order_fabric(stock_room, stock_needed, stock_number, type)
stock_needed.times do
DRCT.order_item(stock_room, stock_number)
DRC.bput("get my #{type} from my #{@bag}", 'What were', 'You get')
next unless DRC.left_hand && DRC.right_hand
DRC.bput("combine #{type} with #{type}", 'You combine')
end
DRCC.stow_crafting_item('burlap cloth', @bag, @belt)
end
def check_yarn
case DRC.bput('get my yarn', 'You get', 'You are already', 'What were you')
when 'What were you'
buy_yarn
when 'You get', 'You are already'
count = DRC.bput('count my yarn', 'You count out \d+ yards').scan(/\d+/).first.to_i
buy_yarn if count < @yarn_quantity
end
DRCC.stow_crafting_item('yarn', @bag, @belt)
end
def check_thread
case DRC.bput('get my cotton thread', 'You get', 'You are already', 'What were you')
when 'What were you'
buy_thread
when 'You get', 'You are already'
count = DRC.bput('count my cotton thread', 'You count out \d+ yards').scan(/\d+/).first.to_i
buy_thread if count < @yarn_quantity
end
DRCC.stow_crafting_item('thread', @bag, @belt)
end
def check_fabric(fabric_volumes)
crafting_data = get_data('crafting')['tailoring'][@hometown]
existing = if DRC.bput("get burlap cloth from my #{@bag}", 'What were', 'You get') == 'What were'
0
else
while DRC.bput("get burlap cloth from my #{@bag}", 'What were', 'You get') == 'You get'
DRC.bput("combine burlap cloth with burlap cloth", 'You combine')
end
DRC.bput("count my burlap cloth", 'You count out \d+ yards').scan(/\d+/).first.to_i
end
stock_needed = ((fabric_volumes - existing) / 10.0).ceil
order_fabric(crafting_data['stock-room'], stock_needed, crafting_data['stock']['burlap']['stock-number'], 'burlap cloth')
end
def check_wood
case DRC.bput('get my maple lumber', 'You get', 'You are already', 'What were you')
when 'What were you'
buy_wood
when 'You get', 'You are already'
count = DRC.bput('count my lumber', 'You count out \d+ pieces of lumber remaining').scan(/\d+/).first.to_i
buy_wood if count < 5
end
DRCC.stow_crafting_item('lumber', @bag, @belt)
end
def check_teaching
return unless @settings.classes_to_teach
return if @settings.classes_to_teach.empty?
return if @last_teacher
if @class_timer.nil? || Time.now - @class_timer > 10 * 60
@settings.classes_to_teach.rotate!
DRC.bput('stop teach', 'You stop', 'you aren\'t teaching')
pause
@class_timer = Time.now
end
to_teach = @settings.classes_to_teach.first
DRRoom.pcs.each { |character| DRC.bput("teach #{to_teach} to #{character}", 'You begin to', 'is already listening to you', 'is listening to someone else', 'I could not find who you were referring to', 'You have already offered', 'That person is too busy teaching', 'You are already teaching', 'You cannot teach two different classes at the same time', 'is not paying attention to you', 'You cannot listen to a teacher and teach', 'already trying to teach you something') }
end
def check_listening
return unless @settings.listen
return if DRC.listen?(@last_teacher, @settings.listen_observe)
return if DRRoom.pcs.empty?
return unless @listen_timer.nil? || Time.now - @listen_timer > 5 * 60
return unless @class_timer.nil?
classes = DRC.assess_teach
@last_teacher = classes
.reject { |t, s| t.nil? || s.nil? }
.sort_by { |_t, s| [DRSkill.getxp(s), DRSkill.getrank(s)] }
.find { |t, _s| DRC.listen?(t, @settings.listen_observe) }
.first
@listen_timer = @last_teacher ? nil : Time.now
end
end
Craft.new