summaryrefslogtreecommitdiff
path: root/world/map/npc/099-2/logic.txt
blob: 45551e12193cab75dc9013d009bc8ffdeafe4b6e (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
// Evol script
// Author:
//      Jesusalva
// Description:
//      099-2 and 099-6 KESHLAM ADVENTURER GUILD QUARTERS
//      Controls gimmicks in 099-3 as well
/////////////////////////////////////////////////////////////////////////////////

-|script|#099-2_CMD|32767
{
    end;

OnStorage:
    if ($DOOMSDAY != 3)
        end;
    if (getmap() != "099-5" && getmap() != "099-4")
        end;
    if ($@DD5_STATUS != 1 && $@DD5_STATUS != 2 && $@DD5_STATUS != 4 && $@DD5_STATUS != 6)
        end;
    openstorage;
    end;

// FIXME DEBUG DEBUG DEBUG FIXME
OnDebug:
    debugmes "CHEAT - JS33";
    if (!debug || $DOOMSDAY != 3 || GM < GM_SYSOP)
        end;
    set $@DD5_TSWITCH, 18;
    set $@DD5_OPENSESAME, 1;
    message strcharinfo(0), "DOOMSDAY ACT 5 DEBUG SUCCESSFUL";
    end;

// FIXME DEBUG DEBUG DEBUG FIXME
OnDebugDamage:
    if (!debug || $DOOMSDAY != 3 || GM < GM_SYSOP)
        end;
    if ($@DD5_HP <= 1000)
        end;
    set $@DD5_HP, max(1000, $@DD5_HP-2500);
    message strcharinfo(0), "Battle: Damage -2500 HP";
    callfunc "FinalExamAttack";
    end;

// FIXME DEBUG DEBUG DEBUG FIXME
OnDebugX:
    debugmes "CHEAT - JS99";
    if (!debug || $DOOMSDAY != 3 || GM < GM_SYSOP || $@DD5_STATUS)
        end;
    set $@DD5_HP, 100;
    set $@DD5_STATUS, 7;
    set $@DD5_BEGIN, gettimetick(2);
    warp "099-5", 0, 0;
    fakenpcname "Zax De'Kagen#0", "Zax De'Kagen#0", 1142;
    message strcharinfo(0), "DOOMSDAY ACT 5 SUPER DEBUG SUCCESSFUL";
    end;

OnInit:
    // Register commands
    registercmd "@js33", strnpcinfo(0)+"::OnDebug";
    registercmd "@js67", strnpcinfo(0)+"::OnDebugDamage";
    registercmd "@js99", strnpcinfo(0)+"::OnDebugX";
    registercmd "#storage", strnpcinfo(0)+"::OnStorage";
    end;
}

099-2,0,0,0|script|#099-2_Prestart|32767
{
    end;

// FIXME Do not work. Again.
OnTrial1:
    monster "099-1", 35, 27, "", 1140, 1, strnpcinfo(0)+"::OnTrial2";
    monster "099-1", 35, 27, "", 1141, 1, strnpcinfo(0)+"::OnTrial2";
    getexp 10000, 0;
    getitem "TreasureKey", 1;
    end;

OnTrial2:
    monster "099-1", 35, 27, "", 1143, 1, strnpcinfo(0)+"::OnTrial3";
    getexp 10000, 0;
    getitem "DarkConcentrationPotion", 1;
    end;

OnTrial3:
    getexp 10000, 0;
    getitem "BentNeedle", 1;
    end;

// Janitor Function
OnTimer30000:
    if (!$@DD5_STATUS)
        end;
    if (getmapusers("099-5") < 1)
        donpcevent "#TMWFinalExam::OnAbort";
    initnpctimer;
    end;

OnInit:
    // Initialize the 18 switches
    set $@DD5_TSWITCH, 0;
    // setarray $@DD5_SWITCH - not needed

    // Initialize the 16 passwords
    setarray $@DD5_PASSWORDS,
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000),
             3555+rand(10000);

    // Spawn monsters on maps
    // The infantry
    areamonster "099-2", 20, 20, 130, 130, "", 1159, 10;
    areamonster "099-2", 20, 20, 130, 130, "", 1160, 10;
    areamonster "099-6", 20, 20, 130, 130, "", 1159, 10;
    areamonster "099-6", 20, 20, 130, 130, "", 1160, 10;
    areamonster "099-3", 20, 20, 120,  80, "", 1159, 15;
    areamonster "099-3", 20, 20, 120,  80, "", 1160, 15;

    // The small fry
    areamonster "099-1", 20, 20, 130, 130, "", 1156, 30;
    areamonster "099-2", 20, 20, 130, 130, "", 1156, 20;
    areamonster "099-6", 20, 20, 130, 130, "", 1156, 20;
    areamonster "099-3", 20, 20, 120,  80, "", 1156, 60;
    // The advanced mobs
    areamonster "099-1", 20, 20, 130, 130, "", 1152, 15;
    areamonster "099-2", 20, 20, 130, 130, "", 1152, 5;
    areamonster "099-6", 20, 20, 130, 130, "", 1152, 5;
    areamonster "099-3", 20, 20, 120,  80, "", 1152, 20;

    // The boss. Used to be 1137 Tormenta but... Well... Better not.
    monster "099-1", 35, 27, "", 1147, 1, "#099-2_Prestart::OnTrial1";
    end;

OnJanitor:
    // Maintain 099-5 (janitor)
    initnpctimer;
    end;
}

