forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbescort.lic
1389 lines (1273 loc) · 45.7 KB
/
bescort.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
# Documentation: https://elanthipedia.play.net/Lich_script_repository#bescort
custom_require.call(%w[common common-arcana common-items common-travel common-money drinfomon equipmanager events skill-recorder])
$turns_since_bad = 0
class MazeRoom
include DRC
include DRCT
$CARDINALS = { 'n' => 's', 's' => 'n', 'ne' => 'sw', 'sw' => 'ne', 'nw' => 'se', 'se' => 'nw', 'e' => 'w', 'w' => 'e' }
$ADJUSTMENTS = { 'n' => [0, 1], 's' => [0, -1], 'ne' => [1, 1], 'sw' => [-1, -1], 'nw' => [-1, 1], 'se' => [1, -1], 'e' => [1, 0], 'w' => [-1, 0] }
attr_accessor :desc, :exits, :checked, :parent, :coords
def initialize(came_from = nil, source_room = nil)
if came_from
@exits = { $CARDINALS[came_from] => source_room }
source_room.exits[came_from] = self
@coords = update_coords(source_room.coords, came_from)
else
@@room_list = []
@exits = {}
@coords = [0, 0]
end
populate_exits
@@room_list << self
end
def find_room_by_coords(coords)
@@room_list.find { |room| room.coords == coords }
end
def update_coords(coords, traveled)
[coords.first + $ADJUSTMENTS[traveled].first, coords.last + $ADJUSTMENTS[traveled].last]
end
def best_path
@@room_list.each do |room|
room.checked = false
room.parent = nil
end
@checked = true
queue = [self]
until queue.empty?
current = queue.shift
current.exits.each do |dir, child|
return current.parent || dir if child.nil?
next if child.checked
child.checked = true
child.parent = current.parent || dir
queue << child
end
end
end
def condense_direction(direction)
direction.gsub(/orth|est|ast|outh/i, '')
end
def populate_exits
remaining_exits = XMLData.room_exits.map { |exit| condense_direction(exit) } - @exits.keys
remaining_exits.each { |exit| @exits[exit] = nil }
end
def wander
dir_to_go = @exits.keys.first if @exits.size == 1
dir_to_go, = @exits.find { |_, room| room.nil? } unless dir_to_go
dir_to_go, = best_path unless dir_to_go
fix_standing
move(dir_to_go)
pause
return @exits[dir_to_go] if @exits[dir_to_go]
if existing_room = find_room_by_coords(update_coords(@coords, dir_to_go))
@exits[dir_to_go] = existing_room
existing_room.exits[$CARDINALS[dir_to_go]] = self
return existing_room
end
MazeRoom.new(dir_to_go, self)
end
end
class Bescort
include DRC
include DRCT
include DRCA
include DRCI
include DRCM
$ICE_PATH_HIB = %w[nw ne ne e ne ne ne nw sw w w nw]
$ICE_PATH_SHARD = %w[se e e ne se sw sw sw w sw sw se]
def initialize
arg_definitions = [
[
{ name: 'wilds', regex: /wilds/i, description: 'The Leucro and Geni wilds on the NTR.' },
{ name: 'mode', options: %w[exit leucro1 leucro2 geni], description: 'Where do you need to get to?' }
],
[
{ name: 'oshu_manor', regex: /oshu_manor/i, description: "The Seordhevor kartais & grave worms in Oshu'ehhrsk Manor. Near germish'din on the STR." },
{ name: 'mode', options: %w[exit worms kartais], description: 'kartais: takes you to seordhevor kartais. worms: takes you to grave worms exit: exits.' }
],
[
{ name: 'faldesu', regex: /faldesu/i, description: 'The Faldesu river at the end of the NTR.' },
{ name: 'mode', options: %w[haven crossing], description: 'Where do you need to get to?' }
],
[
{ name: 'zaulfang', regex: /zaulfang/i, description: 'For crossing the Zaulfang swamp maze outside Haven' },
{ name: 'mode', options: %w[exit enter], description: 'Where do you need to get to?' }
],
[
{ name: 'gate_of_souls', regex: /gate_of_souls/i, description: 'For crossing the Blasted Plain between the Gate of Souls and Temple of Ushnish' },
{ name: 'mode', options: %w[exit blasted temple fangs], description: 'Where do you need to get to?' }
],
[
{ name: 'segoltha', regex: /segoltha/i, description: 'The Segoltha south of the crossing' },
{ name: 'mode', options: %w[north south], description: 'Where do you need to get to?' }
],
[
{ name: 'crocs', regex: /crocs/i, description: 'Blue belly crocodiles on NTR' },
{ name: 'mode', options: %w[enter exit], description: 'Where do you need to get to?' }
],
[
{ name: 'ways', regex: /ways/i, description: 'Astral travelling' },
{ name: 'mode', options: %w[shard crossing leth riverhaven merkresh fang raven throne muspari aesry taisgath theren steppes], description: 'Where do you need to get to?' }
],
[
{ name: 'mammoth', regex: /mammoth/i, description: 'The mammoths between Acenamacra, Fang Cove, and Ratha' },
{ name: 'mode', options: %w[acen fang ratha], description: 'Where do you need to get to?' }
],
[
{ name: 'iceroad', regex: /iceroad/i, description: 'The ice road between Shard and Hibarnhvidar' },
{ name: 'mode', options: %w[shard hibarnhvidar], description: 'Where do you need to get to?' }
],
[
{ name: 'basalt', regex: /basalt/i, description: 'The ferry between Ratha and Necromancer Island' },
{ name: 'mode', options: %w[island ratha], description: 'Where do you need to get to?' }
],
[
{ name: 'balloon', regex: /balloon/i, description: 'The air ship between Langenfirth and Mriss' },
{ name: 'mode', options: %w[langenfirth mriss], description: 'Where do you need to get to?' }
],
[
{ name: 'dirigible', regex: /dirigible/i, description: 'The air ship between Shard and Aesry' },
{ name: 'mode', options: %w[shard aesry], description: 'Where do you need to get to?' }
],
[
{ name: 'therenropebridge', regex: /therenropebridge/i, description: 'The rope bridge between Theren and Rossman\'s Landing' },
{ name: 'mode', options: %w[totheren torossman], description: 'Where do you need to get to?' }
],
[
{ name: 'gondola', regex: /gondola/i, description: 'Gondola between Shard and Leth Deriel' },
{ name: 'mode', options: %w[north south], description: 'Which direction are you going?' }
],
[
{ name: 'sandbarge', regex: /sandbarge/i, description: 'The sand barge between Hvaral, Oasis, and Muspari' },
{ name: 'start_location', options: %w[hvaral oasis muspari], description: 'Where are you coming from?' },
{ name: 'end_location', options: %w[hvaral oasis muspari], description: 'Where do you need to get to?' }
],
[
{ name: 'desert', regex: /desert/i, description: 'Hidasharon Desert on Mriss for hunting armadillos' },
{ name: 'mode', options: %w[adult juvenile elder oasis exit], description: 'Where to?' }
],
[
{ name: 'ferry', regex: /ferry/i, description: 'Ferry between Leth Deriel and the Crossing' },
{ name: 'mode', options: %w[leth crossing], description: 'Which town are you going to?' }
],
[
{ name: 'ferry1', regex: /ferry1/i, description: 'Ferry between Hibarnhvidar and the Ain Ghazal' },
{ name: 'mode', options: %w[hibarnhvidar ainghazal], description: 'Which town are you going to?' }
],
[
{ name: 'lang_barge', regex: /lang/, description: 'Barge between Langenfirth and Riverhaven' }
],
[
{ name: 'shard_gates', regex: /shard/i, description: 'Use the Shard gates' }
],
[
{ name: 'thief_guild', regex: /thief_guild/i, description: 'Enter the Shard thieves guild' }
],
[
{ name: 'abyss', regex: /abyss/i, description: 'Use the Cleric entrance to the Abyss; requires Rezz' }
],
[
{ name: 'haven_throne', regex: /haven_throne/i, description: 'Ferry between Riverhaven and Throne City' }
],
[
{ name: 'hvaral_passport', regex: /hvaral_passport/i, description: 'Handles the gate between Hvaral and Muspari' }
]
]
args = parse_args(arg_definitions)
pause
if args.wilds
wilds(args.mode)
elsif args.oshu_manor
oshu_manor(args.mode)
elsif args.faldesu
faldesu(args.mode)
elsif args.zaulfang
zaulfang(args.mode)
elsif args.gate_of_souls
gate_of_souls(args.mode)
elsif args.segoltha
segoltha(args.mode)
elsif args.crocs
croc_swamp(args.mode)
elsif args.ways
astral_walk(args.mode)
elsif args.mammoth
take_mammoth(args.mode)
elsif args.iceroad
iceroad(args.mode)
elsif args.basalt
take_crawling_plague(args.mode)
elsif args.balloon
take_balloon(args.mode)
elsif args.dirigible
take_dirigible(args.mode)
elsif args.therenropebridge
take_theren_rope_bridge(args.mode)
elsif args.gondola
ride_gondola(args.mode)
elsif args.sandbarge
take_sandbarge(args.start_location, args.end_location)
elsif args.desert
desert(args.mode)
elsif args.ferry
take_xing_ferry(args.mode)
elsif args.ferry1
take_ain_ghazal_ferry(args.mode)
elsif args.abyss
abyss_enter
elsif args.lang_barge
take_rh_lang_barge
elsif args.shard_gates
use_shard_gates
elsif args.thief_guild
enter_thief_guild
elsif args.haven_throne
take_haven_throne_ferry
elsif args.hvaral_passport
hvaral_passport
end
end
private
def do_map_move(movement)
if movement.is_a?(StringProc) || movement.is_a?(Proc)
movement.call
else
move movement
end
end
def manual_go2(goal_room)
return if Room.current.id == goal_room
path = Map.findpath(Room.current.id, Map[goal_room])
path.each { |step| do_map_move(Room.current.wayto[step.to_s]) }
do_map_move(Room.current.wayto[goal_room.to_s])
end
def search
fput('search')
pause
waitrt?
retreat
end
def search_path(pathname, visible = true, movetype = 'go')
if visible
loop do
loop do
search
# 'other stuff' indicates the room is full - any paths could be rolled up into that collection
break if DRRoom.room_objs.find { |obj| obj.include?(pathname) || obj.include?('other stuff') }
end
break if move "#{movetype} #{pathname}"
pause
end
pause
else
search
until move "#{movetype} #{pathname}"
pause
search
end
end
end
def move_direction?(dir_priority, force_match = nil)
if choice = dir_priority.find { |dir| XMLData.room_exits.include?(dir) }
$turns_since_bad = 0
move choice
true
elsif force_match
dir_priority.each do |dir|
if force_match.find { |msg| XMLData.room_description.include?(msg) }
return false
end
move(dir)
pause 0.5
waitrt?
end
true
elsif XMLData.room_exits.empty?
# fog?
move dir_priority[$turns_since_bad % dir_priority.size]
$turns_since_bad += 1
$turns_since_bad < 15
else
false
end
end
def find_room_maze(valid_move = proc { |_| true }, error_rooms = {})
loop do
error_rooms[Room.current.id].call if error_rooms[Room.current.id]
return if DRRoom.pcs.empty? && DRRoom.npcs.empty?
return if !DRRoom.pcs.empty? && (DRRoom.pcs - UserVars.friends).empty? && DRRoom.pcs.size <= 2
exits = XMLData.room_exits.dup.shuffle
exits = %w[nw n ne e se s sw w].shuffle if exits.empty?
exits.rotate! until valid_move.call(exits.first)
move exits.first
end
end
def find_room_list(moves, min = 0)
count = 0
moves.each do |dir|
count += 1
break if DRRoom.pcs.empty? && DRRoom.npcs.empty? && count > min
move dir
pause 0.5
end
end
def oshu_manor(mode)
if mode !~ /exit/i && Room.current.id != 2317
echo('Oshu manor script must be started from 2317')
exit
end
case mode
when /exit/i
walk_to(2317)
when /worms/i
wait_for_script_to_complete('oshu_manor', ['worms'])
find_room_list(%w[sw w w w w n n s s e s e s se ne e w n n ne])
when /kartais/i
wait_for_script_to_complete('oshu_manor', ['kartais'])
find_room_list(%w[e e w w w n n n])
end
end
def take_sandbarge(start_location, end_location)
if start_location == end_location
echo('You entered the same locations.')
exit
end
case start_location # determines what room to find the barge
when 'muspari'
manual_go2(6872)
when 'oasis'
if end_location == 'hvaral'
manual_go2(7578)
elsif end_location == 'muspari'
manual_go2(7579)
end
when 'hvaral'
manual_go2(3766)
end
case end_location # determines how and when to exit the barge
when 'muspari'
port_type = 'platform'
port_call = 'The sand barge pulls into dock'
when 'oasis'
port_type = 'oasis'
port_call = 'The sand barge pulls up to a desert oasis'
when 'hvaral'
port_type = 'dock'
port_call = 'The sand barge pulls into dock'
end
case bput('go barge', 'What were you referring to', "One of the barge's crew members watching", "You can't do that right now")
when /What were you referring to/, /You can't do that right now/
hide?
waitfor 'A sand barge pulls'
take_sandbarge(start_location, end_location)
when /One of the barge's crew members watching/
hide?
waitfor port_call
fput("go #{port_type}")
end
end
def desert_enter
walk_to(12_581)
move 'down'
end
def desert(mode)
priority_directions = %w[northeast east north northwest south southeast west southwest]
if mode !~ /exit/i && Room.current.id != 6760
echo('Desert script must be started in 6760')
exit
end
case mode
when /oasis/
echo 'Not implemented'
exit
when /juvenile/
desert_enter
find_room_maze
when /adult/
desert_enter
move_direction?(priority_directions) until DRRoom.room_objs.include?('faint trail that stretches towards a sand-filled valley')
move 'go trail'
find_room_maze
when /elder/
desert_enter
move_direction?(priority_directions) until DRRoom.room_objs.include?('faint trail that stretches towards a sand-filled valley')
move 'go trail'
move_direction?(priority_directions) until DRRoom.room_objs.include?('faint path leading to some nearby dunes')
move 'go path'
find_room_maze
exit
when /exit/
if XMLData.room_title.include?('Sand Valley') # Adult Area
move_direction?(priority_directions) until DRRoom.room_objs.include?('faint trail leading to some nearby dunes')
move 'go trail'
desert(mode)
end
if XMLData.room_title.include?('High Dunes') # Juvie Area or Elder
move_direction?(priority_directions) until DRRoom.room_objs.include?('faint trail that stretches towards a sand-filled valley') || DRRoom.room_objs.include?('faint path that stretches towards a sand-filled valley')
if DRRoom.room_objs.include?('faint trail that stretches towards a sand-filled valley')
else
move 'go path'
desert(mode)
exit
end
move 'south'
move 'northeast'
walk_to(6760)
end
end
end
def wilds(mode)
if mode !~ /exit/i && Room.current.id != 7958
echo('Wilds script must be started from 7958')
exit
end
case mode
when /exit/i
wilds_leave
when /leucro1/i
wilds_enter
find_room_maze(proc { |dir| !(XMLData.room_exits == %w[east south northwest] && dir == 'northwest') }, 7958 => proc { search_path('spot') }, 7957 => proc { move('east') })
when /leucro2/i
wilds_enter
wilds_leucro_maze(true)
find_room_list(%w[se s se sw sw sw w w w w s se], 4)
when /geni/i
wilds_enter
wilds_leucro_maze(true)
wilds_leucro_walk
find_room_maze
end
end
def wilds_enter
search_path('spot')
end
def wilds_leucro_walk
attempts = 0
until XMLData.room_description.include?('small creatures still lurk beneath its surface -- perhaps following the remnant of an old, long unused trail.')
unless move_direction?(%w[southeast south southwest west])
move('southeast')
end
pause 0.5
attempts += 1
if attempts == 50
echo 'Train your perception!'
exit
end
end
search_path('trail', false)
end
def wilds_leucro_maze(entering)
if entering
while move_direction?(%w[northeast east north southeast])
pause 0.5
break if DRRoom.room_objs.include?('tangled deadfall')
end
if Room.current.id == 7958
move 'go spot'
wilds_leucro_maze(entering)
return
end
move 'go dead'
else
pause 0.5 while move_direction?(%w[northwest west north])
end
end
def wilds_leave_trail
pause 0.5 while move_direction?(%w[northeast north northwest east south], ['A fearsomely large black plant rests at the bottom of two slopes. Its serpentine, multiple stems end in large red tubular openings, which exude a smell like a cross between donkey roadkill and flayed skunk'])
move 'go dead'
end
def wilds_leave
matches = [
'It drips slowly into the undergrowth, creating a damp sludge that makes walking unpleasant and hazardous',
'Several sets of yellow eyes stare out unblinkingly from the safety of oak tree limbs too high for even the largest creatures to reach. The sound of softly fluttering wings drifts down',
'A fearsomely large black plant rests at the bottom of two slopes. Its serpentine, multiple stems end in large red tubular openings, which exude a smell like a cross between donkey roadkill and flayed skunk',
'A lively brook once bubbled through the narrow gully, but time and drought have left only this cracked streambed as a reminder.'
]
loop do
pause 0.25 while move_direction?(%w[northwest west north northeast], matches)
if XMLData.room_description.include?(matches[0])
search_path('trail', false)
elsif XMLData.room_description.include?(matches[1]) || XMLData.room_description.include?(matches[2])
wilds_leave_trail
else
break
end
end
end
def faldesu(mode)
unless mode =~ /haven|crossing/i
echo 'You must specify haven or crossing for traversing the faldesu river'
exit
end
if UserVars.athletics >= 140
unless UserVars.athletics >= 300
EquipmentManager.new.empty_hands
EquipmentManager.new.wear_equipment_set?('swimming')
end
swim_faldesu(mode =~ /haven/i)
EquipmentManager.new.wear_equipment_set?('standard')
else
take_rh_ferry(mode =~ /haven/i)
end
end
def iceroad(mode)
unless mode =~ /shard|hibarnhvidar/i
echo 'You must specify shard or hibarnhvidar for traversing the ice road'
exit
end
path = mode == 'shard' ? $ICE_PATH_SHARD : $ICE_PATH_HIB
if exists?('skates')
EquipmentManager.new.empty_hands
footwear = get_settings.footwear
fput("remove #{footwear}") if footwear
bput("stow my #{footwear}", 'You put') if footwear
fput('get skates')
fput('wear skates')
path.each do |movement|
move(movement)
end
fput('rem skates')
fput('stow skates')
bput("get my #{footwear}", 'You get') if footwear
fput("wear #{footwear}") if footwear
else
path.each do |movement|
move(movement)
waitrt?
collect('rock')
waitrt?
end
end
end
def swim(dir)
move dir
pause
waitrt?
end
def swim_faldesu(north)
start = north ? 1375 : 473
manual_go2(start)
moveset = north ? %w[north northwest northeast] : %w[south southwest southeast]
move 'dive river'
swim(moveset[0]) while XMLData.room_exits.include?(moveset[0])
swim(moveset[1]) while XMLData.room_exits.include?('east')
swim(moveset[2]) while XMLData.room_exits.include?(moveset[0])
move 'climb bridge'
end
def take_mammoth(mode)
case mode
when 'fang'
id_to_mammoth = { 2239 => 'tall', 11_130 => 'sea' }
closest_mammoth = sort_destinations(id_to_mammoth.keys).first
manual_go2(closest_mammoth)
mammoth_type = id_to_mammoth[closest_mammoth]
when 'acen'
manual_go2(8301)
mammoth_type = 'tall'
when 'ratha'
manual_go2(8301)
mammoth_type = 'sea'
end
case bput("join #{mammoth_type} mammoth", 'What were you referring to', 'You join the Merelew driver')
when /What were you referring to/
waitfor 'The waves along the waterline increase drastically', 'A watery trumpeting sound heralds the swift approach'
take_mammoth(mode)
when /You join the Merelew driver/
waitfor 'The burly beast trumpets a series of watery blasts', 'Here we are, ladies and gentlemen'
end
end
def take_crawling_plague(mode)
case mode
when 'island'
manual_go2(12_282)
when 'ratha'
manual_go2(12_292)
end
case bput('join crawling plague', "You join the ship's captain", 'What were you referring to?')
when /You join the ship's captain/
hide?
board_time = Time.now if UserVars.bescort_debug
pause 1 until XMLData.room_title != '[[The Crawling Plague, Deck]]'
echo "Trip time: #{Time.now - board_time} seconds" if UserVars.bescort_debug
when /What were you referring to/
hide?
waitfor 'JOIN CRAWLING PLAGUE before it leaves if you would like to go'
take_crawling_plague(mode)
end
end
def take_dirigible(mode)
case mode
when 'aesry'
manual_go2(12_862)
if wealth('Shard') < DRStats.circle * 50
echo('Get money you slob!')
return unless get_fare?(DRStats.circle * 50, 'Shard', 12_862)
end
when 'shard'
if wealth('Aesry') < DRStats.circle * 50
echo('Get money you slob!')
return unless get_fare?(DRStats.circle * 50, 'Aesry', 12_942)
end
manual_go2(12_942)
end
case bput('join dirigible', 'The Elothean aeromancer says, "Woah there', 'What were you referring to?')
when /Elothean aeromancer/
case bput('join dirigible', 'You hand over your funds and step closer', 'You reach your funds, but')
when /closer/
pause 5
pause until XMLData.room_title != '[[Aboard the Dirigible, Gondola]]'
else
return
end
when /What were you referring to/
waitfor 'JOIN CHARCOAL DIRIGIBLE'
take_dirigible(mode)
end
end
def take_balloon(mode)
case mode
when 'mriss'
manual_go2(8793)
if wealth('Therenborough') < DRStats.circle * 50
echo('Get money you slob!')
return unless get_fare?(DRStats.circle * 50, 'Therenborough', 8793)
end
when 'langenfirth'
if wealth("Mer'Kresh") < DRStats.circle * 50
echo('Get money you slob!')
return unless get_fare?(DRStats.circle * 50, "Mer'Kresh", 8794)
end
manual_go2(8794)
end
case bput('join balloon', 'The Gnomish operator says, "Woah there', 'What were you referring to?')
when /Gnomish operator /
case bput('join balloon', 'You hand over your funds and step closer', 'You reach your funds, but')
when /closer/
pause 5
pause until XMLData.room_title != '[[Aboard the Balloon, Gondola]]'
else
return
end
when /What were you referring to/
waitfor 'JOIN GNOMISH BALLOON'
take_balloon(mode)
end
end
def take_rh_ferry(north)
if north
manual_go2(1385)
else
manual_go2(470)
end
case bput('go ferry', 'You .* climb aboard', 'Come back when you can afford the fare', 'not here', 'I could not find what you were referring to', 'stuck here until the next one arrives')
when /not here/, /I could not find what you were referring to/i, /stuck here until the next one arrives/
hide?
waitfor 'pulls into the dock', 'pulls up to the dock'
take_rh_ferry(north)
when /climb aboard/
hide?
waitfor 'reaches the dock and its crew ties the ferry off'
fput('go dock')
end
end
def zaulfang(mode)
Flags.add('maze-reset', 'The noxious swamp gas takes its toll on your mind, and your surroundings seem to shift as you grow immensely dizzy')
case mode
when /enter/i
unless Room.current.id == 8540
echo('Must enter Zaulfang swamp from 8540')
exit
end
move('go path')
pause
wander_maze_until('sickly tree that looms far above the swamp', 'climb tree')
when /exit/i
unless Room.current.id == 19_415
echo('Must exit Zaulfang swamp from 19415')
exit
end
move('down')
pause
wander_maze_until('curving path', 'go path')
end
end
def wander_maze_until(target, exit_command)
Flags.add('maze-reset', 'You can\'t go there')
current_room = MazeRoom.new
loop do
if Flags['maze-reset']
Flags.reset('maze-reset')
result = bput('look', 'Obvious paths:.*').split(':').last.split(', ').first.delete('.')
move(result)
pause
current_room = MazeRoom.new
end
if DRRoom.room_objs.include?(target)
unless move(exit_command)
fix_standing
wander_maze_until(target, exit_command)
end
return
end
current_room = current_room.wander
end
end
def gate_of_souls(mode)
Flags.add('maze-reset', 'Plumes of lava belch into the air, sending molten rock spraying about')
case mode
when /blasted/i
unless Room.current.id == 1784
echo('Must start at Gate of Souls, room number 1784')
exit
end
gos_blasted_plains
find_room_maze
when /temple/i
unless Room.current.id == 1784
echo('Must start at Gate of Souls, room number 1784')
exit
end
gos_blasted_plains
wander_maze_until('golden sandstone temple', 'go temple')
manual_go2(13_625)
find_room_list(%w[sw e e e se s sw w w w w nw n ne se s ne se n ne w nw])
when /fangs/i
unless Room.current.id == 1784
echo('Must start at Gate of Souls, room number 1784')
exit
end
gos_blasted_plains
wander_maze_until('golden sandstone temple', 'go temple')
manual_go2(13_643)
move('climb cliff')
find_room_maze
when /exit/i
if XMLData.room_title.include?('The Fangs of Ushnish')
wander_maze_until('steep cliff', 'climb cliff')
gos_temple_leave
end
gos_temple_leave if XMLData.room_title.include?('Temple of Ushnish')
gos_plains_leave if XMLData.room_title.include?('Blasted Plain')
gos_tunnel if XMLData.room_title.include?('Before the Gate of Souls')
end
end
def gos_blasted_plains
push_boulder unless DRRoom.room_objs.include?('low tunnel')
retreat
gos_tunnel
move('go field')
end
def push_boulder
fix_standing
fput('push boulder')
case waitfor(/^At the bottom of the hollow/, /^You stop pushing/, /blocking all access to a low tunnel\.$/)
when /^You stop pushing/, /blocking all access to a low tunnel\.$/
push_boulder
end
end
def gos_tunnel
bput('kneel', 'You kneel down upon the ground', 'You are already kneeling')
case bput('go tunnel', /^Wriggling on your stomach/, /^You are engaged/, /^What were you referring to/)
when /^You are engaged/
retreat
gos_tunnel
when /^What were you referring to/
push_boulder
gos_tunnel
end
waitfor /^After a seemingly interminable length of time/
fix_standing
end
def gos_temple_leave
manual_go2(13_159)
move('go field')
gos_plains_leave
end
def gos_plains_leave
wander_maze_until('low cavern', 'go cavern')
gos_tunnel
end
def segoltha(mode)
EquipmentManager.new.empty_hands
EquipmentManager.new.wear_equipment_set?('swimming')
if mode =~ /^n/i
dir_of_travel = 'north'
start_room = 19_373
elsif mode =~ /^s/i
dir_of_travel = 'south'
start_room = 19_457
else
echo('Must specify north or south for swimming the segoltha')
exit
end
unless start_room == Room.current.id
echo("Must start bescort in room #{start_room} for traveling #{dir_of_travel}")
exit
end
loop do
waitrt?
if XMLData.room_exits.length == 2
move 'west'
elsif XMLData.room_exits.include?(dir_of_travel)
move dir_of_travel
else
break
end
end
EquipmentManager.new.wear_equipment_set?('standard')
end
def croc_swamp(mode)
if mode == 'enter'
unless Room.current.id == 1358
echo('Must start bescort in room 1358 to enter the swamp')
exit
end
move('nw')
move('n')
move('go reed')
until DRRoom.pcs.empty? && DRRoom.npcs.empty?
move(%w[w nw n ne e se s sw].sample)
end
else
loop do
if bput('study reed', 'Study what?', 'You see nothing unusual', 'could not find', 'but see nothing special.', 'You study the sky') == 'but see nothing special.'
move('go reed')
break
end
if DRRoom.room_objs.include?('ruined shack')
move('w')
move('nw')
else
move(%w[w nw n ne e se s sw].sample)
end
end
while move_direction?(%w[south southeast])
end
end
end
def take_theren_rope_bridge(mode)
theren_side_roomid = 8650
rossman_side_roomid = 8637
if mode == 'totheren'
if Room.current.id != rossman_side_roomid
echo('Must start on the south side of the rope bridge')
exit
end
shuffle_direction = 'north'
target_room = theren_side_roomid
elsif mode == 'torossman'
if Room.current.id != theren_side_roomid
echo('Must start on the north side of the rope bridge')
exit
end
shuffle_direction = 'south'
target_room = rossman_side_roomid
else
echo("Unrecognized argument: #{mode}")
exit
end
start_room = Room.current.id
Flags.add('rope_wait', 'finally arriving on this side', 'finally reaching the far side')
while Room.current.id == start_room
retreat
Flags.reset('rope_wait') # avoiding race conditions
case bput('climb rope', 'Roundtime', 'is already on the rope', 'You climb onto a', 'You are engaged', 'You can\'t possibly manage to cross the rope bridge while holding')
when 'You can\'t possibly manage to cross the rope bridge while holding'
fput('stow right') if checkright
fput('stow left') if checkleft
when 'is already on the rope'
sleep(0.1) until Flags['rope_wait']
Flags.reset('rope_wait')
else
sleep(2)
waitrt?
end
end
start_time = Time.now
until Room.current.id == target_room || Time.now - start_time > 300
bput("shuffle #{shuffle_direction}", 'Roundtime')
sleep(3)
waitrt?
end
return if Time.now - start_time <= 300
3.times do
beep
sleep(0.5)
end
echo('ROPE BRIDGE TRIP TIMEOUT! This has taken too long. Something is wrong! Fix it!')
exit
end
def abyss_enter
unless Room.current.id == 8142
echo('Abyss entrance script must be started from 8142')
exit
end
release_cyclics
unless cast_spell({ 'abbrev' => 'rezz',
'mana' => 5,
'cyclic' => true }, get_settings)
echo('Failed to cast Resurrection! Try again or use the puzzle to enter.')
exit
end
move('go spirits')
release_cyclics
end
def power_walk(pattern)
fput 'exit' if dead? || Flags['ap-danger']
if Flags['harness-check']
harness_mana([20]) unless Flags['harness-check'].include?('effortlessly')
Flags.reset('harness-check')