forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crossing-training.lic
1049 lines (905 loc) · 32.5 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
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#crossing-training
=end
custom_require.call(%w(drinfomon equipmanager events spellmonitor common common-arcana common-crafting common-items common-money common-travel common-summoning))
class CrossingTraining
include DRC
include DRCA
include DRCC
include DRCI
include DRCM
include DRCS
include DRCT
attr_reader :running, :idling
def stop
@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)
@training_room = (@settings.training_rooms || [@settings.safe_room]).sample
@athletics_options = get_data('athletics').athletics_options
@climbing_target = get_data('athletics').practice_options[@settings.climbing_target]
@song_list = get_data('perform').perform_options
@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 ||= {}
release_cyclics
Flags.add('ct-song', 'you finish playing')
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 main
walk_to(@training_room)
if @settings.waggle_sets['town-training']
pause 10
wait_for_script_to_complete('buff', ['town-training'])
end
loop do
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?(right_hand)
dispose_trash(right_hand)
end
if trash_nouns.any? { |noun| /\b#{noun}/i =~ GameObj.left_hand.noun } && !@equipment_manager.is_listed_item?(left_hand)
dispose_trash(left_hand)
end
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
unless @skills_requiring_movement.include?(skill)
walk_to(@training_room)
check_listening
check_teaching
end
check_research
check_osrel unless @researching
if skill.nil? || skill.empty? || DRSkill.getxp(skill) >= 28
if @researching
echo '***Skills capped and researching***' if UserVars.crossing_trainer_debug
pause 30
else
@idling = true
echo '***Skills capped, sleeping***' if UserVars.crossing_trainer_debug
fput 'exit' if @settings.exit_on_skills_capped
walk_to(@training_room)
play_song?
end
# Output a harmless command to prevent being logged out
fput 'tdp'
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 'Athletics'
train_athletics
when 'Arcana', '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 'Engineering'
train_engineering
when 'First Aid'
train_first_aid
when 'Forging'
train_forging
when 'Locksmithing'
train_locksmithing
when 'Mechanical Lore'
train_mechanical_lore
when 'Outdoorsmanship'
if @settings.mine_for_outdoorsmanship
train_mining
else
train_outdoorsmanship
end
when 'Outfitting'
train_outfitting
when 'Perception'
train_outdoorsmanship
when 'Performance'
train_performance
when 'Scholarship'
train_scholarship
when 'Scouting'
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 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
release_cyclics
return
end
cast_spell(@settings.cyclic_training_spells[cyclic_skill], cyclic_skill)
@cyclic_cycle_timer = Time.now
end
def check_tithe
return unless @settings.tithe
delta = Time.now - (UserVars.tithe_timer || Time.now - 14_400)
return if (delta < 4 * 60 * 60 && DRStats.paladin?) || (delta < 60 * 10 && DRStats.cleric?)
return unless withdraw_exact_amount?('5 silver', @settings.hometown)
wait_for_script_to_complete('pay-debt')
UserVars.tithe_timer = Time.now
walk_to(741)
bput('put 5 silver kronar in almsbox', 'You drop', 'But you do not', 'attend to thy own woes')
end
def train_sorcery
return if @researching
unless @settings.crossing_training_sorcery || (exists?('runestone') && DRSkill.getrank('Sorcery') <= 50)
echo '***UNABLE TO TRAIN SORCERY, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Sorcery')
return
end
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!
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| 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') }
end
def check_listening
return unless @settings.listen
return if listen?(@last_teacher)
return if DRRoom.pcs.empty?
return unless @listen_timer.nil? || Time.now - @listen_timer > 5 * 60
return unless @class_timer.nil?
classes = 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| listen?(t) }
.first
@listen_timer = @last_teacher ? nil : Time.now
end
def train_summoning
summon_weapon
break_summoned_weapon(right_hand)
# Use any remaining elemental charge to train Summoning
fput('pathway focus damage') if DRStats.circle >= 4
end
def train_locksmithing
walk_to(@settings.lockpick_room_id) if @settings.lockpick_room_id
start_time = Time.now
wait_for_script_to_complete('pick')
if Time.now - start_time > 15
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
else
echo '***UNABLE TO TRAIN LOCKSMITHING, REMOVING IT FROM THE TRAINING LIST***'
@settings.crossing_training.delete('Locksmithing')
end
end
def train_theurgy
wait_for_script_to_complete('theurgy')
return unless @researching
return if 'not researching anything' != fput('research status', 'not researching anything', 'Fundamental', 'Augmentation', 'Stream', 'Sorcery', 'Utility', 'Warding')
Flags.reset('research-partial')
Flags.reset('research-complete')
@researching = nil
end
def train_mining
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
return if mana < 40
if @use_research && @settings.research_skills.include?(skill)
do_research(skill)
else
handle_cyclic_timers(skill)
cast_spell(@settings.training_spells[skill], skill)
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")
return 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')
activate_khri?(@settings.kneel_khri, ability)
else
fput ability
end
end
def calculate_mana(min, more, discern_data, cyclic)
total = min + more
total = (total * @settings.prep_scaling_factor).floor
discern_data['mana'] = [(total / 4.0).ceil, min].max
remaining = total - discern_data['mana']
if remaining > @settings.cambrinth_cap
discern_data['mana'] = discern_data['mana'] + (remaining - @settings.cambrinth_cap)
remaining = total - discern_data['mana']
end
if cyclic
discern_data['cambrinth'] = nil
discern_data['mana'] = discern_data['mana'] + remaining
elsif remaining > 0
discern_data['cambrinth'] = []
step_size = (remaining / 3.0).ceil
while remaining > 0
discern_data['cambrinth'] << [remaining, step_size].min
remaining -= step_size
end
else
discern_data['cambrinth'] = nil
end
end
def check_discern(data)
UserVars.discerns = {} unless UserVars.discerns
discern_data = UserVars.discerns[data['abbrev']] || {}
if data['symbiosis']
if discern_data.empty? || discern_data['min'].nil?
/requires at minimum (\d+) mana streams/ =~ bput("discern #{data['abbrev']}", 'requires at minimum \d+ mana streams')
discern_data['mana'] = Regexp.last_match(1).to_i
discern_data['cambrinth'] = nil
discern_data['min'] = Regexp.last_match(1).to_i
discern_data['more'] = 0
end
calculate_mana(discern_data['min'], discern_data['more'], discern_data, false)
elsif discern_data.empty? || discern_data['time_stamp'].nil? || Time.now - discern_data['time_stamp'] > 24 * 60 * 60 || !discern_data['more'].nil?
discern_data['time_stamp'] = Time.now
case discern = bput("discern #{data['abbrev']}", 'The spell requires at minimum \d+ mana streams and you think you can reinforce it with \d+ more', 'You don\'t think you are able to cast this spell', 'You have no idea how to cast that spell')
when /you don't think you are able/i, 'You have no idea how to cast that spell'
discern_data['mana'] = 1
discern_data['cambrinth'] = nil
else
discern =~ /minimum (\d+) mana streams and you think you can reinforce it with (\d+) more/i
calculate_mana(Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, discern_data, data['cyclic'])
end
end
pause 1
waitrt?
UserVars.discerns[data['abbrev']] = discern_data
data['mana'] = discern_data['mana']
data['cambrinth'] = discern_data['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
infuse_om([email protected]_no_harness, @settings.osrel_amount)
end
def research
refresh_cyclic
return if 'You cannot begin' != bput("research #{@researching} 300", 'You focus', 'You tentatively', 'You confidently', 'Abandoning the normal', '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)
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)
check_discern(data)
if data['abbrev'] =~ /^comp/i
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
cast?
end
if data['moon']
# Look for a moon that will be up for the next few minutes
unless Script.running? 'moonwatch'
echo 'moonwatch is not running. Starting it now'
UserVars.moons = {}
custom_require.call('moonwatch')
echo "Run `;e autostart('moonwatch')` to avoid this in the future"
pause 0.5 while UserVars.moons.empty?
end
unless moon = UserVars.moons.find { |moon_name, moon_data| UserVars.moons['visible'].include?(moon_name) && moon_data['timer'] >= 4 }.first
echo "No moon available to cast #{data['abbrev']}"
weather = bput('weather', 'inside', 'You glance up at the sky.')
walk_to @settings.outdoor_room if weather =~ /inside/
fput('perceive moons')
# Look for a moon that will be up for the next few minutes
unless moon = UserVars.moons.find { |moon_name, moon_data| UserVars.moons['visible'].include?(moon_name) && moon_data['timer'] >= 4 }.first
echo "Couldn't find any moons to cast #{data['abbrev']} with"
return
end
end
data['cast'] = "cast #{moon}"
end
release_cyclics if data['cyclic']
return unless prepare?(data['abbrev'], data['mana'], data['symbiosis'])
find_charge_invoke_stow(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap, @settings.dedicated_camb_use, data['cambrinth'])
waitcastrt?
snapshot = DRSkill.getxp(skill) if data['symbiosis']
success = 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 braid_to_fail(item)
return if left_hand || right_hand
return unless forage?(item)
loop do
waitrt?
check_research
case bput("braid my #{item}", 'You need to have more', 'Roundtime', 'You need both hands to do that', 'You can\'t braid the .* into your braided', 'is already as long as you can make it', 'You are in no condition')
when 'Roundtime'
rt = reget(10, 'Roundtime').last.scan(/\d+/).first.to_i
break if rt >= 8 || DRSkill.getxp('Mechanical Lore') >= 30
when 'is already as long as you can make it'
waitrt?
break
when 'You need both hands to do that', /into your braided/
waitrt?
empty_trash
return
when 'You are in no condition'
dispose_trash(item)
wait_for_script_to_complete('safe-room')
return
else
break unless forage?(item)
end
end
pause 1
waitrt?
bput("pull my #{item}", 'You tug and pull')
pause 1
waitrt?
empty_trash
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
if DRSkill.getrank('Outdoorsmanship') < 20
forage?('rock')
dispose_trash 'rock'
else
item = @settings.forage_item || 'rock'
collect(item)
waitrt?
kick_pile? unless kick_pile?("#{item}s")
end
end
def train_first_aid
play_song?
wait_for_script_to_complete('first-aid')
end
def train_scholarship
play_song?
if @settings.hometown == 'Crossing' && !DRStats.necromancer?
wait_for_script_to_complete('study-art', ['scholarship'])
return
end
case bput('get my black 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|
bput("turn my book to page #{count + 1}", 'You turn your book to page', 'You are already on')
bput('study my book', 'roundtime')
waitrt?
end
fput 'stow my book'
end
def train_mechanical_lore
waitrt?
@equipment_manager.wear_equipment_set?('standard')
@equipment_manager.empty_hands
fput "remove #{@settings.hand_armor}"
fput "stow #{@settings.hand_armor}"
pause 1
release_invisibility
if @settings.braid_item
braid_to_fail(@settings.braid_item)
else
braid_to_fail(DRSkill.getrank('Outdoorsmanship') < 110 ? 'grass' : 'vine')
end
@equipment_manager.empty_hands
fput "get my #{@settings.hand_armor}"
fput "wear my #{@settings.hand_armor}"
end
def climb?(room, targets)
targets.each do |target|
walk_to(room)
return true if DRRoom.npcs.length >= 3
fput "climb #{target}"
pause
waitrt?
return false if DRSkill.getxp('Athletics') >= 30
end
true
end
def train_athletics
if @climbing_target
return if @researching
walk_to(@climbing_target['id'])
climb_practice(@climbing_target['target'], @climbing_target['hide'])
elsif DRSkill.getrank('Athletics') >= 400
return if @researching
climb_branch
else
play_song?
@athletics_options
.reject { |data| @settings.avoid_athletics_in_justice && data['justice'] }
.each do |data|
check_research
break unless climb?(data['room'], data['targets'])
end
end
end
def climb_practice(target, to_hide = false)
return unless target
while DRSkill.getxp('Athletics') < 29
check_osrel unless @researching
check_research
retreat
if to_hide
attempts_to_hide = 5
while attempts_to_hide > 0
break if hide?
attempts_to_hide -= 1
end
return if attempts_to_hide.zero?
end
Flags.add('ct-climbing-finished', 'You finish practicing')
Flags.add('ct-climbing-combat', 'You are engaged in combat')
bput("climb practice #{target}", 'You begin to practice ')
loop do
pause 1
break if Flags['ct-climbing-finished']
return if Flags['ct-climbing-combat']
if DRSkill.getxp('Athletics') > 28
fput('stop climb')
break
end
end
end
bput('unhide', 'You come out of hiding', 'You slip out of hiding', 'But you are not')
end
def climb_branch
start_script('skill-recorder') unless Script.running?('skill-recorder')
walk_to(2245)
check_research
if DRSkill.getxp('Athletics') < 29
walk_to(2245)
if UserVars.athletics < 550
climb_practice('branch', true)
else
play_song?
walk_to(9607)
walk_to(19_464)
while DRSkill.getxp('Athletics') < 29
walk_to(2245)
walk_to(9607)
walk_to(11_126)
walk_to(19_464)
check_osrel unless @researching
check_research
break if DRSkill.getxp('Athletics') >= 29
train_outdoorsmanship
train_outdoorsmanship
train_outdoorsmanship
train_outdoorsmanship
end
end
end
check_osrel unless @researching
check_research
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
[8266, 850, 7902, 19_077, 815, 793, 8265, 4652, 19_093, 19_078].each do |room_id|
walk_to(room_id)
5.times do
break if 'You sense:' == bput('perceive health', 'You fail to sense', 'You sense:', 'You\'re not ready to do that again, yet')
pause 1
rt = waitrt?
pause 5 if rt.nil? || rt.zero?
check_research
end
waitrt?
break if DRSkill.getxp('Empathy') >= 30
end
end
def train_scouting
wait_for_script_to_complete('scouting')
end
def train_attunement
if @use_research && @settings.research_skills.include?('Attunement')
do_research('Attunement')
return
end
wait_for_script_to_complete('attunement')
end
def hide_in(room_number)
walk_to room_number
hide?
fput 'unhide'
waitrt?
end
def train_stealth
hide_in 851
hide_in 850
hide_in 764
hide_in 5992
hide_in 992
end
def train_thievery
stop_play if @settings.hide_to_steal
wait_for_script_to_complete('steal')
end
def train_appraisal
return if @researching
play_song? if DRSkill.getrank('Appraisal') >= 250
wait_for_script_to_complete('appraisal')
end
def train_astrology
wait_for_script_to_complete('astrology')
end
def train_outfitting
if @settings.train_workorders.include?('Tailoring')
return unless money_for_training?(5000, 'Outfitting')
wait_for_script_to_complete('workorders', ['Tailoring'])
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
return
end
rank = DRSkill.getrank('Outfitting')
if rank <= 25 # Tier 1 Extremely Easy
sew(5, 'knitted socks', 'socks')
elsif rank <= 50 # Tier 2 Very Easy
sew(5, 'knitted mittens', 'mittens')
elsif rank <= 100 # Tier 3 Easy
sew(5, 'knitted hat', 'hat')
elsif rank <= 175 # Tier 4 Simple
sew(5, 'knitted gloves', 'gloves')
elsif rank <= 300 # Tier 5 Basic
sew(5, 'knitted hose', 'hose')
elsif rank <= 425 # Tier 6 Somewhat Challenging
sew(5, 'knitted cloak', 'cloak')
elsif rank <= 650 # Tier 7 Challenging
sew(5, 'knitted blanket', 'blanket')
else # Tier 12 Extremely Difficult
echo('*** NOT YET IMPLEMENTED ***')
end
end
def train_engineering
return unless money_for_training?(5000, 'Engineering')
wait_for_script_to_complete('workorders', ['Shaping'])
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
end
def train_trading
disciplines = @settings.work_order_disciplines
if @settings.sell_pouches_for_trading && DRSkill.getxp('Trading') < 5 && 'You get a' == bput("get pouch from my #{@settings.sale_pouches_container}", 'You get a', 'What were you')
gemshop = get_data('town')[@settings.hometown]['gemshop']['id']
unless gemshop
echo('NO GEMSHOP DATA FOUND?')
fput('stow pouch')
return
end
walk_to gemshop
fput('spec finesse')
fput('sell pouch')
fput('put pouch in bucket')
wait_for_script_to_complete('sell-loot')
return
end
unless disciplines
beep
echo('SELECT DISCIPLINES FOR TRADING TRAINING WITH work_order_disciplines:')
beep
pause 5
return
end
discipline = disciplines.min_by { |s| DRSkill.getxp(@disciplines_to_skill[s]) }
return unless money_for_training?(5000, 'Trading')
wait_for_script_to_complete('workorders', [discipline])
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
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')
wait_for_script_to_complete('workorders', [eligible.first])
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
return
end
rank = DRSkill.getrank('Forging')
if 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
echo('*** NOT YET IMPLEMENTED ***')
# Journeyman book: triangular wire sieve, bent <metal> scissors, knobby sewing needles, squat knitting needles, narrow <metal> awl
elsif rank <= 850 # Tier 9 - Intricate
echo('*** NOT YET IMPLEMENTED ***')
# Master book: beveled wood shaper, serrated hide scraper, compact <metal> awl, compact <metal> awl, round pestle
elsif rank <= 1175 # Tier 10 - Difficult
echo('*** NOT YET IMPLEMENTED ***')
# Master book: slender <metal> awl, serrated scissors, grooved pestle, oblong wire sieve
elsif rank <= 1400 # Tier 11 - Very Difficult
echo('*** NOT YET IMPLEMENTED ***')
# Master book: jagged wood shaper, thin sewing needles
else # Tier 12 - Extremely Difficult
echo('*** NOT YET IMPLEMENTED ***')
# Master book: trapezoidal wire sieve
end
end
# https://elanthipedia.play.net/Remedies_products
def train_alchemy
if @settings.train_workorders.include?('Remedies')
return unless money_for_training?(5000, 'Alchemy')
wait_for_script_to_complete('workorders', ['Remedies'])
wait_for_script_to_complete('sell-loot')
walk_to(@training_room)
return
end
beep
echo('*** NOT YET IMPLEMENTED ***')
@settings.crossing_training.delete('Alchemy')
end
def money_for_training?(amount, skill)
if 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 sew(chapter, unique_name, item)
return unless buy_yarn
walk_to(@training_room)
check_listening
check_teaching
wait_for_script_to_complete('sew', ['trash', 'knitting', chapter, unique_name, item])
fput('get my wool yarn')
dispose_trash('yarn')
end
def smith(full_name)
wait_for_script_to_complete('smith', ['bronze', full_name, 'buy'])
dispose_trash(right_hand)
dispose_trash(left_hand)
end
def buy_yarn
return unless money_for_training?(700, 'Outfitting')
order_item(16_667, 13)
fput('stow my yarn')
end
def stop_play
return unless @did_play
return if @no_instrument
@did_play = false
bput('stop play', 'You stop playing your song', 'In the name of', "But you're not performing")
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
UserVars.song = @song_list.first.first unless UserVars.song
@did_play = true
case bput("play #{UserVars.song}", 'dirtiness may affect your performance', 'slightest hint of difficulty', 'You begin a', 'You struggle to begin', 'You\'re already playing a song', 'You effortlessly begin', 'You begin some', 'You cannot play', 'Play on what instrument', 'now isn\'t the best time to be playing', 'Perhaps you should find somewhere drier before trying to play')
when 'Play on what instrument'
@no_instrument = true
return false
when 'now isn\'t the best time to be playing', 'Perhaps you should find somewhere drier before trying to play'
return true
when 'You cannot play'
wait_for_script_to_complete('safe-room')
when 'dirtiness may affect your performance'
if DRSkill.getrank('Performance') < 20
echo "Skipping cleaning of zills due to low rank of Performance: #{DRSkill.getrank('Performance')}" if UserVars.crossing_trainer_debug
return true
end
stop_play
clean_zills
return play_song?
when 'You begin a', 'You effortlessly begin', 'You begin some'
stop_play
UserVars.song = @song_list[UserVars.song] || @song_list.first.first
return play_song?
when 'You struggle to begin'