-
No emperium in WOE
anyone know how to have an emperium because when i start the woe i can't see emperium..
Please help me!
This is my woe setter3
//===== eAthena Unofficial Script ============================
//= WoE Time Setter v3
//===== By: ==================================================
//= [GM]Xeon
//===== Current Version: =====================================
//= 3.1.2
//===== Compatible With: =====================================
//= Trunk, SVN 13202+
//===== Description: =========================================
//= Manages and adds WoE times for every town
//===== Additional Comments: =================================
//= For revisions, see the change log!
//= 3.0 Script created ;D [[GM]Xeon]
//= 3.1 Added castle ownership view, manual WoE start/end [[GM]Xeon]
//============================================================
//If getting a agitstart2; as a unknown command, update your SVN!!
//Notes to self:
//For normal WoE donpcevent, make the $woe_cas#_3$ the npc name to call instead of the map name?
prontera,159,189,1 script WoE Information 806,{
//To do:
//GM: Treasure enable/disable/manual spawn, talk to guild manager dude, monster spawn enable/disable, warp to castle entrance/emp room, castle ownership change, whisperglobal management
//Player: None at the moment.
if (getgmlevel()>=80) goto L_Main;
L_View:
mes "[WoE Information]";
mes "The current WoE times are...";
set @vmode, 0;
callsub S_Listing;
dispbottom " Listing format:";
dispbottom "{Is happening now? + Yes, - No}{Town(s)} {Castle(s)} {Start Day}{Start Hour(Military time)}:{Start Minute}-{End Day}{End Hour(Military time)}:{End Minute}";
menu "View castle ownership",-,"Exit",-;
if (@menu==1) { mes "The current castle owners are as follows..."; callsub(S_Ownership); next; goto L_View; }
close;
S_Ownership:
set @town, 0;
for (set .@i, 0; .@i<34; set .@i,.@i+1) {
if (!.@i||.@i==5||.@i==10||.@i==15||.@i==20||.@i==24||.@i==29) { set @town, @town+1; set @temp, 1; mes " ^0066FF"+$woe_towns$[@town]+":^000000"; }
set @good, query_sql("select `guild_id` from `guild_castle` where `castle_id` = '"+.@i+"'",@gid);
if (@good) query_sql("select name,master from `guild` where `guild_id` = '"+@gid+"'",@gname$,@gowner$);
mes getd("$woe_cas"+@town+"_1$["+@temp+"]")+"-"+((@good)?@gname$+" ("+@gowner$+")":"No owner");
set @temp, @temp+1;
}
dispbottom " Listing format:";
dispbottom " {Town name}:";
dispbottom "{Castle name}-{Guild who owns it} ({Owner of that guild})";
return;
S_Listing:
deletearray @ar_id[0], 200;
deletearray @ar_town[0], 200;
deletearray @ar_castle[0], 200;
deletearray @ar_sday[0], 200;
deletearray @ar_shour[0], 200;
deletearray @ar_smin[0], 200;
deletearray @ar_stick[0], 200;
deletearray @ar_svar[0], 200;
deletearray @ar_eday[0], 200;
deletearray @ar_ehour[0], 200;
deletearray @ar_emin[0], 200;
deletearray @ar_etick[0], 200;
deletearray @ar_evar[0], 200;
set @results, query_sql("select * from `woe_times` order by `st` ASC",@ar_id,@ar_town,@ar_castle,@ar_sday,@ar_shour,@ar_smin,@ar_stick,@ar_svar,@ar_eday,@ar_ehour,@ar_emin,@ar_etick,@ar_evar,@ignore);
set @temp, 0;
if (!@results && !@vmode) { mes "There are no current WoE times!"; return; }
while (@temp < @results) {
set @temp$, "";
if (gettimetick(2) >= @ar_stick[@temp] && gettimetick(2) < @ar_etick[@temp]) { set @temp$, @temp$+"^339900+^000000"; } else { set @temp$, @temp$+"^FF0000-^000000"; }
if (@ar_town[@temp]==127) { set @temp$, @temp$+"All"; } else {
set @temp_, @ar_town[@temp];
if (@temp==127) { set @temp$, "All"; } else {
if (@temp_>=64) { set @temp$, "^FFFF00Ar"; set @temp_, @temp_-64; }
if (@temp_>=32) { set @temp$, @temp$+"^FF0000Sc"; set @temp_, @temp_-32; }
if (@temp_>=16) { set @temp$, @temp$+"^9900CCNo"; set @temp_, @temp_-16; }
if (@temp_>=8) { set @temp$, @temp$+"^808080Pr"; set @temp_, @temp_-8; }
if (@temp_>=4) { set @temp$, @temp$+"^339900Pa"; set @temp_, @temp_-4; }
if (@temp_>=2) { set @temp$, @temp$+"^0066FFGe"; set @temp_, @temp_-2; }
if (@temp_==1) set @temp$, @temp$+"^FF9900Al";
}
set @temp$, @temp$+"^000000";
}
set @temp$, @temp$+" ";
if (@ar_castle[@temp]==31) { set @temp$, @temp$+"All"; } else {
set @temp_, @ar_castle[@temp];
if (@temp_==31) { set @temp$, @temp$+"All"; } else {
set @tmp, 16;
for (set .@i, 5; .@i>0; set .@i,.@i-1) { if (@temp_>=@tmp) { set @temp$, @temp$+.@i; } set @tmp, @tmp/2; }
}
}
set @temp$, @temp$+" ";
switch(@ar_sday[@temp]) {
case 0: set @temp$, @temp$+"Sun"; break;
case 1: set @temp$, @temp$+"Mon"; break;
case 2: set @temp$, @temp$+"Tue"; break;
case 3: set @temp$, @temp$+"Wed"; break;
case 4: set @temp$, @temp$+"Thu"; break;
case 5: set @temp$, @temp$+"Fri"; break;
case 6: set @temp$, @temp$+"Sat";
}
set @temp$, @temp$+((@ar_shour[@temp]<10)?"0":"")+@ar_shour[@temp]+";"+((@ar_smin[@temp]<10)?"0":"")+@ar_smin[@temp]+"-";
switch(@ar_eday[@temp]) {
case 0: set @temp$, @temp$+"Sun"; break;
case 1: set @temp$, @temp$+"Mon"; break;
case 2: set @temp$, @temp$+"Tue"; break;
case 3: set @temp$, @temp$+"Wed"; break;
case 4: set @temp$, @temp$+"Thu"; break;
case 5: set @temp$, @temp$+"Fri"; break;
case 6: set @temp$, @temp$+"Sat";
}
set @temp$, @temp$+((@ar_ehour[@temp]<10)?"0":"")+@ar_ehour[@temp]+";"+((@ar_emin[@temp]<10)?"0":"")+@ar_emin[@temp];
if (@vmode) { set @results$,@results$+@temp$+":"; } else { mes @temp$; }
set @temp, @temp+1;
}
return;
L_Main:
mes "[WoE Time Setter]";
mes "Hello there, how can I help you GM?";
next;
menu "Manage WoE Times",L_ModifyListing,"Start/Stop WoE",L_Manual,"Test Player View",L_View,"Exit",-;
close;
L_ModifyListing:
set @vmode, 1;
set @results$, "";
callsub S_Listing;
menu @results$,-,"Add new time",L_ModifyAdd,"Back",L_Main;
set @sel_modify, @menu-1;
set @adding, 0;
menu "Modify time",L_ModifyTown_Main,"Delete time",-,"Back",L_ModifyListing;
if (gettimetick(2)>=@ar_stick[@sel_modify]&&gettimetick(2)<@ar_etick[@sel_modify]) {
dispbottom "The selected WoE is currently active, if you delete it it will automatically stop! Proceed?";
menu "Yes",-,"No",L_ModifyAdd;
callfunc("WoE_Status",0,@ar_town[@sel_modify],@ar_castle[@sel_modify]);
}
query_sql("delete from `woe_times` where `id` = '"+@ar_id[@sel_modify]+"'");
dispbottom "WoE time deleted!";
set $woe_chatinfo, 0;
goto L_ModifyListing;
L_ModifyAdd:
set @adding, 1;
L_ModifyTown_Main: //@sel_modify is passed from the selection of what exisitng time to modify...
if (@adding) {
set @sel, 0;
setarray @sel_town[1], 0, 0, 0, 0, 0, 0, 0;
set @set_castle, 0;
set @set_time, 0;
} else {
set @set_castle, 1;
set @set_time, 1;
set @temp__, 7;
set @temp_, @ar_town[@sel_modify];
set @temp, 64;
set @sel, 0;
for (set .@i, 7; .@i>0; set .@i, .@i-1) { if (@temp_>=@temp) { set @sel_town[.@i], 1; set @temp_, @temp_-@temp; set @sel, @sel+1; } else { set @sel_town[.@i], 0; } set @temp, @temp/2; }
set @temp_, @ar_castle[@sel_modify];
set @temp, 16;
set @sel2, 0;
for (set .@i, 5; .@i>0; set .@i, .@i-1) { if (@temp_>=@temp) { set @sel_castle[.@i], 1; set @temp_, @temp_-@temp; set @sel2, @sel2+1; } else { set @sel_castle[.@i], 0; } set @temp, @temp/2; }
set @sday, @ar_sday[@sel_modify];
set @shour, @ar_shour[@sel_modify];
set @smin, @ar_smin[@sel_modify];
set @svar, @ar_svar[@sel_modify];
set @eday, @ar_eday[@sel_modify];
set @ehour, @ar_ehour[@sel_modify];
set @emin, @ar_emin[@sel_modify];
set @evar, @ar_evar[@sel_modify];
}
dispbottom "Select the town(s) you wish this WoE time to apply to. If the name is green it means it's enabled, red means disabled.";
L_ModifyTown_Sub:
menu ((@sel_town[1])?"^339900":"^FF0000")+$woe_towns$[1]+":"+((@sel_town[2])?"^339900":"^FF0000")+$woe_towns$[2]+":"+((@sel_town[3])?"^339900":"^FF0000")+$woe_towns$[3]+":"+((@sel_town[4])?"^339900":"^FF0000")+$woe_towns$[4]+":"+((@sel_town[5])?"^339900":"^FF0000")+$woe_towns$[5]+":"+((@sel_town[6])?"^339900":"^FF0000")+$woe_towns$[6]+":"+((@sel_town[7])?"^339900":"^FF0000")+$woe_towns$[7]+":"+((@sel==7)?"^339900":"^FF0000")+$woe_towns$[8],-,"^000000Proceed",L_ModifyCastle_Main,"Back",L_ModifyListing;
if (@menu==8) if (@sel<7) { setarray @sel_town[1], 1, 1, 1, 1, 1, 1, 1; set @sel, 7; goto L_ModifyTown_Sub; } else { setarray @sel_town[1], 0, 0, 0, 0, 0, 0, 0; set @sel, 0; goto L_ModifyTown_Sub; }
if (!@sel_town[@menu]) { set @sel_town[@menu], 1; set @sel, @sel+1; goto L_ModifyTown_Sub; } else { set @sel_town[@menu], 0; set @sel, @sel-1; goto L_ModifyTown_Sub; }
L_ModifyCastle_Main:
if (!@sel) { dispbottom "You must first select at least one town!"; goto L_ModifyTown_Sub; }
set @town_code, 0;
set @set_town, 0;
if (@sel_town[1]) { set @town_code, @town_code+1; if (@sel==1) set @set_town, 1; }
set @temp, 2;
for (set .@i, 2; .@i<8; set .@i, .@i+1) { if (@sel_town[.@i]) { set @town_code, @town_code+@temp; if (@sel==1) set @set_town, .@i; } set @temp, @temp*2; }
if (!@set_castle) { set @sel2, 5; setarray @sel_castle[1], 1, 1, 1, 1, 1; if (@sel==1 && @sel_town[5]) { set @sel2, 4; set @sel_castle[5], 0; } }
set @set_castle, 1;
L_ModifyCastle_Sub:
if (@sel>1) {
menu ((@sel_castle[1])?"^339900":"^FF0000")+"Castle 1:"+((@sel_castle[2])?"^339900":"^FF0000")+"Castle 2:"+((@sel_castle[3])?"^339900":"^FF0000")+"Castle 3:"+((@sel_castle[4])?"^339900":"^FF0000")+"Castle 4:"+((@sel_castle[5])?"^339900":"^FF0000")+"Castle 5",-,"^000000Proceed",L_ModifyTime_Main,"Back",L_ModifyTown_Sub;
if (!@sel_castle[@menu]) { set @sel_castle[@menu], 1; set @sel2, @sel2+1; } else { set @sel_castle[@menu], 0; set @sel2, @sel2-1; }
goto L_ModifyCastle_Sub;
} else {
menu ((@sel_castle[1])?"^339900":"^FF0000")+getd("$woe_cas"+@set_town+"_1$[1]")+":"+((@sel_castle[2])?"^339900":"^FF0000")+getd("$woe_cas"+@set_town+"_1$[2]")+":"+((@sel_castle[3])?"^339900":"^FF0000")+getd("$woe_cas"+@set_town+"_1$[3]")+":"+((@sel_castle[4])?"^339900":"^FF0000")+getd("$woe_cas"+@set_town+"_1$[4]")+((@set_town!=5)?":"+((@sel_castle[5])?"^339900":"^FF0000")+getd("$woe_cas"+@set_town+"_1$[5]"):""),-,"^000000Proceed",L_ModifyTime_Main,"Back",L_ModifyTown_Sub;
if (!@sel_castle[@menu]) { set @sel_castle[@menu], 1; set @sel2, @sel2+1; } else { set @sel_castle[@menu], 0; set @sel2, @sel2-1; }
goto L_ModifyCastle_Sub;
}
dispbottom "Select the castle(s) within the previously selected town(s) you wish this WoE time to apply to. If the name is green it means it's enabled, red means disabled.";
L_ModifyTime_Main:
if (!@sel2) { dispbottom "You must first select at least one castle!"; goto L_ModifyCastle_Sub; }
set @cas_code, 0;
if (@sel_castle[1]) set @cas_code, @cas_code+1;
set @temp, 2;
for (set .@i, 2; .@i<6; set .@i, .@i+1) { if (@sel_castle[.@i]) set @cas_code, @cas_code+@temp; set @temp, @temp*2; }
if (!@set_time) {
set @sday, 0;
set @shour, 0;
set @smin, 0;
set @svar, 0;
set @eday, 0;
set @ehour, 0;
set @emin, 0;
set @evar, 0;
}
dispbottom "Select the starting and ending time for the WoE, note the hour is in military time, i.e. 0=12AM, 10=10AM, 22=10PM. Variance is the total amount in seconds to make the time be randomized, ex: setting start to 60 would make the start time either start up to 30 seconds earlier, or start up to 30 seconds later.";
L_ModifyTime_Sub:
for (set .@i, 1; .@i<3; set .@i, .@i+1) {
switch(getd(((.@i==1)?"@sday":"@eday"))) {
case 0: setd("@temp"+.@i+"$", "Sunday"); break;
case 1: setd("@temp"+.@i+"$", "Monday"); break;
case 2: setd("@temp"+.@i+"$", "Tuesday"); break;
case 3: setd("@temp"+.@i+"$", "Wednesday"); break;
case 4: setd("@temp"+.@i+"$", "Thursday"); break;
case 5: setd("@temp"+.@i+"$", "Friday"); break;
case 6: setd("@temp"+.@i+"$", "Saturday");
}
}
menu "Start Day [^0066FF"+@temp1$+"^000000]:Start Hour [^0066FF"+@shour+"^000000]:Start Minute [^0066FF"+@smin+"^000000]:End Day [^0066FF"+@temp2$+"^000000]:End Hour [^0066FF"+@ehour+"^000000]:End Minute [^0066FF"+@emin+"^000000]:Start Variance [^0066FF"+@svar+"^000000]:End Variance [^0066FF"+@evar+"^000000]",-,"Proceed",L_ModifyFinish,"Back",L_ModifyCastle_Sub;
switch(@menu) {
case 1:
menu "Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday",-,"Cancel",L_ModifyTime_Sub;
set @sday, @menu-1;
break;
case 2:
input @shour;
if (@shour>23) set @shour, 0;
break;
case 3:
input @smin;
if (@smin>59) set @smin, 0;
break;
case 4:
menu "Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday",-,"Cancel",L_ModifyTime_Sub;
set @eday, @menu-1;
break;
case 5:
input @ehour;
if (@ehour>23) set @ehour, 0;
break;
case 6:
input @emin;
if (@emin>59) set @emin, 0;
break;
case 7:
input @svar;
break;
case 8:
input @evar;
break;
}
goto L_ModifyTime_Sub;
L_ModifyFinish:
if (@sday==@eday) if (@shour==@ehour) if (@smin==@emin) { dispbottom "Your start time cannot be your end time!"; goto L_ModifyTime_Sub; }
set $woe_chatinfo, 0;
set @temp1, callfunc("WoE_TickCounter",1,@sday,@shour,@smin,@svar);
set @temp2, callfunc("WoE_TickCounter",1,@eday,@ehour,@emin,@evar);
//set @temp2, callfunc("WoE_TickCounter",(@temp1>callfunc("WoE_TickCounter",1,@eday,@ehour,@emin,@evar))?0:1),@eday,@ehour,@emin,@evar);
if (@temp1>@temp2) set @temp2,callfunc("WoE_TickCounter",2,@temp2);
if (@adding) {
query_sql("insert into `woe_times` (town,castle,sd,sh,sm,st,sv,ed,eh,em,et,ev) values ('"+@town_code+"', '"+@cas_code+"', '"+@sday+"', '"+@shour+"', '"+@smin+"', '"+@temp1+"','"+@svar+"','"+@eday+"', '"+@ehour+"', '"+@emin+"', '"+@temp2+"','"+@evar+"')");
} else {
query_sql("update `woe_times` set town='"+@town_code+"', castle='"+@cas_code+"', sd='"+@sday+"', sh='"+@shour+"', sm='"+@smin+"',st='"+@temp1+"',sv='"+@svar+"',ed='"+@eday+"',eh='"+@ehour+"',em='"+@emin+"',et='"+@temp2+"',ev='"+@evar+"' where `id` = '"+@ar_id[@sel_modify]+"'");
}
dispbottom "WoE time "+((@adding)?"added!":"modified!");
goto L_ModifyListing;
L_Manual:
menu (($woe_cas1_2[1]||$woe_cas1_2[2]||$woe_cas1_2[3]||$woe_cas1_2[4]||$woe_cas1_2[5])?"^339900":"^FF0000")+$woe_towns$[1]+":"+(($woe_cas2_2[1]||$woe_cas2_2[2]||$woe_cas2_2[3]||$woe_cas2_2[4]||$woe_cas2_2[5])?"^339900":"^FF0000")+$woe_towns$[2]+":"+(($woe_cas3_2[1]||$woe_cas3_2[2]||$woe_cas3_2[3]||$woe_cas3_2[4]||$woe_cas3_2[5])?"^339900":"^FF0000")+$woe_towns$[3]+":"+(($woe_cas4_2[1]||$woe_cas4_2[2]||$woe_cas4_2[3]||$woe_cas4_2[4]||$woe_cas4_2[5])?"^339900":"^FF0000")+$woe_towns$[4]+":"+(($woe_cas5_2[1]||$woe_cas5_2[2]||$woe_cas5_2[3]||$woe_cas5_2[4]||$woe_cas5_2[5])?"^339900":"^FF0000")+$woe_towns$[5]+":"+(($woe_cas6_2[1]||$woe_cas6_2[2]||$woe_cas6_2[3]||$woe_cas6_2[4]||$woe_cas6_2[5])?"^339900":"^FF0000")+$woe_towns$[6]+":"+(($woe_cas7_2[1]||$woe_cas7_2[2]||$woe_cas7_2[3]||$woe_cas7_2[4])?"^339900":"^FF0000")+$woe_towns$[7],-,"^339900Enable all",-,"^FF0000Disable all",-,"^000000Back",L_Main;
if (@menu==8) { callfunc("WoE_Status",1,127,31); goto L_Manual; }
if (@menu==9) { callfunc("WoE_Status",0,127,31); goto L_Manual; }
set @temp, 64;
for (set .@i, 7; .@i>0; set .@i,.@i-1) { if (.@i==@menu) { set @town, @temp; set @town_, .@i; } set @temp, @temp/2; }
L_ManualCastles:
menu ((getd("$woe_cas"+@town_+"_2[1]"))?"^339900":"^FF0000")+getd("$woe_cas"+@town_+"_1$[1]")+":"+((getd("$woe_cas"+@town_+"_2[2]"))?"^339900":"^FF0000")+getd("$woe_cas"+@town_+"_1$[2]")+":"+((getd("$woe_cas"+@town_+"_2[3]"))?"^339900":"^FF0000")+getd("$woe_cas"+@town_+"_1$[3]")+":"+((getd("$woe_cas"+@town_+"_2[4]"))?"^339900":"^FF0000")+getd("$woe_cas"+@town_+"_1$[4]")+((@set_town!=7)?":"+((getd("$woe_cas"+@town_+"_2[5]"))?"^339900":"^FF0000")+getd("$woe_cas"+@town_+"_1$[5]"):""),-,"^339900Enable all",-,"^FF0000Disable all",-,"^000000Back",L_Manual;
if (@menu==6) { callfunc("WoE_Status",1,@town,31); goto L_ManualCastles; }
if (@menu==7) { callfunc("WoE_Status",0,@town,31); goto L_ManualCastles; }
set @temp, 16;
for (set .@i, 5; .@i>0; set .@i,.@i-1) { if (.@i==@menu) { set @cas, @temp; set @cas_,.@i; } set @temp, @temp/2; }
callfunc("WoE_Status",((getd("$woe_cas"+@town_+"_2["+@cas_+"]"))?0:1),@town,@cas);
goto L_ManualCastles;
OnInit:
query_sql("CREATE TABLE IF NOT EXISTS `ragnarok`.`woe_times` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `town` TINYINT UNSIGNED NOT NULL, `castle` TINYINT UNSIGNED NOT NULL, `sd` TINYINT UNSIGNED NOT NULL, `sh` TINYINT UNSIGNED NOT NULL, `sm` TINYINT UNSIGNED NOT NULL, `st` BIGINT UNSIGNED NOT NULL, `sv` INTEGER UNSIGNED NOT NULL, `ed` TINYINT UNSIGNED NOT NULL, `eh` TINYINT UNSIGNED NOT NULL, `em` TINYINT UNSIGNED NOT NULL, `et` BIGINT UNSIGNED NOT NULL, `ev` INTEGER UNSIGNED NOT NULL, `active` TINYINT UNSIGNED NOT NULL, PRIMARY KEY (`id`) ) ENGINE = MyISAM;");
set $WoE3_Manual, 1; //Variable to know whether WoE was started by atcommand, or through NPC, undeeded when manual WoE is entered? Never use @agistarts/ends!
setarray $woe_towns$[1], "Aldebaran", "Geffen", "Payon", "Prontera", "Novice Castles", "Schwartzvalt", "Arunafeltz", "All Castles"; //These are the town names, mostly for announcements
setarray $woe_cas1_1$[1], getcastlename("aldeg_cas01"), getcastlename("aldeg_cas02"), getcastlename("aldeg_cas03"), getcastlename("aldeg_cas04"), getcastlename("aldeg_cas05"); //These are the castle names
setarray $woe_cas1_2[1], 0, 0, 0, 0, 0; //Aldebaran's agit status
setarray $woe_cas1_3$[1], "aldeg_cas01", "aldeg_cas02", "aldeg_cas03", "aldeg_cas04", "aldeg_cas05";
setarray $woe_cas2_1$[1], getcastlename("gefg_cas01"), getcastlename("gefg_cas02"), getcastlename("gefg_cas03"), getcastlename("gefg_cas04"), getcastlename("gefg_cas05"); //These are the castle names
setarray $woe_cas2_2[1], 0, 0, 0, 0, 0; //Geffen's agit status
setarray $woe_cas2_3$[1], "gefg_cas01", "gefg_cas02", "gefg_cas03", "gefg_cas04", "gefg_cas05";
setarray $woe_cas3_1$[1], getcastlename("payg_cas01"), getcastlename("payg_cas02"), getcastlename("payg_cas03"), getcastlename("payg_cas04"), getcastlename("payg_cas05"); //These are the castle names
setarray $woe_cas3_2[1], 0, 0, 0, 0, 0; //Payon's agit status
setarray $woe_cas3_3$[1], "payg_cas01", "payg_cas02", "payg_cas03", "payg_cas04", "payg_cas05";
setarray $woe_cas4_1$[1], getcastlename("prtg_cas01"), getcastlename("prtg_cas02"), getcastlename("prtg_cas03"), getcastlename("prtg_cas04"), getcastlename("prtg_cas05"); //These are the castle names
setarray $woe_cas4_2[1], 0, 0, 0, 0, 0; //Prontera's agit status
setarray $woe_cas4_3$[1], "prtg_cas01", "prtg_cas02", "prtg_cas03", "prtg_cas04", "prtg_cas05";
setarray $woe_cas5_1$[1], "Aldebaran Castle", "Geffen Castle", "Payon Castle", "Prontera Castle", "-"; //These are the castle names
setarray $woe_cas5_2[1], 0, 0, 0, 0, 0; //Novice's agit status
setarray $woe_cas6_1$[1], getcastlename("schg_cas01"), getcastlename("schg_cas02"), getcastlename("schg_cas03"), getcastlename("schg_cas04"), getcastlename("schg_cas05"); //These are the castle names
setarray $woe_cas6_2[1], 0, 0, 0, 0, 0; //Schwartzvalt's agit status
setarray $woe_cas7_1$[1], getcastlename("arug_cas01"), getcastlename("arug_cas02"), getcastlename("arug_cas03"), getcastlename("arug_cas04"), getcastlename("arug_cas05"); //These are the castle names
setarray $woe_cas7_2[1], 0, 0, 0, 0, 0; //Arunafeltz's agit status
set $woe_global, 0;
agitstart; agitstart2; //Keep WoE alive always
query_sql "update `woe_times` set `active` = '0' where `active` = '1'";
callfunc("WoE_Update");
set $woe_chatinfo, 0;
donpcevent "WoE Information::OnChatInfo"; donpcevent "WoE Information::OnChatInfo2"; //COMMENT THIS LINE TO DISABLE THE WOE TIME CHATROOM
while(1) callfunc("WoE_Init");
end;
OnChatInfo:
while (1) {
if (!$woe_chatinfo) { set .@timeset, query_sql("select st,et from `woe_times` order by `st` ASC",.@woe_s,.@woe_e); set $woe_chatinfo, 1; }
if (.@timeset) {
if (gettimetick(2)>.@woe_s) {
if ($woe_display) { waitingroom "WoE is ACTIVE!",0; } else {
set .@sec, .@woe_e-gettimetick(2);
set .@min, 0; set .@hr, 0; set .@day, 0;
while (.@sec>=86400) { set .@day, .@day+1; set .@sec, .@sec-86400; }
while (.@sec>=3600) { set .@hr, .@hr+1; set .@sec, .@sec-3600; }
while (.@sec>=60) { set .@min, .@min+1; set .@sec, .@sec-60; }
waitingroom "WoE Ends: "+.@day+"d "+((.@hr<10)?"0":"")+.@hr+":"+((.@min<10)?"0":"")+.@min+":"+((.@sec<10)?"0":"")+.@sec,0;
}
} else {
if ($woe_display) { waitingroom "WoE is inactive!",0; } else {
set .@sec, .@woe_s-gettimetick(2);
set .@min, 0; set .@hr, 0; set .@day, 0;
while (.@sec>=86400) { set .@day, .@day+1; set .@sec, .@sec-86400; }
while (.@sec>=3600) { set .@hr, .@hr+1; set .@sec, .@sec-3600; }
while (.@sec>=60) { set .@min, .@min+1; set .@sec, .@sec-60; }
waitingroom "Next WoE: "+.@day+"d "+((.@hr<10)?"0":"")+.@hr+":"+((.@min<10)?"0":"")+.@min+":"+((.@sec<10)?"0":"")+.@sec,0;
}
}
} else { waitingroom "Next WoE: N/A, none set!",0; }
sleep 1000;
}
end;
OnChatInfo2:
while (1) { if ($woe_display) { set $woe_display,0; sleep 3000; } else { set $woe_display,1; sleep 1000; } } //This is the WoE is active/WoE ends display timer in milliseconds
end;
}
//Function to acquire the time difference between now and the arguments in seconds
//arg0=Is start day less then end day or getting start time? 2=Add 7 days to specified arg1
//arg1=Start/end day, the tick count to add 7 days to if arg0=2
//arg2=Start/end hour
//arg3=Start/end minute
//arg4=Random time variance
function script WoE_TickCounter {
if (getarg(0)==2) { return getarg(1)+604800; } else {
if (getarg(0)&&(getarg(1)>gettime(4)||(getarg(1)==gettime(4)&&getarg(2)>=gettime(3)&&getarg(3)>=gettime(2)))) { set .@dayz, getarg(1)-gettime(4); } else { set .@dayz, 7-(gettime(4)-getarg(1)); }
if (getarg(2)>=gettime(3)) { set .@hourz, getarg(2)-gettime(3); } else { set .@hourz, getarg(2)-gettime(3); }
if (getarg(3)>=gettime(2)) { set .@minutez, getarg(3)-gettime(2); } else { set .@minutez, getarg(3)-gettime(2); }
return gettimetick(2)+(.@dayz*86400)+(.@hourz*3600)+(.@minutez*60)+rand(-getarg(4)/2,getarg(4)/2)-gettime(1);
}
}
//Function to update the tick columns of past WoE times so that they may occur again!
function script WoE_Update {
deletearray .@id[0], 200;
deletearray .@st[0], 200;
deletearray .@et[0], 200;
set .@results, query_sql("select id,st,et from `woe_times` where `et` <= '"+gettimetick(2)+"'",.@id,.@st,.@et);
set .@i, 0;
for (set .@i,0; .@i<.@results; set .@i,.@i+1) { query_sql("update `woe_times` set `st` = '"+callfunc("WoE_TickCounter",2,.@st[.@i])+"', `et` = '"+callfunc("WoE_TickCounter",2,.@et[.@i])+"', `active` = '0' where `id` = '"+.@id[.@i]+"'"); }
return;
}
//Function to either start WoE or end it, depending on if the current time tick fits a valid time frame found in the SQL table
function script WoE_Init {
deletearray .@stown[0], 200;
deletearray .@scastle[0], 200;
deletearray .@etown[0], 200;
deletearray .@ecastle[0], 200;
set .@ends, query_sql("select town,castle from `woe_times` where `et` <= '"+gettimetick(2)+"' and `active` = '1'",.@etown,.@ecastle);
if (.@ends) { set $woe_chatinfo, 0; query_sql("update `woe_times` set `active` = '0' where `et` <= '"+gettimetick(2)+"'"); callfunc("WoE_Update"); }
set .@starts, query_sql("select town,castle from `woe_times` where `st` <= '"+gettimetick(2)+"' and `et` > '"+gettimetick(2)+"' and `active` = '0'",.@stown,.@scastle);
if (.@starts) query_sql("update `woe_times` set `active` = '1' where `st` <= '"+gettimetick(2)+"' and `et` > '"+gettimetick(2)+"'");
set $WoE3_Manual, 0;
for (set .@i1, 0; .@i1<.@ends; set .@i1,.@i1+1 ) { //WOE END STUFF
callfunc("WoE_Status",0,.@etown[.@i1],.@ecastle[.@i1]);
}
for (set .@i1, 0; .@i1<.@starts; set .@i1,.@i1+1 ) { //WOE START STUFF
callfunc("WoE_Status",1,.@stown[.@i1],.@scastle[.@i1]);
}
set $WoE3_Manual, 1;
sleep 60000-(1000*gettime(1));
return;
}
//The actual function that starts/stops WoE, called by other NPCs/Functions
//arg0=Stop(0) or start(1)?
//arg1=Town(s), 127=All
//arg2=Castle(s), 31=All
function script WoE_Status {
set .@tcode, getarg(1);
set .@tcurrent, 64;
for (set .@i_, 7; .@i_>0; set .@i_,.@i_-1) {
if (.@tcode>=.@tcurrent) {
set .@temp$, "";
set .@ccode, getarg(2);
set .@ccurrent, 16;
for (set .@i, 5; .@i>0; set .@i,.@i-1) { if (.@ccode>=.@ccurrent) { if (getarg(0)) { if (.@i_!=6&&.@i_!=7) { if(.@tcurrent!=16) donpcevent "Agit#"+getd("$woe_cas"+.@i_+"_3$["+.@i+"]")+"::OnAgitStart_"; } else if (.@i_==7) { donpcevent "Manager#aru0"+.@i+"_02::OnAgitStart2_"; } else { donpcevent "Manager#sch0"+.@i+"_02::OnAgitStart2_"; } } else { if (.@i_!=6&&.@i_!=7) { if (.@tcurrent!=16) donpcevent "Agit#"+getd("$woe_cas"+.@i_+"_3$["+.@i+"]")+"::OnAgitEnd_"; } else if (.@i_==7) {donpcevent "Manager#aru0"+.@i+"_02::OnAgitEnd2_"; } else { donpcevent "Manager#sch0"+.@i+"_02::OnAgitEnd2_"; } } setd "$woe_cas"+.@i_+"_2["+.@i+"]", getarg(0); set .@temp$, .@temp$+getd("$woe_cas"+.@i_+"_1$["+.@i+"]")+((.@ccode>.@ccurrent)?", ":" "); set .@ccode, .@ccode-.@ccurrent; } set .@ccurrent, .@ccurrent/2; }
if (getarg(1)!=127&&.@tcurrent!=16) announce "WoE has "+((getarg(0))?"begun":"ended")+" for "+$woe_towns$[.@i_]+" ( Castle(s): "+((getarg(2)==31)?"All":.@temp$)+" )!",bc_all|bc_yellow;
set .@tcode, .@tcode-.@tcurrent;
}
set .@tcurrent,.@tcurrent/2;
}
if (getarg(1)==127) {
set .@temp$, ""; set .@ccode, getarg(2); set .@ccurrent, 16;
for (set .@i, 5; .@i>0; set .@i,.@i-1) { if (.@ccode>=.@ccurrent) set .@temp$, .@temp$+.@i+((.@ccode>.@ccurrent)?", ":" "); set .@ccode, .@ccode-.@ccurrent; set .@ccurrent, .@ccurrent/2; }
announce "WoE has "+((getarg(0))?"begun":"ended")+" for All Towns ( Castle(s): "+((getarg(2)==31)?"All":.@temp$)+" )!",bc_all|bc_yellow;
}
return;
}
//Auto executed MySQL script, run this if it fails to create the table...
//CREATE TABLE IF NOT EXISTS `ragnarok`.`woe_times` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `town` TINYINT UNSIGNED NOT NULL, `castle` TINYINT UNSIGNED NOT NULL, `sd` TINYINT UNSIGNED NOT NULL, `sh` TINYINT UNSIGNED NOT NULL, `sm` TINYINT UNSIGNED NOT NULL, `st` BIGINT UNSIGNED NOT NULL, `sv` INTEGER UNSIGNED NOT NULL, `ed` TINYINT UNSIGNED NOT NULL, `eh` TINYINT UNSIGNED NOT NULL, `em` TINYINT UNSIGNED NOT NULL, `et` BIGINT UNSIGNED NOT NULL, `ev` INTEGER UNSIGNED NOT NULL, `active` TINYINT UNSIGNED NOT NULL, PRIMARY KEY (`id`) ) ENGINE = MyISAM; //Replace ragnarok with your sql schema
-
Re: No emperium in WOE
ok? try checking your npc.config if the //npc: path/npc/agit.txt
has no// infront of it! cuz it will not spawn if it has a // infront of it^__^
try using or downloading costum npc! agit setter^__^ok?take care!