Переглянути джерело

DTS warper uses binary values; less variables.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6796 54d463be-8e91-2dee-dedb-b68131a5f0ec
evera 19 роки тому
батько
коміт
d1b8524fb8
2 змінених файлів з 181 додано та 334 видалено
  1. 1 0
      npc/Changelog.txt
  2. 180 334
      npc/other/dts_warper.txt

+ 1 - 0
npc/Changelog.txt

@@ -31,6 +31,7 @@ Evera
 Date		Added
 ======
 05/27
+	* Updated DTS Warper; Now uses 3 global vars, 2 are vote #, 1 is etc in binary values. [Evera]
 	* Implemented the friendship quest. *finally* [MasterOfMuppets]
 05/26
 	* Modified Kiel spawn file [Playtester]

+ 180 - 334
npc/other/dts_warper.txt

@@ -3,7 +3,7 @@
 //===== By: ================================================== 
 //= Evera
 //===== Current Version: ===================================== 
-//= 1.3
+//= 1.4
 //===== Compatible With: ===================================== 
 //= eAthena
 //===== Description: =========================================
@@ -12,13 +12,14 @@
 //===== Variables: ===========================================
 //=Server - 	$dtscool 		= # of votes for Cool Corp
 //=		$dtskafra 		= # of votes for Kafra
-//=		$dtsstatus 		= Status for DTS 0, election; 1, Cool Corp enabled, won last; 2, Kafra enabled, won last;
-//=					= 3, Cool corp enabled, lost last; 4, Kafra enabled, lost last.
-//=		$dtslast		= Last election results, same legend as above
-//=		$dtsglobalelig		= 0 for normal eligibility system, 1 for eligibility for everyone
-//=					= Set through GM-eligibility fixing
-//=		$dtsgivevote_(id)	= Gives 'charname' voting rights next time they talk to a NPC in this script
-//=					= Given through GM vote-give thing. 0 for normal, 1 for voting rights.
+//=		$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
+//=					= (1<<6) Global Eligibility
 //=Character -	dtseligible 		= eligibility status, 0 not eligible, 1 eligible, 2 eligible & voted, 3 tried for elig.
 //=					= (By default, 1/4 chance of being able to vote. set to 1 after having random selection;
 //=					= not used if $dtsglobalelig == 1) 
@@ -46,6 +47,8 @@
 //= President's Quest, which isn't yet released.
 //= Default time to check votes is Sunday at 1:00. GM Configurable through Saera.
 //===== Version History: ====================================
+//= 1.4 Changed global variables to read from 3 global variables, updated names,
+//= fixed array bug [Evera]
 //= 1.3 Removed selfconfig [Evera]
 //= 1.2 Mushed some variables together, optimized a bit [Evera]
 //= 1.1	SVN release, removed from major town (found true info after research),
@@ -65,7 +68,7 @@ lighthalzen.gat,154,60,6	script	Cool Event Voting Staff	874,{
 	callfunc "F_DTS_Warp",0,0;
 }
 //Prontera
