//===== rAthena Script =======================================
//= War of Emperium - Time Setter
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.5a
//===== Compatible With: =====================================
//= rAthena 1.0 Final TXT
//===== Description: =========================================
//= Lets a GM set WoE times from inside the game
//===== Additional Comments: =================================
//= Loops used = 4 (I like loops ^_^)
//= Only GM's of lvl 99 can use it
//= If anyone else tries to use it they will just get a list of WoE times
//= It give you the option, as a GM, to Add a new time, Reset all times,
//= or just view the current set times
//= If a WoE is in Progress no time reset is possible
//= A maximum of 200 WoE times can be set, if that is even possible ;)
//= Added in v1.5
//= Change day setting to a menu call, more GUI this way
//= You can choose for the WoE to last between days
//= IE, Sat 23 till Sun 01, is now possible
//= Not even the normal WoE script can do this (by dafault)
//= Removed the need for disabling the normal agit_event
//= 1.5a Applied Playtester's fix. [Vicious]
//============================================================
prontera,162,194,5 script WoE Setter 806,{
mes "[Woe Setter]";
if(getgmlevel()<99) goto L_NotGM;
mes "Welcome, I can set WoE times for you";
mes "Simply follow the intruction given in each section after this, and it should be set and ready to use";
next;
mes "[Woe Setter]";
mes "Now the fun starts";
mes "Please select what you want to do";
next;
menu "Add a WoE time",L_Add,"Reset All WoE times",L_Reset,"View Current WoE times",-;
mes "[Woe Setter]";
mes "Ok currently you have WoE times set for:-";
set @num,0;
L_LoopList:
if($sday[@num] == 0 && $eday[@num] == 0 && $woetime[@num] == 0 && $woetime2[@num] == 0) goto L_LoopListEnd;
if($sday[@num]==0) set $@tempday$,"Sunday";
if($sday[@num]==1) set $@tempday$,"Monday";
if($sday[@num]==2) set $@tempday$,"Tuesday";
if($sday[@num]==3) set $@tempday$,"Wednesday";
if($sday[@num]==4) set $@tempday$,"Thursday";
if($sday[@num]==5) set $@tempday$,"Friday";
if($sday[@num]==6) set $@tempday$,"Saturday";
if($eday[@num]==0) set $@tempday2$,"Sunday";
if($eday[@num]==1) set $@tempday2$,"Monday";
if($eday[@num]==2) set $@tempday2$,"Tuesday";
if($eday[@num]==3) set $@tempday2$,"Wednesday";
if($eday[@num]==4) set $@tempday2$,"Thursday";
if($eday[@num]==5) set $@tempday2$,"Friday";
if($eday[@num]==6) set $@tempday2$,"Saturday";
if($eday[@num]==$sday[@num]) mes $@tempday$+" from "+$woetime[@num]+":00 till "+$woetime2[@num]+":00";
if($eday[@num]!=$sday[@num]) mes "From "+$@tempday$+" "+$woetime[@num]+":00 till "+$@tempday2$+" "+$woetime2[@num]+":00";
set @num,@num+1;
goto L_LoopList;
L_LoopListEnd:
close;
L_Add:
set @num,0;
L_AddLoop:
if($sday[@num] == 0 && $eday[@num] == 0 && $woetime[@num] == 0 && $woetime2[@num] == 0) goto L_AddLoopEnd;
set @num,@num+1;
goto L_AddLoop;
L_AddLoopEnd:
mes "[Woe Setter]";
mes "What day do you want the WoE to start ^FF0000start^000000 in?";
next;
menu "Sunday",-,"Monday",-,"Tuesday",-,"Wednesday",-,"Thursday",-,"Friday",-,"Saturday",-;
if(@menu==1) set $sday[@num],0;
if(@menu==2) set $sday[@num],1;
if(@menu==3) set $sday[@num],2;
if(@menu==4) set $sday[@num],3;
if(@menu==5) set $sday[@num],4;
if(@menu==6) set $sday[@num],5;
if(@menu==7) set $sday[@num],6;
mes "[Woe Setter]";
mes "Ok, now please enter the hour you wish the WoE to ^FF0000start^000000 at";
mes "This is using a 24 hour clock";
mes "00 = Midnight";
mes "12 = Mid-day";
mes "23 = 11pm";
next;
input @input;
if (@input < 0 || @input > 24) goto L_BadNumber;
set $woetime[@num],@input;
mes "[Woe Setter]";
mes "What day do you want the WoE to start ^FF0000finish^000000 in?";
next;
menu "Same as start",-,"Sunday",-,"Monday",-,"Tuesday",-,"Wednesday",-,"Thursday",-,"Friday",-,"Saturday",-;
if(@menu==1) set $eday[@num],$sday[@num];
if(@menu==2) set $eday[@num],0;
if(@menu==3) set $eday[@num],1;
if(@menu==4) set $eday[@num],2;
if(@menu==5) set $eday[@num],3;
if(@menu==6) set $eday[@num],4;
if(@menu==7) set $eday[@num],5;
if(@menu==8) set $eday[@num],6;
mes "[Woe Setter]";
mes "Ok, now please enter the hour you wish the WoE to ^FF0000finish^000000 at";
mes "This also uses the 24 hour clock";
mes "00 = Midnight";
mes "12 = Mid-day";
mes "23 = 11pm";
next;
input @input;
if (@input < 0 || @input > 24) goto L_BadNumber;
set $woetime2[@num],@input;
mes "[Woe Setter]";
mes "You WoE time has now been set";
mes "To confirm this, ask me to show you the ^FF0000'View Current WoE times'^000000";
close;
L_Reset:
mes "[Woe Setter]";
mes "You are about to reset all the set WoE times you have created";
mes "Are you sure?";
next;
menu "No, what was I thinking",L_No,"Yes I really want to do it",-;
if(agitcheck()) goto L_WoEOn;
deletearray $sday[0],200;
deletearray $eday[0],200;
deletearray $woetime[0],200;
deletearray $woetime2[0],200;
mes "[Woe Setter]";
mes "They are all gone now, please remember to set new ones";
close;
L_WoEOn:
mes "[Woe Setter]";
mes "Sorry since there is a WoE in progress you cannot reset the WoE times";
close;
L_No:
mes "[Woe Setter]";
mes "Oh, good, come back whenever";
close;
L_NotGM:
mes "The current WoE times are :-";
set @num,0;
goto L_LoopList;
end;
L_BadNumber:
mes "[Woe Setter]";
mes "Sorry that was an invalid number, please try again";
close;
}
- script Agit_Event2 -1,{
end;
OnInit:
disablenpc "Agit_Event";
OnMinute00:
OnAgitInit:
// starting time check
set $@num,0;
L_StartLoop:
if($sday[$@num] == 0 && $eday[$@num] == 0 && $woetime[$@num] == 0 && $woetime2[$@num] == 0) goto L_StartLoopEnd;
if(gettime(4)==$sday[$@num] && gettime(3)>=$woetime[$@num] && (gettime(3)<$woetime2[$@num] || $sday[$@num]!=$eday[$@num])) goto L_Start;
set $@num,$@num+1;
goto L_StartLoop;
// end time checks
L_StartLoopEnd:
set $@num,0;
L_EndLoop:
if($eday[$@num] == 0 && $woetime[$@num] == 0 && $woetime2[$@num] == 0) end;
if((gettime(4)==$eday[$@num]) && (gettime(3)==$woetime2[$@num])) goto L_End;
set $@num,$@num+1;
goto L_EndLoop;
end;
// Stop WoE
L_End:
if(!agitcheck()) end;
Announce "The War Of Emperium is over!",8;
AgitEnd;
end;
// Start WoE
L_Start:
if(agitcheck()) end;
Announce "The War Of Emperium has begun!",8;
AgitStart;
end;
}