diff --git a/db/castle_db.txt b/db/castle_db.txt index a77b5de7bb..4e0f2e880d 100644 --- a/db/castle_db.txt +++ b/db/castle_db.txt @@ -34,13 +34,13 @@ 21,nguild_gef,Air,Agit_N02,2 22,nguild_pay,Water,Agit_N03,2 23,nguild_prt,Fire,Agit_N04,2 -24,schg_cas01,Himinn,Agit_Sc01,1 // kRO : Himinn -25,schg_cas02,Andlangr,Agit_Sc02,1 // kRO : Andlangr -26,schg_cas03,Viblainn,Agit_Sc03,1 // kRO : Viblainn -27,schg_cas04,Hljod,Agit_Sc04,1 // kRO : Hljod -28,schg_cas05,Skidbladnir,Agit_Sc05,1 // kRO : Skidbladnir -29,arug_cas01,Mardol,Agit_Ar01,1 // kRO : Mardol -30,arug_cas02,Cyr,Agit_Ar02,1 // kRO : Cyr -31,arug_cas03,Horn,Agit_Ar03,1 // kRO : Horn -32,arug_cas04,Gefn,Agit_Ar04,1 // kRO : Gefn -33,arug_cas05,Bandis,Agit_Ar05,1 // kRO : Bandis +24,schg_cas01,Himinn,Manager#schg_cas01,1 // kRO : Himinn +25,schg_cas02,Andlangr,Manager#schg_cas02,1 // kRO : Andlangr +26,schg_cas03,Viblainn,Manager#schg_cas03,1 // kRO : Viblainn +27,schg_cas04,Hljod,Manager#schg_cas04,1 // kRO : Hljod +28,schg_cas05,Skidbladnir,Manager#schg_cas05,1 // kRO : Skidbladnir +29,arug_cas01,Mardol,Manager#arug_cas01,1 // kRO : Mardol +30,arug_cas02,Cyr,Manager#arug_cas02,1 // kRO : Cyr +31,arug_cas03,Horn,Manager#arug_cas03,1 // kRO : Horn +32,arug_cas04,Gefn,Manager#arug_cas04,1 // kRO : Gefn +33,arug_cas05,Bandis,Manager#arug_cas05,1 // kRO : Bandis diff --git a/npc/guild/agit_main.txt b/npc/guild/agit_main.txt index 1175d5a5a4..e878f40f80 100644 --- a/npc/guild/agit_main.txt +++ b/npc/guild/agit_main.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= L0ne_W0lf //===== Current Version: ===================================== -//= 1.9 +//= 1.9a //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= @@ -51,6 +51,7 @@ //= and added extended anouncement format for mapannounce. //= 1.8 Fixed a possible exploit in guild castle investment. [Brian] //= 1.9 Partially rewrote Script. [Masao] +//= 1.9a Fixed incorrect setcastledata parameter. [Euphy] //============================================================ // WoE : Main Functions @@ -158,7 +159,7 @@ OnGuildBreak: // Kill guardians, disable the Kafra, and set owner to 0. killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied"; disablenpc "Kafra Staff#"+strnpcinfo(2); - SetCastleData strnpcinfo(2),0,0; + SetCastleData strnpcinfo(2),1,0; // Wait before refreshing guild information. sleep 7000; Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0; diff --git a/npc/guild2/agit_main_se.txt b/npc/guild2/agit_main_se.txt index f375806176..5aa91f3ace 100644 --- a/npc/guild2/agit_main_se.txt +++ b/npc/guild2/agit_main_se.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Euphy //===== Current Version: ===================================== -//= 1.3 +//= 1.4 //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= @@ -15,6 +15,7 @@ //= 1.1 Fixed an incorrect label execution. [Euphy] //= 1.2 Hopefully fixed a processing error. [Euphy] //= 1.3 Fixed barricade issue in schg_cas02. [Cookie] +//= 1.4 Added OnGuildBreak event and a spawn check. [Euphy] //============================================================ // Core, triggers all other events @@ -66,6 +67,17 @@ OnAgitEnd2: } end; +OnGuildBreak: + if (strnpcinfo(2) == "template") end; + killmonster strnpcinfo(2),"gard1#"+strnpcinfo(2)+"::OnGuardianDied"; + killmonster strnpcinfo(2),"gard2#"+strnpcinfo(2)+"::OnGuardianDied"; + disablenpc "Kafra Employee#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); + setcastledata strnpcinfo(2),1,0; + sleep 7000; + announce "Guild Base ["+getcastlename(strnpcinfo(2))+"] has been abandoned.",0; + donpcevent strnpcinfo(0)+"::OnRecvCastle2"; + end; + OnStart: // $agit_ar0x[] - $agit_sc0x[] // 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians @@ -78,7 +90,10 @@ OnStart: for(set .@i,0; .@i<4; set .@i,.@i+1) donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnEnable"; } + OnEmpSpawn: + set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); + if (mobcount(strnpcinfo(2),"Steward#"+.@str$+"::OnStartArena")) end; if (compare(strnpcinfo(2),"arug")) { if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],87,219; else if (strnpcinfo(2) == "arug_cas02") setarray .@i[0],89,256; @@ -89,7 +104,7 @@ OnEmpSpawn: else if (strnpcinfo(2) == "schg_cas03") setarray .@i[0],338,202; else setarray .@i[0],120,272; // Castles 1,4,5 are identical. } - monster strnpcinfo(2),.@i[0],.@i[1],"Emperium",1288,1,"Steward#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"::OnStartArena"; + monster strnpcinfo(2),.@i[0],.@i[1],"Emperium",1288,1,"Steward#"+.@str$+"::OnStartArena"; end; OnReset: diff --git a/src/map/npc.c b/src/map/npc.c index 5d8a0274ed..38451917d1 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2877,31 +2877,30 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c } st = script_alloc_state(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); - setd_sub(st, NULL, ".@atcmd_command$", 0, (void *)command, NULL); + setd_sub(st, NULL, ".@atcmd_command$", 0, (void *)command, NULL); - // split atcmd parameters based on spaces - i = 0; - j = 0; + // split atcmd parameters based on spaces - temp = (char*)aMalloc(strlen(message) + 1); + temp = (char*)aMalloc(strlen(message) + 1); - while( message[i] != '\0' ) { - if( message[i] == ' ' && k < 127 ) { - temp[j] = '\0'; - setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL); - j = 0; - ++i; - } else - temp[j++] = message[i++]; - } + for( i = 0; i < ( strlen( message ) + 1 ) && k < 127; i ++ ) { + if( message[i] == ' ' || message[i] == '\0' ) { + if( message[ ( i - 1 ) ] == ' ' ) { + continue; // To prevent "@atcmd [space][space][space]..." + } + temp[k] = '\0'; + k = 0; + setd_sub( st, NULL, ".@atcmd_parameters$", j++, (void *)temp, NULL ); + } else { + temp[k] = message[i]; + k++; + } + } - temp[j] = '\0'; - setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL); - setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)&k, NULL); - aFree(temp); + setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)__64BPRTSIZE(j), NULL); + aFree(temp); - run_script_main(st); - return 0; + run_script_main(st); return 0; } /// Parses a function.