summaryrefslogtreecommitdiff
path: root/npc/custom/WoE_Setter.txt
blob: fdab6da98e51f3716a01d60a402a52bf8458874a (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
//===== rAthena Script =======================================
//= War of Emperium - Time Setter
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
//= rAthena SVN
//===== 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;
}