-
Notifications
You must be signed in to change notification settings - Fork 177
/
bescort.lic
2099 lines (1924 loc) · 71.5 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 common-moonmage drinfomon equipmanager events skill-recorder])
$turns_since_bad = 0
class MazeRoom
$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
DRC.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
$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 fou], 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 west], 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: 'airship', regex: /airship/i, description: 'The airship between Crossing and Muspari' }
],
[
{ 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: 'velaka', regex: /velaka/i, description: 'The Velaka desert, containing zombie nomads and westanuryn.' },
{ name: 'mode', options: %w[nomads westanuryn slavers 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' }
],
[
{ name: 'brocket_young', regex: /brocket_young/i, description: 'Enter the young brocket deer hunting area.' },
{ name: 'mode', options: %w[enter exit], description: 'Enter or exit?' }
],
[
{ name: 'brocket_mid', regex: /brocket_mid/i, description: 'Enter the mid brocket deer hunting area.' },
{ name: 'mode', options: %w[enter exit], description: 'Enter or exit?' }
],
[
{ name: 'brocket_elder', regex: /brocket_elder/i, description: 'Enter the elder brocket deer hunting area.' },
{ name: 'mode', options: %w[enter exit], description: 'Enter or exit?' }
],
[
{ name: 'hara_polo', regex: /hara_polo/i, description: 'Traverse Polo Maze.' },
{ name: 'mode', options: %w[up down hunt], description: 'Up Down or Hunt?' }
],
[
{ name: 'jolas', regex: /jolas/i, description: "Ride The Jolas between Hara'jaal and Mer'Kresh." },
{ name: 'mode', options: %w[harajaal merkresh], description: "harajaal or merkresh? Can be started while aboard the Jolas." }
],
[
{ name: 'currach', regex: /currach/i, description: "Row a currach between Halasa Temple and Aesry Surlaenis'a." },
{ name: 'mode', options: %w[halasa aesry], description: "halasa or aesry?" }
],
[
{ name: 'galley', regex: /galley/i, description: "Take the M'riss-Mer'Kresh galley." },
{ name: 'mode', options: %w[mriss merkresh], description: "mriss or merkresh? Can also be started on the galley." }
],
[
{ name: 'cave_trolls', regex: /cave_trolls/i, description: "Enter the cave trolls hunting area beyond the stream." },
{ name: 'mode', options: %w[enter exit], description: "Enter or exit?" }
],
[
{ name: 'asketis_mount', regex: /asketis_mount/i, description: "Climb up or down Asketi's Mount to Black Marble Gargoyles." },
{ name: 'mode', options: %w[up down], description: "Climb up or climb down?" }
],
[
{ name: 'coffin', regex: /coffin/i, description: "Enter the abyss via coffin for lanky grey lachs, et al." }
]
]
args = parse_args(arg_definitions)
@settings = get_settings
@equipment_manager = EquipmentManager.new(@settings)
@flying_mount = @settings.flying_mount
if @settings.mountable_item
@flying_mount_item = @settings.mountable_item
else
@flying_mount_item = @settings.flying_mount
end
@flying_mount_activate = @settings.mountable_verb
@flying_mount_dismount = @settings.mountable_dismount
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.airship
take_airship_muspari
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.velaka
velaka_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
elsif args.brocket_young
brocket_young(args.mode)
elsif args.brocket_mid
brocket_mid(args.mode)
elsif args.brocket_elder
brocket_elder(args.mode)
elsif args.hara_polo
hara_polo(args.mode)
elsif args.jolas
jolas(args.mode)
elsif args.currach
currach(args.mode)
elsif args.galley
take_m_m_galley(args.mode)
elsif args.cave_trolls
cave_trolls(args.mode)
elsif args.asketis_mount
asketis_mount(args.mode)
elsif args.coffin
coffin
end
end
private
def use_flying_mount(type, mode, speed = 'fly')
mode = mode.downcase
case mode
when 'mount'
case type
when /broom|dirigible/i # This section is for broom type flying mounts that are just mounted
DRCI.get_item?(type)
case DRC.bput("mount my #{type}", /You mount your/, /You are already mounted/, /What were you referring/)
when /What were you referring/
DRC.message("Can't mount your #{type}, where is it?")
exit
end
DRC.bput("command #{type} to #{speed}", /You command your/)
when /carpet|rug/i # This section is for carpet style flying mounts that are lowered/unrolled before mounting
DRCI.get_item?(type)
DRC.bput(DRC.right_hand == type ? "lower ground right" : "lower ground left", /You lower/, /But you aren't holding/)
DRC.bput("unroll #{type}", /You carefully unroll/, /You can't unroll/, /What were you referring/)
case DRC.bput("mount #{type}", /You step onto your .* which comes to life and slowly raises up off of the ground/, /You are already mounted/, /What were you referring/)
when /What were you referring/
DRC.message("Can't mount your #{type}, where is it?")
exit
end
DRC.bput("command #{type} to #{speed}", /You command your/)
when /cloud/i # This section is for mounts with different nouns than their activating item. May need to add more activation matches.
DRCI.remove_item?(@flying_mount_item)
DRCI.get_item_if_not_held?(@flying_mount_item)
case DRC.bput("#{@flying_mount_activate} my #{@flying_mount_item}", /You gently buff/, /Rub what/)
when /What were you referring/
DRC.message("Can't mount your #{type}, where is it?")
exit
end
DRC.bput("command #{type} to #{speed}", /You command your/, /You signal the/)
else
DRC.message("#{type} is not a valid type of flying mount.")
exit
end
when 'dismount'
case type
when /broom|dirigible/i
DRC.bput('dismount', /Your .* floats down to the ground/, /You climb off/)
DRCI.put_away_item?(type)
when /carpet|rug/i
DRC.bput('dismount', /Your .* floats down to the ground/, /You climb off/)
DRC.bput("roll #{type}", /You roll up/, /You can't roll/)
DRCI.put_away_item?(type)
when /cloud/i
DRC.bput("#{@flying_mount_dismount} #{type}", /With a gesture,/)
DRCI.wear_item?(@flying_mount_item)
DRCI.put_away_item?(@flying_mount_item) if checkright
DRCI.put_away_item?(@flying_mount_item) if checkleft
else
DRC.message("#{type} is not a valid type of flying mount.")
exit
end
end
end
def coffin
# Check time of day
DRCMM.check_moonwatch
time = UserVars.sun['day']
time ? look_at = 'sunlight' : look_at = 'starlight'
# Hash of images along with the light and dark symbols
image_hash = {
'boar': ['longbow', 'berserking barbarian'],
'cat': ['grimacing woman', 'twin crossed swords with jagged blades'],
'cobra': ['shattered egg', 'the image of an erupting volcano'],
'dolphin': ['deer drinking from a flowing stream', 'great tidal wave'],
'lion': ['pack of well-groomed battle hounds', 'bloodstained stiletto'],
'panther': ['cluster of twinkling stars', 'child shivering fearfully in the throes of a nightmare'],
'ram': ['flourishing rose garden', 'jagged crystalline blade'],
'raven': ['bowl of striped peppermint', 'shattered caravan wheel'],
'wolf': ['charred black stave', 'long flowing skirt'],
'wren': ['plump opera singer', 'cracked mirror']
}
# Populate white and black tapestry images
white_tapestry = image_hash.map { |_key, value| value[0] }
black_tapestry = image_hash.map { |_key, value| value[1] }
lever_pulled = false
# There is a slight possibility that someone else is running the puzzle and resets
# the lever/coffin. This loop helps detect that.
until lever_pulled
DRCT.walk_to(13600)
DRC.bput('look behind satin tapestry', 'Peeking behind the tapestry')
DRC.bput('turn steel crank', 'Roundtime', 'You step behind the blood red tapestry')
# Find our primary image
image = DRC.bput("look #{look_at}", 'I could not find what', *image_hash.keys)
# Set our light and dark images based on primary image
light = image_hash[image.to_sym][0]
dark = image_hash[image.to_sym][1]
dseen = false
lseen = false
# Black tapestry
DRCT.walk_to(13602)
until dseen
wheel = DRC.bput("look wooden wheel", *black_tapestry)
if wheel == dark
dseen = true
break
end
end
# Light tapestry
DRCT.walk_to(13601)
until lseen == true
wheel = DRC.bput("look wooden wheel", *white_tapestry)
if wheel == light
lseen = true
break
end
end
# Back to coffin
DRCT.walk_to(13600)
DRC.bput('look behind satin tapestry', 'Peeking behind the tapestry')
lever = DRC.bput('pull iron lever', 'Roundtime', 'it won\'t budge')
if lever == 'Roundtime'
lever_pulled = true
else
echo "Someone reset the coffin."
end
end
waitrt?
@equipment_manager.empty_hands
DRC.bput('open coffin', 'You open the heavy lid', 'The coffin is already open')
DRC.bput('go coffin', 'Obvious exits', 'The lid of the coffin is closed')
waitfor 'You suddenly feel the presence of cold stone'
pause while stunned?
DRC.fix_standing
fput('look')
fput('look')
end
def asketis_mount(mode)
if mode == "up"
while DRC.bput("climb up", /^You work your way/i, /^You climb over/, /^You can't do that/i) =~ /^You work your way/i
end
elsif mode == "down"
while DRC.bput("climb down", /^You work your way/i, /^You climb down/, /^You can't do that/i) =~ /^You work your way/i
end
end
end
def cave_trolls(mode)
case mode.downcase
when /enter/
start_room = 19089
moveset = %w[southeast southeast southeast]
when /exit/
start_room = 15759
moveset = %w[northwest northwest northwest]
end
manual_go2(start_room)
move('go stream bank')
# Once in the stream then you're in a safe room, get mount or remove gear.
@equipment_manager.empty_hands
have_changed_gear = @flying_mount ? false : @equipment_manager.wear_equipment_set?('swimming')
if @flying_mount
use_flying_mount(@flying_mount, 'mount')
move(moveset.first) # mount travels all three rooms at once
else
moveset.each { |dir| swim(dir) }
end
use_flying_mount(@flying_mount, 'dismount') if @flying_mount
# While in the stream then you're in a safe room, dismount or wear gear.
@equipment_manager.wear_equipment_set?('standard') if have_changed_gear
move('go stream bank')
# You're now among cave trolls!
# The cave is dark; you'll need a light source!
end
def take_m_m_galley(mode)
unless [6555, 6656].include?(Room.current.id) || ["[[The Galley Cercorim]]", "[[The Galley Sanegazat]]"].include?(DRRoom.title)
echo 'You are not at the galley docks, or on the galley.'
return
end
# if you're on the mer'kresh side, check for money (no bank in m'riss. you're screwed without funds)
if (Room.current.id == 6555)
if DRCM.wealth("Mer'Kresh") < 120 # enough to go over and back 2x
echo('Get money you slob!')
return unless get_fare?(300, "Mer'Kresh", 6555)
end
end
loop do
echo 'at top of loop'
# at your destination
if (Room.current.id == 6555 && mode == 'merkresh') || (Room.current.id == 6656 && mode == 'mriss')
echo "You're there."
exit
# Not there, but at the transport waiting room
elsif Room.current.id == 6555 || Room.current.id == 6656
echo 'waiting for transport'
hide? unless DRRoom.room_objs.find { |obj| obj =~ /the galley (Sanegazat|Cercorim)/ }
pause 1 until DRRoom.room_objs.find { |obj| obj =~ /the galley (Sanegazat|Cercorim)/ }
case DRC.bput('go galley', 'You hand him your lirums and climb aboard', 'Come back when you can afford the fare', 'The galley has just left the harbor', 'You look around in vain for the')
when 'The galley has just left the harbor'
pause 1 until !DRRoom.room_objs.find { |obj| obj =~ /the galley (Sanegazat|Cercorim)/ }
when 'Come back when you can afford the fare'
echo('Get money you slob!')
return
when 'You hand him your lirums and climb aboard'
pause 1 # allow catch up
end
# Not there, but on the transport
elsif ["[[The Galley Cercorim]]", "[[The Galley Sanegazat]]"].include?(DRRoom.title)
echo 'waiting for dock'
if mode == 'merkresh'
echo "On transport, headed to merkresh"
hide? unless DRRoom.room_objs.find { |obj| obj =~ /Mer'Kresh dock/ }
echo "On transport, waiting for merkresh dock"
pause 1 until DRRoom.room_objs.find { |obj| obj =~ /Mer'Kresh dock/ }
echo "On transport, found merkresh dock!"
case DRC.bput('go dock', 'Obvious paths:', 'The galley has just pulled away from the dock', 'You see no dock', 'What were you referring to')
when 'The galley has just pulled away from the dock', 'You see no dock', 'What were you referring to'
pause 1 until !DRRoom.room_objs.find { |obj| obj =~ /Mer'Kresh dock/ }
end
elsif mode == 'mriss'
echo "on transport, headed to mriss"
hide? unless DRRoom.room_objs.find { |obj| obj =~ /M'Riss dock/ }
echo "On transport, waiting for mriss dock"
pause 1 until DRRoom.room_objs.find { |obj| obj =~ /M'Riss dock/ }
echo "On transport, found mriss dock!"
case DRC.bput('go dock', 'Obvious paths:', 'The galley has just pulled away from the dock', 'You see no dock', 'What were you referring to')
when 'The galley has just pulled away from the dock', 'You see no dock', 'What were you referring to'
pause 1 until !DRRoom.room_objs.find { |obj| obj =~ /M'Riss dock/ }
end
end
end
end
end
def currach(mode)
if (mode.include?('aesry') && [5555, 5557, 5558].include?(Room.current.id))
echo "You're already there silly!"
exit
elsif (mode.include?('halasa') && [15863].include?(Room.current.id))
echo "You're already there silly!"
exit
elsif mode == 'aesry'
row_direction = 'pier'
elsif mode == 'halasa'
row_direction = 'rock'
else
echo("Unrecognized argument: #{mode}")
exit
end
if [5555, 5557, 5558, 15863].include?(Room.current.id)
move "go currach"
DRC.bput('get oars', 'You grab hold of the oars', 'But you already have a firm grip on the oars', 'What were you referring to', "You can't do that right now")
DRC.bput('untie currach', 'You untie the', "But it's not tied to anything!", 'What were you referring to', "You can't do that right now")
end
loop do
if DRC.bput("tie currach to #{row_direction}", "isn't close enough!", 'You pull at the oars', 'is already moored') == 'is already moored'
DRC.fix_standing
move "go #{row_direction}"
exit
else
DRC.bput("row #{row_direction}", 'You pull strongly', 'What were you referring to', "You can't do that right now")
end
end
end
def jolas(mode)
# Boat has multiple rooms: 15450, 15451, 15452, 15453, 15454
unless [15253, 6542, 15450, 15451, 15452, 15453, 15454].include?(Room.current.id)
echo "You are not at the correct dock to ride The Jolas."
return
end
if (mode.include?('merkresh') && Room.current.id == 6542) || (mode.include?('harajaal') && Room.current.id == 15253)
echo "You're already there silly!"
exit
elsif (mode.include?('merkresh') && Room.current.id == 15253) || (mode.include?('harajaal') && Room.current.id == 6542)
hide? unless DRRoom.room_objs.find { |x| x =~ /The Jolas/ }
pause 1 until DRRoom.room_objs.find { |x| x =~ /The Jolas/ }
DRC.bput('go Jolas', 'You climb', 'What were you referring')
waitfor 'The captain barks the order to tie off the Jolas to the docks'
DRCT.walk_to(15450) if Room.current.id != 15450
if DRRoom.room_objs.include?('Sumilo Dock') && mode.include?('harajaal')
move 'go dock'
exit
elsif DRRoom.room_objs.include?('Wharf End') && mode.include?('merkresh')
move 'go end'
exit
else
jolas(mode)
end
end
end
def hara_polo(mode)
hara_polo_direction(mode)
if mode.include?('up')
move 'climb slope' if Room.current.id == 11411
move 'ne' until DRRoom.room_objs.include?('rock')
move 's'
elsif mode.include?('down')
move 'n' if Room.current.id == 11416
move 'ne' until DRRoom.room_objs.include?('slope')
move 'climb slope'
else
find_room_list(%w[ne ne ne])
end
end
def hara_polo_direction(mode)
if mode == /up/i && (Room.current.id != 11411 || Room.current.id != 11412)
echo('Going up the maze to the Enclave must be started from 11411 or 11412.')
exit
elsif mode == /down/i && (Room.current.id != 11416 || Room.current.id != 11412)
echo('Going down the maze towards the cliff and boat to Ratha must be started from 11416 or 11412.')
exit
elsif mode == /hunt/i && (Room.current.id != 11416 || Room.current.id != 11412)
echo('Going hunting must begin in room 11416 or 11412.')
exit
else
move 'n' if mode.include?('hunt')
end
end
def enter_brocket(mode)
if mode !~ /exit/i && Room.current.id != 3462
echo('Brocket deer entrance must be started from 3462.')
exit
end
move 'climb fence' if mode.include?('enter')
end
def brocket_young(mode)
enter_brocket(mode)
if mode.include?('enter')
find_room_list(%w[w w w])
else
move 'e' until DRRoom.room_objs.include?('log fence')
move 'climb fence'
end
end
def brocket_mid(mode)
enter_brocket(mode)
if mode.include?('enter')
move 'w' until DRRoom.room_objs.include?('gentle hill')
move 'climb hill'
find_room_list(%w[e e e])
else
move 'w' until DRRoom.room_objs.include?('gentle hill')
move 'climb hill'
move 'e' until DRRoom.room_objs.include?('log fence')
move 'climb fence'
end
end
def brocket_elder(mode)
enter_brocket(mode)
if mode.include?('enter')
move 'w' until DRRoom.room_objs.include?('gentle hill')
move 'climb hill'
move 'e' until DRRoom.room_objs.include?('rolling hill')
move 'climb hill'
find_room_list(%w[w w w])
else
move 'e' until DRRoom.room_objs.include?('rolling hill')
move 'climb hill'
move 'w' until DRRoom.room_objs.include?('gentle hill')
move 'climb hill'
move 'e' until DRRoom.room_objs.include?('log fence')
move 'climb fence'
end
end
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?
DRCT.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 = {}, target = nil)
loop do
error_rooms[Room.current.id].call if error_rooms[Room.current.id]
return if DRRoom.pcs.empty? && DRRoom.npcs.empty? && (target.nil? || XMLData.room_title.include?(target))
return if !DRRoom.pcs.empty? && (DRRoom.pcs - UserVars.friends).empty? && DRRoom.pcs.size <= 2 && (target.nil? || XMLData.room_title.include?(target))
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
DRCT.walk_to(2317)
when /worms/i
DRC.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
DRC.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 DRC.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
move("go #{port_type}")
end
end
def desert_enter
DRCT.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/
loop do
desert_enter
path = %w[s ne ne s s ne e]
path.each do |movement|
if DRRoom.room_objs.include?('shimmering oasis')
move 'go oasis'
exit
else
move(movement)
end
end
move 'go trail'
path = %w[ne n ne n ne n n ne n ne n]
path.each do |movement|
if DRRoom.room_objs.include?('shimmering oasis')
move 'go oasis'
exit
else
move(movement)
end
end
move 'go path'
path = %w[sw e s s ne s se n ne ne ne]
path.each do |movement|
if DRRoom.room_objs.include?('shimmering oasis')
move 'go oasis'
exit
else
move(movement)
end
end
move 'go trail'
path = %w[n sw ne s sw n up n s s n n down n s s sw s]
path.each do |movement|
if DRRoom.room_objs.include?('shimmering oasis')
move 'go oasis'
exit
else
move(movement)
end
end
path = %w[n ne up e s ne nw ne e nw]
path.each do |movement|
if DRRoom.room_objs.include?('shimmering oasis')
move 'go oasis'
exit
else
move(movement)
end
end
move 'go road'
end
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?('Sanctuary') # Oasis
DRC.release_invisibility
DRC.bput('ask Sand Elf about desert', 'The Sand Elf laughs and glances at you playfully')
DRC.fix_standing
desert(mode)
end
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')
unless DRRoom.room_objs.include?('faint trail that stretches towards a sand-filled valley')
move 'go path'
desert(mode)
exit
end
move 'south'
move 'northeast'
DRCT.walk_to(6760)
end
end
end
def velaka_desert_enter
DRCT.walk_to(247)
move 'go trail'
end
def velaka_desert(mode)
case mode
when /nomads/
velaka_desert_enter
wander_maze_until('high plateau', 'climb plateau')
when /westanuryn/
velaka_desert_enter
find_room_maze
when /slavers/
velaka_desert_enter
find_room_maze(proc { |_| true }, {}, 'Rock Circle')
when /exit/
unless XMLData.room_title.include?('Velaka Desert')
echo 'This must be started in the Velaka Desert!'