woe_controller.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. //===== rAthena Script =======================================
  2. //= Euphy's WOE Controller
  3. //===== Changelogs: ==========================================
  4. //= 1.3a Initial SVN release [Euphy]
  5. //= 1.3b Fixed WoE SE end labels [Euphy]
  6. //= 1.4 Added auto kick config [Euphy]
  7. //= 1.5 Added additional reward configs [Euphy]
  8. //= 1.5a Fixed hardcoded date constants [Lemongrass]
  9. //= 1.6 Replaced SQL insert for mail with script command [Capuche]
  10. //= 1.6a Fixed invalid name Schwaltzvalt [Daegaladh]
  11. //= 1.6b Fixed hardcoded castle numbers [Lemongrass]
  12. //= 1.7 Removed direct SQL access [Lemongrass]
  13. //= 1.8 Fixed invalid checkweight usage [Lemongrass]
  14. //= 1.9 Fixed reward handout for multiple characters on the same account [Lemongrass]
  15. //===== Description: =========================================
  16. //= A controller for War of Emperium designed for
  17. //= simplicity and ease of use.
  18. //= Many concepts taken from ToastOfDoom's script,
  19. //= and "rewards" function originally by Goddameit.
  20. //=
  21. //= Be sure to disable the default agit controllers!
  22. //= npc\guild\agit_controller.txt
  23. //= npc\guild2\agit_start_se.txt
  24. //============================================================
  25. // Information NPC
  26. //============================================================
  27. prontera,149,193,4 script WOE Information 835,{
  28. doevent "WOE_CONTROL::OnMenu";
  29. end;
  30. OnAgitStart:
  31. while(agitcheck()) {
  32. specialeffect EF_BEGINSPELL6;
  33. sleep 425;
  34. }
  35. end;
  36. }
  37. // Script Core
  38. //============================================================
  39. - script WOE_CONTROL -1,{
  40. function Disp_Owner; function Add_Zero;
  41. OnInit:
  42. // -----------------------------------------------------------
  43. // Configuration settings.
  44. // -----------------------------------------------------------
  45. set .CastleWarp,0; // 1: Always enable all castle warps. | 0: Warp only to active castles.
  46. set .AutoKick,1; // Automatically kick players from inactive castles during WOE? (1:yes / 0:no)
  47. set .NoOwner,0; // Automatically kick players from unconquered castles outside of WOE? (1:yes / 0:no)
  48. set .ExitWarp,0; // Warp all players from castles when WOE ends? (1:yes / 0:no)
  49. set .GMAccess,99; // GM level required to access Session Manager.
  50. // -----------------------------------------------------------
  51. // Reward options.
  52. // -----------------------------------------------------------
  53. // [1] Enable rewards.
  54. // [2] Mail all rewards.
  55. // - If not set, players receive items in their inventory.
  56. // - Only ONE item can be sent via mail for PACKETVER < 20150513 while later clients are limited to MAIL_MAX_ITEM (5).
  57. // - Note that offline players do NOT receive rewards.
  58. // [4] Only reward Guild Masters.
  59. // - If not set, all guild members are rewarded.
  60. // - If mailing is enabled (option 2), offline Guild Masters WILL receive rewards.
  61. // [8] Duplicate IP check.
  62. // - Members in a guild with the same IP address are not rewarded.
  63. // - If Guild Masters is enabled (option 4), this feature is not used.
  64. // -----------------------------------------------------------
  65. // Combine values as needed (e.g. 1|8 = 1+8 = 9).
  66. set .Options, 1|8;
  67. // Rewards per castle.
  68. // setarray .reward_id[0], <itemID>{,<itemID>,...}
  69. // setarray .reward_amount[0], <amount>{,<amount>,...}
  70. setarray .reward_id[0],14001;
  71. setarray .reward_amount[0],1;
  72. // Zeny reward:
  73. .reward_zeny = 0;
  74. // -----------------------------------------------------------
  75. // Constants (leave this section alone).
  76. // -----------------------------------------------------------
  77. setarray .Castles$[0],
  78. "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
  79. "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
  80. "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
  81. "aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
  82. "arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
  83. "schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
  84. setarray .EndLabel$[0],"ar01","ar02","ar03","ar04","ar05","sc01","sc02","sc03","sc04","sc05";
  85. setarray .Days$[0],"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday";
  86. setarray .Regions$[0],"Prontera","Payon","Geffen","Aldebaran","Arunafeltz","Schwarzwald";
  87. setarray .Map$[0],"prt_gld","pay_gld","gef_fild13","alde_gld","aru_gld","sch_gld";
  88. setarray .MapX[0],134,240,153,111,208,121,295,317,140,204,214,308,143,193,305,48, 95,142,239,264,158,83, 68,299,292,293,288, 97,137, 71;
  89. setarray .MapY[0], 65,128,137,240,240,233,116,293,160,266, 75,240,240,278, 87,83,249, 85,242, 90,272,47,155,345,107,100,252,196, 90,315;
  90. // -----------------------------------------------------------
  91. .reward_id_size = getarraysize(.reward_id);
  92. set .Size, getarraysize($WOE_CONTROL);
  93. if (.AutoKick || .NoOwner)
  94. for(set .@i,0; .@i<getarraysize(.Castles$); set .@i,.@i+1) {
  95. setmapflag .Castles$[.@i], mf_loadevent;
  96. setd "."+.Castles$[.@i], .@i;
  97. }
  98. if (!agitcheck() && !agitcheck2()) sleep 4000;
  99. set .Init,1;
  100. OnMinute00:
  101. freeloop(1);
  102. if (agitcheck() || agitcheck2()) {
  103. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  104. if (gettime(DT_DAYOFWEEK) == $WOE_CONTROL[.@i] && gettime(DT_HOUR) == $WOE_CONTROL[.@i+2]) {
  105. OnWOEEnd:
  106. announce "The War Of Emperium is over!",bc_all|bc_woe;
  107. AgitEnd; AgitEnd2;
  108. sleep 1000;
  109. for(set .@j,0; .@j<getarraysize(.Castles$); set .@j,.@j+1) {
  110. if (.Active[0]&(1<<.@j)) Disp_Owner(.Castles$[.@j],1);
  111. if (.ExitWarp) maprespawnguildid .Castles$[.@j],0,3;
  112. }
  113. if ((.Options&1) && .Active[0] && .ForceEnd != 2) callsub OnReward, .Active[0];
  114. deletearray .Active[0],2;
  115. if (.ForceEnd) { set .ForceEnd,0; end; }
  116. break;
  117. }
  118. }
  119. if ((!agitcheck() && !agitcheck2()) || .Init) {
  120. if (!agitcheck() && !agitcheck2()) set .Init,0;
  121. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  122. if (gettime(DT_DAYOFWEEK) == $WOE_CONTROL[.@i] && gettime(DT_HOUR) >= $WOE_CONTROL[.@i+1] && gettime(DT_HOUR) < $WOE_CONTROL[.@i+2]) {
  123. deletearray .Active[0],2;
  124. set .Active[0], $WOE_CONTROL[.@i+3];
  125. if (.Init) { AgitEnd; AgitEnd2; }
  126. else announce "The War Of Emperium has begun!",bc_all|bc_woe;
  127. sleep 1000;
  128. AgitStart; AgitStart2;
  129. for(set .@j,0; .@j<getarraysize(.Castles$); set .@j,.@j+1) {
  130. if (.Active[0]&(1<<.@j)) {
  131. if (!.Init) Disp_Owner(.Castles$[.@j],0);
  132. set .Active[1], .Active[1] | (1<<((.@j/5)+1));
  133. } else {
  134. if (.@j<20) {
  135. donpcevent "Agit#"+.Castles$[.@j]+"::OnAgitEnd";
  136. killmonster .Castles$[.@j], "Agit#"+.Castles$[.@j]+"::OnAgitBreak";
  137. } else {
  138. donpcevent "Manager#"+.Castles$[.@j]+"::OnAgitEnd2";
  139. killmonster .Castles$[.@j], "Steward#"+.EndLabel$[.@j-20]+"::OnStartArena";
  140. }
  141. }
  142. }
  143. break;
  144. }
  145. }
  146. set .Init,0;
  147. end;
  148. function Disp_Owner {
  149. set .@o, getcastledata(getarg(0),1);
  150. if (.@o) announce "The ["+getcastlename(getarg(0))+"] castle "+((getarg(1))?"has been conquered":"is currently held")+" by the ["+getguildname(.@o)+"] guild.",bc_all|bc_woe;
  151. else announce "The ["+getcastlename(getarg(0))+"] castle is currently unoccupied.",bc_all|bc_woe;
  152. return;
  153. }
  154. function Add_Zero {
  155. return ((getarg(0)<10)?"0":"")+getarg(0)+(getarg(1,0)?".":":")+"00";
  156. }
  157. OnReward:
  158. if (!.reward_id_size && !.reward_zeny)
  159. return;
  160. if (.Options&2) set .@str$,gettimestr("%B %d, %Y",21);
  161. freeloop(1);
  162. for(set .@i,0; .@i<getarraysize(.Castles$); set .@i,.@i+1) {
  163. if (getarg(0)&(1<<.@i)) {
  164. set .@gid, getcastledata(.Castles$[.@i],1);
  165. if (!.@gid) continue;
  166. getguildmember( .@gid, 1, .@cid );
  167. .@size_guild = getguildmember( .@gid, 2, .@aid );
  168. if( .Options&4 ){
  169. .@master_cid = getguildmasterid( .@gid );
  170. .@index = inarray(.@cid, .@master_cid);
  171. .@master_aid = .@aid[.@index];
  172. cleararray( .@cid, 0, .@size_guild );
  173. cleararray( .@aid, 0, .@size_guild );
  174. .@size_guild = 1;
  175. .@cid[0] = .@master_cid;
  176. .@aid[0] = .@master_aid;
  177. }
  178. for(set .@j,0; .@j<.@size_guild; set .@j,.@j+1) {
  179. if ((.Options&8) && !(.Options&4)) {
  180. if (isloggedin(.@aid[.@j],.@cid[.@j]))
  181. set .@ip$, replacestr(getcharip(.@aid[.@j]),".","a");
  182. else {
  183. if (query_sql("SELECT `last_ip` FROM `login` WHERE `account_id` = '" + .@aid[.@j] + "'", .@last_ip$) < 1)
  184. continue;
  185. .@ip$ = replacestr(.@last_ip$, ".", "a");
  186. }
  187. if (getd(".@ip_"+.@i+"_"+.@ip$)) continue;
  188. setd ".@ip_"+.@i+"_"+.@ip$,1;
  189. }
  190. if (.Options&2) {
  191. .@charid = .@cid[.@j];
  192. .@sender$ = "no-reply";
  193. .@title$ = "** Siege Reward: "+getcastlename(.Castles$[.@i])+" **";
  194. .@body$ = "Brave one,\r\n \r\n Congratulations!\r\n Your guild has successfully occupied\r\n territory in the War of Emperium on\r\n "+.@str$+".\r\n \r\n \r\n \r\n \r\n [ Your reward is attached. ]";
  195. if (.reward_id_size)
  196. mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny, .reward_id, .reward_amount;
  197. else
  198. mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny;
  199. if (PACKETVER < 20150513 && !getd(".@str_"+.@cid[.@j]) && isloggedin(.@aid[.@j],.@cid[.@j])) {
  200. setd ".@str_"+.@cid[.@j],1;
  201. message rid2name(.@aid[.@j]),"You've got mail!";
  202. }
  203. } else if (isloggedin(.@aid[.@j],.@cid[.@j])) {
  204. attachrid( .@aid[.@j], true );
  205. .@name$ = strcharinfo( 0 );
  206. .@castle_name$ = getcastlename(.Castles$[.@i]);
  207. for ( .@k = 0; .@k < .reward_id_size; .@k++ ) {
  208. if (checkweight(.reward_id[.@k], .reward_amount[.@k]))
  209. getitem .reward_id[.@k], .reward_amount[.@k];
  210. else
  211. dispbottom "You can't receive x" + .reward_amount[.@k] + " " + getitemname(.reward_id[.@k]) + " for conquering " + .@castle_name$ + " because you're overweight.";
  212. }
  213. Zeny += .reward_zeny;
  214. dispbottom "You have been rewarded for conquering " + .@castle_name$ + ".";
  215. detachrid;
  216. }
  217. }
  218. }
  219. }
  220. return;
  221. OnPCLoadMapEvent:
  222. if (!compare(strcharinfo(3),"g_cas")) end;
  223. if (((.AutoKick && .Active[0]) || (.NoOwner && !getcastledata(strcharinfo(3),1))) && !(.Active[0]&(1<<getd("."+strcharinfo(3))))) {
  224. if (getcharid(2) && getcastledata(strcharinfo(3),1) == getcharid(2)) end;
  225. sleep2 1000;
  226. message strcharinfo(0), getcastlename(strcharinfo(3))+" is currently inactive.";
  227. sleep2 5000;
  228. if (compare(strcharinfo(3),"g_cas")) warp "SavePoint",0,0;
  229. }
  230. end;
  231. OnMenu:
  232. while(1) {
  233. mes "[WOE Information]";
  234. if (agitcheck() || agitcheck2()) {
  235. if (.Active[0]) {
  236. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  237. if (gettime(DT_DAYOFWEEK) == $WOE_CONTROL[.@i] && gettime(DT_HOUR) >= $WOE_CONTROL[.@i+1] && gettime(DT_HOUR) < $WOE_CONTROL[.@i+2]) {
  238. set .@i, $WOE_CONTROL[.@i+2];
  239. break;
  240. }
  241. mes "The War of Emperium is ^0055FFactive^000000 until ^FF0000"+Add_Zero(.@i)+"^000000 in the following regions:";
  242. mes " ";
  243. for(set .@i,0; .@i<6; set .@i,.@i+1)
  244. if (.Active[1]&(1<<(.@i+1))) mes " > ^777777"+.Regions$[.@i]+"^000000";
  245. } else
  246. mes "The War of Emperium is ^0055FFactive^000000.";
  247. } else {
  248. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  249. if ((gettime(DT_DAYOFWEEK) == $WOE_CONTROL[.@i] && gettime(DT_HOUR) <= $WOE_CONTROL[.@i+1]) || gettime(DT_DAYOFWEEK) < $WOE_CONTROL[.@i]) {
  250. setarray .@time[0],$WOE_CONTROL[.@i],$WOE_CONTROL[.@i+1];
  251. break;
  252. }
  253. if (!getarraysize(.@time))
  254. setarray .@time[0],$WOE_CONTROL[0],$WOE_CONTROL[1];
  255. mes "The War of Emperium is ^777777inactive^000000.";
  256. if (.Size) {
  257. mes " ";
  258. mes "The next session will begin";
  259. mes "on ^0055FF"+.Days$[.@time[0]]+"^000000 at "+Add_Zero(.@time[1])+"^000000.";
  260. }
  261. }
  262. next;
  263. switch(select(""+((.CastleWarp || .Active[1])?" ~ Warp to castles...":"")+": ~ Check schedule...: ~ View castle owners...:"+((getgmlevel()<.GMAccess || !getgmlevel())?"":" ~ Manage sessions...")+": ~ ^777777Cancel^000000")) {
  264. case 1:
  265. if (.CastleWarp) set .@clr$,"^0055FF";
  266. set .@menu$,"";
  267. for(set .@i,0; .@i<6; set .@i,.@i+1) {
  268. if (.CastleWarp || .Active[1]&(1<<(.@i+1)))
  269. set .@menu$, .@menu$+" ~ "+((.Active[1]&(1<<(.@i+1)))?.@clr$:"^777777")+.Regions$[.@i]+" Castles^000000";
  270. set .@menu$, .@menu$+":";
  271. }
  272. set .@i, select(.@menu$)-1;
  273. set .@menu$,"";
  274. for(set .@j,.@i*5; .@j<(.@i*5)+5; set .@j,.@j+1) {
  275. if (.CastleWarp || .Active[0]&(1<<.@j))
  276. set .@menu$, .@menu$+" ~ "+((.Active[0]&(1<<.@j))?.@clr$:"^777777")+getcastlename(.Castles$[.@j])+"^000000";
  277. set .@menu$, .@menu$+":";
  278. }
  279. set .@j, select(.@menu$)-1;
  280. warp .Map$[.@i],.MapX[(.@i*5)+.@j],.MapY[(.@i*5)+.@j];
  281. close;
  282. case 2:
  283. mes "[Schedule]";
  284. if (.Size) {
  285. freeloop(1);
  286. for(set .@i,0; .@i<.Size; set .@i,.@i+4) {
  287. mes "> ^FF0000"+.Days$[$WOE_CONTROL[.@i]]+" ("+Add_Zero($WOE_CONTROL[.@i+1])+"-"+Add_Zero($WOE_CONTROL[.@i+2])+")^000000";
  288. for(set .@j,0; .@j<getarraysize(.Castles$); set .@j,.@j+1)
  289. if ($WOE_CONTROL[.@i+3]&(1<<.@j)) mes " ~ "+getcastlename(.Castles$[.@j])+" ^777777("+.Castles$[.@j]+")^000000";
  290. if (.@i+4 < .Size) mes " ";
  291. }
  292. freeloop(0);
  293. } else
  294. mes "No times are configured.";
  295. next;
  296. break;
  297. case 3:
  298. mes "[Castle Ownership]";
  299. for(set .@i,0; .@i<6; set .@i,.@i+1) {
  300. set .@k, .@i*5;
  301. mes "> ^FF0000"+.Regions$[.@i]+"^000000";
  302. for(set .@j,.@k; .@j<(.@k+5); set .@j,.@j+1) {
  303. set .@t, getcastledata(.Castles$[.@j],1);
  304. mes " ~ "+getcastlename(.Castles$[.@j])+": "+((.@t)?"^0055FF"+getguildname(.@t):"^777777unoccupied")+"^000000";
  305. }
  306. if (.@i < 5) mes " ";
  307. }
  308. next;
  309. break;
  310. case 4:
  311. while(1) {
  312. mes "[Session Manager]";
  313. mes "There are ^0055FF"+(.Size/4)+" session(s)^000000 configured.";
  314. mes "What would you like to do?";
  315. next;
  316. switch(select(" ~ Add a session...: ~ Delete a session...: ~ Reload settings...:"+((agitcheck() || agitcheck2())?" ~ End WOE session...":"")+": ~ ^777777Go back^000000")) {
  317. case 1:
  318. mes "[New Session]";
  319. if (.Size > 127) {
  320. mes "You have already reached the maximum of 32 sessions.";
  321. next;
  322. break;
  323. }
  324. mes "Select a day.";
  325. next;
  326. set .@Day, select(" ~ "+implode(.Days$,": ~ "))-1;
  327. mes "[New Session]";
  328. mes "Select a start time for ^0055FF"+.Days$[.@Day]+"^000000.";
  329. next;
  330. set .@menu$,"";
  331. for(set .@i,0; .@i<23; set .@i,.@i+1)
  332. set .@menu$, .@menu$+" ~ "+Add_Zero(.@i,1)+":";
  333. set .@Start, select(.@menu$)-1;
  334. mes "[New Session]";
  335. mes "Select an end time for ^0055FF"+.Days$[.@Day]+"^000000.";
  336. next;
  337. set .@menu$,"";
  338. for(set .@i,.@Start+1; .@i<24; set.@i,.@i+1)
  339. set .@menu$, .@menu$+" ~ "+Add_Zero(.@i,1)+":";
  340. set .@End, select(.@menu$)+.@Start;
  341. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  342. if (.@Day == $WOE_CONTROL[.@i] &&
  343. ((.@Start >= $WOE_CONTROL[.@i+1] && .@Start < $WOE_CONTROL[.@i+2]) ||
  344. (.@End > $WOE_CONTROL[.@i+1] && .@End <= $WOE_CONTROL[.@i+2]) ||
  345. (.@Start <= $WOE_CONTROL[.@i+1] && .@End >= $WOE_CONTROL[.@i+2]))) {
  346. mes "[New Session]";
  347. mes "The chosen times overlap with an existing session.";
  348. next;
  349. set .@d,1;
  350. break;
  351. }
  352. if (.@d) { set .@d,0; break; }
  353. set .@Castle,0;
  354. while(1) {
  355. mes "[New Session]";
  356. mes "^0055FF"+.Days$[.@Day]+" ("+Add_Zero(.@Start)+"-"+Add_Zero(.@End)+")^000000";
  357. mes " > Castles:";
  358. if (!.@Castle)
  359. mes " ~ ^777777(none selected)^000000";
  360. else for(set .@i,0; .@i<getarraysize(.Castles$); set .@i,.@i+1)
  361. if (.@Castle&(1<<.@i)) mes " ~ "+getcastlename(.Castles$[.@i])+" ("+.Castles$[.@i]+")";
  362. next;
  363. set .@menu$,((.@Castle)?" ~ ^FF0000Finished...^000000":"")+":";
  364. for(set .@i,0; .@i<getarraysize(.Castles$); set .@i,.@i+1)
  365. set .@menu$, .@menu$+" ~ "+((.@Castle&(1<<.@i))?"^0055FF":"")+getcastlename(.Castles$[.@i])+" ("+.Castles$[.@i]+")^000000:";
  366. set .@i, select(.@menu$)-1;
  367. if (.@i)
  368. set .@Castle, .@Castle^(1<<(.@i-1));
  369. else {
  370. mes "[New Session]";
  371. mes "Are you sure?";
  372. next;
  373. switch(select(" ~ ^0055FFAdd session...^000000: ~ Continue selecting castles...: ~ ^777777Cancel^000000")) {
  374. case 1:
  375. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  376. if ((.@Day == $WOE_CONTROL[.@i] && .@End <= $WOE_CONTROL[.@i+1]) || .@Day < $WOE_CONTROL[.@i]) {
  377. set .@d,1;
  378. break;
  379. }
  380. if (!.@d) { set .@d,1; set .@i,.Size; }
  381. copyarray $WOE_CONTROL[.@i+4], $WOE_CONTROL[.@i], .Size-.@i;
  382. setarray $WOE_CONTROL[.@i], .@Day, .@Start, .@End, .@Castle;
  383. set .Size, getarraysize($WOE_CONTROL);
  384. case 3:
  385. mes "[New Session]";
  386. mes ((.@d)?"Session added.":"cancelled.");
  387. next;
  388. set .@d,1;
  389. case 2:
  390. break;
  391. }
  392. if (.@d) { set .@d,0; break; }
  393. }
  394. }
  395. break;
  396. case 2:
  397. mes "[Remove Session]";
  398. if (!.Size) {
  399. mes "There are no sessions configured.";
  400. next;
  401. break;
  402. }
  403. mes "Select a session to remove.";
  404. next;
  405. set .@menu$,"";
  406. for(set .@i,0; .@i<.Size; set .@i,.@i+4)
  407. set .@menu$, .@menu$+" ~ "+.Days$[$WOE_CONTROL[.@i]]+" ("+Add_Zero($WOE_CONTROL[.@i+1],1)+"-"+Add_Zero($WOE_CONTROL[.@i+2],1)+"):";
  408. set .@menu$, .@menu$+" ~ ^777777Cancel^000000";
  409. set .@i, select(.@menu$)-1;
  410. if (.@i == (.Size/4)) break;
  411. mes "[Remove Session]";
  412. mes "Delete ^0055FF"+.Days$[$WOE_CONTROL[.@i*4]]+"'s^000000 session?";
  413. mes "This action cannot be undone.";
  414. next;
  415. set .@j, select(" ~ ^FF0000Delete session...^000000: ~ ^777777Cancel^000000");
  416. mes "[Remove Session]";
  417. if (.@j == 2)
  418. mes "cancelled.";
  419. else {
  420. deletearray $WOE_CONTROL[.@i*4],4;
  421. set .Size, getarraysize($WOE_CONTROL);
  422. mes "Session deleted.";
  423. }
  424. next;
  425. break;
  426. case 3:
  427. mes "[Reload Settings]";
  428. mes "This will trigger all events related to new session configurations, if any.";
  429. if (agitcheck() || agitcheck2()) {
  430. mes " ";
  431. mes "Be aware that this will disrupt the current WOE session.";
  432. }
  433. next;
  434. set .@i, select(" ~ ^0055FFReload settings...^000000: ~ ^777777Cancel^000000");
  435. mes "[Reload Settings]";
  436. if (.@i == 2) mes "cancelled.";
  437. else {
  438. set .Init,1;
  439. donpcevent "WOE_CONTROL::OnMinute00";
  440. mes "Variables have been re-initialized.";
  441. }
  442. next;
  443. break;
  444. case 4:
  445. mes "[Force Agit End]";
  446. if (!agitcheck() && !agitcheck2()) {
  447. mes "WOE has already ended.";
  448. next;
  449. break;
  450. }
  451. mes "This command will safely execute all AgitEnd events.";
  452. mes " ";
  453. mes "Kill the current WOE session?";
  454. next;
  455. set .@i, select(" ~ ^FF0000End session...^000000:"+((.Options&1)?" ~ ^FF0000End session without rewards...^000000":"")+": ~ ^777777Cancel^000000");
  456. mes "[Force Agit End]";
  457. if (.@i == 3)
  458. mes "cancelled.";
  459. else {
  460. set .ForceEnd, .@i;
  461. donpcevent "WOE_CONTROL::OnWOEEnd";
  462. mes "WOE session terminated.";
  463. }
  464. next;
  465. break;
  466. case 5:
  467. set .@d,1; break;
  468. }
  469. if (.@d) { set .@d,0; break; }
  470. } break;
  471. case 5:
  472. close;
  473. } }
  474. }