root/npc/custom/WoE_Setter.txt @ 6

Revision 1, 6.5 kB (checked in by jinshiro, 17 years ago)
Line 
1//===== eAthena Script =======================================
2//= War of Emperium - Time Setter
3//===== By: ==================================================
4//= Fredzilla
5//===== Current Version: =====================================
6//= 1.5a
7//===== Compatible With: =====================================
8//= eAthena 1.0 Final TXT
9//===== Description: =========================================
10//= Lets a GM set WoE times from inside the game
11//===== Additional Comments: =================================
12//= Loops used = 4 (I like loops ^_^)
13//= Only GM's of lvl 99 can use it
14//= If anyone else tries to use it they will just get a list of WoE times
15//= It give you the option, as a GM, to Add a new time, Reset all times,
16//= or just view the current set times
17//= If a WoE is in Progress no time reset is possible
18//= A maximum of 200 WoE times can be set, if that is even possible ;)
19//= Added in v1.5
20//= Change day setting to a menu call, more GUI this way
21//= You can choose for the WoE to last between days
22//= IE, Sat 23 till Sun 01, is now possible
23//= Not even the normal WoE script can do this (by dafault)
24//= Removed the need for disabling the normal agit_event
25//= 1.5a Applied Playtester's fix. [Vicious]
26//============================================================
27prontera,162,194,5      script  WoE Setter      806,{
28        mes "[Woe Setter]";
29        if(getgmlevel()<99) goto L_NotGM;
30        mes "Welcome, I can set WoE times for you";
31        mes "Simply follow the intruction given in each section after this, and it should be set and ready to use";
32        next;
33        mes "[Woe Setter]";
34        mes "Now the fun starts";
35        mes "Please select what you want to do";
36        next;
37        menu "Add a WoE time",L_Add,"Reset All WoE times",L_Reset,"View Current WoE times",-;
38        mes "[Woe Setter]";
39        mes "Ok currently you have WoE times set for:-";
40        set @num,0;
41L_LoopList:
42        if($sday[@num] == 0 && $eday[@num] == 0 && $woetime[@num] == 0 && $woetime2[@num] == 0) goto L_LoopListEnd;
43        if($sday[@num]==0) set $@tempday$,"Sunday";
44        if($sday[@num]==1) set $@tempday$,"Monday";
45        if($sday[@num]==2) set $@tempday$,"Tuesday";
46        if($sday[@num]==3) set $@tempday$,"Wednesday";
47        if($sday[@num]==4) set $@tempday$,"Thursday";
48        if($sday[@num]==5) set $@tempday$,"Friday";
49        if($sday[@num]==6) set $@tempday$,"Saturday";
50        if($eday[@num]==0) set $@tempday2$,"Sunday";
51        if($eday[@num]==1) set $@tempday2$,"Monday";
52        if($eday[@num]==2) set $@tempday2$,"Tuesday";
53        if($eday[@num]==3) set $@tempday2$,"Wednesday";
54        if($eday[@num]==4) set $@tempday2$,"Thursday";
55        if($eday[@num]==5) set $@tempday2$,"Friday";
56        if($eday[@num]==6) set $@tempday2$,"Saturday";
57        if($eday[@num]==$sday[@num]) mes $@tempday$+" from "+$woetime[@num]+":00 till "+$woetime2[@num]+":00";
58        if($eday[@num]!=$sday[@num]) mes "From "+$@tempday$+" "+$woetime[@num]+":00 till "+$@tempday2$+" "+$woetime2[@num]+":00";
59        set @num,@num+1;
60        goto L_LoopList;
61L_LoopListEnd:
62        close;
63L_Add:
64        set @num,0;
65L_AddLoop:
66        if($sday[@num] == 0 && $eday[@num] == 0 && $woetime[@num] == 0 && $woetime2[@num] == 0) goto L_AddLoopEnd;
67        set @num,@num+1;
68        goto L_AddLoop;
69L_AddLoopEnd:
70        mes "[Woe Setter]";
71        mes "What day do you want the WoE to start ^FF0000start^000000 in?";
72        next;
73        menu "Sunday",-,"Monday",-,"Tuesday",-,"Wednesday",-,"Thursday",-,"Friday",-,"Saturday",-;
74        if(@menu==1) set $sday[@num],0;
75        if(@menu==2) set $sday[@num],1;
76        if(@menu==3) set $sday[@num],2;
77        if(@menu==4) set $sday[@num],3;
78        if(@menu==5) set $sday[@num],4;
79        if(@menu==6) set $sday[@num],5;
80        if(@menu==7) set $sday[@num],6;
81        mes "[Woe Setter]";
82        mes "Ok, now please enter the hour you wish the WoE to ^FF0000start^000000 at";
83        mes "This is using a 24 hour clock";
84        mes "00 = Midnight";
85        mes "12 = Mid-day";
86        mes "23 = 11pm";
87        next;
88        input @input;
89        if (@input < 0 || @input > 24) goto L_BadNumber;
90        set $woetime[@num],@input;
91        mes "[Woe Setter]";
92        mes "What day do you want the WoE to start ^FF0000finish^000000 in?";
93        next;
94        menu "Same as start",-,"Sunday",-,"Monday",-,"Tuesday",-,"Wednesday",-,"Thursday",-,"Friday",-,"Saturday",-;
95        if(@menu==1) set $eday[@num],$sday[@num];
96        if(@menu==2) set $eday[@num],0;
97        if(@menu==3) set $eday[@num],1;
98        if(@menu==4) set $eday[@num],2;
99        if(@menu==5) set $eday[@num],3;
100        if(@menu==6) set $eday[@num],4;
101        if(@menu==7) set $eday[@num],5;
102        if(@menu==8) set $eday[@num],6;
103        mes "[Woe Setter]";
104        mes "Ok, now please enter the hour you wish the WoE to ^FF0000finish^000000 at";
105        mes "This also uses the 24 hour clock";
106        mes "00 = Midnight";
107        mes "12 = Mid-day";
108        mes "23 = 11pm";
109        next;
110        input @input;
111        if (@input < 0 || @input > 24) goto L_BadNumber;
112        set $woetime2[@num],@input;
113        mes "[Woe Setter]";
114        mes "You WoE time has now been set";
115        mes "To confirm this, ask me to show you the ^FF0000'View Current WoE times'^000000";
116        close;
117L_Reset:
118        mes "[Woe Setter]";
119        mes "You are about to reset all the set WoE times you have created";
120        mes "Are you sure?";
121        next;
122        menu "No, what was I thinking",L_No,"Yes I really want to do it",-;
123        if(agitcheck()) goto L_WoEOn;
124        deletearray $sday[0],200;
125        deletearray $eday[0],200;
126        deletearray $woetime[0],200;
127        deletearray $woetime2[0],200;   
128        mes "[Woe Setter]";
129        mes "They are all gone now, please remember to set new ones";
130        close;
131L_WoEOn:
132        mes "[Woe Setter]";
133        mes "Sorry since there is a WoE in progress you cannot reset the WoE times";
134        close;
135L_No:
136        mes "[Woe Setter]";
137        mes "Oh, good, come back whenever";
138        close;
139L_NotGM:
140        mes "The current WoE times are :-";
141        set @num,0;
142        goto L_LoopList;
143        end;
144L_BadNumber:
145        mes "[Woe Setter]";
146        mes "Sorry that was an invalid number, please try again";
147        close;
148}
149-       script  Agit_Event2     -1,{
150        end;
151OnInit:
152disablenpc "Agit_Event";
153OnMinute00:
154OnAgitInit:
155
156// starting time check
157        set $@num,0;
158L_StartLoop:
159        if($sday[$@num] == 0 && $eday[$@num] == 0 && $woetime[$@num] == 0 && $woetime2[$@num] == 0) goto L_StartLoopEnd;
160        if(gettime(4)==$sday[$@num] && gettime(3)>=$woetime[$@num] && (gettime(3)<$woetime2[$@num] || $sday[$@num]!=$eday[$@num])) goto L_Start;
161        set $@num,$@num+1;
162        goto L_StartLoop;
163
164// end time checks
165        L_StartLoopEnd:
166        set $@num,0;
167        L_EndLoop:
168        if($eday[$@num] == 0 && $woetime[$@num] == 0 && $woetime2[$@num] == 0) end;
169        if((gettime(4)==$eday[$@num]) && (gettime(3)==$woetime2[$@num])) goto L_End;
170        set $@num,$@num+1;
171        goto L_EndLoop;
172        end;
173
174// Stop WoE
175L_End:
176        if(!agitcheck()) end;
177        Announce "The War Of Emperium is over!",8;
178        AgitEnd;
179        end;
180
181// Start WoE
182L_Start:
183        if(agitcheck()) end;
184        Announce "The War Of Emperium has begun!",8;
185        AgitStart;
186        end;
187}
Note: See TracBrowser for help on using the browser.