summaryrefslogblamecommitdiff
path: root/npc/other/dts_warper.txt
blob: 6b35ee3888de1024de33f8a6989e1289d48142f8 (plain) (tree)
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




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                         
 
//===== eAthena Script ======================================= 
//= Dungeon Teleport Service
//===== By: ================================================== 
//= Evera
//===== Current Version: ===================================== 
//= 2.3c
//===== Compatible With: ===================================== 
//= eAthena
//===== Description: =========================================
//= Cool Event Corp NPCs vs. Kafra Dungeon Teleport Service and voting system.
//= This is a special event on official servers where there's a
//= big competition between Kafra Corp. and Cool Event Corp.
//= To warp to selected levels of certain dungeons.
//= Also includes Cool Event Corp HQ NPCs.
//===== Variables: ===========================================
//=Server - 	$dtsvote		= Variable for # of votes
//=					= Positive = Cool Corp winning
//=					= Negative = Kafra Corp winning
//=		$dts			= Variable for DTS status
//=					= (1<<0) Election
//=					= (1<<1) Cool Corp Enabled
//=					= (1<<2) Kafra Enabled
//=					= (1<<3) No winner last election
//=					= (1<<4) Cool Corp won last election
//=					= (1<<5) Kafra won last election
//=		$dtsday			= Week count for dts vote count, used for resetting players' votes
//=Character -	dtseligible 		= eligibility status, 0 not eligible yet, 1 eligible.
//=					= $dtsday used when MISC_QUEST|128, and signifies that person already voted.
//=		MISC_QUEST		= |128 = eligible and voted.
//=NPC Func. -	arg(0) 			= 0, Cool Event Corp Voting Staff; 1, Kafra Corp Voting Staff
//=		arg(1)			= Kafra only, Cool Corp script does not use. Changes illus for different sprites.
//=					= 0 = 4_f_kafra6 (yellow ponytail, classic outfit, spr 112)
//=					= 1 = 4_f_kafra5 (pink hair, classic outfit, spr 113)
//=					= 2 = 4_f_kafra4 (orange short hair, classic outfit, spr 114)
//=					= 3 = 4_f_kafra3 (brown bangs, classic outfit, spr 115)
//=					= 4 = 4_f_kafra2 (brown ponytale, classic outfit, spr 116)
//=					= 5 = 4_f_kafra1 (blue hair, classic outfit, spr 117)
//=					= 6 = 4_f_agentkafra (purp hair, black outfit, spr 859)
//=					= 7 = 4_f_kafra8 (blue hair, brown outfit, spr 860)
//=					= 8 = 4_f_kafra9 (red hair, brown outfit, spr 861)
//=Temporary - 	@dtstemp		= Temporary buffer, used in GM vote-fixing
//=		@dtstemps$		= Temporary buffer, like above, but a string.
//=		$@dtstempg		= Temporary buffer, but global
//===== Additional Comments: ================================= 
//= Some unofficial translations, some unofficial dungeon warps
//= Also includes unofficial GM-enabled tweaking for script
//= Includes NPCs in Cool Event Corp headquarters
//= If new locations are found of this NPC, please report on forums
//= http://www.eathena.ws/board/index.php?showforum=106
//= Base level 60 required to vote
//===== Version History: ====================================
//= 1.0	Initial release [Evera]
//= 1.1	SVN release, removed from major town (found true info after research),
//=	put more arg(2) parameters, fixed a few bugs [Evera]
//= 1.2 Mushed some variables together, optimized a bit [Evera]
//= 1.3 Removed selfconfig [Evera]
//= 1.4 Changed global variables to read from 3 global variables, updated names,
//= 	fixed array bug [Evera]
//= 1.5 Mushed voting varialbes into 1 variable. [Evera]
//= 1.6 Removed Duplicates [Silent]
//= 1.7	Fixed bug of DTS_Admin not running by itself [Evera]
//= 1.8	Changed requirement to lvl 60 [Evera]
//= 1.9 Removed global eligibility option [Evera]
//= 2.0 Fixed zeny bug [Evera]
//= 2.1 Fixed headers with and updated with newer information [Evera]
//= 2.2 Changed dtseligible 2 to MISC_QUEST|128, to clean up variable usage. [Evera]
//=	Also added F_ClearGarbage function to the scripts. [Evera]
//= 2.3	Changed dtseligible to be $dtsday when MISC_QUEST|128
//=	Added $dtsday for vote session counter
//=	Fixed bug that involved having both warpers enabled at the same time. [Evera]
//=	New $dtsday system and bug fix[Evera]
//= 2.3a fixed 2 bugs with comparision [Lupus]
//= 2.3b corrected Glast warp coords [Lupus] 2.3c Bailand -> Bayalan
//============================================================ 

