forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crossing-training.lic
881 lines (712 loc) · 26.8 KB
/
crossing-training.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
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#crossing-training
=end
custom_require.call(%w[equipmanager events spellmonitor common common-arcana common-healing common-items common-moonmage common-money common-travel common-summoning])
class CrossingTraining
attr_reader :running, :idling
def stop
echo 'Received stop signal' if UserVars.crossing_trainer_debug
@stop = true
end
def initialize
@stop = false
@running = true
@idling = false
@cyclic_cycle_timer = Time.now - 300
arg_definitions = [[]]
args = parse_args(arg_definitions, true)
@settings = get_settings(args.flex)
@worn_trashcan = @settings.worn_trashcan
@worn_trashcan_verb = @settings.worn_trashcan_verb
@hometown = @settings.hometown
@training_room = (@settings.training_rooms || [@settings.safe_room]).sample
@song_list = get_data('perform').perform_options
@junk_timer = Time.now
@pray_to_chadatru = @settings.pray_to_chadatru
@chadatru_prayer_cooldown = 3600
@use_tessera = @settings.use_tessera_during_crossing_training
@tessera_invoke_cooldown = 660
@use_research = @settings.use_research
@settings.storage_containers.each { |container| fput("open my #{container}") }
@disciplines_to_skill = {
'Blacksmithing' => 'Forging',
'Weaponsmithing' => 'Forging',
'Armorsmithing' => 'Forging',
'Tailoring' => 'Outfitting',
'Shaping' => 'Engineering',
'Carving' => 'Engineering',
'Remedies' => 'Alchemy'
}
@skills_requiring_movement = @settings.crossing_training_requires_movement
@equipment_manager = EquipmentManager.new(@settings)
UserVars.crossing_timers ||= {}
if DRStats.paladin?
UserVars.chadatru_prayer_last ||= Time.now - @chadatru_prayer_cooldown
elsif DRStats.trader?
UserVars.tessera_invoke_last ||= Time.now - @tessera_invoke_cooldown
end
DRCA.release_cyclics
Flags.add('ct-song', 'you finish playing')
Flags.add('ct-no-instrument', 'Play on what instrument')
Flags.add('research-partial', 'there is still more to learn before you arrive at a breakthrough', 'distracted by combat', 'distracted by your spellcasting', 'You lose your focus on your research project', 'you forget what you were')
Flags.add('research-complete', '^Breakthrough!')
end
def dump_junk
return unless @settings.dump_junk
return unless Time.now - @junk_timer > 300
return unless DRRoom.room_objs.size > @settings.dump_item_count
DRC.bput('dump junk', 'You should just kick', 'You have marked this room', 'You cannot summon', 'The janitor was recently summoned')
@junk_timer = Time.now
end
def main
DRCT.walk_to(@training_room)
loop do
if @settings.waggle_sets['town-training']
DRC.wait_for_script_to_complete('buff', ['town-training'])
end
event_loop
if @idling
pause 30
@idling = false
end
next unless @stop && !@researching
@running = false
stop_play
break
end
end
def empty_trash
trash_nouns = get_data('items').trash_nouns
if trash_nouns.any? { |noun| /\b#{noun}/i =~ GameObj.right_hand.noun } && !@equipment_manager.is_listed_item?(DRC.right_hand)
DRCI.dispose_trash(DRC.right_hand, @worn_trashcan, @worn_trashcan_verb)
end
if trash_nouns.any? { |noun| /\b#{noun}/i =~ GameObj.left_hand.noun } && !@equipment_manager.is_listed_item?(DRC.left_hand)
DRCI.dispose_trash(DRC.left_hand, @worn_trashcan, @worn_trashcan_verb)
end
dump_junk
end
def event_loop
empty_trash
@equipment_manager.empty_hands
# The next skill to train is the one with the lowest field experience
skill = @settings.crossing_training
.select { |s| ready_to_use?(s) }
.select { |s| not_research_blocked?(s) }
.reject { |s| @settings.crossing_training_stationary_skills_only && @skills_requiring_movement.include?(s) }
.min_by { |s| DRSkill.getxp(s) }
check_tithe
check_chadatru
check_tessera
unless @skills_requiring_movement.include?(skill)
DRCT.walk_to(@training_room)
check_listening
check_teaching
end
check_research
check_osrel unless @researching
if skill.nil? || skill.empty? || DRSkill.getxp(skill) >= @settings.crossing_training_max_threshold
if @researching
echo '***Skills capped and researching***' if UserVars.crossing_trainer_debug
pause 30
fput 'research status'
else
@idling = true
echo '***Skills capped, sleeping***' if UserVars.crossing_trainer_debug
fput 'exit' if @settings.exit_on_skills_capped
DRCT.walk_to(@training_room)
play_song?
fput 'tdp'
end
return
end
stop_play unless @researching
refresh_cyclic unless @researching
echo "***Attempting to train #{skill}***" if UserVars.crossing_trainer_debug
update_timer(skill)
case skill
when 'Appraisal'
train_appraisal
when 'Arcana'
train_arcana
when 'Athletics'
train_athletics
when 'Life Magic', 'Holy Magic', 'Lunar Magic', 'Elemental Magic', 'Arcane Magic'
do_research skill
when 'Astrology'
train_astrology
when 'Attunement'
train_attunement
when 'Augmentation', 'Warding', 'Utility', 'Debilitation'
train_magic skill
when 'Empathy'
train_empathy
when 'Enchanting'
train_enchanting
when 'Engineering'
train_engineering
when 'First Aid'
train_first_aid
when 'Forging'
train_forging
when 'Locksmithing'
train_locksmithing
when 'Mechanical Lore'
warn('*** REMOVED *** Mechanical Lore is no longer supported as it has been removed from the game with the release of Enchanting. Please remove from your training routine.')
@settings.crossing_training.delete('Mechanical Lore')
warn('Dependency has \'Engineering\' to train engineering. Mechanical Lore is slow.')
when 'Outdoorsmanship'
if @settings.mine_for_outdoorsmanship
train_mining
else
train_outdoorsmanship
end
when 'Outfitting'
train_outfitting
when 'Perception'
train_perception
when 'Performance'
train_performance
when 'Scholarship'
train_scholarship
when 'Instinct'
train_scouting
when 'Sorcery'
train_sorcery
when 'Stealth'
train_stealth
when 'Summoning'
train_summoning
when 'Theurgy'
train_theurgy
when 'Thievery'
train_thievery
when 'Trading'
train_trading
when 'Alchemy'
train_alchemy
else
echo "#{skill} not implemented yet"
pause 15
end
end
def check_nerves
wounds = DRCH.check_health['wounds']
return unless wounds.values.flatten.map(&:body_part).map(&:downcase).include?('skin')
DRC.wait_for_script_to_complete('safe-room', ['force'])
DRCT.walk_to(@training_room)
end
def refresh_cyclic
return unless @settings.cyclic_training_spells
return unless Time.now - @cyclic_cycle_timer > 300
cyclic_skill = @settings.cyclic_cycle_skills
.min_by { |s| DRSkill.getxp(s) }
if DRSkill.getxp(cyclic_skill) >= 32
DRCA.release_cyclics
return
end
cast_spell(@settings.cyclic_training_spells[cyclic_skill], cyclic_skill)
check_nerves
@cyclic_cycle_timer = Time.now
end
def check_tithe
return unless @settings.tithe
return unless (almsbox = @settings.tithe_almsbox || get_data('town')[@hometown]['almsbox']['id'])
delta = Time.now - (UserVars.tithe_timer || Time.now - 14_400)
return if (delta < 4 * 60 * 60 && DRStats.paladin?) || (delta < 60 * 10 && DRStats.cleric?)
currency = DRCM.hometown_currency(@hometown)
return unless DRCM.withdraw_exact_amount?('5 silver', @settings)
DRC.wait_for_script_to_complete('pay-debt')
UserVars.tithe_timer = Time.now
DRCT.walk_to(almsbox)
DRC.bput("put 5 silver #{currency} in almsbox", 'You drop', 'But you do not', 'attend to thy own woes')
end
def check_chadatru
return unless DRStats.paladin? && @pray_to_chadatru
return unless Time.now - UserVars.chadatru_prayer_last > @chadatru_prayer_cooldown
altar_loc = get_data('theurgy')[@hometown]['chadatru_altar']['id']
if altar_loc.nil?
echo "***CHADATRU PRAYER SUPPORT NOT YET IMPLEMENTED IN #{@hometown}, REMOVING CHADATRU PRAYER***"
@pray_to_chadatru = false
return
end
DRCT.walk_to(altar_loc)
DRC.bput('kneel', 'You kneel', 'You are already', 'You rise')
case DRC.bput('pray chadatru', 'As you kneel', 'decide it would be inappropriate')
when 'As you kneel'
waitfor('soothing sensation washes over your soul')
end
UserVars.chadatru_prayer_last = Time.now
end
def check_tessera
return unless DRStats.trader? && @use_tessera
return unless Time.now - UserVars.tessera_invoke_last > @tessera_invoke_cooldown
DRC.retreat
return unless /inside your (.*)\./ =~ DRC.bput("get my tessera", 'You get a .+ tessera from inside your (.*).', 'What were you')
container = DRC.get_noun(Regexp.last_match(1))
DRC.bput('Ask my tessera about invest', 'You send your')
DRC.bput("put my tessera in my #{container}", 'You put', 'What were you')
DRCI.stow_hand('left') if DRC.left_hand.include?('tessera')
DRCI.stow_hand('right') if DRC.right_hand.include?('tessera')
UserVars.tessera_invoke_last = Time.now
end
def train_sorcery
return if @researching
unless @settings.crossing_training_sorcery || (DRCI.exists?('runestone') && DRSkill.getrank('Sorcery') <= 50)
echo '***UNABLE TO TRAIN SORCERY, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Sorcery')
return
end
DRC.wait_for_script_to_complete('sorcery')
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
def train_summoning
DRCS.summon_weapon
DRCS.break_summoned_weapon(DRC.right_hand)
# Use any remaining elemental charge to train Summoning
fput('pathway focus damage') if DRStats.circle >= 4
end
def train_locksmithing
return if @researching
DRC.wait_for_script_to_complete('burgle', ['start']) if @settings.train_with_burgle
return if DRSkill.getxp('Locksmithing') >= 30
if @settings.lockpick_room_id
DRCT.walk_to(@settings.lockpick_room_id)
else
DRCT.walk_to(@training_room)
end
start_time = Time.now
DRC.wait_for_script_to_complete('locksmithing')
if Time.now - start_time > 15
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
end
end
def train_theurgy
DRC.wait_for_script_to_complete('theurgy')
return unless @researching
return if fput('research status', 'not researching anything', 'Fundamental', 'Augmentation', 'Stream', 'Sorcery', 'Utility', 'Warding') != 'not researching anything'
Flags.reset('research-partial')
Flags.reset('research-complete')
@researching = nil
end
def train_mining
return if @researching
DRC.wait_for_script_to_complete('mining-buddy')
end
def handle_cyclic_timers(skill)
return unless @settings.training_spells[skill]['cyclic']
other_cyclics = @settings.training_spells.keys.select { |x| x != skill && @settings.training_spells[x]['cyclic'] }
other_cyclics.each { |type| update_timer(type) }
(other_cyclics + [skill]).each { |type| @settings.exp_timers[type] = 300 } # Only needs to be done once in setup, but meh.
end
def train_magic(skill)
if @settings.train_with_spells
if @use_research && @settings.research_skills.include?(skill)
do_research(skill)
else
return if mana < 40
handle_cyclic_timers(skill)
cast_spell(@settings.training_spells[skill], skill)
check_nerves
end
else
cast_nonspell(skill)
end
end
def not_research_blocked?(skill)
return true unless @use_research
return (['Summoning', 'Attunement', 'Athletics', 'Outdoorsmanship', 'Perception', 'Appraisal', 'Empathy', 'Mechanical Lore', 'Theurgy'] - @settings.research_skills).include?(skill) if @researching
research = @settings.research_skills.include?(skill)
return true unless research
return DRSkill.getxp(skill) < 18 if ['Life Magic', 'Holy Magic', 'Lunar Magic', 'Elemental Magic', 'Arcane Magic', 'Arcana'].include?(skill)
return DRSkill.getxp(skill) < 9 if %w[Warding Utility Augmentation Attunement].include?(skill)
echo("You have #{skill} listed as a research skill, which is not a valid research option")
true
end
def ready_to_use?(skill)
return true unless UserVars.crossing_timers[skill]
(Time.now - UserVars.crossing_timers[skill]) > get_skill_timer(skill)
end
def get_skill_timer(skill)
info = @settings.exp_timers[skill]
return 14 if info.nil?
info.is_a?(Hash) ? info['cooldown'] : info.to_i
end
def update_timer(skill)
UserVars.crossing_timers[skill] = Time.now
end
def cast_nonspell(skill)
ability = @settings.training_nonspells[skill]
echo("using ability: #{ability}") if UserVars.crossing_trainer_debug
if ability.include?('Khri')
DRCA.activate_khri?(@settings.kneel_khri, ability)
elsif ability.include?('berserk')
fput ability
fput 'berserk stop'
else
fput ability
end
end
def map_cambrinth(settings)
[settings.cambrinth, settings.cambrinth_cap, settings.stored_cambrinth]
end
def check_osrel
return unless @settings.osrel_amount && DRSpells.active_spells['Osrel Meraud']
return if @last_check_osrel && @last_check_osrel + 120 > Time.now
@last_check_osrel = Time.now
DRCA.infuse_om([email protected]_no_harness, @settings.osrel_amount)
end
def research
refresh_cyclic
return if DRC.bput("research #{@researching} 300", 'You focus', 'You tentatively', 'You confidently', 'Abandoning the normal', 'You cannot begin') != 'You cannot begin'
fput('research cancel')
fput('research cancel')
research
end
def check_research
return unless @researching
if Flags['research-partial']
Flags.reset('research-partial')
check_osrel
research
elsif Flags['research-complete']
Flags.reset('research-complete')
@researching = nil
end
end
def do_research(skill)
unless @use_research
echo "Tried to use spell research to train #{skill} with it disabled, please correct YAML."
return
end
return if @stop
Flags.reset('research-partial')
Flags.reset('research-complete')
until DRSpells.active_spells['Gauge Flow'] > 20
cast_spell({ 'abbrev' => 'GAF' }, nil)
check_nerves
pause 2
end
@researching = case skill
when 'Arcana', 'Life Magic', 'Holy Magic', 'Lunar Magic', 'Elemental Magic', 'Arcane Magic'
'FUNDAMENTAL'
when 'Attunement'
'STREAM'
else
skill.upcase
end
research
end
def cast_spell(data, skill)
data = DRCA.check_discern(data, @settings)
if data['abbrev'] =~ /^comp/i
DRCT.walk_to @settings.compost_room
return unless DRRoom.npcs.empty?
fput(['\'Had this been a real compost your belongings would be gone. Composting soon', '\'Compost', '\'Compost incoming', '\'This is a code green, compost alert', '\'Pick up your valuables, compost time', '\'If it\'s on the ground it\'s gone, Compost incoming'].sample)
end
if (data['abbrev'] =~ /locat/i) && !DRSpells.active_spells['Clear Vision']
fput('prep cv')
pause 5
DRCA.cast?
end
if data['moon']
# Look for a moon that will be up for the next few minutes
DRCMM.check_moonwatch
unless DRCMM.set_moon_data(data)
weather = DRC.bput('weather', 'inside', 'You glance up at the sky.')
DRCT.walk_to @settings.outdoor_room if weather =~ /inside/
fput('perceive moons')
# Look for a moon that will be up for the next few minutes
return unless DRCMM.set_moon_data(data)
end
data = DRCMM.set_moon_data(data)
end
DRCA.release_cyclics if data['cyclic']
return unless DRCA.prepare?(data['abbrev'], data['mana'], data['symbiosis'])
unless @settings.cambrinth_items[0]['name']
@settings.cambrinth_items = [{
'name' => @settings.cambrinth,
'cap' => @settings.cambrinth_cap,
'stored' => @settings.stored_cambrinth
}]
end
@settings.cambrinth_items.each_with_index do |item, index|
if data['cambrinth'][index][0]
DRCA.find_charge_invoke_stow(item['name'], item['stored'], item['cap'], @settings.dedicated_camb_use, data['cambrinth'][index], @settings.cambrinth_invoke_exact_amount)
end
end
waitcastrt?
snapshot = DRSkill.getxp(skill) if data['symbiosis']
success = DRCA.cast?(data['cast'], data['symbiosis'], data['before'], data['after'])
return unless data['symbiosis']
start = Time.now
pause 0.5 until snapshot != DRSkill.getxp(skill) || Time.now - start > 10 || !success
if !success
UserVars.discerns[data['abbrev']]['more'] = [UserVars.discerns[data['abbrev']]['more'] - 1, 0].max
elsif DRSkill.getxp(skill) - snapshot < @settings.symbiosis_learning_threshold
UserVars.discerns[data['abbrev']]['more'] = UserVars.discerns[data['abbrev']]['more'] + 1
end
end
def train_performance
return if play_song?(true)
echo '***UNABLE TO TRAIN PERFORMANCE, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Performance')
end
def train_outdoorsmanship
return if @researching && @settings.crafting_training_spells
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('outdoorsmanship')
end
def train_perception
return if @researching && @settings.crafting_training_spells
DRCT.walk_to(@training_room)
DRC.wait_for_script_to_complete('outdoorsmanship', ['perception'])
end
def train_first_aid
if @settings.fa_skinning_trainer
DRC.wait_for_script_to_complete('faskinner')
end
DRC.wait_for_script_to_complete('first-aid') if DRSkill.getxp('First Aid') < 30
end
def train_scholarship
play_song?
if @hometown == 'Crossing' && !DRStats.necromancer?
DRC.wait_for_script_to_complete('study-art', ['scholarship'])
return
end
case DRC.bput('get my blacksmithing book', 'What were you', 'You get')
when 'What were you'
echo '***UNABLE TO TRAIN SCHOLARSHIP, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Scholarship')
return
end
fput('turn my book to chapter 6')
14.times do |count|
DRC.bput("turn my book to page #{count + 1}", 'You turn your book to page', 'You are already on')
DRC.bput('study my book', 'roundtime')
waitrt?
break if DRSkill.getxp('Scholarship') >= 30
end
fput 'stow my book'
end
def train_athletics
return if @researching
DRC.wait_for_script_to_complete('burgle', ['start']) if @settings.train_with_burgle
return if DRSkill.getxp('Athletics') >= 30
DRC.wait_for_script_to_complete('athletics')
end
def train_empathy
if (DRSkill.getrank('Empathy') + DRSkill.getrank('Attunement')) / 2 < 75
echo '***UNABLE TO TRAIN EMPATHY DUE TO LOW RANK, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Empathy')
return
end
room_list = get_data('town')[@hometown]['perceive_health_rooms']
room_list.each do |room_id|
DRCT.walk_to(room_id)
5.times do
break if DRC.bput('perceive health', 'You fail to sense', 'You sense:', 'You\'re not ready to do that again, yet') == 'You sense:'
pause 1
pause 5 unless waitrt?
check_research
end
waitrt?
break if DRSkill.getxp('Empathy') >= 30
end
end
def train_scouting
DRC.wait_for_script_to_complete('scouting')
end
def train_attunement
if @use_research && @settings.research_skills.include?('Attunement')
do_research('Attunement')
return
end
DRC.wait_for_script_to_complete('attunement')
end
def hide_in(room_number)
DRCT.walk_to room_number
DRC.hide?
fput 'unhide'
waitrt?
end
def train_stealth
return if @researching
DRC.wait_for_script_to_complete('burgle', ['start']) if @settings.train_with_burgle
return if DRSkill.getxp('Stealth') >= 30 || DRSkill.getrank('Stealth') >= 30
hide_in 851
hide_in 850
hide_in 764
hide_in 5992
hide_in 992
end
def train_thievery
return if @researching
DRC.wait_for_script_to_complete('burgle', ['start']) if @settings.train_with_burgle
return if DRSkill.getxp('Thievery') >= 30
stop_play if @settings.hide_to_steal
DRC.wait_for_script_to_complete('steal')
end
def train_appraisal
return if @researching
DRCT.walk_to(@training_room)
play_song? if DRSkill.getrank('Appraisal') >= 250
DRC.wait_for_script_to_complete('appraisal')
end
def train_arcana
if @use_research && @settings.research_skills.include?('Arcana')
do_research('Arcana')
return
end
DRC.wait_for_script_to_complete('sanowret-crystal', ['run'])
end
def train_astrology
DRC.wait_for_script_to_complete('astrology')
end
def train_outfitting
if @settings.train_workorders.include?('Tailoring')
return unless money_for_training?(5000, 'Outfitting')
DRC.wait_for_script_to_complete('workorders', ['Tailoring'])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
end
DRC.wait_for_script_to_complete('craft', ['outfitting'])
end
def train_engineering
if @settings.train_workorders.include?('Shaping')
return unless money_for_training?(5000, 'Engineering')
DRC.wait_for_script_to_complete('workorders', ['Shaping'])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
elsif @settings.train_workorders.include?('Carving')
return unless money_for_training?(5000, 'Engineering')
DRC.wait_for_script_to_complete('workorders', ['Carving'])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
end
DRC.wait_for_script_to_complete('craft', ['engineering'])
end
def train_trading
disciplines = @settings.work_order_disciplines
if @settings.sell_pouches_for_trading && DRSkill.getxp('Trading') < 5
DRC.wait_for_script_to_complete('sell-pouches')
return if DRSkill.getxp('Trading') > 5
end
unless disciplines
DRC.beep
echo('SELECT DISCIPLINES FOR TRADING TRAINING WITH work_order_disciplines:')
DRC.beep
pause 5
return
end
discipline = disciplines.min_by { |s| DRSkill.getxp(@disciplines_to_skill[s]) }
return unless money_for_training?(5000, 'Trading')
DRC.wait_for_script_to_complete('workorders', [discipline])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
end
def train_enchanting
eligible = @settings.train_workorders & %w[Artificing]
unless eligible.empty?
return unless money_for_training?(20_000, 'Enchanting')
DRC.wait_for_script_to_complete('workorders', [eligible.first])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
end
DRC.wait_for_script_to_complete('craft', ['enchanting'])
end
# https://elanthipedia.play.net/Blacksmithing_Products
def train_forging
eligible = @settings.train_workorders & %w[Blacksmithing Weaponsmithing]
unless eligible.empty?
return unless money_for_training?(5000, 'Forging')
DRC.wait_for_script_to_complete('workorders', [eligible.first])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
end
DRC.wait_for_script_to_complete('craft', ['forging'])
end
# https://elanthipedia.play.net/Remedies_products
def train_alchemy
if @settings.train_workorders.include?('Remedies')
return unless money_for_training?(5000, 'Alchemy')
DRC.wait_for_script_to_complete('workorders', ['Remedies'])
DRC.wait_for_script_to_complete('sell-loot')
DRCT.walk_to(@training_room)
return
end
DRC.beep
echo('*** NOT YET IMPLEMENTED ***')
@settings.crossing_training.delete('Alchemy')
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 stop_play
return unless @did_play
return if @no_instrument
@did_play = false
DRC.stop_playing
Flags['ct-song'] = true
end
def play_song?(blocking = false)
return true if @researching
return false if @no_instrument
return true if DRSkill.getxp('Performance') >= 28
is_instrument_worn = @settings.instrument.nil?
Flags.reset('ct-no-instrument')
@did_play = DRC.play_song?(@settings, @song_list, is_instrument_worn, false)
@no_instrument = Flags['ct-no-instrument'] && !@did_play
return false unless @did_play
return true unless blocking
Flags.reset('ct-song')
pause 1 until Flags['ct-song']
true
end
end
before_dying do
Flags.delete('ct-song')
Flags.delete('ct-no-instrument')
Flags.delete('research-partial')
Flags.delete('research-complete')
end
# Call this last to avoid the need for forward declarations
$CROSSING_TRAINER = CrossingTraining.new
$CROSSING_TRAINER.main