/////////////////////////////////////////////////////
// Switches subsystem
// Switches are distributed between three maps
// There is a total of 18 switches
099-2,25,17,0|script|#099-2_25_17|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[0]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[0], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-2,90,18,0|script|#099-2_90_18|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[1]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[1], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-2,121,70,0|script|#099-2_121_70|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[2]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[2], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-2,23,95,0|script|#099-2_23_95|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[3]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[3], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-2,57,130,0|script|#099-2_57_130|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[4]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[4], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-6,25,17,0|script|#099-6_25_17|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[5]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[5], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-6,90,18,0|script|#099-6_90_18|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[6]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[6], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-6,121,71,0|script|#099-6_121_71|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[7]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[7], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-6,23,95,0|script|#099-6_23_95|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[8]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[8], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-6,57,130,0|script|#099-6_57_130|422
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[9]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[9], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,29,69,0|script|#099-3_29_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	if (!$@DD5_SWITCH[10]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[10], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,35,69,0|script|#099-3_35_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[11]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[11], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,41,69,0|script|#099-3_41_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[12]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[12], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,59,69,0|script|#099-3_59_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[13]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[13], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,79,69,0|script|#099-3_79_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[14]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[14], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,91,69,0|script|#099-3_91_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[15]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[15], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,97,69,0|script|#099-3_97_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[16]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[16], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}

099-3,115,69,0|script|#099-3_115_69|422
{
    // For the cells I need a smaller distance
    set @npc_distance, 2;
    if(@npc_check) end;

	if (!$@DD5_SWITCH[17]) goto L_Enable;
	end;

L_NoItem:
	mes "The switch is stuck, if I only had a Needle or something...";
	close;

L_Enable:
	if ($DOOMSDAY_VANILLA)
		end;
	if (countitem("BentNeedle") == 0) goto L_NoItem;
	delitem "BentNeedle", 1;
	fakenpcname strnpcinfo(0), strnpcinfo(0)+"_", 423;
	set $@DD5_SWITCH[17], 1;
	set $@DD5_TSWITCH, $@DD5_TSWITCH+1;
	getexp 100000, 0;
	message strcharinfo(0), "The switch is now on!";
	end;
}