//Yuno
yuno.gat,153,191,4	script	Cool Event Voting Staff::CoolEventVotingStaff01	874,{
	callfunc "F_DTS_Warp",0,0;
}
yuno.gat,162,191,6	script	Kafra Voting Staff#01	861,{
	callfunc "F_DTS_Warp",1,8;
}
//Lighthalzen
lighthalzen.gat,154,60,6	script	Cool Event Voting Staff::CoolEventVotingStaff02	874,{
	callfunc "F_DTS_Warp",0,0;
}
//Prontera
prontera.gat,147,125,4	script	Cool Event Voting Staff::CoolEventVotingStaff03	874,{
	callfunc "F_DTS_Warp",0,0;
}
prontera.gat,164,125,6	script	Kafra Voting Staff#02	115,{
	callfunc "F_DTS_Warp",1,3;
}

//Cool Event Staff Headquarters NPCs
//Kudiuu (Maintenance Guy)
lhz_in02.gat,20,274,6	script	Maintenance Guy	851,{
	mes "[Kudiuu]";
	mes "Holy...!";
	mes "Will this place";
	mes "ever get cleaned up?!";
	mes "*Cough cough* There's";
	mes "so much dust here, it's";
	mes "almost a health hazard!";
	close;
}
//Cesuna (Zondaman at desk)
lhz_in02.gat,36,284,1	script	Cool Event Staff#01	874,{
	mes "[Cesuna]";
	mes "Ack! I'm totally";
	mes "swamped with all this";
	mes "work! But I don't wannna";
	mes "do any of it. That's it!";
	mes "I totally need a break";
	next;
	mes "[Cesuna]";
	mes "*Sigh...*";
	mes "I wonder if Saera";
	mes "would ever consider";
	mes "going out with me?";
	mes "That would be nice~";
	close;
}
//Jellarin (Event planner)
lhz_in02.gat,40,279,3	script	Event Planner	833,{
	mes "[Jellarin]";
	mes "I don't like this.";
	mes "But I don't like that";
	mes "idea either. What will";
	mes "I do for a new event, eh?";
	next;
	mes "[Jellarin]";
	mes "I need something";
	mes "major, something that'll";
	mes "really shake up the world,";
	mes "something epochal, but what?";
	mes "Hey, do you have any ideas";
	close;
}
//Baoto (Cool Event Manager)
lhz_in02.gat,110,283,5	script	Cool Event Manager	853,{
	mes "[Baoto]";
	mes "Hmmm...";
	mes "The employees seem";
	mes "to be having too much";
	mes "fun amongst themselves";
	mes "recently. This does not";
	mes "bode well at all...";
	next;
	mes "[Baoto]";
	mes "It looks like I'm";
	mes "just going to have to";
	mes "start cracking that whip";
	mes "more often and much";
	mes "harder. Ha ha ha ha!";
	close;
}
//Saera (Secretary), contains GM menu
lhz_in02.gat,36,274,3	script	Cool Event Staff#02	831,{
	callfunc "F_ClearGarbage";				//Clear outdated, unused variables
	if($dts == 0){
		set $dts,$dts|(1<<0);				//Sets NPCs to election mode if first time running
		set $dts,$dts|(1<<3);
	}
	if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
		if($dts&(1<<0)) set $dts,$dts&~(1<<0);
		if($dts&(1<<1)) set $dts,$dts&~(1<<1);
		if($dts&(1<<2)) set $dts,$dts&~(1<<2);
		set $dts,$dts|(1<<0);
	}
	if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
		if($dts&(1<<3)) set $dts,$dts&~(1<<3);
		if($dts&(1<<4)) set $dts,$dts&~(1<<4);
		if($dts&(1<<5)) set $dts,$dts&~(1<<5);
		set $dts,$dts|(1<<3);
	}
	mes "[Saera]";
	mes "Welcome to the";
	mes "temporary headquarters";
	mes "of Cool Event Corporation";
	mes "How may I help you today?";
	next;
	if(getgmlevel()>=40){ 						//Unofficial Text, GM-configurable settings for Event (GM level above 40 required)
		mes "[Saera]";
		mes "Why, I didn't even";
		mes "notice you there,";
		mes strcharinfo(0)+". What would";
		mes "you like to do today?";
		next;
		menu "Fix Vote",Lfixvote,
		"Set current teleporter",Lsettele,
		"Set last election winner",Lsetlast,
		"Manually run vote check",Lmanuvotecheck,
		"Normal menu please",-;
		mes "[Saera]";
		mes "Ok";
		next;
	}
	menu "Temporary headquarters?",Ltemphead,
	"Voting",Lvoting,"No, thanks.",Lnothx;

	Ltemphead:
		mes "[Saera]";
		mes "Our headquarters building";
		mes "is currently undergoing";
		mes "reconstruction, so we are";
		mes "basing our operations in";
		mes "this place for the meantime";
		close;

	Lvoting:
		mes "[Saera]";
		mes "Currently, Kafra Corporation";
		mes "and Cool Event Corp are working";
		mes "on a collaborative program that";
		mes "will provide direct teleport";
		mes "services to dungeons.";
		next;
		mes "[Saera]";
		mes "Due to technical issues,";
		mes "both companies cannot provide";
		mes "teleport services to the same";
		mes "dungeon. Therefore, we will be";
		mes "selecting our valued customers";
		mes "to choose the company they want.";
		next;
		if((dtseligible == 0 || dtseligible == 3) && baselevel >= 60 && MISC_QUEST&128 == 0) set dtseligible,1;
		//Clear previous var of dtseligible,3 being tried for eligibility already
		if(dtseligible != $dtsday && baselevel >= 60 && MISC_QUEST&128){
			set MISC_QUEST,MISC_QUEST&~128;
			set dtseligible,1;
		}
		switch(dtseligible){
			default:
				mes "[Saera]";
				mes "Only a limited number of";
				mes "voters will be chosen, so";
				mes "you can check your voting";
				mes "eligibility at the headquarters";
				mes "of both participating companies.";
				mes "Thank you for your patronage~";
				close;
				break;
			case 1:
				mes "[Saera]";
				mes "It appears that you are";
				mes "eligible to vote";
				mes "so please cast your";
				mes "vote at any Voting Staff";
				mes "representative. Thank you~";
				close;
				break;
			case 2:
				mes "[Saera]";
				mes "You are eligible to vote, but";
				mes "you have already voted. Thank";
				mes "you for your participation";
				close;
				break;
		}

	Lnothx:
		mes "[Saera]";
		mes "Thank you.";
		mes "Have a good day.";
		close;
									//GM options start
	Lfixvote:							//Fix Vote
		mes "[Saera]";
		mes "Umm, sure..";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		mes "To who would you like to give votes to?";
		next;
		menu "Kafra",-,"Cool Event Corp",Lfixcool;

	Lfixkafra:							//Fixing vote for Kafra
		mes "[Saera]";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";	//multiplied by -1 because var is negative
		if($dtsv == 0) mes "The vote is currently tied.";
		mes "Please input the amount you wish to give to Kafra Corp";
		input @dtstemp;					//Set buffer for Kafra vote
		next;
		mes "[Saera]";
		mes "You inputted "+@dtstemp+" for Kafra";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		mes "Are you sure you would like to";
		mes "make these changes?";
		next;
		menu "Yes",-,"No",Lnothx;
		set $dtsv,$dtsv-@dtstemp;				//Set buffer to Kafra vote
		mes "[Saera]";
		mes "Okay, you fixed the vote";
		mes "of Kafra Corp.";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		close;

	Lfixcool:						//Fixing vote for cool corp
		mes "[Saera]";
		mes "Let me find the papers...";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		mes "Please input new vote for Cool Event Corp";
		input @dtstemp;					//Set buffer for Cool vote
		next;
		mes "[Saera]";
		mes "You inputted "+@dtstemp+" for Cool Event Corp";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		mes "Are you sure you would like to";
		mes "make these changes?";
		next;
		menu "Yes",-,"No",Lnothx;			//Confirmaiton
		set $dtsv,@dtsv+@dtstemp;			//Set buffer to Cool vote
		mes "[Saera]";
		mes "Okay, you fixed the vote";
		mes "of Cool Event Corp.";
		if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
		if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
		if($dtsv == 0) mes "The vote is currently tied.";
		close;

	Lsettele:							//Set current DTS tele
		mes "[Saera]";
		mes "Type Kafra for Kafra-enabled warp,";
		mes "Cool for Cool Event Corp-enabled";
		mes "warp ,Election for election mode,";
		mes "or Cancel to cancel.";
		if($dts&(1<<0)) mes "The election is currently in election mode.";
		if($dts&(1<<1)) mes "Cool Event Corp is currently the DTS warper.";
		if($dts&(1<<2)) mes "Kafra Corp is currently the DTS warper.";
		next;
		input @dtstemps$;					//Typed in choices to prevent mistakes
		mes "Let me find the papers...";
		next;
		if(@dtstemps$ == "Election" || @dtstemps$ == "election"){
			if($dts&(1<<1)){
				set $dts,$dts&~(1<<1);			//Removes previous winner
				set $dts,$dts|(1<<0);			//Changes status to election
			}
			if($dts&(1<<2)){
				set $dts,$dts&~(1<<2);
				set $dts,$dts|(1<<0);
			}
			mes "[Saera]";
			mes "Set to election mode.";
			close;
		}
		if(@dtstemps$ == "Cool" || @dtstemps$ == "cool"){
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);
				set $dts,$dts|(1<<1);
			}
			if($dts&(1<<2)){
				set $dts,$dts&~(1<<2);
				set $dts,$dts|(1<<1);
			}
			mes "[Saera]";
			mes "Cool Event Corp. is now the DTS warper.";
			close;
		}
		if(@dtstemps$ == "Kafra" || @dtstemps$ == "kafra"){
			if($dts&(1<<1)){
				set $dts,$dts&~(1<<1);
				set $dts,$dts|(1<<2);
			}
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);
				set $dts,$dts|(1<<2);
			}
			mes "[Saera]";
			mes "Kafra Corp. is now the DTS warper.";
			close;
		}
		if(@dtstemps$ == "Cancel" || @dtstemps$ == "cancel") goto Lnothx;
		mes "[Saera]";
		mes "Please input a correct name for the election";
		next;
		goto Lsettele;

	Lsetlast:							//Set last winner
		mes "[Saera]";
		mes "Type Kafra for election records to show Kafra,";
		mes "Cool for Cool for election records to show Cool Event Corp,";
		mes "None for no winner in election records,";
		mes "or Cancel to cancel.";
		if($dts&(1<<3)) mes "There was no previous winner";
		if($dts&(1<<4)) mes "Cool Event Corp was the last winner";
		if($dts&(1<<5)) mes "Kafra Corp was the last winner";
		next;
		input @dtstemps$;
		mes "[Saera]";
		mes "Let me find the papers...";
		next;
		if(@dtstemps$ == "None" || @dtstemps$ == "none"){
			if($dts&(1<<4)){
				set $dts,$dts&~(1<<4);			//removes last winner
				set $dts,$dts|(1<<3);			//sets current last winner
			}
			if($dts&(1<<5)){
				set $dts,$dts&~(1<<5);
				set $dts,$dts|(1<<3);
			}
			mes "[Saera]";
			mes "Set records to show no previous winner.";
			close;
		}
		if(@dtstemps$ == "Cool" || @dtstemps$ == "cool"){
			if($dts&(1<<3)){
				set $dts,$dts&~(1<<3);
				set $dts,$dts|(1<<4);
			}
			if($dts&(1<<5)){
				set $dts,$dts&~(1<<5);
				set $dts,$dts|(1<<4);
			}
			mes "[Saera]";
			mes "Cool Event Corp. is now the previous winner.";
			close;
		}
		if(@dtstemps$ == "Kafra" || @dtstemps$ == "kafra"){
			if($dts&(1<<3)){
				set $dts,$dts&~(1<<3);
				set $dts,$dts|(1<<5);
			}
			if($dts&(1<<4)){
				set $dts,$dts&~(1<<4);
				set $dts,$dts|(1<<5);
			}
			mes "[Saera]";
			mes "Kafra Corp. is now the previous winner.";
			close;
		}
		if(@dtstemps$ == "Cancel" || @dtstemps$ == "cancel") goto Lnothx;
		mes "[Saera]";
		mes "Please input a correct name";
		mes "for previous winner";
		next;
		goto Lsetlast;

	Lmanuvotecheck:
		mes "[Saera]";
		mes "Are you sure you would like to run";
		mes "the vote check again?";
		next;
		menu "Yes",Lmanuvoteyes,"No",Lnothx;

	Lmanuvoteyes:
		if($dtsday<4 || $dtsday>=100) set $dtsday,4;
		else set $dtsday,$dtsday+1;
		if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
			if($dts&(1<<0)) set $dts,$dts&~(1<<0);
			if($dts&(1<<1)) set $dts,$dts&~(1<<1);
			if($dts&(1<<2)) set $dts,$dts&~(1<<2);
			set $dts,$dts|(1<<0);
		}
		if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			set $dts,$dts|(1<<3);
		}
		if($dtsv == 0){
			set $@dtstemp,rand(1,2);
			if($@dtstemp == 1) set $dtsv,$dtsv+100;
			else set $dtsv,$dtsv-100;
		}
		if($dtsv > 0){
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);			//removes last winner varialbes
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);				//removes winner variable
				set $dts,$dts|(1<<3);				//sets last winner varialbe
				set $dts,$dts|(1<<1);				//sets current winner variable
			}
			if($dts&(1<<1)) set $dts,$dts|(1<<4);
			if($dts&(1<<2)){
				set $dts,$dts&~(1<<2);
				set $dts,$dts|(1<<1);
				set $dts,$dts|(1<<5);
			}
			set $dtsv,0;
		}
		else{
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);
				set $dts,$dts|(1<<2);
				set $dts,$dts|(1<<3);
			}
			if($dts&(1<<1)){
				set $dts,$dts&~(1<<1);
				set $dts,$dts|(1<<2);
				set $dts,$dts|(1<<4);
			}
			if($dts&(1<<2)) set $dts,$dts|(1<<5);
			set $dtsv,0;
		}
		mes "[Saera]";
		mes "Vote check run again.";
		if($dts&(1<<0)) mes "The election is currently in election mode.";
		if($dts&(1<<1)) mes "Cool Event Corp is currently the DTS warper.";
		if($dts&(1<<2)) mes "Kafra Corp is currently the DTS warper.";
		close;
}

