-
Notifications
You must be signed in to change notification settings - Fork 3
/
xnarost.lic
998 lines (912 loc) · 64.1 KB
/
xnarost.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
=begin
xNarost - Lost Ranger's eXperimental Narost branch.
Tracks your current room on Tsoran (or other) maps
Key differences between this and ;narost:
* xnarost has a better-organized map list with submenus, and uses 'proper' map names instead of filenames.
* xnarost sorts the list of tags.
* xnarost supports CTRL+Mousewheel zooming.
click on a room to go there
shift-click on a room to show its description
right-click for some options
author: LostRanger ([email protected])
original Narost author: Tillmen ([email protected])
game: Gemstone
tags: core, movement
version: 0.5.1 (2017-05-29) based on narost.lic from 2014-08-24
changelog:
version 0.5.1 (2017-05-29)
* fix some metadata errors between Solhaven/Vornavis
* remove inadvertent debugging code left on during drag.
version 0.5 (2017-05-29)
* Improve ctrl+mousewheel zoom to not reset the map to the origin
* Fix some bugs that would cause the circle image to be visible when it shouldn't be
* Reintroduced regular scrolling with mousewheel
* Added horizontal mousewheel scrolling with shift+mousewheel
version 0.4 (2017-05-27)
* Fix issue where filename comparisons were case-sensitive, causing map menu metadata to not apply correctly.
* Fix issue where maps with no associated metadata were not properly added to the list.
version 0.3 (2017-05-26)
* Added most of the rest of the map metadata. Remove the "This is experimental!" nag-message.
* Sort the list of tags.
* Make tag and map sorting case-insensitive.
* Maps can now be zoomed with CTRL+Mousewheel.
version 0.2 (2017-05-25)
* Complete more map data.
version 0.1 (2017-05-25) based on narost.lic from 2014-08-24
* Improve map list organization.
=end
# fixme: click arrow to next map to show map
i_stand_alone
clear
unless HAVE_GTK
respond
respond 'error: ruby-gtk bindings are not installed or failed to load'
respond
exit
end
unless defined?(Gtk.queue)
respond
respond 'Your version of Lich is too old for this script.'
respond
exit
end
if $SAFE > 0
echo "This script needs to be trusted to work properly. (;trust #{script.name})"
exit
end
# echo <<EOF
#
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# This is an EXPERIMENTAL update to Narost, and it does not yet have completely updated data.
#
# You can help crowdsource the data entry at the below link:
# https://docs.google.com/spreadsheets/d/1oGk-4XZL0196aMGPUQFtDpvo_LPxJI3sx40tRKw7uoY/edit#gid=0
#
# This nag message will be removed when the data collection is complete and the script is updated.
# See also ;repo set-updatable xnarost.lic
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# EOF
class MapData
# Source for data: https://docs.google.com/spreadsheets/d/1oGk-4XZL0196aMGPUQFtDpvo_LPxJI3sx40tRKw7uoY/edit#gid=0
Data = {
'adventurers_guild' => {:name => 'Adventurer\'s Guild', :shortname => 'Adventurer\'s Guild', :categories => ['Guilds', 'Wehnimer\'s Landing', 'Icemule Trace', 'Vornavis', 'River\'s Rest', 'Isle of the Four Winds', 'Teras Isle', 'Zul Logoth', 'Elven Nations']},
'confluence' => {:name => 'Elemental Confluence, The', :shortname => 'Elemental Confluence', :categories => ['Other']},
'ebonstone_manor' => {:name => 'Wehnimer\'s Landing - Ebonstone Manor', :shortname => 'Ebonstone Manor', :categories => ['Wehnimer\'s Landing', 'CHE']},
'en-aradhul-road' => {:name => 'Elven Nations - Aradhul Road', :shortname => 'Aradhul Road', :categories => ['Elven Nations']},
'en-cemetery' => {:name => 'Elven Nations - Ta\'Vaalor Cemetary and Neartofar Forest', :shortname => 'Cemetary/Neartofar Forest', :categories => ['Elven Nations']},
'en-cleric_guild' => {:name => 'Elven Nations - Ta\'Illistim Cleric Guild', :shortname => 'Cleric Guild (Ta\'Illistim)', :categories => ['Elven Nations', 'Guilds']},
'en-cysaegir' => {:name => 'Elven Nations - Cysaegir', :shortname => 'Cysaegir', :categories => ['Elven Nations', 'Towns']},
'en-fearling' => {:name => 'Elven Nations - Fearling Pass', :shortname => 'Fearling Pass', :categories => ['Elven Nations']},
'en-gyldemar' => {:name => 'Elven Nations - Gyldemar', :shortname => 'Gyldemar', :categories => ['Elven Nations']},
'en-illistim_rogue_guild' => {:name => 'Elven Nations - Ta\'Illistim Rogue Guild', :shortname => 'Rogue Guild (Ta\'Illistim)', :categories => ['Elven Nations', 'Guilds']},
'en-old_ta_faendryl' => {:name => 'Elven Nations - Old Ta\'Faendryl', :shortname => 'Old Ta\'Faendryl', :categories => ['Elven Nations']},
'en-ravelin' => {:name => 'Elven Nations - Ravelin', :shortname => 'Ravelin', :categories => ['Elven Nations']},
'en-sapphire' => {:name => 'Elven Nations - Ta\'Illistim Sapphire Gate', :shortname => 'Sapphire Gate/Whistler\'s Pass North', :categories => ['Elven Nations']},
'en-skull' => {:name => 'Elven Nations - Skull Temple', :shortname => 'Skull Temple', :categories => ['Elven Nations']},
'en-sylvarraend' => {:name => 'Elven Nations - Sylvarraend Road', :shortname => 'Sylvarraend Road', :categories => ['Elven Nations', 'Towns']},
'en-ta_illistim-embassies' => {:name => 'Elven Nations - Ta\'Illistim Embassies', :shortname => 'Ta\'Illistim Embassies', :categories => ['Elven Nations']},
'en-ta_illistim-isharn_enclave' => {:name => 'Elven Nations - Ta\'Illistim - Isharn Enclave', :shortname => 'Isharn Enclave', :categories => ['Elven Nations', 'MHO']},
'en-ta_illistim-new' => {:name => 'Elven Nations - Ta\'Illistim', :shortname => 'Ta\'Illistim', :categories => ['Elven Nations', 'Towns']},
'en-ta_illistim-rangerguild-v2' => {:name => 'Elven Nations - Ta\'Illistim Ranger Guild', :shortname => 'Ranger Guild (Ta\'Illistim)', :categories => ['Elven Nations', 'Guilds']},
'en-ta_illistim-sorcerer_guild' => {:name => 'Elven Nations - Ta\'Illistim Sorcerer Guild', :shortname => 'Sorcerer Guild (Ta\'Illistim)', :categories => ['Elven Nations', 'Guilds']},
'en-ta_illistim-wizard_guild' => {:name => 'Elven Nations - Ta\'Illistim Wizard Guild', :shortname => 'Wizard Guild (Ta\'Illistim)', :categories => ['Elven Nations', 'Guilds']},
'en-ta_illistim_buildings' => {:name => 'Elven Nations - Ta\'Illistim Buildings', :shortname => 'Ta\'Illistim Buildings', :categories => ['Elven Nations']},
'en-ta_vaalor' => {:name => 'Elven Nations - Ta\'Vaalor', :shortname => 'Ta\'Vaalor', :categories => ['Elven Nations', 'Towns']},
'en-ta_vaalor-dancing_dahcre' => {:name => 'Elven Nations - Ta\'Vaalor - Dancing Dahcre', :shortname => 'Ta\'Vaalor - Dancing Dahcre (Annex)', :categories => ['Elven Nations', 'CHE']},
'en-ta_vaalor-sorcerer_guild' => {:name => 'Elven Nations - Ta\'Vaalor Sorcerer Guild', :shortname => 'Sorcerer Guild (Ta\'Vaalor)', :categories => ['Elven Nations', 'Guilds']},
'en-ta_vaalor-wyverns_keep' => {:name => 'Elven Nations - Ta\'Vaalor - Wyvern Keep', :shortname => 'Ta\'Vaalor - Wyvern Keep', :categories => ['Elven Nations']},
'en-tower' => {:name => 'Elven Nations - Maaghara Tower', :shortname => 'Maaghara Tower', :categories => ['Elven Nations']},
'en-trail' => {:name => 'Elven Nations - Trail (Locksmehr River/West of Dragonspine)', :shortname => 'Locksmehr River Trail', :categories => ['Elven Nations', 'Wehnimer\'s Landing']},
'en-vaalor-rogue-guild' => {:name => 'Elven Nations - Ta\'Vaalor Rogue Guild', :shortname => 'Rogue Guild (Ta\'Vaalor)', :categories => ['Elven Nations', 'Guilds']},
'en-victory' => {:name => 'Elven Nations - Victory Road', :shortname => 'Victory Road', :categories => ['Elven Nations']},
'en-vo-homes' => {:name => 'Neighborhood of Elven Nations and Solhaven', :shortname => 'Neighborhood of Elven Nations and Solhaven', :categories => ['Elven Nations', 'Vornavis', 'Neighborhoods', 'Premium']},
'en-whistlers_pass' => {:name => 'Elven Nations - Whistler\'s Pass', :shortname => 'Whistler\'s Pass', :categories => ['Elven Nations']},
'en-zul-sorcerer_guild' => {:name => 'Zul Logoth - Sorcerer Guild', :shortname => 'Sorcerer Guild (Zul Logoth)', :categories => ['Zul Logoth', 'Guilds']},
'en-zul-wizard_guild' => {:name => 'Zul Logoth - Wizard Guild', :shortname => 'Wizard Guild (Zul Logoth)', :categories => ['Zul Logoth', 'Guilds']},
'en-zul_logoth' => {:name => 'Zul Logoth - Town Map', :shortname => 'Zul Logoth', :categories => ['Zul Logoth', 'Towns']},
'en-zul_logoth-rangerguild-v2' => {:name => 'Zul Logoth - Ranger Guild', :shortname => 'Ranger Guild (Zul Logoth)', :categories => ['Zul Logoth', 'Guilds']},
'fest-albatross' => {:name => 'fest-albatross', :shortname => 'fest-albatross', :categories => ['Events and Festivals']},
'fest-duskruin' => {:name => 'fest-duskruin', :shortname => 'fest-duskruin', :categories => ['Events and Festivals']},
'fest-ebon_gate' => {:name => 'fest-ebon_gate', :shortname => 'fest-ebon_gate', :categories => ['Events and Festivals']},
'fest-festival_of_the_fallen' => {:name => 'fest-festival_of_the_fallen', :shortname => 'fest-festival_of_the_fallen', :categories => ['Events and Festivals']},
'fest-highman_games' => {:name => 'fest-highman_games', :shortname => 'fest-highman_games', :categories => ['Events and Festivals']},
'fest-lumnea' => {:name => 'fest-lumnea', :shortname => 'fest-lumnea', :categories => ['Events and Festivals']},
'fest-midsummers-night' => {:name => 'fest-midsummers-night', :shortname => 'fest-midsummers-night', :categories => ['Events and Festivals']},
'fest-picklefest' => {:name => 'fest-picklefest', :shortname => 'fest-picklefest', :categories => ['Events and Festivals']},
'fest-spitfire' => {:name => 'fest-spitfire', :shortname => 'fest-spitfire', :categories => ['Events and Festivals']},
'ifw-cleric_guild' => {:name => 'Isle of the Four Winds - Cleric Guild', :shortname => 'Cleric Guild (FWI)', :categories => ['Isle of the Four Winds', 'Guilds', 'Premium']},
'ifw-eastern_waterway' => {:name => 'Isle of the Four Winds - Eastern Waterway', :shortname => 'Eastern Waterway', :categories => ['Isle of the Four Winds', 'Premium']},
'ifw-empath_guild' => {:name => 'Isle of the Four Winds - Empath Guild', :shortname => 'Empath Guild (FWI)', :categories => ['Isle of the Four Winds', 'Guilds', 'Premium']},
'ifw-isle_of_four_winds' => {:name => 'Isle of the Four Winds - Mist Harbor', :shortname => 'Mist Harbor', :categories => ['Isle of the Four Winds', 'Towns', 'Premium']},
'ifw-rogue_guild' => {:name => 'Isle of the Four Winds - Rogue Guild', :shortname => 'Rogue Guild (FWI)', :categories => ['Isle of the Four Winds', 'Guilds', 'Premium']},
'ifw-saewehna_lagoon' => {:name => 'Four Winds - Monsoon Lagoon', :shortname => 'Monsoon Lagoon', :categories => ['Isle of the Four Winds', 'Premium']},
'ifw-warrior guild' => {:name => 'Four Winds - Warrior Guild', :shortname => 'Warrior Guild (IFW)', :categories => ['Isle of the Four Winds', 'Guilds', 'Premium']},
'ifw-wilds' => {:name => 'Isle of the Four Winds - Wilds', :shortname => 'Wilds', :categories => ['Isle of the Four Winds', 'Premium']},
'imt-bramble_patch' => {:name => 'Icemule Trace - Bramble Patch', :shortname => 'Bramble Patch', :categories => ['Icemule Trace']},
'imt-cleric_guild' => {:name => 'Icemule Trace - Cleric Guild', :shortname => 'Cleric Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'imt-clovertooth_hall' => {:name => 'Icemule Trace - Clovertooth Hall', :shortname => 'Clovertooth Hall', :categories => ['Icemule Trace']},
'imt-east_west_north_gates' => {:name => 'Icemule Trace - East, West and North Gates', :shortname => 'East, West and North Gates', :categories => ['Icemule Trace']},
'imt-empath_guild' => {:name => 'Icemule Trace - Empath Guild', :shortname => 'Empath Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'imt-homes' => {:name => 'Neighborhoods of Icemule Trace and Pinefar', :shortname => 'Neighborhoods of Icemule Trace and Pinefar', :categories => ['Icemule Trace', 'Neighborhoods', 'Premium']},
'imt-icemule' => {:name => 'Icemule Trace', :shortname => 'Icemule Trace', :categories => ['Icemule Trace', 'Towns']},
'imt-pinefar' => {:name => 'Icemule Trace - Pinefar', :shortname => 'Pinefar', :categories => ['Icemule Trace', 'Towns']},
'imt-rangerguild-v2' => {:name => 'Icemule Trace - Ranger Guild', :shortname => 'Ranger Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'imt-reim' => {:name => 'Icemule Trace - The Settlement of Reim', :shortname => 'The Settlement of Reim', :categories => ['Icemule Trace']},
'imt-rift' => {:name => 'Icemule Trace - Rift, The', :shortname => 'Rift, The', :categories => ['Icemule Trace']},
'imt-rogue_guild' => {:name => 'Icemule Trace - Rogue Guild', :shortname => 'Rogue Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'imt-scatter' => {:name => 'Icemule Trace - Scatter, The', :shortname => 'Scatter, The', :categories => ['Icemule Trace']},
'imt-silvermule_gaming_hall' => {:name => 'Icemule Trace - Silvermule Gaming Hall', :shortname => 'Silvermule Gaming Hall', :categories => ['Icemule Trace']},
'imt-sorcerer_guild' => {:name => 'Icemule Trace - Sorcerer Guild', :shortname => 'Sorcerer Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'imt-south_gate' => {:name => 'Icemule Trace - South Gate Wilds', :shortname => 'South Gate Wilds', :categories => ['Icemule Trace']},
'imt-trail' => {:name => 'Icemule Trace - Trail to Wehnimer\'s Landing', :shortname => 'Trail between Wehnimer\'s Landing and Icemule', :categories => ['Icemule Trace', 'Wehnimer\'s Landing']},
'imt-underground' => {:name => 'Icemule Trace - Underground', :shortname => 'Underground', :categories => ['Icemule Trace']},
'imt-whitehaven2' => {:name => 'Icemule Trace - House White Haven (Map #1)', :shortname => 'House White Haven (Map #1)', :categories => ['Icemule Trace', 'CHE']},
'imt-white_haven' => {:name => 'Icemule Trace - House White Haven (Map #2)', :shortname => 'House White Haven (Map #2)', :categories => ['Icemule Trace', 'CHE']},
'imt-wizard_guild' => {:name => 'Icemule Trace - Wizard Guild', :shortname => 'Wizard Guild (Icemule)', :categories => ['Icemule Trace', 'Guilds']},
'premium_halls' => {:name => 'Premium Halls of Elanthia', :shortname => 'Premium Halls of Elanthia', :categories => ['Premium', 'Elven Nations', 'Wehnimer\'s Landing', 'Zul Logoth', 'River\'s Rest', 'Icemule Trace', 'Vornavis', 'Teras Isle']},
'red_forest' => {:name => 'Red Forest, The', :shortname => 'Red Forest', :categories => ['Wehnimer\'s Landing', 'Elven Nations']},
'rr-beacon_hall' => {:name => 'River\'s Rest - Beacon Hall Archive', :shortname => 'Beacon Hall Archive', :categories => ['River\'s Rest', 'CHE']},
'rr-citadel' => {:name => 'River\'s Rest - Citadel', :shortname => 'Citadel', :categories => ['River\'s Rest']},
'rr-maelstrom' => {:name => 'River\'s Rest - Maelstrom Bay', :shortname => 'Maelstrom Bay', :categories => ['River\'s Rest']},
'rr-marsh_keep' => {:name => 'River\'s Rest - Marsh Keep', :shortname => 'Marsh Keep', :categories => ['River\'s Rest']},
'rr-rivers_rest' => {:name => 'River\'s Rest', :shortname => 'River\'s Rest', :categories => ['River\'s Rest', 'Towns']},
'rr-rogue_guild' => {:name => 'River\'s Rest - Rogue Guild', :shortname => 'Rogue Guild (River\'s Rest)', :categories => ['River\'s Rest', 'Guilds']},
'rr-sorcerer_guild' => {:name => 'River\'s Rest - Sorcerer Guild', :shortname => 'Sorcerer Guild (River\'s Rest)', :categories => ['River\'s Rest', 'Guilds']},
'rr-warrens' => {:name => 'River\'s Rest - Warrens', :shortname => 'Warrens', :categories => ['River\'s Rest']},
'rr-wizard_guild' => {:name => 'River\'s Rest - Wizard Guild', :shortname => 'Wizard Guild (River\'s Rest)', :categories => ['River\'s Rest', 'Guilds']},
'sanctum' => {:name => 'Sanctum of Scales', :shortname => 'Sanctum of Scales', :categories => ['Other']},
'spire_grounds_5117' => {:name => 'Summit Academy and Sylinar\'s Spire', :shortname => 'Summit Academy and Sylinar\'s Spire', :categories => ['Other']},
'ti-adventurers_rest' => {:name => 'Teras Isle - Adventurer\'s Rest', :shortname => 'Adventurer\'s Rest', :categories => ['Teras Isle']},
'ti-cleric_guild' => {:name => 'Teras Isle - Cleric Guild', :shortname => 'Cleric Guild (Teras)', :categories => ['Teras Isle', 'Guilds']},
'ti-nelemar' => {:name => 'Teras Isle - Nelemar', :shortname => 'Nelemar', :categories => ['Teras Isle']},
'ti-rogue_guild' => {:name => 'Teras Isle - Rogue Guild', :shortname => 'Rogue Guild (Teras)', :categories => ['Teras Isle', 'Guilds']},
'ti-rr-homes' => {:name => 'Neighborhoods of Teras Isle and River\'s Rest', :shortname => 'Neighborhoods of Teras Isle and River\'s Rest', :categories => ['Teras Isle', 'River\'s Rest', 'Neighborhoods', 'Premium']},
'ti-sorcerer_guild' => {:name => 'Teras Isle - Sorcerer Guild', :shortname => 'Sorcerer Guild (Teras)', :categories => ['Teras Isle', 'Guilds']},
'ti-teras' => {:name => 'Teras Isle - Kharam-Dzu', :shortname => 'Kharam-Dzu', :categories => ['Teras Isle', 'Towns']},
'ti-vtull' => {:name => 'Teras Isle - Eye of V\'Tull', :shortname => 'Eye of V\'Tull', :categories => ['Teras Isle']},
'ti-wilds' => {:name => 'Teras Isle - Fhorian Village', :shortname => 'Fhorian Village', :categories => ['Teras Isle']},
'ti-wizard_guild' => {:name => 'Teras Isle - Wizard Guild', :shortname => 'Wizard Guild (KD)', :categories => ['Teras Isle', 'Guilds']},
'vo-caravansary' => {:name => 'Vornavis - Caravansary', :shortname => 'Caravansary', :categories => ['Vornavis']},
'vo-cleric_guild' => {:name => 'Vornavis - Cleric Guild', :shortname => 'Cleric Guild (VO)', :categories => ['Vornavis', 'Guilds']},
'vo-foggy_valley' => {:name => 'Vornavis - Foggy Valley', :shortname => 'Foggy Valley', :categories => ['Vornavis']},
'vo-north_beach' => {:name => 'Vornavis - North Beach', :shortname => 'North Beach', :categories => ['Vornavis']},
'vo-outlands' => {:name => 'Vornavis - Outlands', :shortname => 'Outlands', :categories => ['Vornavis']},
'vo-rangerguild-v2' => {:name => 'Vornavis - Ranger Guild', :shortname => 'Ranger Guild (VO)', :categories => ['Vornavis', 'Guilds']},
'vo-rogue_guild' => {:name => 'Vornavis - Rogue Guild', :shortname => 'Rogue Guild (VO)', :categories => ['Vornavis', 'Guilds']},
'vo-solhaven' => {:name => 'Vornavis - Solhaven', :shortname => 'Solhaven', :categories => ['Vornavis', 'Towns']},
'vo-sorcerer_guild' => {:name => 'Vornavis - Sorcerer Guild', :shortname => 'Sorcerer Guild (VO)', :categories => ['Vornavis', 'Guilds']},
'vo-trail' => {:name => 'Trail to Vornavis', :shortname => 'Trail to Vornavis', :categories => ['Vornavis', 'Wehnimer\'s Landing']},
'vo-warehouse_lockers' => {:name => 'Vornavis - Solhaven Lockers', :shortname => 'Solhaven Lockers', :categories => ['Vornavis']},
'warcamp' => {:name => 'Grimswarm Warcamp', :shortname => 'Grimswarm Warcamp', :categories => ['Other']},
'warrior_guilds' => {:name => 'Warrior Guilds', :shortname => 'Warrior Guilds', :categories => ['Guilds', 'Elven Nations', 'Icemule Trace', 'Vornavis', 'Wehnimer\'s Landing', 'River\'s Rest', 'Teras Isle']},
'wl-beacon_hall' => {:name => 'Wehnimer\'s Landing - Beacon Hall Annex', :shortname => 'Beacon Hall Annex', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-black_wolves_manor' => {:name => 'Wehnimer\'s Landing - Black Wolves', :shortname => 'Black Wolves', :categories => ['Wehnimer\'s Landing', 'MHO']},
'wl-brigatta' => {:name => 'Wehnimer\'s Landing - House Brigatta (Map 1)', :shortname => 'House Brigatta (Map 1)', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-broken' => {:name => 'Wehnimer\'s Landing - Broken Lands', :shortname => 'Broken Lands', :categories => ['Wehnimer\'s Landing']},
'wl-burrow_way' => {:name => 'Wehnimer\'s Landing - Burrow Way', :shortname => 'Burrow Way', :categories => ['Wehnimer\'s Landing']},
'wl-catacombs' => {:name => 'Wehnimer\'s Landing - Catacombs', :shortname => 'Catacombs', :categories => ['Wehnimer\'s Landing']},
'wl-cavernhold' => {:name => 'Wehnimer\'s Landing - Cavernhold', :shortname => 'Cavernhold', :categories => ['Wehnimer\'s Landing']},
'wl-cleric_guild' => {:name => 'Wehnimer\'s Landing - Cleric Guild', :shortname => 'Cleric Guild (Wehnimer\'s)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
'wl-coastal_cliffs' => {:name => 'Wehnimer\'s Landing - Coastal Cliffs', :shortname => 'Coastal Cliffs', :categories => ['Wehnimer\'s Landing']},
'wl-danjirland' => {:name => 'Wehnimer\'s Landing - Danjirland', :shortname => 'Danjirland', :categories => ['Wehnimer\'s Landing']},
'wl-darkstone' => {:name => 'Wehnimer\'s Landing - Darkstone Castle', :shortname => 'Darkstone Castle', :categories => ['Wehnimer\'s Landing']},
'wl-deadfall' => {:name => 'Wehnimer\'s Landing - Deadfall Forest', :shortname => 'Deadfall Forest', :categories => ['Wehnimer\'s Landing']},
'wl-dyers_tent' => {:name => 'Wehnimer\'s Landing - Reignbeau Caverns (Dyer\'s Tent)', :shortname => 'Reignbeau Caverns (Dyer\'s Tent)', :categories => ['Wehnimer\'s Landing']},
'wl-empath_guild' => {:name => 'Wehnimer\'s Landing - Empath Guild', :shortname => 'Empath Guild (Wehnimer\'s)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
'wl-faendryl-v2' => {:name => 'Wehnimer\'s Landing - Faendryl Enclave', :shortname => 'Faendryl Enclave', :categories => ['Wehnimer\'s Landing', 'MHO']},
'wl-gates' => {:name => 'Wehnimer\'s Landing - Outside Gates', :shortname => 'Outside Gates', :categories => ['Wehnimer\'s Landing']},
'wl-graveyard' => {:name => 'Wehnimer\'s Landing - Graveyard', :shortname => 'Graveyard', :categories => ['Wehnimer\'s Landing']},
'wl-halcyon_hills' => {:name => 'Wehnimer\'s Landing - Halcyon Hills', :shortname => 'Halcyon Hills', :categories => ['Wehnimer\'s Landing']},
'wl-hearthstone_manor' => {:name => 'Wehnimer\'s Landing - Hearthstone Manor', :shortname => 'Hearthstone Manor', :categories => ['Wehnimer\'s Landing']},
'wl-homes-1' => {:name => 'Neighborhoods of Wehnimer\'s Landing #1', :shortname => 'Neighborhoods of Wehnimer\'s Landing #1', :categories => ['Wehnimer\'s Landing', 'Neighborhoods', 'Premium']},
'wl-homes-2' => {:name => 'Neighborhoods of Wehnimer\'s Landing #2', :shortname => 'Neighborhoods of Wehnimer\'s Landing #2', :categories => ['Wehnimer\'s Landing', 'Neighborhoods', 'Premium']},
'wl-house_brigatta' => {:name => 'Wehnimer\'s Landing - House Brigatta (Map 2)', :shortname => 'House Brigatta (Map 2)', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-house_onoir' => {:name => 'Wehnimer\'s Landing - House Daingneach Onoir', :shortname => 'House Daingneach Onoir', :categories => ['Wehnimer\'s Landing', 'MHO']},
'wl-house_paupers' => {:name => 'Wehnimer\'s Landing - House Paupers', :shortname => 'House Paupers', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-house_phoenix' => {:name => 'Wehnimer\'s Landing - House Of The Rising Phoenix', :shortname => 'House Of The Rising Phoenix', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-house_sovyn' => {:name => 'Wehnimer\'s Landing - House Sovyn', :shortname => 'House Sovyn', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-lysierian' => {:name => 'Wehnimer\'s Landing - Lysierian Hills', :shortname => 'Lysierian Hills', :categories => ['Wehnimer\'s Landing']},
'wl-mineroad' => {:name => 'Wehnimer\'s Landing - Old Mine Road', :shortname => 'Old Mine Road', :categories => ['Wehnimer\'s Landing']},
'wl-moot_hall' => {:name => 'Wehnimer\'s Landing - Moot Hall', :shortname => 'Moot Hall', :categories => ['Wehnimer\'s Landing']},
'wl-museum' => {:name => 'Wehnimer\'s Landing - Museum', :shortname => 'Museum', :categories => ['Wehnimer\'s Landing']},
'wl-rangerguild-v1' => {:name => 'Wehnimer\'s Landing - Ranger Guild', :shortname => 'Ranger Guild (WL)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
'wl-rogue_guild' => {:name => 'Wehnimer\'s Landing - Rogue Guild', :shortname => 'Rogue Guild (Wehnimer\'s)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
'wl-silvergate_inn' => {:name => 'Wehnimer\'s Landing - Silvergate Inn', :shortname => 'Silvergate Inn', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-sorcerer_guild' => {:name => 'Wehnimer\'s Landing - Sorcerer Guild', :shortname => 'Sorcerer Guild (Wehnimer\'s)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
'wl-spider_temple' => {:name => 'Wehnimer\'s Landing - Spider Temple', :shortname => 'Spider Temple', :categories => ['Wehnimer\'s Landing']},
'wl-stone_baths' => {:name => 'Wehnimer\'s Landing - Stone Baths', :shortname => 'Stone Baths', :categories => ['Wehnimer\'s Landing']},
'wl-stronghold' => {:name => 'Wehnimer\'s Landing - Stronghold and Thanatoph', :shortname => 'Stronghold/Thanatoph', :categories => ['Wehnimer\'s Landing']},
'wl-swale' => {:name => 'Wehnimer\'s Landing - Swale, The', :shortname => 'Swale, The', :categories => ['Wehnimer\'s Landing']},
'wl-sylvanfair' => {:name => 'Wehnimer\'s Landing - House Sylvanfair', :shortname => 'House Sylvanfair', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-talador' => {:name => 'Wehnimer\'s Landing - Talador Festival Grounds', :shortname => 'Talador Festival Grounds', :categories => ['Wehnimer\'s Landing']},
'wl-talador-east' => {:name => 'Wehnimer\'s Landing - Talador Hunting East', :shortname => 'Talador Hunting East', :categories => ['Wehnimer\'s Landing']},
'wl-talador-west' => {:name => 'Wehnimer\'s Landing - Talador Hunting West', :shortname => 'Talador Hunting West', :categories => ['Wehnimer\'s Landing']},
'wl-trollfang' => {:name => 'Wehnimer\'s Landing - Upper Trollfang', :shortname => 'Upper Trollfang', :categories => ['Wehnimer\'s Landing']},
'wl-twilight_hall' => {:name => 'Wehnimer\'s Landing - Twilight Hall', :shortname => 'Twilight Hall', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-wehnimers' => {:name => 'Wehnimer\'s Landing - Town Map', :shortname => 'Wehnimer\'s Landing', :categories => ['Wehnimer\'s Landing', 'Towns']},
'wl-wehntoph' => {:name => 'Wehnimer\'s Landing - Wehntoph', :shortname => 'Wehntoph', :categories => ['Wehnimer\'s Landing']},
'wl-willow_hall' => {:name => 'Wehnimer\'s Landing - Willow Hall', :shortname => 'Willow Hall', :categories => ['Wehnimer\'s Landing', 'CHE']},
'wl-wizard_guild' => {:name => 'Wehnimer\'s Landing - Wizard Guild', :shortname => 'Wizard Guild (Wehnimer\'s)', :categories => ['Wehnimer\'s Landing', 'Guilds']},
}
def MapData.normalize_filename(filename)
filename.gsub(/(-\d+)?\..+$/, '').downcase
end
def MapData.[](key)
Data[MapData.normalize_filename(key)]
end
def MapData.[]=(key, value)
Data[MapData.normalize_filename(key)] = value
end
# Links from narost. Migrated on startup because I'm too lazy to do it right.
[
['TI-teras.gif', 1962, 2238, 68, 192, 'TI-wilds.gif', 840, 1252],
['TI-teras.gif', 710, 972, 2130, 2260, 'WL-wehnimers.gif', 2338, 1070],
['TI-wilds.gif', 1124, 1412, 604, 682, 'TI-vtull.gif', 2276, 1638],
['TI-wilds.gif', 678, 1006, 1218, 1296, 'TI-teras.gif', 2100, 130],
['TI-wilds.gif', 1190, 1390, 2750, 2878, 'TI-nelemar.gif', 2794, 1670],
['TI-vtull.gif', 2100, 2452, 1598, 1672, 'TI-wilds.gif', 1268, 643],
['TI-nelemar.gif', 2704, 2882, 1598, 1724, 'TI-wilds.gif', 1290, 2814],
['WL-wehnimers.gif', 2188, 2494, 976, 1144, 'TI-teras.gif', 834, 2204],
['WL-gates.gif', 1956, 2160, 1600, 1660, 'WL-danjirland.gif', 226, 2592],
['WL-danjirland.gif', 96, 354, 2500, 2672, 'WL-gates.gif', 2052, 1636],
['EN-tavaalor.gif', 2380, 2618, 322, 446, 'EN-cemetery.gif', 350, 1906],
['EN-tavaalor.gif', 2348, 2618, 1794, 1912, 'EN-cemetery.gif', 170, 2178],
['EN-tavaalor.gif', 1058, 1362, 1802, 1920, 'EN-victory.gif', 2510, 560],
['EN-tavaalor.gif', 1030, 1344, 242, 364, 'EN-fearling.gif', 2158, 1946],
['EN-tavaalor.gif', 48, 266, 1260, 1480, 'EN-fearling.gif', 2768, 1882],
['EN-cemetery.gif', 230, 472, 1816, 1992, 'EN-tavaalor.gif', 2498, 374],
['EN-cemetery.gif', 56, 294, 2096, 2266, 'EN-tavaalor.gif', 2490, 1844],
['EN-victory.gif', 2360, 2656, 492, 612, 'EN-tavaalor.gif', 1210, 1850],
['EN-victory.gif', 1812, 2154, 688, 788, 'EN-fearling.gif', 1658, 2182],
['EN-victory.gif', 1494, 1840, 614, 670, 'EN-fearling.gif', 1148, 2188],
['EN-fearling.gif', 1986, 2324, 1876, 1998, 'EN-tavaalor.gif', 1184, 296],
['EN-fearling.gif', 2644, 2892, 1858, 1932, 'EN-tavaalor.gif', 162, 1378],
['EN-fearling.gif', 2698, 2892, 1810, 1858, 'EN-tavaalor.gif', 162, 1378],
['EN-fearling.gif', 990, 1316, 2132, 2238, 'EN-victory.gif', 1660, 642],
['EN-fearling.gif', 1570, 1742, 2120, 2242, 'EN-victory.gif', 1984, 744],
['EN-fearling.gif', 1214, 1500, 84, 212, 'EN-sylvarraend.gif', 2492, 2223],
['EN-sylvarraend.gif', 2396, 2588, 2162, 2278, 'EN-fearling.gif', 1350, 150],
['EN-gyldemar.gif', 2118, 2330, 1364, 1486, 'EN-old-tafaendryl.gif', 482, 2192],
['EN-gyldemar.gif', 2052, 2118, 1545, 1486, 'EN-old-tafaendryl.gif', 482, 2192],
['EN-gyldemar.gif', 84, 374, 2232, 2408, 'EN-sylvarraend.gif', 1436, 1148],
['EN-old-tafaendryl.gif', 372, 592, 2156, 2230, 'EN-gyldemar.gif', 2186, 1434],
['EN-sapphire.gif', 2636, 2944, 1870, 1992, 'EN-taillistim.gif', 246, 716],
['EN-sapphire.gif', 2202, 2522, 30, 150, 'EN-taillistim.gif', 2726, 2222],
['EN-sylvarraend.gif', 1330, 1548, 1106, 1184, 'EN-gyldemar.gif', 228, 2372],
['EN-sylvarraend.gif', 74, 498, 978, 1096, 'EN-sapphire.gif', 2394, 440],
['EN-sapphire.gif', 2270, 2524, 386, 500, 'EN-sylvarraend.gif', 282, 1046],
['EN-sapphire.gif', 1210, 1464, 704, 828, 'EN-skull.gif', 1332, 2808],
['EN-skull.gif', 1240, 1436, 2740, 2868, 'EN-sapphire.gif', 1386, 772],
['EN-taillistim.gif', 78, 416, 614, 866, 'EN-sapphire.gif', 2788, 1940],
['EN-taillistim.gif', 2552, 2900, 2154, 2270, 'EN-sapphire.gif', 2364, 100],
['IMT-icemule.gif', 76, 188, 1654, 1730, 'IMT-east-west-north-gates.gif', 632, 1266],
['IMT-icemule.gif', 1132, 1272, 564, 640, 'IMT-east-west-north-gates.gif', 2156, 2076],
['IMT-icemule.gif', 2214, 2320, 1482, 1560, 'IMT-east-west-north-gates.gif', 226, 2110],
['IMT-icemule.gif', 1136, 1270, 2750, 2826, 'IMT-south-gate.gif', 856, 1084],
['IMT-east-west-north-gates.gif', 580, 694, 1228, 1306, 'IMT-icemule.gif', 132, 1690],
['IMT-east-west-north-gates.gif', 2088, 2226, 2043, 2114, 'IMT-icemule.gif', 1198, 602],
['IMT-east-west-north-gates.gif', 178, 282, 2076, 2150, 'IMT-icemule.gif', 2260, 1520],
['IMT-east-west-north-gates.gif', 230, 478, 2196, 2260, 'IMT-south-gate.gif', 1126, 814],
['IMT-east-west-north-gates.gif', 390, 638, 1340, 1414, 'IMT-south-gate.gif', 694, 812],
['RR-riversrest.gif', 300, 544, 84, 206, 'RR-maelstrom.gif', 1946, 2668],
['RR-riversrest.gif', 1518, 1682, 298, 372, 'RR-citadel.gif', 1988, 1046],
['RR-riversrest.gif', 430, 706, 1608, 1680, 'VO-caravansary.gif', 1688, 1782],
['RR-maelstrom.gif', 1814, 2076, 2626, 2702, 'RR-riversrest.gif', 416, 148],
['RR-citadel.gif', 1868, 2138, 1010, 1082, 'RR-riversrest.gif', 1598, 336],
['VO-caravansary.gif', 1556, 1824, 1742, 1816, 'RR-riversrest.gif', 576, 1642],
].each {|link|
map = MapData[link[0]]
next unless map
link[5] = MapData[link[5]]
next unless link[5]
map[:links] = [] unless map[:links]
map[:links] << link[1..-1]
}
def MapData.associate(filename)
key = MapData.normalize_filename(filename)
if Data[key]
Data[key][:filename] = filename
return Data[key]
end
Data[key] = {:name => key, :shortname => key, :categories => [], :filename => filename}
end
def MapData.data
Data
end
end
trouble = script.vars.any? {|var| var =~ /trouble/i}
Settings.load
setting_keep_above = Settings['keep_above']
setting_keep_above = true if setting_keep_above.nil?
setting_follow = nil
menu_follow = nil
window_width = Settings['window_width'] || 400
window_height = Settings['window_height'] || 300
window_position = Settings['window_position'] || [0, 0]
if trouble
echo "Settings['window_width']: #{Settings['window_width'].inspect}"
echo "Settings['window_height']: #{Settings['window_height'].inspect}"
echo "Settings['window_position']: #{Settings['window_position'].inspect}"
echo "window_width: #{window_width.inspect}"
echo "window_height: #{window_height.inspect}"
echo "window_position: #{window_position.inspect}"
end
global_scale = Settings['global_scale']
global_scale = 1.0 if global_scale.nil?
map_scale = Settings['map_scale'] || Hash.new
$narost_maps ||= Hash.new
scale = nil
map_offset_x = nil
map_offset_y = nil
narost_exit = false
dragging = false
map_dir = "#{$lich_dir}maps#{File::Separator}"
window_resized = true
fix_click = nil
current_room = nil
current_map = nil
short_current_map = nil
start = nil
window = nil
scroller = nil
layout = nil
image = nil
circle_width = nil
circle_height = nil
circle_image = nil
tag_img_pixbuf = nil
tag_img_width = nil
tag_img_height = nil
tag_img_list = Array.new
menu = nil
menu_scale_list = nil
menu_tags_list = nil
current_tag = nil
scale_list = [10, 25, 33, 50, 66, 75, 90, 100, 110, 125, 133, 150, 166, 175, 190, 200]
used_maps = Set.new
Map.list.each {|room| used_maps.add(room.map_name) unless room.map_name.nil?}
missing_maps = used_maps.find_all {|map_name| not File.exists?("#{map_dir}#{map_name}")}
echo "These map images were not found: #{missing_maps.sort.join(', ')}" unless missing_maps.empty?
missing_maps = nil
unless File.exists?("#{map_dir}circle.png")
File.open("#{map_dir}circle.png", 'wb') {|f| f.puts('iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0ooAAAAAXNSR0IArs4c6QAAChFJREFUaN7dm3uwXVV9gL/fWmvv87jnvvIiN0jMzU0kQWKJIhB7q2BLMNQBUydMkBntBOnUjAhCp0KjEbQCYwSkqYHWkUFmbDsBnKK0tDjtTFupD7iAlBINhCTyCMF43+ex99pr/fpHQqpJCATyuDffn2evs/b69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A2JdjHEsLPRvHPLYfhI5Ge/wPqrhQNEbYBoQAAAABJRU5ErkJggg=='.unpack('m').join(''))}
end
unless File.exists?("#{map_dir}tag_img.png")
File.open("#{map_dir}tag_img.png", 'wb') {|f| f.puts('iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAAAXNSR0IArs4c6QAABspJREFUSMetlntwFeUZxn/f7p491yQnJxcwEAghNBGCgYJQ0sRCIsNQqmDRilPUKkRSKiItHTt1aKcycVRmHDu2hcqAFIZbA0WnpVqBglKRS+QiSLiD3ElCDrmcnMue3bd/eDrDIIyx8M7sPzuz32+f531330cRerqTzu1uEscbge8BYe54+apw919P6CEdUU0GngIbJE6XtwSzYBvSdzQdb95BcPB+AmXvkH5/EiPLJnq4h0b0gImR6ZD9ZAR/WSFGy1YwMu8MMH0svpJ3CFTaKBNiRwzaNusa7TvfRSwDs7eDu8gicbEEkjuB2wNnPVNFRvV6AsMFiSs6P3HR/LafxJGZGvaFx7Cjf8fucCFxhXeghXtgIWj7Af//BQw9WYWnTz1pFTZiCF37Ddo2+pCOGmCZAsC9TJG2ezUSm4iekUQSED/ionNHB040X0QUkAd4gEtKqVYAEXEDhUAOcFopdY6c2VW4QuvwDXewwxqtf/XQ9p4XrOnAEgADgPhPhDg/RqWvJXDvRPyDYvgGJzFyfHTtPbvrUHLkyFLjO0AP4JSIbAI0oAwYBbQACv+DA3CF1uG9W3BlC7rbRguA5pmGYy39nxH6daYIKr6e+LkyEs2luHok0dKF7Kfkgx3hh595NP+06VKDgX6AAxSlgD7Amf3CUt+uhgPL0Tw6klQIAujowZ/RtuEv17uv39ANAWctdmsl8S+KyZkeJTDUSjgez5nGjZU/GFt6XNf1XkB1CugGLs2t+7hp4eorC2x3qYBAx3aTyC4PWvZMLjy/4saWazfeEBFNRL5v9nj4X5o7RwdbRTvO6pu3HjJ/+av5ExOJhAakAUHAXPRWfez3Cze+HrcMDeUFI1vwliZRvhlcnLv8ZnOmbgINpYbDLB7/8W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ERWb6S5PmHMIIWTgz0DLCunaRlQxVyOnw9dCz4/kFapU2g3EIsSDYZGDk1XK5b9Q0TksI7sh7foAn4h8Uwezm0b3PT9KfzkBj15XD1qruPzMkRMG20oI2rl4WeJXhHTr2NLKjwj66n34o2vvV+Mz1fbEPPtoGjQKaOv7wRMy+JnibET+rYLQYSfZbkhSW3FUHz31iHtA3GiQ/EOqdQHkhezUUS4xW+8hi+YRZKg/gZnY6PnkXCS+9I1q5oVRyauQbikzBCFlazRqTBVICDpyRJeoWBHqrh0mtLuLOlcJeswj9sEv4RMeLn9f8CDNDXOHI7wF8AAAAASUVORK5CYII='.unpack('m').join(''))}
end
Gtk.queue {
format, width, height = Gdk::Pixbuf.get_file_info("#{map_dir}tag_img.png")
tag_img_width = width
tag_img_height = height
tag_img_pixbuf = Gdk::Pixbuf.new("#{$lich_dir}maps/tag_img.png")
}
show_tag = proc {|tag|
current_tag = tag
while img = tag_img_list.shift
img.hide
img.destroy
end
if tag
# short_current_map = current_map.sub(/^.*\//, '')
Map.list.each {|room|
next if room.nil?
next unless room.image == short_current_map
next unless room.tags.include?(tag)
img = Gtk::Image.new
tag_img_list.push(img)
img.set_pixbuf(tag_img_pixbuf)
layout.put(img, (((room.image_coords[0].to_i + room.image_coords[2].to_i)/2)*scale) - (tag_img_width/2) + map_offset_x, (((room.image_coords[1].to_i + room.image_coords[3].to_i)/2)*scale) - (tag_img_height/2) + map_offset_y)
img.show
}
end
}
change_map = proc {|file_name, suppress_scroll=false|
current_map = file_name
short_current_map = current_map.sub(/^.*\//, '')
if File.exists?(current_map)
if global_scale
scale = global_scale
else
scale = map_scale[current_map] || 1.0
end
menu_scale_list.children[scale_list.index((scale*100).to_i)+1].active = true
unless $narost_maps[current_map] and ($narost_maps[current_map]['scale'] == scale)
# Gtk.queue {
$narost_maps[current_map] = Hash.new
format, width, height = Gdk::Pixbuf.get_file_info(current_map)
$narost_maps[current_map]['width'] = width
$narost_maps[current_map]['height'] = height
$narost_maps[current_map]['scale'] = scale
if scale == 1
$narost_maps[current_map]['pixbuf'] = Gdk::Pixbuf.new(current_map)
else
$narost_maps[current_map]['pixbuf'] = Gdk::Pixbuf.new(current_map).scale(width*scale, height*scale)
end
# }
end
# Gtk.queue {
image.set_pixbuf($narost_maps[current_map]['pixbuf'])
image.set_size_request($narost_maps[current_map]['width']*scale, $narost_maps[current_map]['height']*scale)
map_offset_x = scroller.allocation.width.to_i/2
map_offset_y = scroller.allocation.height.to_i/2
layout.set_size(($narost_maps[current_map]['width']*scale) + map_offset_x*2, ($narost_maps[current_map]['height']*scale) + map_offset_y*2)
layout.move(image, map_offset_x, map_offset_y) unless suppress_scroll
tag_list = Set.new
short_current_map = current_map.sub(/^.*\//, '')
Map.list.each {|room|
next if room.nil?
next unless room.image == short_current_map
room.tags.each {|tag|
tag_list.add(tag) unless (tag =~ /^silver\-cost/) or tag_list.include?(tag)
}
}
menu_tags_list.children.each {|child| child.destroy}
group = Gtk::RadioMenuItem.new('(clear)')
menu_tags_list.append(group)
group.signal_connect('toggled') {|owner|
Gtk.queue {
show_tag.call(nil) if owner.active?
}
}
tag_list.sort_by {|tag| tag.downcase}.each {|tag|
menu_tag = Gtk::RadioMenuItem.new(group, tag)
menu_tags_list.append(menu_tag)
menu_tag.signal_connect('toggled') {|owner|
Gtk.queue {
if owner.active?
show_tag.call(tag)
end
}
}
if current_tag == tag
menu_tag.active = true
show_tag.call(tag)
end
}
menu_tags_list.show_all
unless tag_list.include?(current_tag)
group.active = true
show_tag.call(nil)
end
# }
else
echo "file not found: #{current_map}"
end
}
change_room = proc {|suppress_scroll = false|
if window_resized
window_resized = false
# Gtk.queue {
map_offset_x = scroller.allocation.width.to_i/2
map_offset_y = scroller.allocation.height.to_i/2
layout.set_size(($narost_maps[current_map]['width']*scale) + (map_offset_x*2), ($narost_maps[current_map]['height']*scale) + (map_offset_y*2))
layout.move(image, map_offset_x, map_offset_y)
if current_tag
show_tag.call(current_tag)
end
# }
end
# Gtk.queue {
unless suppress_scroll
scroller.hadjustment.value = current_room.map_x.to_i*scale
scroller.vadjustment.value = current_room.map_y.to_i*scale
end
if current_room.image == short_current_map
layout.move(circle_image, (current_room.map_x.to_i*scale) - (circle_width/2) + map_offset_x, (current_room.map_y.to_i*scale) - (circle_height/2) + map_offset_y)
circle_image.show
else
circle_image.hide
end
window.title = "xNarost: #{Char.name} (##{current_room.id})"
# }
}
no_room = proc {
Gtk.queue {
circle_image.hide
# layout.move(circle_image, -circle_width, -circle_height)
window.title = "xNarost: #{Char.name}"
}
}
def find_clicked_link(key, click_x, click_y)
map = MapData[key]
return unless map
return unless map[:links]
map[:links].each {|link|
if (click_x > link[0]) and (click_x < link[1]) and (click_y > link[2]) and (click_y < link[3])
return ["#{map_dir}#{link[4][:filename]}", link[5], link[6]]
end
}
nil
end
find_clicked_room = proc {|click_x, click_y|
Map.list.find {|room|
not room.nil? and not room.map_name.nil? and not room.map_x.nil? and not room.map_y.nil? and not room.map_roomsize.nil? and (current_map =~ /#{room.map_name}$/) and (room.map_x > click_x - (room.map_roomsize/2)) and (room.map_x < click_x + (room.map_roomsize/2)) and (room.map_y > click_y - (room.map_roomsize/2)) and (room.map_y < click_y + (room.map_roomsize/2))}
}
Gtk.queue {
window = Gtk::Window.new
window.title = "XNarost: #{Char.name}"
window.signal_connect('delete_event') {narost_exit = true}
window.signal_connect('size_allocate') {window_resized = true}
scroller = Gtk::ScrolledWindow.new
scroller.border_width = 0
scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS)
window.add(scroller)
layout = Gtk::Layout.new
scroller.add(layout)
image = Gtk::Image.new
layout.put(image, 0, 0)
format, width, height = Gdk::Pixbuf.get_file_info("#{map_dir}circle.png")
circle_width = width
circle_height = height
circle_pixbuf = Gdk::Pixbuf.new("#{$lich_dir}maps/circle.png")
circle_image = Gtk::Image.new
circle_image.set_pixbuf(circle_pixbuf)
layout.put(circle_image, -circle_width, -circle_height)
menu_follow = Gtk::CheckMenuItem.new('follow current room')
menu_follow.active = true
setting_follow = true
menu_follow.signal_connect('toggled') {|owner| setting_follow = owner.active?}
menu_keep_above = Gtk::CheckMenuItem.new('keep above')
menu_keep_above.active = setting_keep_above
menu_keep_above.signal_connect('toggled') {|owner| setting_keep_above = window.keep_above = owner.active?}
menu_find = Gtk::MenuItem.new('find room')
menu_find.signal_connect('activate') {
Gtk.queue {
find_window = Gtk::Window.new
find_window.title = 'find room'
find_entry = Gtk::Entry.new
find_button = Gtk::Button.new('find')
find_entry.signal_connect('activate') {
Gtk.queue {find_button.clicked}
}
find_button.signal_connect('clicked') {
Gtk.queue {
if room = Room[find_entry.text]
if room.map_name
file_name = "#{map_dir}#{room.map_name}"
change_map.call(file_name) unless current_map == file_name
if window_resized
window_resized = false
Gtk.queue {
map_offset_x = scroller.allocation.width.to_i/2
map_offset_y = scroller.allocation.height.to_i/2
layout.set_size(($narost_maps[current_map]['width']*scale) + (map_offset_x*2), ($narost_maps[current_map]['height']*scale) + (map_offset_y*2))
layout.move(image, map_offset_x, map_offset_y)
}
end
Gtk.queue {
scroller.hadjustment.value = room.map_x.to_i*scale
scroller.vadjustment.value = room.map_y.to_i*scale
layout.move(circle_image, (room.map_x.to_i*scale) - (circle_width/2) + map_offset_x, (room.map_y.to_i*scale) - (circle_height/2) + map_offset_y)
window.title = "Narost: #{Char.name} (##{room.id})"
}
else
respond '[narost: that room does not have an image associated with it]'
end
else
respond '[narost: no matching room]'
end
find_window.destroy
}
}
find_box = Gtk::HBox.new
find_box.pack_start(find_entry, false, false, 2)
find_box.pack_start(find_button, false, false, 2)
find_window.add(find_box)
find_window.show_all
}
}
used_maps.each {|filename|
MapData.associate(filename)
}
make_gtk_submenu = proc {|title|
item = Gtk::MenuItem.new(title, false)
item.submenu = Gtk::Menu.new
item
}
make_gtk_mapitem = proc {|mapdata, title=nil|
title = mapdata[:shortname] unless title
item = Gtk::MenuItem.new(title, false)
item.signal_connect('activate') {change_map.call("#{map_dir}#{mapdata[:filename]}"); no_room.call}
item
}
map_submenus = {}
map_special_submenus = {'ALL' => make_gtk_submenu.call('All Maps')}
# Create category menus
for key, data in MapData.data.sort_by {|key, map| map[:shortname].downcase}
next unless data[:categories].length > 0 # Only want categorized maps.
next unless data[:filename] # Skip not-found maps
data[:categories].each {|cat|
map_submenus[cat] = make_gtk_submenu.call(cat) unless map_submenus[cat]
map_submenus[cat].submenu.append(make_gtk_mapitem.call(data))
}
end
# Create All/Uncategorized Menus
for key, data in MapData.data.sort_by {|key, map| map[:name].downcase}
next unless data[:filename] # Skip not-found maps
map_special_submenus['ALL'].submenu.append(make_gtk_mapitem.call(data, data[:name]))
next if data[:categories].length > 0 # Only want categorized maps.
map_special_submenus['UNCATEGORIZED'] = make_gtk_submenu.call('Uncategorized Maps') unless map_special_submenus['UNCATEGORIZED']
map_special_submenus['UNCATEGORIZED'].submenu.append(make_gtk_mapitem.call(data, data[:name]))
end
menu_map_list = Gtk::Menu.new
map_submenus.sort.each {|unused, submenu| menu_map_list.append(submenu)}
menu_map_list.append(Gtk::SeparatorMenuItem.new)
map_special_submenus.sort.each {|unused, submenu| menu_map_list.append(submenu)}
menu_view_map = Gtk::MenuItem.new('view map')
menu_view_map.submenu = menu_map_list
menu_scale_list = Gtk::Menu.new
menu_global_scale = Gtk::CheckMenuItem.new('global setting')
menu_global_scale.active = true if global_scale
menu_scale_list.append(menu_global_scale)
group = nil
scale_list.each {|num|
if group
item = Gtk::RadioMenuItem.new(group, "#{num} %")
else
group = item = Gtk::RadioMenuItem.new("#{num} %")
end
item.signal_connect('toggled') {|owner|
if owner.active?
new_scale = num/100.0
if new_scale != scale
if global_scale
global_scale = new_scale
else
map_scale[current_map] = new_scale
end
change_map.call(current_map)
change_room.call
end
end
}
menu_scale_list.append(item)
}
group = nil
menu_global_scale.signal_connect('toggled') {
if menu_global_scale.active?
scale_list.each_index {|index| global_scale = scale_list[index]/100.0 if menu_scale_list.children[index+1].active?}
else
global_scale = false
end
}
menu_scale_map = Gtk::MenuItem.new('scale')
menu_scale_map.submenu = menu_scale_list
menu_tags = Gtk::MenuItem.new('tags')
menu_tags_list = Gtk::Menu.new
menu_tags.submenu = menu_tags_list
menu = Gtk::Menu.new
menu.append(menu_follow)
menu.append(menu_keep_above)
menu.append(menu_find)
menu.append(menu_view_map)
menu.append(menu_scale_map)
menu.append(menu_tags)
menu.show_all
def scroll_event_handler(owner, ev)
end
layout.signal_connect('scroll_event') {|owner, ev|
if ev.state == Gdk::Window::SHIFT_MASK
if ev.direction == Gdk::EventScroll::DOWN
ev.direction = Gdk::EventScroll::RIGHT
ev.put
true
elsif ev.direction == Gdk::EventScroll::UP
ev.direction = Gdk::EventScroll::LEFT
ev.put
true
else
false
end
# Gtk.queue {
# Gdk::Signal.new()
# }
elsif ev.state == Gdk::Window::CONTROL_MASK
if current_map
Gtk.queue {
# TODO: Figure out why this is not centering on the mousepointer and what's wrong with the math.
# It's at least better than recentering to the corner though!
window_x = (ev.x - scroller.hadjustment.value)
window_y = (ev.y - scroller.vadjustment.value)
old_width = layout.width.to_f
old_height = layout.height.to_f
# echo "---"
# echo "event: #{ev.x}, #{ev.y}"
# echo "window event: #{window_x}, #{window_y}"
# echo "old width: #{layout.width}, #{layout.height}"
#
if ev.direction == Gdk::EventScroll::DOWN
new_scale = scale_list[scale_list.index((scale*100).to_i)-1]/100.0
elsif ev.direction == Gdk::EventScroll::UP
new_scale = scale_list[scale_list.index((scale*100).to_i)+1]/100.0
end
unless new_scale.nil?
if global_scale
global_scale = new_scale
else
map_scale[current_map] = new_scale
end
change_map.call(current_map, true)
change_room.call(true)
# echo "new width: #{layout.width}, #{layout.height}"
scale_x = layout.width.to_f / old_width
scale_y = layout.height.to_f / old_height
# echo "scale: #{scale_x}, #{scale_y}"
translated_x = ev.x * scale_x
translated_y = ev.y * scale_y
# echo "tx event: #{translated_x}, #{translated_y}"
scroller.hadjustment.value = translated_x - window_x
scroller.vadjustment.value = translated_y - window_y
# echo scroller.hadjustment.lower
# echo scroller.hadjustment.upper
# echo scroller.hadjustment.page_size
# echo scroller.hadjustment.value
end
}
end
true
else
false
end
}
layout.add_events(Gdk::Event::BUTTON_PRESS_MASK)
layout.signal_connect('button_press_event') {|owner, ev|
if ev.button == 3
menu.popup(nil, nil, ev.button, ev.time)
elsif ev.button == 4
respond 'button4'
elsif ev.button == 5
respond 'button4'
else
dragging = nil
pointer_x, pointer_y = layout.pointer
before_drag = {
'x' => pointer_x,
'y' => pointer_y,
'hadj' => scroller.hadjustment.value.to_i,
'vadj' => scroller.vadjustment.value.to_i
}
Thread.new {
while dragging != false
sleep 0.1
pointer_x = pointer_y = nil
Gtk.queue {pointer_x, pointer_y = layout.pointer}
sleep 0.01 while pointer_y.nil?
if dragging.nil?
if (pointer_x < before_drag['x'] - 10) or (pointer_x > before_drag['x'] + 10) or (pointer_y < before_drag['y'] - 10) or (pointer_y > before_drag['y'] + 10)
dragging = true
end
end
if dragging
diff_x = before_drag['x'] - pointer_x
diff_y = before_drag['y'] - pointer_y
Gtk.queue {
scroller.hadjustment.value = [(before_drag['hadj'] + diff_x), ($narost_maps[current_map]['width']*scale)].min
scroller.vadjustment.value = [(before_drag['vadj'] + diff_y), ($narost_maps[current_map]['height']*scale)].min
}
end
end
}
end
}
layout.add_events(Gdk::Event::BUTTON_RELEASE_MASK)
layout.signal_connect('button-release-event') {|owner, ev|
Gtk.queue {
if dragging
dragging = false
else
dragging = false
if (ev.event_type == Gdk::Event::Type::BUTTON_RELEASE) and (ev.button == 1)
pointer_x, pointer_y = layout.pointer
click_x = (scroller.hadjustment.value.to_i + pointer_x.to_i - map_offset_x.to_i)/scale.to_f
click_y = (scroller.vadjustment.value.to_i + pointer_y.to_i - map_offset_y.to_i)/scale.to_f
# fixme: check state correctly
if (ev.state.inspect =~/shift-mask.*control-mask|control-mask.*shift-mask/) and (script.vars[0] =~ /fix/)
map_name = current_map.slice(/([^\/\\]+)$/)
if fix_click.nil?
fix_click = [click_x, click_y]
else
x = ((click_x + fix_click[0])/2).round
y = ((click_y + fix_click[1])/2).round
size = ((([click_x, fix_click[0]].max - [click_x, fix_click[0]].min) + ([click_y, fix_click[1]].max - [click_y, fix_click[1]].min))/2).round
current_room = $narost_fake_room || Room.current
respond "#{current_room.id}; x: #{x}, y: #{y}, size: #{size}"
if defined?(current_room.image_coords)
current_room.image = map_name
current_room.image_coords = [[fix_click[0].round, click_x.round].min, [fix_click[1].round, click_y.round].min, [fix_click[0].round, click_x.round].max, [fix_click[1].round, click_y.round].max]
else
current_room.map_name = map_name
current_room.map_x = x
current_room.map_y = y
current_room.map_roomsize = size
end
fix_click = nil
end
elsif ev.state.inspect =~/control-mask/
respond "x: #{click_x}, y: #{click_y}"
elsif ev.state.inspect =~ /shift-mask/
if clicked_room = find_clicked_room.call(click_x, click_y)
respond
respond clicked_room
respond
else
respond '[narost: no matching room found]'
end
else
if clicked_link = find_clicked_link(current_map, click_x, click_y)
change_map.call(clicked_link[0])
scroller.hadjustment.value = clicked_link[1].to_i*scale
scroller.vadjustment.value = clicked_link[2].to_i*scale
elsif clicked_room = find_clicked_room.call(click_x, click_y)
start_script 'go2', [clicked_room.id.to_s, '_disable_confirm_']
else
respond '[narost: no matching room found]'
end
end
end
end
}
}
window.show_all
window_width = [window_width, 100].max
window_height = [window_height, 100].max
window.resize(window_width, window_height)
window_position[0] = [[0, window_position[0].to_i].max, (Gdk.screen_width-window_width)].min
window_position[1] = [[0, window_position[1].to_i].max, (Gdk.screen_height-window_height)].min
window.move(window_position[0], window_position[1])
if trouble
respond
respond "[narost: window_width: #{window_width.inspect}]"
respond "[narost: window_height: #{window_height.inspect}]"
respond "[narost: window_position: #{window_position.inspect}]"
respond "[narost: window.allocation.width: #{window.allocation.width.inspect}]"
respond "[narost: window.allocation.height: #{window.allocation.height.inspect}]"
respond "[narost: window.position: #{window.position.inspect}]"
end
window.keep_above = true if setting_keep_above
start = true
}
before_dying {
window_position = window_width = window_height = nil
Gtk.queue {
window_position = window.position
window_width = window.allocation.width
window_height = window.allocation.height
}
sleep 0.01 while window_height.nil?
Gtk.queue {window.destroy}
Settings['window_position'] = window_position if (window_position.class == Array) and (window_position[0].to_i > 0) and (window_position[1].to_i > 0)
Settings['window_width'] = window_width if (window_width.class == Fixnum) and (window_width > 100)
Settings['window_height'] = window_height if (window_height.class == Fixnum) and (window_height > 100)
Settings['keep_above'] = setting_keep_above
Settings['global_scale'] = global_scale
Settings['map_scale'] = map_scale
Settings.save
}
wait_until {start}
if script.vars[1] and (script.vars[1] !~ /^fix|trouble$/) and (current_room = Room[script.vars[1..-1].join(' ')]) and (map_name = current_room.map_name)
menu_follow.active = false
setting_follow = false
file_name = "#{map_dir}#{map_name}"
Gtk.queue {
change_map.call(file_name) unless current_map == file_name
change_room.call
}
room_count = $room_count
sleep 0.2 while (room_count == $room_count) and not narost_exit
wait_until {setting_follow or narost_exit} unless setting_follow or narost_exit
end
until narost_exit
if (current_room = Room.current) and (map_name = current_room.map_name)
file_name = "#{map_dir}#{map_name}"
Gtk.queue {
change_map.call(file_name) unless current_map == file_name
change_room.call
}
else
no_room.call
end
room_count = $room_count
sleep 0.2 while (room_count == $room_count) and not narost_exit
wait_until {setting_follow or narost_exit} unless setting_follow or narost_exit
end