/////////////////////////////////////////////////////
// Password subsystem
// Passwords are distributed between two maps
// There is a total of 16 passwords
099-2,119,18,0|script|Writing#2_119_18|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... NULL... It is... "+$@DD5_PASSWORDS[0]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,25,45,0|script|Writing#2_25_45|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... EIN... It is... "+$@DD5_PASSWORDS[1]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,93,42,0|script|Writing#2_93_42|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... ZWEI... It is... "+$@DD5_PASSWORDS[2]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,59,72,0|script|Writing#2_59_72|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... DREI... It is... "+$@DD5_PASSWORDS[3]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,89,66,0|script|Writing#2_89_66|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... VIER... It is... "+$@DD5_PASSWORDS[4]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,123,94,0|script|Writing#2_123_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... FUNF... It is... "+$@DD5_PASSWORDS[5]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,62,94,0|script|Writing#2_62_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... SECHS... It is... "+$@DD5_PASSWORDS[6]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-2,27,94,0|script|Writing#2_27_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... SIEBEN... It is... "+$@DD5_PASSWORDS[7]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,119,18,0|script|Writing#6_119_18|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... ACHT... It is... "+$@DD5_PASSWORDS[8]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,25,45,0|script|Writing#6_25_45|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... NEUN... It is... "+$@DD5_PASSWORDS[9]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,93,42,0|script|Writing#6_93_42|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... ZEHN... It is... "+$@DD5_PASSWORDS[10]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,59,72,0|script|Writing#6_59_72|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... ELF... It is... "+$@DD5_PASSWORDS[11]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,89,66,0|script|Writing#6_89_66|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... ZWOLF... It is... "+$@DD5_PASSWORDS[12]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,123,94,0|script|Writing#6_123_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... DREIZEHN... It is... "+$@DD5_PASSWORDS[13]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,62,94,0|script|Writing#6_62_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... VIERZEHN... It is... "+$@DD5_PASSWORDS[14]+"...";
	mes "The remainder was too blurred to read.";
	close;
}

099-6,27,94,0|script|Writing#6_27_94|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is a strange writing here. ##0";
	mes "";
	mes "##1Password... FUNFZEHN... It is... "+$@DD5_PASSWORDS[15]+"...";
	mes "The remainder was too blurred to read.";
	close;
}





/////////////////////////////////////////////////////
// Lore subsystem
// Lore tidbits are distributed between four maps
// Strategy notes are mixed as well
// There is a total of 18 lore parts

099-2,57,17,0|script|???#099-2_57_17|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Flower ::.";
	mes "This orange flower is dangerous!";
    mes "Do not disturb them - they have great range and damage!";
    mes "";
    mes "Whoever designed this artifical flower must have been crazy!";
    mes "Killing it is not fast enough, avoid its nectar at all costs!";
	close;
}

099-2,123,128,0|script|???#099-2_123_128|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Slime ::.";
	mes "A crazy combat unit made in a crazy laboratory.";
    mes "If you can, just avoid it. It is slow enough.";
    mes "It can be slain, but have a decent defense, so use magic.";
	close;
}

099-2,95,122,0|script|???#099-2_95_122|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Snake ::.";
	mes "If I find who designed these monsters ... Grr...";
    mes "They are fast. And powerful. Goes down quickly, though.";
	close;
}

099-2,28,122,0|script|???#099-2_28_122|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "Last night, we were attacked by Xakelbael the Dark.";
    mes "Our attacks could barely do him any harm, and then...";
    mes "He cast \"Fourth Fall\". All our buffed soldiers fell down the same instant.";
    mes "";
    mes "I am gravely injured, but I'm leaving this note here.";
    mes "Comrades, please avenge me!";
	close;
}

099-2,91,92,0|script|???#099-2_91_92|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: Sasquatch ::.";
	mes "Developed for protection of the Earth Crystal.";
    mes "They are extreme power houses capable to smash intruders.";
    mes "They have very meh defense, though.";
    mes "Also, even then could not harm Xakelbael the Dark.";
	close;
}