//Function for Voting Staff NPC
function	script	F_DTS_Warp	{
	callfunc "F_ClearGarbage"; //Clear outdated, unused variables
	if($dts == 0){ 						//Sets NPCs to election mode if first time running
		set $dts,$dts|(1<<0);
		set $dts,$dts|(1<<3);
	}
	if((dtseligible == 0 || dtseligible == 3) && baselevel >= 60 && MISC_QUEST&128 == 0) set dtseligible,1;	//Clear previous var of dtseligible,3 being tried for eligibility already
	if(dtseligible != $dtsday && baselevel >= 60 && MISC_QUEST&128){
		set MISC_QUEST,MISC_QUEST&~128;
		set dtseligible,1;
	}
	switch(getarg(0)){
	case 0:
		cutin "zonda_01",2;
		mes "[Cool Event Corp. Voting Staff]";
		mes "Hello! Don't forget to make";
		mes "your voice be heard and make";
		mes "sure you vote in the elections";
		mes "between Cool Event Corp. and";
		mes "Kafra Corporation for control of";
		mes "the Dungeon Teleport Service!";
		break;
	case 1:
		switch(getarg(1)){
		case 0: cutin "kafra_06",2; break;			//Finding arguments to find which illust to use
		case 1: cutin "kafra_05",2; break;			//Used Red hair "kafra_09" for black outfit kafra
		case 2: cutin "kafra_04",2; break;			//because I couldn't find a suitable illust
		case 3: cutin "kafra_03",2; break;
		case 4: cutin "kafra_02",2; break;
		case 5: cutin "kafra_01",2; break;
		case 6: cutin "kafra_09",2; break;
		case 7: cutin "kafra_08",2; break;
		case 8: cutin "kafra_09",2; break;
		default: cutin "kafra_09",2; break;
		}
		mes "[Kafra Voting Staff]";
		mes "Greetings, adventurer.";
		mes "As you may be aware, we";
		mes "are holding an election to";
		mes "provide the Dungeon Teleport";
		mes "Service. How may I help you?";
		break;
	}
	next;
	menu "Reason for Election",Lelection,"Cast a Vote",Lvote,
	"Use Teleport Service",Lteleport,"Cancel",Lcancel;

	Lelection: 							//Reason for election explanation
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]";
			mes "Cool Event Corp. has been";
			mes "planning to provide a new";
			mes "Dungeon Teleport Service to";	
			mes "its customers, a service not";
			mes "already provided by the Kafra";
			mes "Corporation. However...";
			next;
			mes "[Cool Event Corp. Voting Staff]";
			mes "Kafra Corporation, which";
			mes "already monopolizes the";
			mes "public teleportation market,";
			mes "actually also had plans to";
			mes "provide a similar service.";
			next;
			mes "[Cool Event Corp. Voting Staff]";
			mes "Because of technological";
			mes "limitations, only one company";
			mes "can be chosen as the provider";
			mes "of this Dungeon Teleport Service.";
			mes "Hence, we will let the customers";
			mes "decide through these elections.";
			next;
			mes "[Cool Event Corp. Voting Staff]";
			mes "Multiple elections will be";
			mes "held so that our customers";
			mes "can test out the special services";
			mes "of each company for themselves.";
			mes "However, keep in mind that you";
			mes "must be eligible in order to vote.";
			next;
			mes "[Cool Event Corp. Voting Staff]";
			mes "For voter eligibility";
			mes "details, please visit our";
			mes "headquarters in the city of";
			mes "Lighthalzen located in the";
			mes "Schwaltzvalt Republic.";
			mes "Thank you for your time.";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "Cool Event Corp and the";
			mes "Kafra Corporation have both";
			mes "been planning to provide a";
			mes "Teleport Service to dungeons.";
			next;
			mes "[Kafra Voting Staff]";
			mes "But due to technological";
			mes "limitations, only one company";
			mes "can serve as provider for this";
			mes "Dungeon Teleport Service at a";
			mes "time. There, both companies have";
			mes "agreed to hold special elections";
			next;
			mes "[Kafra Voting Staff]";
			mes "Each company has its own";
			mes "policies and guarantees in";
			mes "regards to the Dungeon Teleport";
			mes "Service, and in this election, the";
			mes "customers will ultimately decide";
			mes "and choose what's best for them.";
			next;
			mes "[Kafra Voting Staff]";
			mes "For now, the Dungeon";
			mes "Teleport Service will be";
			mes "provided in a series of trial";
			mes "periods. This way, customers can";
			mes "see the benefits of both companies";
			mes "before making the final decision";
			next;
			mes "[Kafra Voting Staff]";
			mes "If you are qualified,";
			mes "please vote in each election";
			mes "to decide which company will";
			mes "provide the Dungeon Teleport";
			mes "Service for the next trial period.";
			mes "Thank you for your support~";
			break;
		}
		goto Lend;

	Lvote: //If you clicked you wanted to vote
		if(dtseligible == 1) goto Leligible; 			//Var check if eligible

	Lnoteligible: 							//Text displayed if wanted to vote, but not eligible/voted
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]";
			mes "I'm sorry, but you are not";
			mes "eligible to vote at this time.";
			mes "Please visit our headquarters";
			mes "in Lighthalzen for information";
			mes "related to acquiring voting";
			mes "rights. Thank you for your time.";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "Oh, I'm so sorry, but you";
			mes "are currently not qualified to";
			mes "vote. For voting qualification";
			mes "information, please visit the";
			mes "Al De Baran Kafra Headquarters.";
			mes "Thank you and have a nice day.";
			break;
		}
		goto Lend;

	Leligible: 							//Text displayed if eligible to vote
		if(MISC_QUEST&128 && $dtsday == dtseligible) goto Lnoteligible; //Var check if voted
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]"; 		//Unofficial text
			mes "Checking your credentials, you";
			mes "are able to vote for the";
			mes "Dungeon Teleport Service";
			mes "elections. Who would you like";
			mes "to vote for?";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "It appears that you qualify";
			mes "to vote for the Dungeon";
			mes "Teleport Service elections.";
			mes "Who would you like to vote for";		//End Unofficial text
			break;
		}
		next;
		menu "Cool Event Corp.",Lvotecool,"Kafra Corp.",Lvotekafra;
	
	Lvotecool:
		set $dtsv,$dtsv+1;				//Adds 1 to cool count
		set MISC_QUEST,MISC_QUEST|128;				//Sets var so that you can't vote over and over
		set dtseligible,$dtsday;
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]";
			mes "Thank you for voting for us.";
			mes "Your vote has been counted,";
			mes "and we appreciate your input";
			mes "Thank you and have a good day.";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "We thank you for your vote.";
			mes "Your opinion matters very much";
			mes "and has been counted for Cool";
			mes "Event Corp.";
			break;
		}
		goto Lend;

	Lvotekafra:
		setd $dtsv,$dtsv-1; 				//Adds 1 to kafra count
		set MISC_QUEST,MISC_QUEST|128; 			//Sets var to prevent cheating
		set dtseligible,$dtsday;
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]";		//Unofficial Text
			mes "Thank you for your opinion.";
			mes "Your vote for Kafra corp.";
			mes "has been counted. Thank";
			mes "you and have a good day.";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "Your vote for us has been";
			mes "counted. We thank you very";
			mes "much for your input, and";
			mes "we hope that we meet your";
			mes "adventuring needs and";
			mes "standards of excellence.";
			break;
		}
		goto Lend;						//End Unofficial text

	Lteleport: 							//Selected Teleport
		switch(getarg(0)){
		case 0:
			if($dts&(1<<0)){
				mes "[Cool Event Corp. Voting Staff]";
				mes "I'm sorry, but the";
				mes "Dungeon Teleport Service is";
				mes "unavailable during elections";
				mes "and will be reactivated after the";
				mes "election results are announced.";
				mes "Thank you and have a nice day.";
				goto Lend;
			}
			if($dts&(1<<1)) goto Lteleenabled;
			mes "[Cool Event Corp. Voting Staff]";		//Text if Kafra won DTS elect.
			mes "I'm sorry, but Cool Event";
			mes "Corp. does not currently offer";
			mes "the Dungeon Teleport Service";
			mes "due to the results of the last";
			mes "election. Please vote for us";
			mes "next time, alright? Good day~";
			break;
		case 1:
			if($dts&(1<<0)){
				mes "[Kafra Voting Staff]";
				mes "Sorry, but the elections for";
				mes "which Dungeon Teleport System";
				mes "to use is currently going on";
				mes "right now. We are unable to";
				mes "vote until results are announced";
				goto Lend;
			}
			if($dts&(1<<2)) goto Lteleenabled;
			mes "[Kafra Voting Staff]";
			mes "We're sorry, but Kafra Corp";
			mes "doesn't currently offer the";
			mes "Dungeon Teleport System due";
			mes "to last election's results,";
			mes "Please vote for Kafra Corp";
			mes "next time~";
			break;
		}
		goto Lend;

	Lteleenabled: 							//Shows DTS tele selections
	cleararray @dtswarpmap$[0],"",getarraysize(@dtswarpmap$);
	cleararray @dtswarp$[0],"",getarraysize(@dtswarp$);
	switch(getarg(0)){
	case 0:
		mes "[Cool Event Corp. Voting Staff]";
		mes "Please remember that we";
		mes "cannot accept Free Warp Tickets";
		mes "or award Special Reserve Points";
		mes "for this service. Now, please";
		mes "choose your destination.";
		setarray @dtswarpmap$[0],"Byalan, Level 4","Clock Tower, Basement 3";
		setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
		@dtswarpmap$[1]+" -> 4,000z","Cancel";
		if($dts&(1<<4)){ 
			set @dtswarpmap$[2],"Glastheim Entrance";
			setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
		}
		break;
	case 1:
		mes "[Kafra Voting Staff]";
		mes "Thank you for choosing the";
		mes "Dungeon Teleport Service";
		mes "Please keep in mind that the";
		mes "Free Warp Tickets and Kafra";
		mes "Special Reserve Points do not";
		mes "apply in this special service.";
		setarray @dtswarpmap$[0],"Toy Factory, Level 2","Clock Tower, Level 3";
		setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
		@dtswarpmap$[1]+" -> 4,000z","Cancel";
		if($dts&(1<<5)){ 
			set @dtswarpmap$[2],"Lava Dungeon, Level 2";
			setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
		}
		break;
	}
	next;
	switch(select(@dtswarp$[0],@dtswarp$[1],@dtswarp$[2],@dtswarp$[3])){
		case 1:
			set @num, 0;
			break;
		case 2:
			set @num, 1;
			break;
		case 3:
			set @num, 2;
			break;
		case 4:
			set @num, 3;
			break;
	}
	Lwarp:
		if (@dtswarp$[@num] == "Cancel") goto Lcancel;
		if (Zeny<4000) goto Lnomoney;
		set Zeny, Zeny-4000;
		if (@dtswarpmap$[@num] == "Toy Factory, Level 2") warp "xmas_dun02.gat",130,123;
 //Maps to warp to
		if (@dtswarpmap$[@num] == "Clock Tower, Level 3") warp "alde_dun03.gat",265,22;

		if (@dtswarpmap$[@num] == "Lava Dungeon, Level 2") warp "mag_dun02.gat",47,40;

		if (@dtswarpmap$[@num] == "Byalan, Level 4") warp "iz_dun03.gat",32,63;

		if (@dtswarpmap$[@num] == "Clock Tower, Basement 3") warp "alde_dun03.gat",277,178;

		if (@dtswarpmap$[@num] == "Glastheim Entrance") warp "glast_01.gat",370,304;

		cutin "", 255;
		end;
	Lnomoney:
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]"; 		//Unofficial Text
			mes "Umm, apparently you don't have";
			mes "adequate funds for your";
			mes "selected warp. Please check";
			mes "that you have the correct amount";
			mes "of money, and try again later";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "It appears as if you don't";
			mes "have enough zeny for the warp";
			mes "Please check your funds and";
			mes "try again.";
			break;
		}
		goto Lend;						//End unofficial text

	Lcancel: 							//Selected Cancel on first menu
		switch(getarg(0)){
		case 0:
			mes "[Cool Event Corp. Voting Staff]";	
			mes "Cool Event Corp. is always";
			mes "working to make sure that";
			mes "not only are our customers";
			mes "satisfied, but that we also";
			mes "exceed your utmost standards.";
			mes "Thank you and have a good day.";
			break;
		case 1:
			mes "[Kafra Voting Staff]";
			mes "We, here at Kafra Corporation,";
			mes "are alwyas endeavoring to provide";
			mes "you with the best services. We hope";
			mes "that we meet your adventuring needs";
			mes "and the standards of excellence.";
			break;
		}
		goto Lend;
	Lend:
		close2;
		cutin "", 255;
		end;

}

