//====================================================================================================== //= Toasty's WoE Controller (formerly WoE Info Banner) //====================================================================================================== - script WoEInfoBase -1,{ OnStartMenu: if(.init == 0) donpcevent strnpcinfo(3)+"::OnInit"; OnStartMenu2: mes "The " + ((.state)?"^00DD00current":"^DD0000next") + "^000000 WoE session is: "; mes " "; mes "Day: ^0000DD" + .daysOfWeek$[.woe_day[.woe_index]]; mes "^000000Start time: ^00DD00" + .woe_0_str$[.woe_index]; mes "^000000End time: ^DD0000" + .woe_1_str$[.woe_index]; mes "^000000Region:"; set .@state_strs$, ".woe_state_str_" + .woe_state[.woe_index] + "$"; for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { set .@output$, getd(.@state_strs$ + "[" + .@i + "]"); if(.@output$ != "") mes "^000000- ^0000DD" + .@output$; } next; //if( getcharid(3) == 2000002) if( getcharid(3) == 2000001 ) select( "Warp to Castle Grounds", "View Castle Owners", "View all WoE times", "Reset Ranking", "Set WoE Guilds" ); else if(getgmlevel() >= .gm_access) select( "Warp to Castle Grounds", "View Castle Owners", "View all WoE times", "Reset Ranking", "Set WoE Guilds", ((!.state)?"Start next WoE":"End current WoE"), ((.state)?"":"Skip next WoE session") ); else select( "Warp to Castle Grounds", "View Castle Owners", "View all WoE times"); switch(@menu) { case 1: //warp //mes "Good luck, fella!"; //next; //select(.region_warp$[.woe_state[.woe_index]]); //if(@menu < 1 || @menu > .num_regions) //close; //close2; //dispbottom "map: " + .region_warp$[.woe_state[.woe_index]]; //warp .region_maps$[@menu - 1], .region_x[@menu - 1], .region_y[@menu - 1]; // PROPER WARP BY : HaringJ if(compare(.region_warp$[.woe_state[.woe_index]], "Himinn")) { warp "sch_gld",293,100; } else if (compare(.region_warp$[.woe_state[.woe_index]], "Cyr")) { warp "aru_gld",83,47; } else if (compare(.region_warp$[.woe_state[.woe_index]], "Andlangr")) { warp "sch_gld",288,252; } else if (compare(.region_warp$[.woe_state[.woe_index]], "Viblainn")) { warp "sch_gld",97,196; } else if (compare(.region_warp$[.woe_state[.woe_index]], "Horn")) { warp "aru_gld",68,155; } else if (compare(.region_warp$[.woe_state[.woe_index]], "Mardol")) { warp "aru_gld",162,264; } break; // guild warps // aru_gld // mardol 158, 272 arug_cas01 // cyr 83, 47 arug_cas02 // horn 68, 155 arug_cas03 // gefn 299, 345 arug_cas04 // banadis 292, 107 arug_cas05 // sch_gld // Himinn 293, 100 schg_cas01 // Andlangr 288, 252 schg_cas02 // Vidblain 97, 196 schg_cas03 // Hljod 137, 90 schg_cas04 // Skidbladnir 71, 315 schg_cas05 case 2: //view set .@woe_state_array$, ".woe_state_" + .woe_state[.woe_index]; for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { set .@k, 0; set .@castles$, ".castles_" + .regions$[.@i] + "$"; set .@castle_check, getd(.@woe_state_array$ + "[" + .@i + "]"); while(.@castle_check && .@k < .num_castles[.@i]) { if(.@castle_check & (1 << .@k)) { set .@map$, getd(.@castles$+"["+.@k+"]"); if (GetCastleData(.@map$,1)) { dispbottom "The [" + GetCastleName(.@map$) + "] castle of the [" + .region_names$[.@i] + "] region is currently held by the [" + GetGuildName(GetCastleData(.@map$,1)) + "] guild."; } else { dispbottom "The [" + GetCastleName(.@map$) + "] castle of the [" + .region_names$[.@i] + "] region is currently unoccupied."; } set .@castle_check, .@castle_check - (1 << .@k); } set .@k, .@k + 1; } } break; case 3: //woe times for(set .@i, 0; .@i < .num_woes; set .@i, .@i + 1) { dispbottom "- " + .daysOfWeek$[.woe_day[.@i]] + " " + .woe_0_str$[.@i] + "-" + .woe_1_str$[.@i]; set .@woe_state_str_array$, ".woe_state_str_" + .woe_state[.@i] + "$"; for(set .@k, 0; .@k < .num_regions; set .@k, .@k + 1) { set .@output$, getd(.@woe_state_str_array$ + "[" + .@k + "]"); if(.@output$ != "") dispbottom " " + .@output$; } } break; case 6: //start next; if(getgmlevel() <.gm_access) close; mes "^FF0000Are you sure you want to " + ((!.state)?"start the next WoE session?":"end the current WoE session?"); next; if(select("Yes:No") == 2) break; set .remainTime, 0; //might not work sometimes...you have like a 500ms window out of 505ms i guess.. sleep2 .timer_refresh_rate; //wait abit so the menu doesn't screw up (how long it takes for the timer to update) break; case 7: //skip next; if(getgmlevel() <.gm_access || .state) close; mes "^FF0000Are you sure you want to skip the next WoE session^000000"; next; if(select("Yes:No") == 2) break; if(.state) { //you really can't do this with woe active next; mes "Sorry, in the time you took making your decision, WoE started"; mes "Please either manually end it first or wait"; break; } set .woe_index, (.woe_index + 1) % .num_woes; donpcevent strnpcinfo(3)+"::OnUpdateCountTick"; sleep2 .timer_refresh_rate; break; case 4: //Reset Rank if( getcharid(3) != 2000001 && getgmlevel() < .gm_access ) close; //if( getcharid(3) != 2000002 && getcharid(3) != 2000185 && getcharid(3) != 2000008 ) close; //if(getgmlevel() < .gm_access) close; mes "^FF0000Are you sure you want to reset the WoE ranking?^000000"; next; if(select("Yes:No") == 2) break; atcommand "@rankreset 1"; //rankreset 0; // WoE Ranking Restart //query_sql "TRUNCATE TABLE `char_wstats`"; //query_sql "TRUNCATE TABLE `char_woe_log`"; //query_sql "TRUNCATE TABLE `skill_count`"; close; break; case 5: //Woe Guilds *Mash //if( getcharid(3) != 2000002 ) close; if( getcharid(3) != 2000001 ) close; menu "Register Guild",-,"Delete Registered Guild.",W_DReg,"Clear All Registered Guild",W_Clear,"Set WOE CAP",W_Cap,"View Registered Guilds",W_ViewGuilds; //query_sql "SELECT `guild`.`guild_id`,`guild`.`name`,COUNT(`guild_member`.`guild_id`) AS gOnline, `guild`.`isWOE` FROM `guild` left JOIN `guild_member` ON `guild_member`.`guild_id` = `guild`.`guild_id` AND `guild_member`.`online` = 1 GROUP BY `guild`.`guild_id` ORDER BY `guild`.`isWOE` DESC, `guild`.`connect_member` DESC", .@gid,.@gname$,.@online,.@gCap; mes "Input Guild Name"; input .@guildname$; query_sql "SELECT `guild_id`,`name` FROM `guild` WHERE `name` LIKE '%"+.@guildname$+"%' ",.@guildid,.@mgname$; if(.@guildid != 0) { for (set .@i,0; .@i < getarraysize(.@guildid); set .@i,.@i+1) set .@menu$, .@menu$ + .@mgname$[.@i]+ ":"; mes "Select a guild:"; set .@num, select(.@menu$); for ( .@c = 0; .@c < getarraysize($guildRegistered); .@c++ ) if($guildRegistered[.@c] == .@guildid[.@num-1]) { mes "Guild already registered"; close; } for ( .@c = 0; .@c < getarraysize($mbkGuild); .@c++ ) if($mbkGuild[.@c] == .@guildid[.@num-1]) { mes "Guild already registered in MBK"; close; } menu "Register Guild",-,"Registered as MBK Guild.",W_RegMBK; set $guildRegistered[getarraysize($guildRegistered)], $guildRegistered + .@guildid[.@num-1]; close; W_RegMBK: set $mbkGuild[getarraysize($mbkGuild)], .@guildid[.@num-1]; close; //mes .@guildid[.@num-1]; } else mes "No guild found."; //mes "Guild ID " + .@gid[.@num-1]; //mes "Guild Name " + .@gname$[.@num-1]; //input .@setgcap; //query_sql "UPDATE `guild` SET `isWOE` = "+.@setgcap+" WHERE `guild_id` = "+.@gid[.@num-1]; close; W_DReg: query_sql "SELECT `guild`.`guild_id`,`guild`.`name`,COUNT(`guild_member`.`guild_id`) AS gOnline, `guild`.`isWOE` FROM `guild` left JOIN `guild_member` ON `guild_member`.`guild_id` = `guild`.`guild_id` AND `guild_member`.`online` = 1 WHERE `guild`.`isWOE` > 0 GROUP BY `guild`.`guild_id` ORDER BY `guild`.`isWOE` DESC, `guild`.`connect_member` DESC", .@gid,.@gname$,.@online,.@gCap; //query_sql "SELECT `guild_id`,`name`,`connect_member`,`isWOE` FROM `guild` WHERE isWOE > 0 ORDER BY `isWOE` DESC, `connect_member` DESC", .@gid,.@gname$,.@online,.@gCap; for (set .@i,0; .@i < getarraysize(.@gname$); set .@i,.@i+1) { if (.@online[.@i] > 0) set .@menu$, .@menu$ + .@gname$[.@i]+ " (^27ae59"+.@online[.@i] +"^000000) [^FF0000"+.@gCap[.@i]+"^000000 cap] :"; else set .@menu$, .@menu$ + .@gname$[.@i]+ "[^FF0000"+.@gCap[.@i]+"^000000 cap] :"; } mes "Select a guild:"; set .@num, select(.@menu$); //mes "Guild ID " + .@gid[.@num-1]; //mes "Guild Name " + .@gname$[.@num-1]; //input .@setgcap; query_sql "UPDATE `guild` SET `isWOE` = 0 WHERE `guild_id` = "+.@gid[.@num-1]; close; W_Clear: mes "^FF0000Are you sure you want to clear all the registered guilds?^000000"; next; if(select("Yes:No") == 2) break; cleararray $mbkGuild[0],0,getarraysize($mbkGuild); cleararray $guildRegistered[0],0,getarraysize($guildRegistered); //query_sql "UPDATE `guild` set `isWOE` = 0"; close; W_Cap: mes "Guild Cap [ ^ff0000"+ $guildCap+" ^000000]"; mes "MBK Cap [ ^ff0000"+ $mbkCap+" ^000000]"; menu "Set Guild Cap",-,"Set MBK Cap.",W_SMbk,"Clear WOE CAP",W_ClearWOECAP; mes "Input Guild Cap"; input .@gCap; set $guildCap, .@gCap; close; W_SMbk: mes "Input MBK Cap"; input .@mbkCap; set $mbkCap, .@mbkCap; close; W_ClearWOECAP: mes "^FF0000Are you sure you want to clear the WoE Cap?^000000"; next; if(select("Yes:No") == 2) break; set $guildCap, 0; set $mbkCap, 0; close; W_ViewGuilds: for ( .@c = 0; .@c < getarraysize($guildRegistered); .@c++ ) { if (.@c == getarraysize($guildRegistered) -1) set .@gID$, .@gID$ + $guildRegistered[.@c]; else set .@gID$, .@gID$ + $guildRegistered[.@c]+ ","; } if (getarraysize($guildRegistered) < 0) query_sql "SELECT `name` FROM `guild` WHERE `guild_id` IN ("+.@gID$+") ",.@gname$; for ( .@c = 0; .@c < getarraysize($mbkGuild); .@c++ ) { if (.@c == getarraysize($mbkGuild) -1) set .@mgID$, .@mgID$ + $mbkGuild[.@c]; else set .@mgID$, .@mgID$ + $mbkGuild[.@c]+ ","; } //mes .@mgID$; query_sql "SELECT `name` FROM `guild` WHERE `guild_id` IN ("+.@mgID$+") ",.@mgname$; mes "----Registered Guilds ("+getarraysize($guildRegistered)+")----"; if (getarraysize($guildRegistered) < 0) for (set .@i,0; .@i < getarraysize(.@gname$); set .@i,.@i+1) mes .@gname$[.@i]; mes "----MBK Guilds ("+getarraysize($mbkGuild)+")----"; for (set .@i,0; .@i < getarraysize(.@mgname$); set .@i,.@i+1) mes .@mgname$[.@i]; //close; //cleararray @array[0],0,getarraysize(@array); break; default: close; } goto OnStartMenu2; OnInit: //-----------------------------------------------------------------------------------------// //CONFIG START // //-----------------------------------------------------------------------------------------// set .gm_access, 60; //WoE timings needs to be ordered ascendingly unless you want to do weird //stuff like skip a region every other week or so... //Also times can't overlap. Uses second of day(gettimetick(1)) for timing // eg 1am -> 3600, 2:30pm -> 52200, midnight -> 86400 (anything past that doesn't work) //Note: woe_0 is start times, woe_1 is end times. Ignore how it's called but // don't change it either since it's dynamically used // Also..woe has to end on the same day it starts (it's easier that way..) setarray .woe_day[0], 0, 1, 2, 3, 4, 5, 6; setarray .woe_0[0], 79200,14400,79200,79200,75600,72000,79200; setarray .woe_1[0], 86400,21600,86400,86400,82800,79200,86400; setarray .woe_state[0], 4, 2, 2, 0, 2, 5, 0; //WoE state settings. Every WoE session can be defined as a particular state of castle configuration. //.woe_state_#[%] = $ // # - state number // % - region number // $ - binary representation of castles that are active for that region in that state ( // (ie. 0 is no castles, 5 is castle 0 and 2 (2^0 + 2^2 = 5)) //******Mash //0,0,0,0,1,0,0; //Mardol //0,0,0,0,2,0,0; //Cyr //0,0,0,0,4,0,0; //Horn //0,0,0,0,0,1,0; //Himinn //0,0,0,0,0,2,0; //Andlangr //0,0,0,0,0,4,0; //Vidblainn //********** setarray .woe_state_0[0],0,0,0,0,1,0,0; //Mardol setarray .woe_state_1[0],0,0,0,0,2,0,0; //Cyr setarray .woe_state_2[0],0,0,0,0,4,0,0; //Horn setarray .woe_state_3[0],0,0,0,0,0,1,0; //Himinn setarray .woe_state_4[0],0,0,0,0,0,2,0; //Andlangr setarray .woe_state_5[0],0,0,0,0,0,4,0; //Vidblainn setarray .woe_state_6[0],0,0,0,0,1,0,0; //Mardol //Setting for if script handles WoE controller function. Disable agit_controller.txt if you are using this. //For if you want to use something else to handle your woe stuff but only this script //to show info (1 - on, 0 - off...duh) set .active_woe, 1; //WoE inactive on map notifier. Basically notifies player if the castle they are entering is //WoE active or not set .notify_woe, 1; //-----------------------------------------------------------------------------------------// //CONFIG END // //-----------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------// //CONSTANTS START - Don't touch this unless you know what you are doing // //-----------------------------------------------------------------------------------------// //castle maps by region setarray .castles_prtg$[0],"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05"; setarray .castles_payg$[0],"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05"; setarray .castles_gefg$[0],"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05"; setarray .castles_aldeg$[0],"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05"; setarray .castles_arug$[0],"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05"; setarray .castles_schg$[0],"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05"; setarray .castles_novi$[0],"nguild_alde","nguild_gef","nguild_pay","nguild_prt"; //woe kill functions for each castle // setarray .woe_kill_prtg$[0],"Agit#prtg_cas01::OnAgitEnd","Agit#prtg_cas02::OnAgitEnd","Agit#prtg_cas03::OnAgitEnd","Agit#prtg_cas04::OnAgitEnd","Agit#prtg_cas05::OnAgitEnd"; // setarray .woe_kill_payg$[0],"Agit#payg_cas01::OnAgitEnd","Agit#payg_cas02::OnAgitEnd","Agit#payg_cas03::OnAgitEnd","Agit#payg_cas04::OnAgitEnd","Agit#payg_cas05::OnAgitEnd"; // setarray .woe_kill_gefg$[0],"Agit#gefg_cas01::OnAgitEnd","Agit#gefg_cas02::OnAgitEnd","Agit#gefg_cas03::OnAgitEnd","Agit#gefg_cas04::OnAgitEnd","Agit#gefg_cas05::OnAgitEnd"; // setarray .woe_kill_aldeg$[0],"Agit#aldeg_cas01::OnAgitEnd","Agit#aldeg_cas02::OnAgitEnd","Agit#aldeg_cas03::OnAgitEnd","Agit#aldeg_cas04::OnAgitEnd","Agit#aldeg_cas05::OnAgitEnd"; setarray .woe_kill_arug$[0],"Manager#aru01_02::OnAgitEnd2","Manager#aru02_02::OnAgitEnd2","Manager#aru03_02::OnAgitEnd2","Manager#aru04_02::OnAgitEnd2","Manager#aru05_02::OnAgitEnd2"; setarray .woe_kill_schg$[0],"Manager#sch01_02::OnAgitEnd2","Manager#sch02_02::OnAgitEnd2","Manager#sch03_02::OnAgitEnd2","Manager#sch04_02::OnAgitEnd2","Manager#sch05_02::OnAgitEnd2"; //setarray .woe_kill_novi$[0],"Agit_N01::OnAgitEnd","Agit_N02::OnAgitEnd","Agit_N03::OnAgitEnd","Agit_N04::OnAgitEnd"; //region prefixs setarray .regions$[0],"prtg","payg","gefg","aldeg","arug","schg","novi"; //region info setarray .region_names$[0],"Prontera", "Payon", "Geffen", "Aldebaran", "Arunafeltz", "Schwarzwald", "Novice Castles"; setarray .region_maps$[0],"prt_gld", "pay_gld", "gef_fild13", "alde_gld", "aru_gld", "sch_gld", "prontera"; //coords to warp player to region (0 is random) setarray .region_x[0],293, 83, 0, 0, 0, 0, 148; setarray .region_y[0],100, 47, 0, 0, 0, 0, 163; setarray .waitMsg$[0], "WoE Starts: ", "WoE Ends: "; setarray .startMsg$[0], "WoE is Starting", "WoE is Ending"; set .ticks_in_day, 86400; //mmm...magic numbers setarray .daysOfWeek$[0], "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"; set .timer_refresh_rate, 500; //how many ms per timer refresh...keep less than 1000 (in milliseconds) set .change_state_sleep, 3000; //how long to show "WoE is Start|End-ing" msg for in ms. (in milliseconds) //Make sure WoE sessions are longer than this xD set .banner_refresh_rate, 10; //how many seconds per banner refresh...keep 1 or above (in seconds) //-----------------------------------------------------------------------------------------// //CONSTANTS END // //-----------------------------------------------------------------------------------------// set .num_regions, getarraysize(.regions$); set .num_woes, getarraysize(.woe_1); //force WoE to end if active callfunc "WoEToggler", 0; for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { //count num castles per region set .num_castles[.@i], getarraysize(getd(".castles_" + .regions$[.@i] + "$")); } //convert timestamps to readable format for(set .@i, 0; .@i < .num_woes; set .@i, .@i + 1) { set .@hrs, .woe_0[.@i] / 3600; set .@mins, .woe_0[.@i] % 3600 / 60; set .@output$, ((.@hrs % 12)?.@hrs%12:12) + ":" + ((.@mins < 10)?"0"+.@mins:.@mins) + " " + ((.@hrs > 12)?"PM":"AM"); set .woe_0_str$[.@i], .@output$; set .@hrs, .woe_1[.@i] / 3600; set .@mins, .woe_1[.@i] % 3600 / 60; set .@output$, ((.@hrs % 12)?.@hrs%12:12) + ":" + ((.@mins < 10)?"0"+.@mins:.@mins) + " " + ((.@hrs > 12)?"PM":"AM"); set .woe_1_str$[.@i], .@output$; } //calc number of woe states and consolidate states to create list of castles used set .num_states, 0; while(getarraysize(getd(".woe_state_" + (.num_states)))) { set .@state$, ".woe_state_" + .num_states; set .@i, 0; while(.@i < getarraysize(getd(.@state$))) { set .castleUsage[.@i], .castleUsage[.@i] | getd(.@state$ + "[" + .@i + "]"); set .@i, .@i + 1; } set .num_states, .num_states + 1; } for(set .@i, 0; .@i < .num_states; set .@i, .@i + 1) { set .@woe_state_array$, ".woe_state_" + .@i; for(set .@k, 0; .@k < .num_regions; set .@k, .@k + 1) { if(.castleUsage[.@k] > 0) { set .@castles$, ".castles_" + .regions$[.@k] + "$"; set .@castle_check, getd(.@woe_state_array$ + "[" + .@k + "]"); if(.@castle_check == 0) { //region not in this state //region warp menu string set .region_warp$[.@i], .region_warp$[.@i] + "^DD0000" + .region_names$[.@k] + "^000000:"; continue; } else { if(.@castle_check >= ((1 << .num_castles[.@k]) - 1)) { //includes all castles...just list as region. setd(".woe_state_str_" + .@i + "$[" + .@k + "]", .region_names$[.@k]); //region warp menu string //set .region_warp$[.@i], .region_warp$[.@i] + "^00DD00" + .region_names$[.@k] + "^000000:"; set .region_warp$[.@i], .@output$; } else { set .@j, 0; set .@output$, ""; while(.@j < .num_castles[.@k]) { if(.@castle_check & (1 << .@j)) { set .@output$, .@output$ + GetCastleName(getd(.@castles$+"["+.@j+"]")); set .@castle_check, .@castle_check - (1 << .@j); if(.@castle_check) { if(.@output$ != "") set .@output$, .@output$ + ", "; } else break; } set .@j, .@j + 1; } setd(".woe_state_str_" + .@i + "$[" + .@k + "]", .region_names$[.@k] + " ("+ .@output$ + ")"); //region warp menu string //set .region_warp$[.@i], .region_warp$[.@i] + "^00DD00" + .region_names$[.@k] + " ("+ .@output$ + ")^000000:"; set .region_warp$[.@i], .@output$; } } } else { set .region_warp$[.@i], .region_warp$[.@i] + ":"; } } } donpcevent strnpcinfo(3)+"::OnFindCurIndex"; donpcevent strnpcinfo(3)+"::OnUpdateCountTick"; if(.active_woe) { if(.notify_woe) { //set mapflag for all castle maps for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { set .@region_array$, ".castles_" + .regions$[.@i] + "$"; for(set .@k, 0; .@k < .num_castles[.@i]; set .@k, .@k + 1) { setmapflag getd(.@region_array$ + "[" + .@k + "]"), mf_loadevent; setd(".loadmap_region_" + getd(.@region_array$ + "[" + .@k + "]"), .@i + 1); setd(".loadmap_castleIndex_" + getd(.@region_array$ + "[" + .@k + "]"), .@k); } } } //activates WoE if needed donpcevent strnpcinfo(3)+"::OnDoWoE"; } //flag that init occured set .init, 1; OnWoETimer: //timer stuff while (1) { set .remainTime, .count_tick - gettimetick(2); set .bannerTimer, .remainTime - (.remainTime % .banner_refresh_rate) + .banner_refresh_rate; set .min, .bannerTimer / 60; set .sec, .bannerTimer - .min * 60; set .hr, .min / 60; set .min, .min - .hr * 60; set .roomMsg$, .waitMsg$[.state] + .hr + ":" + ((.min < 10 )?"0":"") + .min + ":" + ((.sec < 10 )?"0":"") + .sec; sleep .timer_refresh_rate; if(.remainTime <= 0) { if(.active_woe) { donpcevent strnpcinfo(3)+"::OnDoWoE"; } set .roomMsg$, .startMsg$[.state]; set .woe_index, (.woe_index + .state) % .num_woes; //go to next index if needed set .state, (.state + 1) % 2; //flip state donpcevent strnpcinfo(3)+"::OnUpdateCountTick"; sleep .change_state_sleep; } } end; //obligatory end =D OnUpdateCountTick: set .count_tick, getd(".woe_" + .state + "[" + .woe_index + "]"); set .count_tick, gettimetick(2) + .count_tick - gettimetick(1) + (.woe_day[.woe_index] - gettime(4) + 7) % 7 * .ticks_in_day; if(gettimetick(2) > .count_tick) set .count_tick, .count_tick + 7 * .ticks_in_day; end; OnFindCurIndex: set .@cur_day, gettime(4); set .@cur_tick, gettimetick(1); set .woe_index, 0; set .state, 0; for(set .@i, 0; .@i < .num_woes; set .@i, .@i + 1) { if(.woe_day[.@i] < .@cur_day) continue; if(.woe_day[.@i] == .@cur_day) { if(.woe_0[.@i] >= .@cur_tick) { set .woe_index, .@i; set .state, 0; break; } if(.woe_1[.@i] >= .@cur_tick) { set .woe_index, .@i; set .state, 1; break; } } if(.woe_day[.@i] > .@cur_day) { set .woe_index, .@i; set .state, 0; break; } } end; //On map notifier //Comment out OnPCLoadMapEvent label if .notify_woe is disabled to prevent unnecessary triggering OnPCLoadMapEvent: if(.state && .notify_woe) { getmapxy(.@map$, .@x, .@y, 0); set .@region, getd(".loadmap_region_" + .@map$) - 1; if(.@region >= 0) { set .@castleIndex, getd(".loadmap_castleIndex_" + .@map$); if(getd(".woe_state_" + .woe_state[.woe_index] + "[" + .@region + "]") & 1 << .@castleIndex) dispbottom "The [" + GetCastleName(.@map$) + "] castle is available for conquering during this WoE session"; else dispbottom "The [" + GetCastleName(.@map$) + "] castle is NOT available for conquering during this WoE session"; } } end; //------------------------------------------------------------------------------ // WoE Controller Stuff Here //------------------------------------------------------------------------------ OnDoWoE: if((.state == 0 && .init) || (.state == 1 && !agitcheck())) { //starting callfunc "WoEToggler", 1; //kills WoE in all castles that shouldn't have WoE set .@woe_state_array$, ".woe_state_" + .woe_state[.woe_index]; for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { set .@castles$, ".castles_" + .regions$[.@i] + "$"; set .@castle_check, getd(.@woe_state_array$ + "[" + .@i + "]"); for(set .@k, 0; .@k < .num_castles[.@i]; set .@k, .@k + 1) { set .@map$, getd(.@castles$+"["+.@k+"]"); if((.@castle_check & (1 << .@k)) == 0) { donpcevent getd(".woe_kill_" + .regions$[.@i] + "$[" + .@k + "]"); } } } //rankreset 0; // WoE Ranking Restart announce "The War Of Emperium has begun!",bc_all; donpcevent strnpcinfo(3)+"::OnDisplayOwners"; } else { //ending if(agitcheck()) { callfunc "WoEToggler", 0; announce "The War Of Emperium is over!",bc_all; donpcevent strnpcinfo(3)+"::OnDisplayOwners"; } } end; OnDisplayOwners: //displays based on current region set .@woe_state_array$, ".woe_state_" + .woe_state[.woe_index]; for(set .@i, 0; .@i < .num_regions; set .@i, .@i + 1) { set .@k, 0; set .@castle_check, getd(.@woe_state_array$ + "[" + .@i + "]"); set .@castles$, ".castles_" + .regions$[.@i] + "$"; while(.@castle_check && .@k < .num_castles[.@i]) { if(.@castle_check & (1 << .@k)) { set .@map$, getd(.@castles$+"["+.@k+"]"); if (GetCastleData(.@map$,1)) { announce "The [" + GetCastleName(.@map$) + "] castle of the [" + .region_names$[.@i] + "] region is currently held by the [" + GetGuildName(GetCastleData(.@map$,1)) + "] guild.",bc_all; } else { announce "The [" + GetCastleName(.@map$) + "] castle of the [" + .region_names$[.@i] + "] region is currently unoccupied.",bc_all; } set .@castle_check, .@castle_check - (1 << .@k); } set .@k, .@k + 1; } } end; } prt_pvp,45,70,5 script WoE Info 837,{ if(getwaitingroomstate(3, strnpcinfo(3)) == -1) donpcevent strnpcinfo(3)+"::OnInit"; doevent "WoEInfoBase::OnStartMenu"; end; OnInit: while (1) { //only updates if msg is different set .banner$, getwaitingroomstate(4, strnpcinfo(3)); if(getvariableofnpc(.roomMsg$, "WoEInfoBase") != .banner$) { delwaitingroom; waitingroom getvariableofnpc(.roomMsg$, "WoEInfoBase"), 0; } sleep 500; } end; } //--------------------------------------------------------------------------------------------------------------------- function script WoEToggler { // = 0|1 if(getarg(0)) { //AgitStart; AgitStart2; //query_sql "UPDATE woe_status SET status = 1"; } else { //AgitEnd; AgitEnd2; //query_sql "UPDATE woe_status SET status = 0"; } return; } //zomg! it duplicates!! // florian,103,150,6 duplicate(WoE Info) WoE Info#167winfo 837 // sky_quest,51,49,6 duplicate(WoE Info) WoE Spectator#Spectator 837 // payon,166,238,6 duplicate(WoE Info) WoE Info#167winfo2 837 // morocc,158,97,6 duplicate(WoE Info) WoE Info#morroc 837 // izlude,129,115,6 duplicate(WoE Info) WoE Info#izlude 837 //--------------------------------------------------------------------------------------------------------------------- // - script MashWoe -1,{ // set .@gcount, 20; //gmem count // set .@mbkcount, 2; //MBK shit // OnPCLoadMapEvent: // if (compare("schg_cas01|schg_cas02|schg_cas03|schg_cas04|schg_cas05|arug_cas01|arug_cas02|arug_cas03|arug_cas04|arug_cas05", strcharinfo(3))) // { // if(getgmlevel() > .@gm) end; // if( getcharid(2) == 0 && (BaseLevel > 1 || JobLevel > 1 || Class != Job_Novice ) ) //Guildless Motherfucker & Novice lvl 1 only // { // //message strcharinfo(0), "You either need to be a member of a registered guild or a Level 1 Novice to spectate."; // message strcharinfo(0), "Spectator Disabled."; // //message strcharinfo(0), "Only members of a guild are allowed here!"; // warp "florian",93,153; // end; // } // // if(BaseLevel == 1 && JobLevel == 1 && (Class == Job_Novice || Class == Job_Xmas ) && !checkoption(0x40)) // // { // // setoption 0x40, 1; // // //atcommand "@job 26"; // // //callfunc "Job_Change", 26; // // //set @target_job, 26; // // //setoption 0x40 | Option_Xmas, 1; // // //atcommand "@mute 120 "+ strcharinfo(0); // // //set Manner,-120; // // sc_start SC_NOCHAT,-1,0; // // atcommand "@damageignore"; // // atcommand "@speed 0"; // // } // query_sql "SELECT `isWOE` FROM `guild` WHERE `guild_id` = " +getcharid(2)+ " ",.@isWOE; // query_sql "SELECT COUNT(`guild_id`) FROM `guild_member` WHERE `guild_id`= " +getcharid(2)+ " ",.@onlineCount; // if( .@isWOE == 0 && getcharid(2) != 0){ // //message strcharinfo(0), "Only registered guilds are allowed here!"; // message strcharinfo(0), "Spectator Disabled."; // warp "florian",93,153; // end; // } // //message strcharinfo(0), "iswoe: " + .@isWOE; // //message strcharinfo(0), "mnbkcount: " + .@mbkcount; // //message strcharinfo(0), "OnlineCount: " + .@onlineCount; // if ( .@isWOE == 22 && .@onlineCount > 22 ) { // message strcharinfo(0), "Your guild members are over the limit"; // warp "florian", 93,153; // } // //if ( .@isWOE == 2 ) // //{ // // message strcharinfo(0), "Registered as mbk"; // //} // if ( .@isWOE == 2 && .@onlineCount > 2 ) { // message strcharinfo(0), "Your MBK guild members are over the limit"; // warp "florian", 93,153; // } // } // end; // OnPCLogoutEvent: // if(Class == Job_Xmas || checkoption(0x40)) // { // setoption 0x40 | Option_Xmas, 0; // //atcommand "@job 0"; // //callfunc "Job_Change", 0; // //set @target_job, 26; // atcommand "@damageignore"; // //set Manner,0; // //sc_end SC_NOCHAT; // atcommand "@unmute "+ strcharinfo(0); // //set Weight, 150; // //atcommand "@unmute "+ strcharinfo(0); // } // end; // } - script MashWoe -1,{ OnPCLoadMapEvent: if (compare("schg_cas01|schg_cas02|schg_cas03|schg_cas04|schg_cas05|arug_cas01|arug_cas02|arug_cas03|arug_cas04|arug_cas05", strcharinfo(3))) { if(getgmlevel() > .@gm) end; for ( .@c = 0; .@c < getarraysize($guildRegistered); .@c++ ) { if (getcharid(2) == $guildRegistered[.@c]) { getguildmember getcharid(2),1; getguildmember getcharid(2),2; for ( set .@i, 0; .@i < $@guildmembercount; set .@i, .@i +1 ) if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) set .@count_online, .@count_online +1; if ( .@count_online > $guildCap ) warp "prt_pvp",49,48; else end; } } for ( .@c = 0; .@c < getarraysize($mbkGuild); .@c++ ) { if (getcharid(2) == $mbkGuild[.@c]) { getguildmember getcharid(2),1; getguildmember getcharid(2),2; for ( set .@i, 0; .@i < $@guildmembercount; set .@i, .@i +1 ) if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) set .@mbkcount_online, .@mbkcount_online +1; if ( .@mbkcount_online > $mbkCap ) warp "prt_pvp",49,48; else end; } } warp "prt_pvp",49,48; } end; } schg_cas01 mapflag loadevent schg_cas02 mapflag loadevent schg_cas03 mapflag loadevent schg_cas04 mapflag loadevent schg_cas05 mapflag loadevent arug_cas01 mapflag loadevent arug_cas02 mapflag loadevent arug_cas03 mapflag loadevent arug_cas04 mapflag loadevent arug_cas05 mapflag loadevent