099-2,62,43,0|script|???#099-6_62_43|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "Zax De'Kagen trademark skill, the Bliss of Oblivion.";
    mes "A powerful skill which dispels mana around himself.";
    mes "Monsters will perish the very moment he cast it, and anyone too close";
    mes "will have their mana drained as well, and might die from it.";
    mes "";
    mes "Not only that, but he may become immune to certain sources of damage.";
    mes "It is a killer move which also allows him to assemble an army right after.";
    mes "I do believe there is a weakness, though. Something about excessive fur growth?";
	close;
}

099-6,57,17,0|script|???#099-6_57_17|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Soldier ::.";
	mes "These units can endure a lot of pain and use bows.";
	mes "They are not dangerous, but do not let they become fodder.";
	mes "A lot of soldiers can be very difficult to kill later on.";
    mes "Random trivia: They are afraid of bone arrows and knifes.";
	close;
}

099-6,123,128,0|script|???#099-6_123_128|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Mouboo ::.";
	mes "A solid all rounder unit, it has decent health and damage.";
    mes "But it proved useless as a security biopart.";
    mes "Figures out, we could not subvert its peaceful nature.";
	close;
}

099-6,95,122,0|script|???#099-6_95_122|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: Tengu ::.";
	mes "Developed for protection of the Earth Crystal.";
    mes "There shouldn't be any here, but they have a high defense.";
    mes "They turned out vulnerable to magic, unfortunately.";
	close;
}

099-6,28,122,0|script|???#099-6_28_122|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Bat ::.";
	mes "They fly very fast and can quickly swarm you.";
    mes "Their damage and health is not important.";
    mes "But if not careful, they will overwhelm you.";
    mes "Also, did you hear about lay on hands on overlapping dimensions?";
    mes "This have nothing to do with bats but is a cool fact!";
	close;
}

099-6,91,92,0|script|???#099-6_91_92|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: Mana Slayer ::.";
	mes "An anti-magic unit, made to run and slay mages.";
    mes "They look so much like us, that we are afraid of them all time.";
    mes "Not strong against physical damage, but can resist magic pretty well.";
	close;
}

099-6,62,43,0|script|???#099-6_92_43|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "Do not neglect the potions which you deemed useless until now.";
    mes "Our foe is formidable. Our knowledge is being tested, here.";
    mes "The same techniques which worked for years simply do not apply.";
    mes "";
    mes "Knowing what and when to cast is important in survival.";
    mes "I think what should sense magic, might sense mana devoid-ness as well.";
    mes "In this case, such would be the only way to know how far of killing we are.";
    mes "But I'm not sure if such trick would work except on support role.";
	close;
}



///////////////////////////////
099-1,43,14,0|script|Painting#099-1|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes "Reading this is as hard as finding a needle in a haystack.";
    if (countitem("FlawedLens") < 1) goto L_Tools;
	mes "Although the painting also has no artistic value on its own...";
    mes "Something tells you there is something ominous with it.";
    next;
    mes "##9 Use [Flawed Lens] on the painting? ##0";
    menu
        "No", L_Close,
        "Yes", L_UseLens;

L_Close:
    close;

L_Tools:
    mes "The painting itself has no artistic value, either.";
    mes "There is something ominous, but you don't know what.";
    close;

L_UseLens:
    delitem "FlawedLens", 1;
    getexp 10000, 10000;
    mes "[@@https://wiki.themanaworld.org/images/5/57/Kirin_by_clef.jpg|There is the image of a woman on it@@].";
    mes "";
    mes "You can make out the following words on it:";
    mes "In memoriam ..... Kirin De'Kagen.";
    mes ".... help .... stop ... neither .....";
    mes "Went missing .... .... .... The War.";
    mes "";
    mes "Rest in Peace. Damnatio memoriae. Effective immediately.";
    // ;-- TRANSLATORS: Damnatio memoriae - "condemnation of memory", indicating that a person is to be excluded from official accounts. History rewrite if required.
    next;
    mes "The lens break! They were not only poorly effective but also of bad quality.";
    mes "If only we could make the real Lens, we would have been able to find out";
    mes "what is up with this ominous, eerie feeling this picture gives.";
    close;
}