//Elections administration NPC (hidden)
-	script	DTS_Admin	-1,{
	OnSun0100:					//Works only at 1am on sunday
		if($dtsday<4 || $dtsday>=100) set $dtsday,4;
		else set $dtsday,$dtsday+1;
		if($dts == 0){
			set $dts,$dts|(1<<0);
			set $dts,$dts|(1<<3);
		}
		if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
			if($dts&(1<<0)) set $dts,$dts&~(1<<0);
			if($dts&(1<<1)) set $dts,$dts&~(1<<1);
			if($dts&(1<<2)) set $dts,$dts&~(1<<2);
			set $dts,$dts|(1<<0);
		}
		if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			set $dts,$dts|(1<<3);
		}
		if($dtsv == 0){				//If tied, gives random side 100 votes
			set $@dtstemp,rand(1,2);
			if($@dtstemp == 1) set $dtsv,$dtsv+100;
			else set $dtsv,$dtsv-100;
		}
		if($dtsv > 0){
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);
				set $dts,$dts|(1<<1);
				set $dts,$dts|(1<<3);
			}
			if($dts&(1<<1)) set $dts,$dts|(1<<4);
			if($dts&(1<<2)){
				set $dts,$dts&~(1<<2);
				set $dts,$dts|(1<<1);
				set $dts,$dts|(1<<5);
			}
			set $dtsv,0;
		}
		else{
			if($dts&(1<<3)) set $dts,$dts&~(1<<3);
			if($dts&(1<<4)) set $dts,$dts&~(1<<4);
			if($dts&(1<<5)) set $dts,$dts&~(1<<5);
			if($dts&(1<<0)){
				set $dts,$dts&~(1<<0);
				set $dts,$dts|(1<<2);
				set $dts,$dts|(1<<3);
			}
			if($dts&(1<<1)){
				set $dts,$dts&~(1<<1);
				set $dts,$dts|(1<<2);
				set $dts,$dts|(1<<4);
			}
			if($dts&(1<<2)) set $dts,$dts|(1<<5);
			set $dtsv,0;
		}
		end;
}