-prontera.gat,147,125,4	script	Cool Event Voting	874,{
+prontera.gat,147,125,4	script	Cool Event Voting Staff	874,{
 	callfunc "F_DTS_Warp",0,0;
 }
 prontera.gat,164,125,6	script	Kafra Voting Staff	115,{
@@ -137,9 +140,9 @@ lhz_in02.gat,110,283,5	script	Cool Event Manager	853,{
 }
 //Saera (Secretary), contains GM menu
 lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
-	if(getd("$dtsgivevote_"+getcharid(0)) == 1){			//Check to see if GM enabled eligibility
-		set dtseligible,1;
-		setd "$dtsgivevote_"+getcharid(0),0;
+	if($dts == 0){
+		set $dts,$dts|(1<<0);				//Sets NPCs to election mode if first time running
+		set $dts,$dts|(1<<3);
 	}
 	mes "[Saera]";
 	mes "Welcome to the";
@@ -147,20 +150,21 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 	mes "of Cool Event Corporation";
 	mes "How may I help you today?";
 	next;
-	if(getgmlevel()>60){ 						//Unofficial Text, GM-configurable settings for Event (GM level above 60 required)
+	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,
+		menu "Fix Vote",Lfixvote,
+		"Set current teleporter",Lsettele,
 		"Set last election winner",Lsetlast,
-		"Set eligiblity for players",Lseteligibility,
 		"Manually run vote check",Lmanuvotecheck,
-		"Change day to check votes",Lchangeday,
-		"Temporary headquarters?",Ltemphead,			//Normal NPC menu
-		"Voting",Lvoting,
-		"No, thanks.",Lnothx;
+		"Normal menu please",-;
+		mes "[Saera]";
+		mes "Ok";
+		next;
 	}
 	menu "Temporary headquarters?",Ltemphead,
 	"Voting",Lvoting,"No, thanks.",Lnothx;
@@ -278,9 +282,7 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		mes "Are you sure you would like to";
 		mes "make these changes?";
 		next;
-		menu "Yes",Lfixkafray,"No",Lnothx;			//Confirmation
-
-	Lfixkafray:
+		menu "Yes",-,"No",Lnothx;
 		set $dtskafra,@dtstemp;				//Set buffer to Kafra vote
 		mes "[Saera]";
 		mes "Okay, you fixed the vote";
@@ -304,9 +306,7 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		mes "Are you sure you would like to";
 		mes "make these changes?";
 		next;
-		menu "Yes",Lfixcooly,"No",Lnothx;			//Confirmaiton
-
-	Lfixcooly:
+		menu "Yes",-,"No",Lnothx;			//Confirmaiton
 		set $dtscool,@dtstemp;				//Set buffer to Cool vote
 		mes "[Saera]";
 		mes "Okay, you fixed the vote";
@@ -321,55 +321,47 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		mes "Cool for Cool Event Corp-enabled";
 		mes "warp ,Election for election mode,";
 		mes "or Cancel to cancel.";
-		switch($dtsstatus){
-			case 0: mes "The election is currently in election mode"; break;
-			case 3:
-			case 5:
-			case 1: mes "Cool Event Corp is currently the DTS warper."; break;
-			case 4:
-			case 6:
-			case 2: mes "Kafra Corp is currently the DTS warper."; break;
-			default: break;
-		}
+		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$;
 		mes "Let me find the papers...";
 		next;
 		if(@dtstemps$ == "Election" || @dtstemps$ == "election"){
-			set $dtsstatus,0;
+			if($dts&(1<<1)){
+				set $dts,$dts&~(1<<1);
+				set $dts,$dts|(1<<0);
+			}
+			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"){
-			switch($dtstatus){
-				case 2:
-				case 4:
-				case 6:
-					set $dtsstatus,3;
-					break;
-				case 3:
-				case 5:
-					set $dtsstatus,1;
-					break;
-				default: break;
+			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"){
-			switch($dtsstatus){
-				case 1:
-				case 3:
-				case 5:
-					set $dtsstatus,4;
-					break;
-				case 4:
-				case 6:
-					set $dtsstatus,2;
-					break;
-				default: break;
+			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.";
@@ -377,8 +369,7 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		}
 		if(@dtstemps$ == "Cancel" || @dtstemps$ == "cancel") goto Lnothx;
 		mes "[Saera]";
-		mes "Please input a correct name";
-		mes "for the election";
+		mes "Please input a correct name for the election";
 		next;
 		goto Lsettele;
 
@@ -388,63 +379,48 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		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.";
-		switch($dtsstatus){
-			case 5:
-			case 6:
-			case 0: mes "There was no previous winner"; break;
-			case 1:
-			case 4: mes "Cool Event Corp was the last winner"; break;
-			case 3:
-			case 2: mes "Kafra Corp was the last winner"; break;
-			default: break;
-		}
+		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"){
-			switch($dtsstatus){
-				case 1:
-				case 3:
-					set $dtsstatus,5;
-					break;
-				case 2:
-				case 4:
-					set $dtsstatus,6;
-					break;
-				default: break;
+			if($dts&(1<<4)){
+				set $dts,$dts&~(1<<4);
+				set $dts,$dts|(1<<3);
+			}
+			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"){
-			switch($dtsstatus){
-				case 2:
-				case 6:
-					set $dtsstatus,4;
-					break;
-				case 3:
-				case 5:
-					set $dtsstatus,1;
-					break;
-				default: break;
+			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"){
-			switch($dtsstatus){
-				case 1:
-				case 5:
-					set $dtsstatus,3;
-					break;
-				case 4:
-				case 6:
-					set $dtsstatus,2;
-				default: break;
+			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.";
@@ -457,31 +433,6 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 		next;
 		goto Lsetlast;
 
-	Lseteligibility:						//Set player eligibility
-		mes "[Saera]";
-		mes "Input the name of the character";
-		mes "you wish to give voting rights.";
-		mes "If the character voted, this will";
-		mes "also clear their vote";
-		switch($dtsglobalelig){ 
-			case 0: mes "Type All to give everyone voting rights."; break;
-			case 1: mes "Type Removeall to remove global voting rights"; break;
-			default: mes "Type All to give everyone voting rights."; break;
-		}
-		next;
-		input @seteligibility$;
-		mes "[Saera]";
-		mes "Let me find the papers...";
-		next;
-		if(@seteligibility$ == "All" || @seteligibility$ == "all") set $dtsglobalelig,1;
-		if(@seteligibility$ == "Removeall" && @seteligibility$ == "removeall") set $dtsglobalelig,0;
-		if(@seteligibility$ != "All" && @seteligibility$ != "all") setd "$dtsgivevote_"+getcharid(0,@seteligibility$),1;
-		mes "[Saera]";
-		mes "Eligibility options set.";
-		mes "Would you like to set the eligiblity options on another character?";
-		next;
-		menu "Yes",Lseteligibility,"No",Lnothx;
-
 	Lmanuvotecheck:
 		mes "[Saera]";
 		mes "Are you sure you would like to run";
@@ -496,149 +447,59 @@ lhz_in02.gat,36,274,3	script	Cool Event Staff	831,{
 			else set $dtskafra,$dtskafra+100;
 		}
 		if($dtscool > $dtskafra){
-			switch($dtsstatus){
-				case 3:
-				case 5:
-					set $dtsstatus,1;
-					break;
-				case 2:
-				case 4:
-				case 6:
-					set $dtsstatus,3;
-					break;
-				default: break;
+			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 $dtscool,0;
 			set $dtskafra,0;
 		}
 		else{
-			switch($dtsstatus){
-				case 1:
-				case 3:
-				case 5:
-					set $dtsstatus,4;
-					break;
-				case 4:
-				case 6:
-					set $dtsstatus,2;
-					break;
-				default: break;
+			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<<2);
+				set $dts,$dts|(1<<2);
+				set $dts,$dts|(1<<4);
 			}
+			if($dts&(1<<2)) set $dts,$dts|(1<<5);
 			set $dtscool,0;
 			set $dtskafra,0;
 		}
 		mes "[Saera]";
 		mes "Vote check run again.";
-		switch($dtsstatus){
-			case 0: mes "The election is currently in election mode"; break;
-			case 3:
-			case 5:
-			case 1: mes "Cool Event Corp is currently the DTS warper."; break;
-			case 4:
-			case 6:
-			case 2: mes "Kafra Corp is currently the DTS warper."; break;
-			default: break;
-		}
-		close;
-
-	Lchangeday:
-		mes "[Saera]";
-		mes "Okay, please input the";
-		mes "day you would like to change";
-		mes "the vote-checking to.";
-		mes "Please type Mon-Sun, or type out the";
-		mes "entire day. Thank you~";
-		next;
-		mes "[Saera]";
-		mes "Let me find the papers...";
-		input @dtschangeday$;
-		next;
-		mes "[Saera]";
-		mes "You requested the vote day";
-		if(@dtschangeday$ == "Mon" || @dtschangeday$ == "mon" || 
-		@dtschangeday$ == "Monday" || @dtschangeday$ == "monday"){
-		mes "to be changed to Monday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Tue" || @dtschangeday$ == "tue" || 
-		@dtschangeday$ == "Tuesday" || @dtschangeday$ == "tuesday"){
-		mes "to be changed to Tuesday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Wed" || @dtschangeday$ == "wed" || 
-		@dtschangeday$ == "Wednesday" || @dtschangeday$ == "wednesday"){
-		mes "to be changed to Wednesday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Thu" || @dtschangeday$ == "thu" || 
-		@dtschangeday$ == "Thursday" || @dtschangeday$ == "thursday"){
-		mes "to be changed to Thursday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Fri" || @dtschangeday$ == "fri" || 
-		@dtschangeday$ == "Friday" || @dtschangeday$ == "friday"){
-		mes "to be changed to Friday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Sat" || @dtschangeday$ == "sat" || 
-		@dtschangeday$ == "Saturday" || @dtschangeday$ == "saturday"){
-		mes "to be changed to Saturday.";
-		goto Ldayconfirm;
-		}
-		if(@dtschangeday$ == "Sun" || @dtschangeday$ == "sun" || 
-		@dtschangeday$ == "Sunday" || @dtschangeday$ == "sunday"){
-		mes "to be changed to Sunday.";
-		goto Ldayconfirm;
-		}
-		mes ", but you specified an invalid";
-		mes "day. What action would you like";
-		mes "to take?";
-		next;
-		menu "Re-input day",Lchangeday,"Cancel",Lnothx;
-
-	Ldayconfirm:
-		mes "Are you sure you would like to";
-		mes "change the check to this day?";
-		next;
-		menu "Yes",Ldayset,"No",Lnothx,"Input another day",Lchangeday;
-
-	Ldayset:
-		if(@dtschangeday$ == "Mon" || @dtschangeday$ == "mon" || 
-		@dtschangeday$ == "Monday" || @dtschangeday$ == "monday")
-		set $dtsday,1;
-		if(@dtschangeday$ == "Tue" || @dtschangeday$ == "tue" || 
-		@dtschangeday$ == "Tuesday" || @dtschangeday$ == "tuesday")
-		set $dtsday,2;
-		if(@dtschangeday$ == "Wed" || @dtschangeday$ == "wed" || 
-		@dtschangeday$ == "Wednesday" || @dtschangeday$ == "wednesday")
-		set $dtsday,3;
-		if(@dtschangeday$ == "Thu" || @dtschangeday$ == "thu" || 
-		@dtschangeday$ == "Thursday" || @dtschangeday$ == "thursday")
-		set $dtsday,4;
-		if(@dtschangeday$ == "Fri" || @dtschangeday$ == "fri" || 
-		@dtschangeday$ == "Friday" || @dtschangeday$ == "friday")
-		set $dtsday,5;
-		if(@dtschangeday$ == "Sat" || @dtschangeday$ == "sat" || 
-		@dtschangeday$ == "Saturday" || @dtschangeday$ == "saturday")
-		set $dtsday,6;
-		if(@dtschangeday$ == "Sun" || @dtschangeday$ == "sun" || 
-		@dtschangeday$ == "Sunday" || @dtschangeday$ == "sunday")
-		set $dtsday,0;
-		mes "[Saera]";
-		mes "Successfully changed the day.";
+		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	{
+	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){						//Gives random(1/4) chance of being eligible
-		set @randapply,rand(4);
+		set @randapply,rand(3);					//Unofficial, until President's quest is finished
 		if(@randapply == 0) set dtseligible,1;
 	}
-	if(getd("$dtsgivevote_"+getcharid(0)) == 1){			//Check to see if GM enabled eligibility
-		set dtseligible,1;
-		setd "$dtsgivevote_"+getcharid(0),0;
-	}
 	switch(getarg(0)){
 	case 0:
 		cutin "zonda_01",2;
@@ -760,9 +621,7 @@ function	script	F_DTS_Warp	{
 		goto Lend;
 
 	Lvote: //If you clicked you wanted to vote
-		if(dtseligible == 1) goto Leligible; 			//Var check if eligible
-		if($dtsglobalelig == 1) goto Leligible;			//Var check for global elig.
-		goto Lnoteligible;
+		if(dtseligible == 1 || $dts&(1<<6)) goto Leligible; 			//Var check if eligible
 
 	Lnoteligible: 							//Text displayed if wanted to vote, but not eligible/voted
 		switch(getarg(0)){
@@ -788,7 +647,7 @@ function	script	F_DTS_Warp	{
 		goto Lend;
 
 	Leligible: 							//Text displayed if eligible to vote
-		if(dtseligible == 3 && $dtsglobalelig == 0 || dtseligible == 2) goto Lnoteligible;//Var check if voted
+		if(dtseligible == 3 || dtseligible == 2) goto Lnoteligible; //Var check if voted
 		switch(getarg(0)){
 		case 0:
 			mes "[Cool Event Corp. Voting Staff]"; 		//Unofficial text
@@ -856,13 +715,17 @@ function	script	F_DTS_Warp	{
 	Lteleport: 							//Selected Teleport
 		switch(getarg(0)){
 		case 0:
-			switch($dtsstatus){
-				case 0: goto Lteleelect; break;		//Check if it's time to elect
-				case 3:
-				case 5:
-				case 1: goto Lteleenabled; break;	//Check if Cool is enabled to DTS
-				default: break;
+			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";
@@ -872,13 +735,16 @@ function	script	F_DTS_Warp	{
 			mes "next time, alright? Good day~";
 			break;
 		case 1:
-			switch($dtsstatus){
-				case 0: goto Lteleelect; break;		//Check if it's time to elect
-				case 4:
-				case 6:
-				case 2: goto Lteleenabled; break; 	//Check if Kafra is enabled to DTS
-				default: break;
+			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";
@@ -890,29 +756,9 @@ function	script	F_DTS_Warp	{
 		}
 		goto Lend;
 
-	Lteleelect: 							//During elections, displayed if asking for tele
-		switch(getarg(0)){
-		case 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.";
-			break;
-		case 1:
-			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";
-			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]";
@@ -924,9 +770,9 @@ function	script	F_DTS_Warp	{
 		setarray @dtswarpmap$[0],"Bailand, Level 4","Clock Tower, Basement 3";
 		setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
 		@dtswarpmap$[1]+" -> 4,000z","Cancel";
-		if($dtsstatus == 2){ 
+		if($dts&(1<<4)){ 
 			set @dtswarpmap$[2],"Glastheim Entrance";
-			setarray @dtswarp[2],@dtswarpmap[2]+" -> 4,000z","Cancel";
+			setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
 		}
 		break;
 	case 1:
@@ -940,28 +786,27 @@ function	script	F_DTS_Warp	{
 		setarray @dtswarpmap$[0],"Toy Factory, Level 2","Clock Tower, Level 3";
 		setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
 		@dtswarpmap$[1]+" -> 4,000z","Cancel";
-		if($dtsstatus == 1){ 
+		if($dts&(1<<5)){ 
 			set @dtswarpmap$[2],"Lava Dungeon, Level 2";
 			setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
 		}
 		break;
 	}
 	next;
-	menu @dtswarp$[0],Ldtswarp0,@dtswarp$[1],		//Array set above
-	Ldtswarp1,@dtswarp$[2],Ldtswarp2;
-
-	Ldtswarp0:
-		set @num, 0;
-		goto Lwarp;
-
-	Ldtswarp1:
-		set @num, 1;
-		goto Lwarp;
-
-	Ldtswarp2:
-		set @num, 2;
-		goto Lwarp;
-
+	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;
@@ -991,7 +836,7 @@ function	script	F_DTS_Warp	{
 			mes "of money, and try again later";
 			break;
 		case 1:
-			mes "[Kafra Voting STaff]";
+			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";
@@ -1029,44 +874,45 @@ function	script	F_DTS_Warp	{
 
 //Elections administration NPC (hidden)
 -	script DTS_Admin -1,{
-	OnHour01:
-		if($dtsday == gettime(4)) goto Lcheck;			//Works only at 1am
-		end;							//Goes to Lcheck for ability of manual check.
-	Lcheck:								//Checks to see if today is day to count votes
-		if($dtscool == $dtskafra){				//Counts votes for Kafra and Cool Corp,
-			set $@dtstempg,rand(1,2);			//and sets $dtsstatus accordingly.
-			if($@dtstempg == 1) set $dtscool,$dtscool+100;	//Random value if tied
+	On000100:					//Works only at 1am on sunday
+		if($dtscool == $dtskafra){
+			set $@dtstemp,rand(1,2);
+			if($@dtstemp == 1) set $dtscool,$dtscool+100;
 			else set $dtskafra,$dtskafra+100;
 		}
 		if($dtscool > $dtskafra){
-			switch($dtsstatus){
-				case 3:
-				case 5:
-					set $dtsstatus,1;
-					break;
-				case 2:
-				case 4:
-				case 6:
-					set $dtsstatus,3;
-					break;
-				default: break;
+			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 $dtscool,0;
 			set $dtskafra,0;
 		}
 		else{
-			switch($dtsstatus){
-				case 1:
-				case 3:
-				case 5:
-					set $dtsstatus,4;
-					break;
-				case 4:
-				case 6:
-					set $dtsstatus,2;
-					break;
-				default: break;
+			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<<2);
+				set $dts,$dts|(1<<2);
+				set $dts,$dts|(1<<4);
 			}
+			if($dts&(1<<2)) set $dts,$dts|(1<<5);
 			set $dtscool,0;
 			set $dtskafra,0;
 		}