Skip to content
Navigation Menu
{{ message }}
forked from elanthia-online/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo2.lic
More file actions
2086 lines (1954 loc) · 107 KB
/
Copy pathgo2.lic
File metadata and controls
2086 lines (1954 loc) · 107 KB
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
attempts to find the shortest route between any two rooms in the game
requires a map database (;repository download-mapdb)
;go2 help
author: Tillmen (tillmen@lichproject.org)
original author: Shaelun
contributors: Deysh, Doug, Gildaren, Sarvatt, Tysong, Xanlin
game: any
tags: core, movement
version: 2.0.9
required: Lich >= 5.4.1
changelog:
2.0.9 (2023-07-05): Xanlin:
Fix for permanent urchin guide access. Rubocop cleanup.
2.0.8 (2023-03-03): Tysong:
bugfix for integer comparison to string for Society
2.0.7 (2023-03-03): Xanlin:
navigate out of a playershop even if it's not mapped (GS only)
2.0.6 (2023-02-09): Rinualdo
Added targets list for portmaster, grocer, cobbling and treasuremaster
2.0.5 (2022-11-29): Tysong
Fix for variable name syntax
2.0.4 (2022-11-28): Gildaren:
Add support to "goback" to the room go2 last started in
2.0.3 (2022-11-22): Mahtra:
adjusted DR/GS separattion of features
Support for yaml-based map timeto and stringproc overrides
2.0.2 (2022-10-20): Xanlin:
adjusted wait before exiting
2.0.1 (2022-10-08)
bug fix for non-Gtk users
backward compatibility for Lich4
2.0 (2022-10-08): Deysh:
added setup gui
added color options to help output
=end
=begin
1.37 (2022-10-07): Xanlin:
added option to hide room descriptions for travel
added option to hide room titles for travel
added option to echo input
added fallback for check_silvers that uses wealth quiet instead
wrap in module
travel time now calculated to a higher precision.
targets town name now based on location.
targets won't include towns tagged closed.
1.36.0 (2022-06-16):
fix for urchins runners not recognized as command option
add sos caravan options.
1.35 (2022-05-12):
exit if get-silvers fails to get enough silver from bank.
1.34 (2022-03-31):
For DR: add support for yaml-based map stringproc overrides
1.33 (2022-03-31):
set UserVars.mapdb_urchins_expire to 0 when expired to fix comparison with nil
1.32 (2022-03-31):
Added setting --use-portmasters for UserVars.mapdb_use_portmasters
Added setting --use-urchins for UserVars.mapdb_use_urchins
Added location and uid to output list for multiple matched destinations
1.31 (2022-03-10):
Merged in DR changes from v1.22f by Sarvatt
1.30 (2022-03-03):
Added Util.silver_count to replace check_silvers
Added support for uid input by prefixing 'u' on a uid number
1.29 (2022-02-27):
Added tags for collectibles
1.28 (2022-01-23):
Added tags for postoffice and mail
1.27 (2021-10-29):
Fix lag check after COMBATANT verb was updated
1.26 (2020-10-08):
Fix silver check broken by Commageddon
1.25 (2019-05-11):
Fix DragonRealms auto drag feature (Sarvatt)
1.24 (2019-03-03):
Updated formatting for ";go2 list" in GSPlat and GSF
1.23 (2019-03-03):
add setting for using GSPlat old portal system
1.22 (2019-02-10):
add settings for using Chronomage day passes
1.21 (2017-10-07):
don't try to stand before swimming movements
1.20 (2017-09-17):
add confluence-hot and confluence-cold targets
1.19 (2016-09-24):
fix DragonRealms auto drag feature some more
1.18 (2016-09-24):
fix DragonRealms auto drag feature somewhat
1.17 (2016-09-12):
change portal settings to be saved using UserVars
1.16 (2016-08-19):
add fwi-trinket setting
1.15 (2016-04-01):
added experimental setting to auto drag in DragonRealms
1.14 (2015-07-09):
change ice mode setting to be saved using UserVars
1.13 (2015-07-09):
don't search for the confluence if you're already there
1.12 (2015-07-08):
don't do a GS lag check in DR
1.11 (2015-04-13):
add --instability option
fix going to a specific room inside the confluence from outside
1.10 (2015-04-13):
add confluence and instability targets
1.9 (2015-02-08):
stop using Map.tags
1.8 (2015-01-16):
fix ";go2 save" bug
1.7 (2014-12-11):
added stop-for-dead to the help message
1.6 (2014-12-10):
added stop-for-dead option
add settings to list command
1.5 (2014-12-04):
remove a debug message
1.4 (2014-12-04):
added delay setting
fixed bug with finding silver cost of a path
1.3 (2014-11-09):
changed typeahead setting to be different for each character
1.2 (2014-10-16):
don't use typeaheads for first move: makes it easier to find problems
1.1 (2014-10-07):
only automatically reduce typeahead setting if there's a typeahead message in the buffer
=end
# fixme: don't do puzzles option
module Go2
Go2_version = '2.0.8'
@@data ||= nil
def self.data
@@data
end
def self.color(color, msg)
if defined?(Lich::Messaging)
Lich::Messaging.msg_format(color, msg)
else
msg
end
end
def self.wealth_quiet();
wealth_pattern = /^You have (no silver|[,\d]+|but one) coins?/;
wealth = dothistimeout 'wealth quiet', 3, wealth_pattern;
coins = 0;
if wealth.gsub('but one', '1') =~ wealth_pattern;
coins = $1.gsub(',', '').to_i;
end;
return coins;
end;
def self.go2_check_silver;
if LICH_VERSION.split('.')[0].to_i < 5 or !defined?(Lich::Util.silver_count)
return self.wealth_quiet
else
return Lich::Util.silver_count
end
end
def self.load_go2_settings()
if UserVars.mapdb_buy_day_pass == true
buy_pass = "on"
elsif UserVars.mapdb_buy_day_pass == false
buy_pass = "off"
else
buy_pass = UserVars.mapdb_buy_day_pass
end
settings_hash = {
:mapdb_car_to_sos => UserVars.mapdb_car_to_sos,
:mapdb_car_from_sos => UserVars.mapdb_car_from_sos,
:mapdb_use_portals => UserVars.mapdb_use_portals,
:mapdb_use_old_portals => UserVars.mapdb_use_old_portals,
:mapdb_use_urchins => UserVars.mapdb_use_urchins,
:mapdb_use_portmasters => UserVars.mapdb_use_portmasters,
:mapdb_use_day_pass => UserVars.mapdb_use_day_pass,
:mapdb_buy_day_pass => buy_pass,
:mapdb_day_pass_sack => UserVars.day_pass_sack,
:mapdb_ice_mode => UserVars.mapdb_ice_mode,
:mapdb_fwi_trinket => UserVars.mapdb_fwi_trinket,
:rogue_password => UserVars.rogue_password,
:delay => CharSettings['delay'],
:typeahead => CharSettings['typeahead'],
:stop_for_dead => CharSettings['stop for dead'],
:get_silvers => CharSettings['get silvers'],
:get_return_silvers => CharSettings['get return trip silvers'],
:use_vaalor_shortcut => CharSettings['vaalor shortcut'],
:use_seeking => CharSettings['use seeking'],
:echo_input => CharSettings['echo_input'],
:hide_room_desc => CharSettings['hide_room_descriptions'],
:hide_room_titles => CharSettings['hide_room_titles'],
}
settings_hash
end
def self.load(settings)
@@data = settings
end
def self.save_go2_settings(settings)
UserVars.mapdb_car_to_sos = settings[:mapdb_car_to_sos]
UserVars.mapdb_car_from_sos = settings[:mapdb_car_from_sos]
UserVars.mapdb_use_portals = settings[:mapdb_use_portals]
UserVars.mapdb_use_old_portals = settings[:mapdb_use_old_portals]
UserVars.mapdb_use_urchins = settings[:mapdb_use_urchins]
UserVars.mapdb_use_portmasters = settings[:mapdb_use_portmasters]
UserVars.mapdb_use_day_pass = settings[:mapdb_use_day_pass]
UserVars.day_pass_sack = settings[:mapdb_day_pass_sack]
UserVars.mapdb_ice_mode = settings[:mapdb_ice_mode]
if settings[:mapdb_buy_day_pass].empty? || settings[:mapdb_buy_day_pass] =~ /off|no|false/
UserVars.mapdb_buy_day_pass = nil
elsif settings[:mapdb_buy_day_pass] =~ /on|true|yes/
UserVars.mapdb_buy_day_pass = true
else
settings[:mapdb_buy_day_pass].split(';').each { |location|
if location !~ /^\s*(?:wl,imt|imt,wl|wl,sol|sol,wl|imt,sol|ill,val|val,ill|ill,cys|cys,ill|val,cys|cys,val)\s*$/i
echo "warning: Location #{location} is invalid. Using it anyway."
end
}
UserVars.mapdb_buy_day_pass = settings[:mapdb_buy_day_pass]
end
if settings[:mapdb_fwi_trinket].empty? || UserVars.mapdb_fwi_trinket =~ /^off$/i
UserVars.mapdb_fwi_trinket = nil
else
UserVars.mapdb_fwi_trinket = settings[:mapdb_fwi_trinket]
end
UserVars.rogue_password = settings[:rogue_password]
CharSettings['delay'] = settings[:delay]
CharSettings['typeahead'] = settings[:typeahead]
CharSettings['stop for dead'] = settings[:stop_for_dead]
CharSettings['get silvers'] = settings[:get_silvers]
CharSettings['get return trip silvers'] = settings[:get_return_silvers]
CharSettings['vaalor shortcut'] = settings[:use_vaalor_shortcut]
CharSettings['use seeking'] = settings[:use_seeking]
CharSettings['echo_input'] = settings[:echo_input]
CharSettings['hide_room_descriptions'] = settings[:hide_room_desc]
CharSettings['hide_room_titles'] = settings[:hide_room_titles]
end
if defined?(Gtk)
# Setup is an extension of Gtk::Builder for Gtk setup
class Setup < Gtk::Builder
attr_accessor :settings
@@categories = {
general: {
mapdb_car_to_sos: { default: false },
mapdb_car_from_sos: { default: false },
mapdb_ice_mode: { default: false },
mapdb_use_urchins: { default: false },
mapdb_use_portmasters: { default: false },
mapdb_use_day_pass: { default: false },
mapdb_buy_day_pass: { default: '' },
mapdb_day_pass_sack: { default: '' },
mapdb_fwi_trinket: { default: '' },
mapdb_use_portals: { default: false },
mapdb_use_old_portals: { default: false },
typeahead: { default: 0 },
delay: { default: 0 },
use_vaalor_shortcut: { default: false },
get_silvers: { default: false },
get_return_silvers: { default: false },
hide_room_desc: { default: false },
hide_room_titles: { default: false },
echo_input: { default: true },
use_seeking: { default: false },
stop_for_dead: { default: false },
rogue_password: { default: '' },
}
}
def self.get_category(key)
@@categories.each { |category, data| return category unless data[key].nil? }
nil
end
def self.get_setting(key)
cat = Setup.get_category(key)
return nil if cat.nil?
@@categories[cat].each { |setting, data| return data if setting == key }
nil
end
def initialize(settings)
super()
@settings = settings
# set default values if they don't exist
@@categories.each do |_, data|
data.each { |key, value| @settings[key] = value[:default] if @settings[key].nil? }
end
# remove settings that doesn't exist
@settings.delete_if { |key, _| next Setup.get_category(key).nil? }
# use a GTK Builder to setup all the basics of the window then expand on that base
return unless defined?(Gtk) && Gtk::Version::MAJOR == 3
Gtk.queue do
# add_from_file("#{$data_dir}go2.ui")
add_from_string(Setup.go2_ui)
load_settings
self['main'].keep_above = true
self['main'].set_title "Go2 Setup v#{Go2_version}"
# connect signals after settings are loaded to a bunch of handlers don't trigger
connect_signals { |handler| method(handler) }
end
end
def self.go2_ui
ui_string = '<?xml version="1.0" encoding="UTF-8"?><interface><requires lib="gtk+" version="3.20"/><object class="GtkAdjustment" id="delay_adjustment"><property name="upper">600</property>
<property name="step-increment">1</property><property name="page-increment">10</property></object><object class="GtkAdjustment" id="type_ahead_adjustment"><property name="upper">100</property>
<property name="step-increment">1</property><property name="page-increment">10</property></object><object class="GtkWindow" id="main"><property name="width-request">840</property>
<property name="height-request">550</property><property name="can-focus">False</property><property name="title" translatable="yes">Go2 Setup</property>
<signal name="destroy" handler="on_destroy" swapped="no"/><child><object class="GtkBox"><property name="visible">True</property><property name="can-focus">False</property>
<property name="orientation">vertical</property><property name="spacing">5</property><child><object class="GtkNotebook"><property name="visible">True</property>
<property name="can-focus">True</property><property name="hexpand">True</property><property name="vexpand">True</property><child><placeholder/></child><child type="tab"><placeholder/>
</child><child><placeholder/></child><child type="tab"><placeholder/></child><child><placeholder/></child><child type="tab"><placeholder/></child>
<child><object class="GtkScrolledWindow"><property name="visible">True</property><property name="can-focus">True</property><property name="shadow-type">in</property>
<child><object class="GtkViewport"><property name="visible">True</property><property name="can-focus">False</property><child><object class="GtkBox"><property name="visible">True</property>
<property name="can-focus">False</property><property name="orientation">vertical</property><child><object class="GtkFrame"><property name="visible">True</property>
<property name="can-focus">False</property><property name="border-width">10</property><property name="label-xalign">0</property><child><!-- n-columns=5 n-rows=4 --><object class="GtkGrid"><property name="visible">True</property>
<property name="can-focus">False</property><property name="margin-top">5</property><property name="margin-bottom">5</property><property name="row-spacing">5</property><property name="column-spacing">5</property>
<child><object class="GtkCheckButton" id="use_seeking"><property name="label" translatable="yes">Use Seeking</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">6</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">2</property><property name="top-attach">0</property></packing></child><child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="halign">end</property><property name="label" translatable="yes">Type Ahead </property></object><packing><property name="left-attach">3</property><property name="top-attach">0</property></packing></child>
<child><object class="GtkSpinButton" id="typeahead"><property name="visible">True</property><property name="can-focus">True</property><property name="halign">start</property><property name="adjustment">type_ahead_adjustment</property>
<property name="numeric">True</property><property name="value">-0.021999999999999999</property></object><packing><property name="left-attach">4</property><property name="top-attach">0</property></packing></child>
<child><object class="GtkCheckButton" id="mapdb_use_urchins"><property name="label" translatable="yes">Use Urchins</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">7</property><property name="draw-indicator">True</property>
</object><packing><property name="left-attach">1</property><property name="top-attach">2</property></packing></child><child><object class="GtkSpinButton" id="delay"><property name="visible">True</property>
<property name="can-focus">True</property><property name="halign">start</property><property name="text" translatable="yes">0</property><property name="adjustment">delay_adjustment</property><property name="numeric">True</property>
</object><packing><property name="left-attach">4</property><property name="top-attach">1</property></packing></child><child><object class="GtkLabel"><property name="visible">True</property>
<property name="can-focus">False</property><property name="halign">end</property><property name="label" translatable="yes">Delay</property></object><packing><property name="left-attach">3</property>
<property name="top-attach">1</property></packing></child><child><object class="GtkCheckButton" id="mapdb_use_portmasters"><property name="label" translatable="yes">Use Portmasters</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">1</property><property name="top-attach">3</property></packing></child>
<child><object class="GtkCheckButton" id="get_silvers"><property name="label" translatable="yes">Get Silvers</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">7</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">0</property><property name="top-attach">0</property></packing></child><child><object class="GtkCheckButton" id="get_return_silvers"><property name="label" translatable="yes">Get Return Silvers</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">0</property><property name="top-attach">1</property></packing></child>
<child><object class="GtkCheckButton" id="hide_room_desc"><property name="label" translatable="yes">Hide Room Desc</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">7</property><property name="draw-indicator">True</property>
</object><packing><property name="left-attach">0</property><property name="top-attach">2</property></packing></child><child><object class="GtkCheckButton" id="hide_room_titles"><property name="label" translatable="yes">Hide Room Titles</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">0</property><property name="top-attach">3</property></packing></child>
<child><object class="GtkCheckButton" id="stop_for_dead"><property name="label" translatable="yes">Stop for Dead</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">6</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">2</property><property name="top-attach">1</property></packing></child><child><object class="GtkCheckButton" id="use_vaalor_shortcut"><property name="label" translatable="yes">Use Vaalor Shortcut</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">6</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">2</property><property name="top-attach">2</property></packing></child>
<child><object class="GtkCheckButton" id="echo_input"><property name="label" translatable="yes">Echo Input</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">6</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">2</property><property name="top-attach">3</property></packing></child><child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="halign">end</property><property name="label" translatable="yes">Ice Mode</property></object><packing><property name="left-attach">3</property><property name="top-attach">2</property></packing></child>
<child><object class="GtkComboBoxText" id="mapdb_ice_mode"><property name="visible">True</property><property name="can-focus">False</property><property name="halign">start</property><property name="active">0</property>
<property name="has-entry">True</property><items><item id="1" translatable="yes">Auto</item><item id="2" translatable="yes">On</item><item id="3" translatable="yes">Off</item></items>
<child internal-child="entry"><object class="GtkEntry"><property name="can-focus">False</property></object></child></object><packing><property name="left-attach">4</property><property name="top-attach">2</property></packing></child>
<child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property><property name="halign">end</property><property name="label" translatable="yes">Rogue Password</property></object>
<packing><property name="left-attach">3</property><property name="top-attach">3</property></packing></child><child><object class="GtkEntry" id="rogue_password"><property name="visible">True</property><property name="can-focus">True</property>
<property name="halign">start</property><property name="width-chars">47</property><property name="placeholder-text" translatable="yes">pull, push,tap...whatever. There should be 7 actions</property></object>
<packing><property name="left-attach">4</property><property name="top-attach">3</property></packing></child><child><object class="GtkCheckButton" id="mapdb_car_from_sos"><property name="label" translatable="yes">Caravan from SoS</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">1</property><property name="top-attach">1</property></packing></child>
<child><object class="GtkCheckButton" id="mapdb_car_to_sos"><property name="label" translatable="yes">Caravan to SoS</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">7</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">1</property><property name="top-attach">0</property></packing></child></object></child><child type="label"><object class="GtkLabel"><property name="visible">True</property>
<property name="can-focus">False</property><property name="label" translatable="yes">Misc</property></object></child></object><packing><property name="expand">False</property><property name="fill">True</property>
<property name="position">0</property></packing></child><child><object class="GtkFrame"><property name="visible">True</property><property name="can-focus">False</property><property name="border-width">10</property>
<property name="label-xalign">0</property><child><!-- n-columns=4 n-rows=3 --><object class="GtkGrid"><property name="visible">True</property><property name="can-focus">False</property><property name="margin-top">5</property>
<property name="margin-bottom">5</property><property name="row-spacing">5</property><property name="column-spacing">5</property><child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="halign">end</property><property name="margin-start">13</property><property name="label" translatable="yes">FWI Trinket</property></object><packing><property name="left-attach">0</property>
<property name="top-attach">0</property></packing></child><child><object class="GtkEntry" id="mapdb_fwi_trinket"><property name="visible">True</property><property name="can-focus">True</property><property name="halign">start</property>
<property name="width-chars">47</property><property name="placeholder-text" translatable="yes">name of FWI trinket or \'off\' to stop using it</property></object><packing><property name="left-attach">1</property>
<property name="top-attach">0</property></packing></child><child><object class="GtkCheckButton" id="mapdb_use_portals"><property name="label" translatable="yes">Use Portals (Plat and Shattered Only)</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">0</property><property name="top-attach">1</property><property name="width">2</property></packing></child>
<child><object class="GtkCheckButton" id="mapdb_use_old_portals"><property name="label" translatable="yes">Use Old Portals (Plat Only)</property><property name="visible">True</property><property name="can-focus">True</property>
<property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">10</property><property name="margin-bottom">7</property><property name="draw-indicator">True</property></object>
<packing><property name="left-attach">0</property><property name="top-attach">2</property><property name="width">2</property></packing></child><child><object class="GtkCheckButton" id="mapdb_use_day_pass"><property name="label" translatable="yes">Use Day Pass</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">False</property><property name="halign">start</property><property name="margin-start">15</property>
<property name="margin-bottom">7</property><property name="draw-indicator">True</property></object><packing><property name="left-attach">2</property><property name="top-attach">0</property><property name="width">2</property></packing></child>
<child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property><property name="halign">end</property><property name="margin-start">19</property>
<property name="label" translatable="yes">Day Pass Sack</property></object><packing><property name="left-attach">2</property><property name="top-attach">2</property></packing></child>
<child><object class="GtkEntry" id="mapdb_day_pass_sack"><property name="visible">True</property><property name="can-focus">True</property><property name="halign">start</property><property name="width-chars">47</property></object>
<packing><property name="left-attach">3</property><property name="top-attach">2</property></packing></child><child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="halign">end</property><property name="margin-start">19</property><property name="label" translatable="yes">Buy Day Pass</property></object><packing><property name="left-attach">2</property>
<property name="top-attach">1</property></packing></child><child><object class="GtkEntry" id="mapdb_buy_day_pass"><property name="visible">True</property><property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Buy a Chronomage day pass if you don\'t have an unexpired one. Get Silvers will also need to be turned on if you want to buy one without gold ring credits. If you only want to buy passes for certain locations, specify the locations like so: wl,imt;imt,wl;imt,sol;ill,val;ill,cys</property>
<property name="halign">start</property><property name="width-chars">47</property><property name="placeholder-text" translatable="yes"><on|off|locations></property></object><packing><property name="left-attach">3</property>
<property name="top-attach">1</property></packing></child></object></child><child type="label"><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="label" translatable="yes">Portals and Passes</property></object></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">1</property></packing></child>
<child><object class="GtkFrame"><property name="visible">True</property><property name="can-focus">False</property><property name="border-width">10</property><property name="label-xalign">0</property>
<child><!-- n-columns=1 n-rows=2 --><object class="GtkGrid"><property name="visible">True</property><property name="can-focus">False</property><property name="margin-top">5</property><property name="margin-bottom">5</property>
<property name="row-spacing">10</property><property name="column-spacing">5</property><child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="halign">start</property><property name="margin-start">10</property><property name="margin-top">5</property>
<property name="label" translatable="yes">Custom Targets cannot be done from the UI. Please use the command line</property></object><packing><property name="left-attach">0</property><property name="top-attach">0</property></packing></child>
<child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property><property name="halign">start</property><property name="margin-start">10</property>
<property name="margin-bottom">5</property><property name="label" translatable="yes">Command line still functions for all options. See help for details.</property></object><packing><property name="left-attach">0</property>
<property name="top-attach">1</property></packing></child></object></child><child type="label"><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="label" translatable="yes">Notes</property></object></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">2</property></packing></child></object></child></object></child></object>
<packing><property name="position">3</property></packing></child><child type="tab"><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property>
<property name="label" translatable="yes">General</property></object><packing><property name="position">3</property><property name="tab-fill">False</property></packing></child></object><packing><property name="expand">False</property>
<property name="fill">True</property><property name="position">0</property></packing></child><child><object class="GtkBox"><property name="visible">True</property><property name="can-focus">False</property>
<child><object class="GtkLabel"><property name="visible">True</property><property name="can-focus">False</property><property name="margin-start">10</property><property name="margin-top">5</property><property name="margin-bottom">5</property>
<property name="label" translatable="yes">Changes are only saved if you use the Close button --></property><attributes><attribute name="style" value="italic"/></attributes></object><packing><property name="expand">False</property>
<property name="fill">True</property><property name="position">0</property></packing></child><child><object class="GtkButton"><property name="label" translatable="yes">Close</property><property name="width-request">80</property>
<property name="visible">True</property><property name="can-focus">True</property><property name="receives-default">True</property><property name="halign">end</property><property name="margin-end">10</property>
<property name="margin-top">5</property><property name="margin-bottom">5</property><property name="hexpand">True</property><signal name="clicked" handler="on_close_clicked" swapped="no"/></object><packing><property name="expand">False</property>
<property name="fill">True</property><property name="position">1</property></packing></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="pack-type">end</property>
<property name="position">1</property></packing></child></object></child></object></interface>'
end
# This is connected to automatically during load_settings and syncs data back to CharSettings.
def on_update(obj)
Gtk.queue do
key = obj.builder_name.to_sym
setting = Setup.get_setting(key)
return if setting.nil?
if obj.class == Gtk::CheckButton
@settings[key] = obj.active?
elsif obj.class == Gtk::Entry
@settings[key] = obj.text.strip
elsif obj.class == Gtk::SpinButton
# update from text entry
obj.update
# force int, we don't use floats anywhere
@settings[key] = obj.adjustment.value.to_i
elsif obj.class == Gtk::ComboBoxText
@settings[key] = obj.active_text
end
end
end
def on_close_clicked
Go2.load(@settings)
self['main'].destroy
end
def on_destroy
Gtk.queue {
Go2.load(@settings)
@running = false
}
end
# iterate all objects and for any that match a setting name directly we set the default
def load_settings
Gtk.queue do
# load up the generic settings which are just matching by name of the widget
objects.each do |obj|
next unless obj.methods.include?(:builder_name)
key = obj.builder_name.to_sym
next if (setting = Setup.get_setting(key)).nil?
# set the default value
obj.set_sensitive(false) if (obj.builder_name.to_s.eql?("mapdb_use_portals")) && XMLData.game !~ /^GSPlat|^GSF/
obj.set_sensitive(false) if (obj.builder_name.to_s.eql?("mapdb_use_old_portals")) && XMLData.game !~ /^GSPlat/
obj.set_sensitive(false) if (obj.builder_name.to_s.eql?("rogue_password")) && Char.prof != "Rogue"
obj.set_sensitive(false) if (obj.builder_name.to_s.eql?("use_seeking")) && Society.member !~ /Order of Voln/ && Society.rank.eql?(26)
if obj.class == Gtk::CheckButton
obj.active = @settings[key]
obj.signal_connect('toggled') { on_update(obj) }
elsif obj.class == Gtk::Entry
obj.text = @settings[key].strip
obj.signal_connect('changed') { on_update(obj) }
elsif obj.class == Gtk::SpinButton
obj.value = @settings[key]
obj.adjustment.value = @settings[key]
obj.signal_connect('changed') { on_update(obj) }
elsif obj.class == Gtk::ComboBoxText
# Fixme: change to builder_name
if @settings[key] == "Auto"
item = 0
elsif @settings[key] == "On"
item = 1
elsif @settings[key] == "Off"
item = 2
elsif @settings[key] == "1"
item = 0
elsif @settings[key] == "2"
item = 1
end
obj.set_active(item) if item
obj.signal_connect('changed') { on_update(obj) }
elsif obj.class == Gtk::TreeView
if (store = self["#{key}_store"]).nil?
respond "** failed to find store for treeview #{key}"
next
elsif setting[:load].nil?
respond "** no :load defined #{key}"
next
end
setting[:load].call(store, @settings[key])
# setup the signals
if (add = self["#{key}_add"]).nil?
respond "** failed to find add for treeview #{key}"
next
elsif (delete = self["#{key}_delete"]).nil?
respond "** failed to find delete for treeview #{key}"
next
elsif (entry = self["#{key}_entry"]).nil?
respond "** failed to find entry for treeview #{key}"
next
end
add.signal_connect('clicked') do
if setting[:set].nil?
respond "** no :set defined for #{key}"
next
elsif entry.text.empty?
next
end
setting[:set].call(store, entry.text, @settings[key])
setting[:load].call(store, @settings[key])
end
delete.signal_connect('clicked') do
if setting[:delete].nil?
respond "** no :delete defined for #{key}"
next
elsif (selected = obj.selection.selected).nil?
next
end
setting[:delete].call(store, selected, @settings[key])
setting[:load].call(store, @settings[key])
end
end
end
# checkboxes for array storage with id's <setting>:<value>
# this is primarily used by the loot types
objects.each do |obj|
next unless obj.methods.include?(:builder_name)
next unless obj.builder_name =~ /^([^:]+):(.*)$/i
next unless obj.class == Gtk::CheckButton
key = Regexp.last_match(1).to_sym
value = Regexp.last_match(2).to_s
# echo "key: #{key} value: #{value}"
next if Setup.get_setting(key).nil?
# echo @settings[key].include?(value)
obj.active = @settings[key].include?(value)
# add in hook
obj.signal_connect('toggled') do
@settings[key].delete(value)
if obj.active?
@settings[key].push(value)
@settings[key].uniq!.sort!
end
end
end
end
end
def start
@running = true
Gtk.queue { self['main'].show_all }
wait_while { @running }
end
def list(cat_to_list: 'all')
indent_size = 2
print_array =
proc do |key, value, indent|
_respond("#{' ' * indent_size * indent.to_i}#{key}:")
value.sort!.each { |entry| _respond("#{' ' * indent_size * (indent.to_i + 1)}#{value.index(entry) + 1}. #{entry}") }
end
print_value = proc { |key, value, indent| _respond("#{' ' * indent_size * indent.to_i}#{key}: #{value}") }
categories = cat_to_list == 'all' ? %w[general internal] : [cat_to_list]
if $frontend == 'stormfront'
output = "<output class=\"mono\"/>\n"
else
output = String.new
end
categories.each do |opt|
_respond("#{output}") if !output.empty?
_respond("#{monsterbold_start}= #{opt.capitalize} =#{monsterbold_end}\n")
@@categories[opt.to_sym].each do |id, _|
value = @settings[id]
value.class == Array ? print_array.call(id, value, 1) : print_value.call(id, value, 1)
end
end
if $frontend == 'stormfront'
output = "<output class=\"\"/>\n"
_respond("#{output}")
end
end
def self.update_setting(key, value)
setting = Setup.get_setting(key)
echo "** Setting #{key.inspect} does not exist" if setting.nil?
action = nil
if value =~ /^([+-])(.*)$/
action = Regexp.last_match(1)
value = Regexp.last_match(2).strip.downcase
end
if value == 'reset'
@settings.delete(key)
echo " Reset #{key}"
elsif @settings[key].class == Array
if value =~ /\d/ && @settings[key][value.to_i]
@settings[key].delete_at(value.to_i)
else
@settings[key].delete(value)
end
if action == '-'
echo " #{value.inspect} removed from #{key.inspect}"
else
@settings[key].push(value)
echo " #{value.inspect} added to #{key.inspect}"
end
echo " #{key.inspect} is now #{@settings[key].join(', ').inspect}"
else
if @settings[key].class == FalseClass || @settings[key].class == TrueClass
value = value =~ /^true|1|yes|on/ ? true : false
elsif @settings[key].class == Integer
value = value.to_i
end
echo "#{key.inspect} has been set to #{value.inspect}"
@settings[key] = value
end
end
end
end
setting_value = { 'on' => true, 'true' => true, 'yes' => true, 'off' => false, 'false' => false, 'no' => false }
previous = shortest_distances = nil
if XMLData.game =~ /^GS/
UserVars.mapdb_urchins_expire = 0 if UserVars.mapdb_urchins_expire.nil?
UserVars.mapdb_car_to_sos = false if UserVars.mapdb_car_to_sos.nil?
UserVars.mapdb_car_from_sos = false if UserVars.mapdb_car_from_sos.nil?
UserVars.mapdb_ice_mode = 'auto' if UserVars.mapdb_ice_mode.nil?
CharSettings['vaalor shortcut'] = false if CharSettings['vaalor shortcut'].nil?
CharSettings['get silvers'] = false if CharSettings['get silvers'].nil?
CharSettings['stop for dead'] = false if CharSettings['stop for dead'].nil?
end
CharSettings['typeahead'] = 0 if CharSettings['typeahead'].nil?
CharSettings['delay'] = 0 if CharSettings['delay'].nil?
CharSettings['hide_room_descriptions'] = false if CharSettings['hide_room_descriptions'].nil?
CharSettings['hide_room_titles'] = false if CharSettings['hide_room_titles'].nil?
CharSettings['echo_input'] = true if CharSettings['echo_input'].nil?
show_help = proc {
output = []
output << "<output class='mono'/>"
output << ""
output << " Recent changes are #{Go2.color("yellow", "highlighted")}" if defined?(Lich::Messaging) == true
output << ""
output << " #{$lich_char}#{Script.current.name} <target> Takes you where you want to go using your saved options."
output.<< " #{$lich_char}#{Script.current.name} goback Takes you back to the room your last #{Script.current.name} started in."
output << " #{$lich_char}#{Script.current.name} <options> <target> Takes you where you want to go, using the given options"
output << " #{' '.rjust($lich_char.length + Script.current.name.length)} instead of your saved options."
output << " #{$lich_char}#{Script.current.name} <options> Saves the given options."
output << " #{Go2.color("yellow", "#{$lich_char}#{Script.current.name} setup")} Brings up GUI for Lich5 users with most of the commands below"
output << " #{Go2.color("yellow", "--hide_room_descriptions=<on|off>")} When 'on', turns room descriptions off for traveling"
output << " #{Go2.color("yellow", "--hide_room_titles=<on|off>")} When 'on', turns room titles off for traveling"
output << " #{Go2.color("yellow", "--echo_input=<on|off>")} When 'on', echos the script input from when the script was called"
output << ""
output << " target: "
output << " target may be a room number, a custom target, a built-in target,"
output << " or part of a room title or room description."
output << ""
output << " options:"
output << " --typeahead=<#> Sets the number of typeahead lines to use."
output << " --delay=<#> Sets the delay in seconds between movements"
output << " (disables typeahead)."
if XMLData.game =~ /^GS/
output << " --get-silvers=<on|off> Sets if #{Script.current.name} has permission to access your bank"
output << " account."
output << " --get-return-trip-silvers=<on|off> Sets if #{Script.current.name} should withdraw enough silvers to"
output << " return from your destination room to your starting room."
output << " --ice-mode=<auto|wait|run> Sets how #{Script.current.name} should deal with rooms that make"
output << " you slip and fall."
output << " --stop-for-dead=<on|off> Pauses the script if you pass a dead person."
output << " --shortcut=<on|off> Sets if the shortcut to Ta'Vaalor should be used."
output << " (climbing and/or simming needed)"
output << " --use-seeking=<on|off> Sets if #{Script.current.name} should use Voln symbol of seeking"
output << " when it will shorten your trip."
output << " --use-urchins=<on|off> Sets if #{Script.current.name} should use urchin guides"
output << " when it will shorten your trip."
output << " --use-portmasters=<on|off> Sets if #{Script.current.name} should use portmasters"
output << " when it will shorten your trip."
output << " --use-day-pass=<on|off> Use a Chronomage day pass to travel between towns in the"
output << " same zone if you have one."
output << " --buy-day-pass=<on|off|locations> Buy a Chronomage day pass if you don't have an unexpired"
output << " one. get-silvers will also need to be turned on if you"
output << " want to buy one without gold ring credits. If you only"
output << " want to buy passes for certain locations, specify the"
output << " locations like so:"
output << " ;go2 --buy-day-pass=wl,imt;imt,wl;imt,sol;ill,val;ill,cys"
output << " --day-pass-container=<container name> Sets the container where you keep your day passes"
output << " --instability=<room number> Use the instability at the given room number to get into"
output << " the Elementla Confluence instead of finding an attuned one."
output << " --fwi-trinket=<trinket name> Use a FWI trinket to get to/from FWI"
output << " --fwi-trinket=<off> Stop using a FWI trinket"
output << " --caravan-to-sos=<on|off> Use the caravan to travel to the Sanctum of Scales"
output << " --caravan-from-sos=<on|off> Use the caravan to travel back from the Sanctum of Scales"
elsif XMLData.game =~ /^DR/
output << " --drag=<name> Attempt to automatically drag someone to your destination"
output << " (this probably won't work)"
end
if XMLData.game =~ /^GSPlat|^GSF/
output << " --portals=<on|off> Sets if portals should be used."
end
if XMLData.game =~ /^GSPlat/
output << " --old-portals=<on|off> Sets if old (dangerous) portals should be used."
output << " --portal-pass=<on|off> Turn this on if you have a wearable portal pass and don't"
output << " need a portal ticket."
end
output << ""
output << " other commands:"
output << ""
output << " #{$lich_char}#{Script.current.name} save new name=<target> <Saves> a custom target. target can be the same"
output << " #{''.rjust($lich_char.length + Script.current.name.length)} as before, or \"current\" for your current room"
output << " #{$lich_char}#{Script.current.name} delete custom target Deletes a saved custom target."
output << " #{$lich_char}#{Script.current.name} list Shows your settings and custom targets."
output << " #{$lich_char}#{Script.current.name} targets Shows the built-in targets."
output << ""
output << "<output class=''/>"
output << ""
results = []
output.each { |line|
new_line = line
if $frontend =~ /^(?:wizard)$/
sf_to_wiz(line)
items = /<output class='mono'\/>|<output class=''\/>/
new_line = new_line.gsub(items, "")
new_line = new_line.gsub(/</, "<")
new_line = new_line.gsub(/>/, ">")
else
line.scan(/\<[^\]\<]*[^\/]>/).each { |item|
next if item.include?("preset")
new_line = new_line.gsub(item, item.encode(:xml => :text))
}
end
results.push(new_line)
}
_respond results
}
# For Dragonrealms only
# A change in behavior from Lich4 to Lich5 caused certain ;go2 map wayto movements to fail.
# This is because of the way the map stringprocs are structured, and the method used to evaluate
# certain map moves, which involved an arguably dubious overloading of FalseClass on Lich4.
# The transition to Lich5 makes it necessary to fix some stringprocs as an interim solution, at
# least until the map can be divested from current owner control and handled appropriately. This code
# also allows the flexibility to pull custom map wayto overrides from the standard yaml hierarchy.
if XMLData.game =~ /^DR/ and defined?(get_settings)
# Get yaml settings
settings = get_settings
# Get base and personal wayto overrides
base_wayto_overrides = settings.base_wayto_overrides
personal_wayto_overrides = settings.personal_wayto_overrides
# Merge the two hashes into a single hash, favoring personal overrides for duplicate keys.
wayto_overrides = base_wayto_overrides.merge(personal_wayto_overrides)
# Iterate through the aggregated map wayto overrides from above and set new stringprocs
wayto_overrides.each do |_key, values|
start_room_id = values['start_room'].to_i
end_room_id = values['end_room'].to_i
start_room = Map.list[start_room_id]
old_wayto = start_room.wayto["#{end_room_id}"]
old_timeto = start_room.timeto["#{end_room_id}"]
new_wayto = old_wayto
new_timeto = old_timeto
if values['str_proc']
new_wayto = StringProc.new("#{values['str_proc']}")
end
if values['travel_time']
new_timeto = values['travel_time'].to_f
end
start_room.wayto["#{end_room_id}"] = new_wayto
start_room.timeto["#{end_room_id}"] = new_timeto
end
end
change_map_vaalor_shortcut = proc { |use_shortcut|
unless Map.list.any? { |room| room.timeto.any? { |_adj_id, time| time.class == Proc and time._dump =~ /$go2_use_vaalor_shortcut/ } }
if use_shortcut
Room[16745].timeto['16746'] = 15
Room[16746].timeto['16745'] = 15
else
Room[16745].timeto['16746'] = 15000
Room[16746].timeto['16745'] = 15000
end
end
}
get_silver_cost = proc { |path|
cost = 0
path.each_index { |index|
Room[path[index]].tags.each { |tag|
if tag =~ /^silver-cost:#{path[index + 1]}:(.*)$/
cost_string = $1
if cost_string =~ /^[0-9]+$/
cost += cost_string.to_i
else
cost += StringProc.new(cost_string).call.to_i
end
end
}
}
cost
}
update_urchin_expire = proc {
if UserVars.mapdb_use_urchins
urchin_status_expires_pattern = /You will have access to the urchin guides until (?<expires>.*?)\./
result = dothistimeout 'urchin status', 3, /You will have access to the urchin guides|You currently have no access to the urchin guides.|permanent access to the urchin guides./
if (m = urchin_status_expires_pattern.match(result))
UserVars.mapdb_urchins_expire = Time.parse(m[:expires].gsub(/(\d+)\/(\d+)\/(\d+) (\d+:\d+:\d+) (.*?)$/, '\3-\1-\2 \4 \5')).to_i
echo "Urchin expiration successfully updated."
elsif result =~ /permanent access to the urchin guides/
UserVars.mapdb_urchins_expire = Time.new(Time.now.year + 1, 1, 1).to_i
echo "Urchin expiration successfully updated."
else
UserVars.mapdb_urchins_expire = 0;
end
if UserVars.mapdb_use_urchins and (UserVars.mapdb_urchins_expire.nil? or UserVars.mapdb_urchins_expire == 0 or Time.now.to_i > UserVars.mapdb_urchins_expire)
echo "Current settings indicate to use urchins, but your access has expired or is unable to be parsed."
echo "Disable this check by running ;go2 --use-urchins=off"
end
end
}
if UserVars.mapdb_use_urchins and (UserVars.mapdb_urchins_expire.nil? or Time.now.to_i > UserVars.mapdb_urchins_expire)
before_dying { update_urchin_expire.call }
end
#
# check for general commands
#
echo "input: #{Script.current.vars[0]}" if CharSettings['echo_input'] == true;
if Script.current.vars.empty? or Script.current.vars[0].strip =~ /^help$/i
show_help.call
exit
elsif Script.current.vars[0] =~ /^setup$/i
Setup.new(Go2.load_go2_settings).start
Go2.save_go2_settings(Go2.data)
exit
elsif Script.current.vars[0] =~ /^targets$/i
echo 'generating list...'
dr_interesting_tags = ["alchemist", "armorshop", "bakery", "bank", "barbarian", "bard", "boutique", "cleric", "clericshop", "empath", "exchange", "fletcher", "forge", "furrier", "gemshop", "general store", "herbalist", "inn", "locksmith", "moonmage", "movers ", "necromancer", "npchealer", "paladin", "pawnshop", "ranger", "smokeshop", "stable", "thief", "town", "trader", "warmage", "weaponshop"]
gs_interesting_tags = ["advguard", "advguard2", "advguild", "advpickup", "alchemist", "armorshop", "bakery", "bank", "bardguild", "boutique", "chronomage", "clericguild", "clericshop", "cobbling", "collectibles", "consignment", "empathguild", "exchange", "fletcher", "forge", "furrier", "gemshop", "general store", "grocer", "herbalist", "inn", "locksmith pool", "locksmith", "mail", "movers", "npccleric", "npchealer", "pawnshop", "portmaster", "postoffice", "rangerguild", "smokeshop", "sorcererguild", "sunfist", "treasuremaster", "town", "voln", "warriorguild", "weaponshop", "wizardguild"]
town_list = Map.list.find_all { |room| room.tags.include?('town') and !room.tags.include?('closed') }
town_ids = town_list.collect { |room| room.id }
town_hash = Hash.new
town_ids.each { |id| town_hash[id] = Array.new }
interesting_tags = (XMLData.game =~ /^DR/ ? dr_interesting_tags : gs_interesting_tags)
for tag in interesting_tags
for room in Map.list.find_all { |iroom| iroom.tags.include?(tag) }
if (nearest = Room[room.id].find_nearest(town_ids))
unless town_hash[nearest].any? { |line| line =~ /^ \- #{tag.ljust(17)} / }
town_hash[nearest].push " - #{tag.ljust(17)} #{room.title.first.sub(/^\[/, '').sub(/\]$/, '').ljust(34)} - #{room.id.to_s.rjust(5)}"
end
end
end
end
output = []
town_list.each { |town_room|
output << "---------------------------------------------------------------"
output << " - town #{town_room.location.to_s.sub(/^.*?([A-Z].*?)$/, '\1').ljust(34)} - #{town_room.id.to_s.rjust(5)}"
output << "---------------------------------------------------------------"
town_hash[town_room.id].sort.each { |target|
output << target
}
output << ""
}
if XMLData.game =~ /^DR/
output << "---------------------------------------------------------------"
output << " - Known Nexus Rooms"
output << "---------------------------------------------------------------"
Map.list.find_all { |iroom| iroom.tags.include?('nexus') }
.each { |room| output << "#{room.title.first.sub(/^\[/, '').sub(/\]$/, '').ljust(45)} - #{room.id.to_s.rjust(5)}" }
end
respond output
exit
elsif Script.current.vars[0] =~ /^list$/i
output = []
output << "settings:"
output << ""
output << " typeahead: #{CharSettings['typeahead']}"
if (CharSettings['typeahead'] > 0) and (CharSettings['delay'] > 0)
output << " (not used because delay > 0)"
end
output << ""
output << " delay: #{CharSettings['delay']}"
output << " get silvers: #{CharSettings['get silvers'] ? 'on' : 'off'}"
output << " get return silvers: #{CharSettings['get return trip silvers'] ? 'on' : 'off'}"
output << " ice mode: #{UserVars.mapdb_ice_mode}"
output << " use seeking: #{CharSettings['use seeking'] ? 'on' : 'off'}"
output << " use urchins: #{UserVars.mapdb_use_urchins ? 'on' : 'off'}"
output << " use portmasters: #{UserVars.mapdb_use_portmasters ? 'on' : 'off'}"
output << " use day pass: #{UserVars.mapdb_use_day_pass ? 'on' : 'off'}"
output << " buy day pass: #{UserVars.mapdb_buy_day_pass ? 'on' : 'off'}"
output << " day pass container: #{UserVars.day_pass_sack.nil? ? '(not set)' : UserVars.day_pass_sack}"
output << "hide room descriptions: #{CharSettings['hide_room_descriptions'] ? 'on' : 'off'}"
output << " hide room titles: #{CharSettings['hide_room_titles'] ? 'on' : 'off'}"
output << " echo input: #{CharSettings['echo_input'] ? 'on' : 'off'}"
if XMLData.game =~ /^GS/
output << " stop for dead: #{CharSettings['stop for dead'] ? 'on' : 'off'}"
output << " vaalor shortcut: #{CharSettings['vaalor shortcut'] ? 'on' : 'off'}"
output << " FWI trinket: #{UserVars.mapdb_fwi_trinket ? UserVars.mapdb_fwi_trinket : '(not set)'}"
output << " caravan to sos: #{UserVars.mapdb_car_to_sos == true ? 'on' : 'off'}"
output << " caravan from sos: #{UserVars.mapdb_car_from_sos == true ? 'on' : 'off'}"
end
if XMLData.game =~ /^GSPlat|^GSF/
output << " use portals: #{(UserVars.mapdb_use_portals == 'yes') ? 'yes' : 'no'}"
end
if XMLData.game =~ /^GSPlat/
output << " use old portals: #{(UserVars.mapdb_use_old_portals == 'yes') ? 'yes' : 'no'}"
end
if XMLData.game =~ /^GSPlat|^GSF/
output << " have portal pass: #{(UserVars.mapdb_have_portal_pass == 'yes') ? 'yes' : 'no'}"
end
output << ""
output << "custom targets:"
output << ""
for target_name, target_num in GameSettings['custom targets'].sort
output << " #{target_name.ljust(20)} = #{target_num.to_s.rjust(5)} #{Map[target_num].title.first}"
end
output << ""
respond output
exit
elsif Script.current.vars[1] =~ /^save/i
unless Script.current.vars[0] =~ /^save (.+?)=(.+)$/
echo "error: You're doing it wrong."
exit
end
target_name = $1.strip
target = $2.strip
if target_name =~ /^\d+$/
echo "error: target name can't be just a number."
exit
end
if target =~ /^current$/i
unless (target_room = Map.current)
echo 'error: your current room was not found in the map database.'
exit
end
else
unless target =~ /^\d+$/ and (target_room = Map[target.to_i])
unless (target_room = Map[target])
echo "error: could not identify the target room"
exit
end
end
end
custom_targets = (GameSettings['custom targets'] || Hash.new)
custom_targets[target_name] = target_room.id
GameSettings['custom targets'] = custom_targets
echo "custom target saved (#{target_name}->#{target_room.id})"
exit
elsif Script.current.vars[1] =~ /^delete$/i
delkey = Script.current.vars[0].sub(/\s*delete\s*/i, '')
custom_targets = (GameSettings['custom targets'] || Hash.new)
if (kilkey = custom_targets.keys.find { |key| key =~ /^#{delkey}$/i }) or (kilkey = custom_targets.keys.find { |key| key =~ /^#{delkey}/i })
custom_targets.delete(kilkey)
You can’t perform that action at this time.
