Browse Source

> Guild fixes:
* Added a check to prevent double Emperium spawns in WOE SE castles (since r16571).
* Added guild disbanding events for WOE SE castles (since r12531).
* Fixed an incorrect parameter in WOE FE guild disbanding event (since r12673).

> Other:
* Fixed .@atcmd_numparameters, code by Zephyr (bugreport:7198).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17106 54d463be-8e91-2dee-dedb-b68131a5f0ec

euphyy 12 years ago
parent
commit
b2a3bdd1c9
4 changed files with 49 additions and 34 deletions
  1. 10 10
      db/castle_db.txt
  2. 3 2
      npc/guild/agit_main.txt
  3. 17 2
      npc/guild2/agit_main_se.txt
  4. 19 20
      src/map/npc.c

+ 10 - 10
db/castle_db.txt

@@ -34,13 +34,13 @@
 21,nguild_gef,Air,Agit_N02,2
 21,nguild_gef,Air,Agit_N02,2
 22,nguild_pay,Water,Agit_N03,2
 22,nguild_pay,Water,Agit_N03,2
 23,nguild_prt,Fire,Agit_N04,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

+ 3 - 2
npc/guild/agit_main.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //===== By: ==================================================
 //= L0ne_W0lf
 //= L0ne_W0lf
 //===== Current Version: =====================================
 //===== Current Version: =====================================
-//= 1.9
+//= 1.9a
 //===== Compatible With: =====================================
 //===== Compatible With: =====================================
 //= rAthena SVN
 //= rAthena SVN
 //===== Description: =========================================
 //===== Description: =========================================
@@ -51,6 +51,7 @@
 //=     and added extended anouncement format for mapannounce.
 //=     and added extended anouncement format for mapannounce.
 //= 1.8 Fixed a possible exploit in guild castle investment. [Brian]
 //= 1.8 Fixed a possible exploit in guild castle investment. [Brian]
 //= 1.9 Partially rewrote Script. [Masao]
 //= 1.9 Partially rewrote Script. [Masao]
+//= 1.9a Fixed incorrect setcastledata parameter. [Euphy]
 //============================================================
 //============================================================
 
 
 // WoE : Main Functions
 // WoE : Main Functions
@@ -158,7 +159,7 @@ OnGuildBreak:
 	// Kill guardians, disable the Kafra, and set owner to 0.
 	// Kill guardians, disable the Kafra, and set owner to 0.
 	killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied";
 	killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied";
 	disablenpc "Kafra Staff#"+strnpcinfo(2);
 	disablenpc "Kafra Staff#"+strnpcinfo(2);
-	SetCastleData strnpcinfo(2),0,0;
+	SetCastleData strnpcinfo(2),1,0;
 	// Wait before refreshing guild information.
 	// Wait before refreshing guild information.
 	sleep 7000;
 	sleep 7000;
 	Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0;
 	Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0;

+ 17 - 2
npc/guild2/agit_main_se.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //===== By: ==================================================
 //= Euphy
 //= Euphy
 //===== Current Version: =====================================
 //===== Current Version: =====================================
-//= 1.3
+//= 1.4
 //===== Compatible With: =====================================
 //===== Compatible With: =====================================
 //= rAthena SVN
 //= rAthena SVN
 //===== Description: =========================================
 //===== Description: =========================================
@@ -15,6 +15,7 @@
 //= 1.1 Fixed an incorrect label execution. [Euphy]
 //= 1.1 Fixed an incorrect label execution. [Euphy]
 //= 1.2 Hopefully fixed a processing error. [Euphy]
 //= 1.2 Hopefully fixed a processing error. [Euphy]
 //= 1.3 Fixed barricade issue in schg_cas02. [Cookie]
 //= 1.3 Fixed barricade issue in schg_cas02. [Cookie]
+//= 1.4 Added OnGuildBreak event and a spawn check. [Euphy]
 //============================================================
 //============================================================
 
 
 // Core, triggers all other events
 // Core, triggers all other events
@@ -66,6 +67,17 @@ OnAgitEnd2:
 	}
 	}
 	end;
 	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:
 OnStart:
 	// $agit_ar0x[] - $agit_sc0x[]
 	// $agit_ar0x[] - $agit_sc0x[]
 	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
 	// 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)
 		for(set .@i,0; .@i<4; set .@i,.@i+1)
 			donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnEnable";
 			donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnEnable";
 	}
 	}
+
 OnEmpSpawn:
 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 (compare(strnpcinfo(2),"arug")) {
 		if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],87,219;
 		if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],87,219;
 		else if (strnpcinfo(2) == "arug_cas02") setarray .@i[0],89,256;
 		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 if (strnpcinfo(2) == "schg_cas03") setarray .@i[0],338,202;
 		else setarray .@i[0],120,272;	// Castles 1,4,5 are identical.
 		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;
 	end;
 
 
 OnReset:
 OnReset:

+ 19 - 20
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);
 	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.
 /// Parses a function.