099-1,35,22,0|script|Fireplace#099-1|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "##9 There is something interesting on this fireplace. ##0";
	mes "##9 It doesn't seems to fit this building. ##0";
	mes "##9 As if it have been taken from another world and put here. ##0";
    next;
	mes "##9 After searching it, you found nothing. ##0";
	mes "##9 It is just a common fireplace, after all. ##0";
	close;
}

///////////////////////////////
// Basic Monsters Knowledge
099-1,20,22,0|script|Bookcase#099-1|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Scorpion ::.";
	mes "The most basic combat unit in Keshlam.";
    mes "They have decent health, damage, and speed.";
    mes "";
    mes ".:: V0id Mushroom ::.";
	mes "The most basic combat unit in Keshlam.";
    mes "They have decent health, damage, and speed, and a higher range.";
    mes "Unlike the scorpions, they can move faster, but attack is slower.";
	close;
}

099-1,45,22,0|script|Bookcase#099-1b|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    mes ".:: V0id Maggot ::.";
	mes "They are pathetic individually, and slow, a failed experiment.";
    mes "But do not let them overwhelm you, togheter they are formidable!";
    mes "";
    mes ".:: V0id Archant ::.";
	mes "An advanced combat unit, without weak points.";
    mes "They are slow in movement, but other than that, they are good.";
	close;
}

///////////////////////////////
// Boss fight general knowledge
099-3,107,50,0|script|Music Score#099-3|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "There is a nice score here.";
    mes "I assume important info will be sent by SFX only.";
    next;
    mes "Also, the time beats of this score are all in 600ms intervals.";
    mes "Could it be that attack speed is overridden during the fight?!";
    mes "";
    mes "However, potions will still work, hmm.";
    mes "There is also a spell here: \"##B#storage##b\".";
    mes "I assume it only works at specific times.";
	close;
}

099-3,39,46,0|script|Outstanding Book#099-3|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

	mes "Zax De'Kagen's Diary, entry #27";
    mes "";
    mes "##9 I am all soaking wet. They found my weak point. ##0";
    mes "##9 However it was too late, Fourth Fall brought the end to this. ##0";
    mes "##9 I did not even had to cancel my illusion. ##0";
    next;
	mes "Zax De'Kagen's Diary, entry #34";
    mes "";
    mes "##9 Today my Rubber Bat flew away. Probably shouldn't have given life to it. ##0";
    mes "##9 I'll miss it, my dear friend, I hope one day he returns? ##0";
    next;
	mes "Zax De'Kagen's Diary, entry #42";
    mes "";
    mes "##9 What I wouldn't give for some pickled beets right now... ##0";
    mes "##9 Meh, whatever. I'm not going to Dimond's Cove ever again! ##0";
	close;
}

099-3,64,62,0|script|Pan#099-3|400
{
    // Default distance is 4 tiles - all we need
    callfunc "PCtoNPCRange";
    if(@npc_check) end;

    if (rand(6) % 2 == 0)
        goto L_Shock;
    goto L_Potion;

L_Shock:
	mes "Some was trying to make Shock Sweets here.";
    mes "However, it doesn't seems to have been finished.";
    next;
    mes "There are the initials \"To stop F.F.\" nearby.";
    mes "One can only wonder who or what F.F. is.";
	close;

L_Potion:
	mes "Some was trying to make a Mana Potion here.";
    mes "However, it doesn't seems to have been finished.";
    next;
    mes "There are the initials \"To stop Bob\" nearby.";
    mes "Well, I assume it is \"Bob\", text is fainted.";
    mes "it could be \"boo\" as well. Maybe from Mouboo?";
	close;
}