-
Notifications
You must be signed in to change notification settings - Fork 178
/
craft.lic
822 lines (687 loc) · 41.5 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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#craft
=end
custom_require.call(%w[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.force_crafting_town || @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 <= 550 # Tier 7 Challenging
knit(5, 'a knitted blanket', 'blanket')
elsif rank <= 700 # Tier 8, Complicated
sew(3, 'a small cloth rucksack', 'rucksack', 7)
elsif rank <= 850 # Tier 9, Intricate
sew(3, 'a cloth rucksack', 'rucksack', 8)
elsif rank <= 1175 # Tier 10, Difficult
sew(3, "a cloth mining belt", 'belt', 10)
elsif rank <= 1400 # Tier 11, Very Difficult
sew(3, "a cloth survival belt", 'belt', 10)
else # Tier 12 Extremely Difficult
sew(3, "a cloth artisan's belt", 'belt', 10)
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
shape(6, 'ornate wood burin', 'burin')
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 { |each_recipe| each_recipe['name'] =~ /some blister cream/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some moisturizing ointment/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some chest salve/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /a neck potion/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some limb salve/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some chest unguent/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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('unguent', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 550 # Tier 7 - Challenging
# Buy riolur leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some neck tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some eye tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /a body elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /a general elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some refreshment elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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 { |each_recipe| each_recipe['name'] =~ /some vigor poultices/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
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')
stock_room = crafting_data['artificing'][@hometown]
rank = DRSkill.getrank('Enchanting')
enchanting_room = @settings.enchanting_room
quantity = 1
if rank <= 25 # Tier 1 Extremely Easy
# Buy an abolition sigil and bone totem for Radiant Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a radiant trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 50 # Tier 2 - Very Easy
# Buy an induction sigil and bone totem for Flash Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a flash trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 100 # Tier 3 - Easy
# Buy an rarefaction sigil and bone totem for Wind Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a wind trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 175 # Tier 4 - Simple
# Buy an permutation sigil and bone totem fo Earth Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /an earth trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 300 # Tier 5 - Basic
# Buy an abolition and congruence sigils and bone totem for Basic Holy Ritual focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /basic holy ritual focus/ }
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purcahse if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
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 for Strange Arrow
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /strange arrow runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['noun'].split.last) unless DRCI.exists?("basic runestone", @bag)
DRCC.stow_crafting_item('runestone', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 550 # Tier 7 - Challenging
# Buy a abolition and induction sigils and basic runestone for Gauge Flow
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /gauge flow runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purcahse if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['noun'].split.last) unless DRCI.exists?("basic runestone", @bag)
DRCC.stow_crafting_item('runestone', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of product.
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 700 # Tier 8 - Complicated
# Buy a rarefaction and induction sigils and basic runestone for Dispel
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /dispel runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purcahse item for product.
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['noun'].split.last) unless DRCI.exists?("basic runestone", @bag)
DRCC.stow_crafting_item('runestone', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of the product.
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 850 # Tier 9 - Intricate
# Buy a induction and rarefaction sigils and basic runestone for Lay Ward
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /lay ward runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.buy_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['noun'].split.last) unless DRCI.exists?("basic runestone", @bag)
DRCC.stow_crafting_item('runestone', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of the product.
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 1175 # Tier 10 - Difficult - Need to use sigilhunter or similar to gather the sigils for Frost Focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a frost focus/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for third sigil. Purchase if required.
if recipe['enchant_stock3_name'] == recipe['enchant_stock1_name'] && recipe['enchant_stock3_name'] == !recipe['enchant_stock2_name']
quantity *= 2
elsif recipe['enchant_stock3_name'] == recipe['enchant_stock1_name'] && recipe['enchant_stock3_name'] == recipe['enchant_stock2_name']
quantity *= 3
end
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock3_name'], recipe['enchant_stock3'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of the product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
else # Tier 11 Very Difficult - Need to use sigilhunter or similar to gather the sigils for Electric Focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /an electric focus/ }
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for second sigil. Purchase if required.
quantity *= 2 if recipe['enchant_stock2_name'] == recipe['enchant_stock1_name']
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock2_name'], recipe['enchant_stock2'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Check for third sigil. Purchase if required.
if recipe['enchant_stock3_name'] == recipe['enchant_stock1_name'] && recipe['enchant_stock3_name'] == !recipe['enchant_stock2_name']
quantity *= 2
elsif recipe['enchant_stock3_name'] == recipe['enchant_stock1_name'] && recipe['enchant_stock3_name'] == recipe['enchant_stock2_name']
quantity *= 3
end
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock3_name'], recipe['enchant_stock3'], quantity, @bag, @belt, stock_room)
DRCC.stow_crafting_item('sigil-scroll', @bag, @belt)
# Exit craft if tally is greater than or equal to one. This means one of the above checks and purchasing failed.
exit if tally >= 1
# Purchase item for product.
DRCT.order_item(crafting_data['artificing'][@hometown]['stock-room'], recipe['item']) unless DRCI.exists?("bone totem", @bag)
DRCC.stow_crafting_item('totem', @bag, @belt)
# Check if the fount has enough charges left and replace if required.
DRCC.fount(crafting_data['artificing'][@hometown]['tool-room'], 1, crafting_data['artificing'][@hometown]['fount'], 2, @bag, @bag_items, @belt)
# Head to your crafting location.
DRCC.find_enchanting_room(@training_room, enchanting_room)
# Finally make the product.
DRC.wait_for_script_to_complete('enchant', [recipe['chapter'], recipe['name'], recipe['noun'].split.last])
# Dispose of the product.
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
end
end
def money_for_training?(amount, skill)
if DRCM.ensure_copper_on_hand(amount, @settings, @hometown)
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, @hometown) 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, @hometown) 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')
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['tailoring'][@hometown]['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