Selaa lähdekoodia

Added some source part. Thanks @aleos89 / @Cydh
Some debug thanks @Cydh

Atemo 9 vuotta sitten
vanhempi
commit
9373c697b5

+ 8 - 2
conf/msg_conf/map_msg.conf

@@ -418,7 +418,7 @@
 400: Usage: @jailfor <time> <character name>
 401: You have been jailed for %d years, %d months, %d days, %d hours and %d minutes
 402: %s in jail for %d years, %d months, %d days, %d hours and %d minutes
-// WoE SE (@agitstart2)
+// WoE SE (@agitstart2/@agitend2)
 403: War of Emperium SE has been initiated.
 404: War of Emperium SE is currently in progress.
 405: War of Emperium SE has been ended.
@@ -781,7 +781,13 @@
 739: Please enter a body style (usage: @bodystyle <body ID: %d-%d>).
 740: This job has no alternate body styles.
 
-//741-899 free
+// WoE TE (@agitstart3/@agitend3)
+741: War of Emperium TE has been initiated.
+742: War of Emperium TE is currently in progress.
+743: War of Emperium TE has been ended.
+744: War of Emperium TE is currently not in progress.
+
+//745-899 free
 
 //------------------------------------
 // More atcommands message

+ 5 - 0
db/castle_db.txt

@@ -9,6 +9,7 @@
 // 04. OnGuildBreakEventName    NPC unique name to invoke ::OnGuildBreak on, when a occupied
 //                              castle is abandoned during guild break.
 
+// WOE FE castle
 0,aldeg_cas01,Neuschwanstein,Agit#aldeg_cas01	// kRO : Noisyubantian
 1,aldeg_cas02,Hohenschwangau,Agit#aldeg_cas02	// kRO : Hohensyubangawoo
 2,aldeg_cas03,Nuernberg,Agit#aldeg_cas03		// kRO : Nyirenverk
@@ -29,10 +30,14 @@
 17,prtg_cas03,Fadhgridh,Agit#prtg_cas03			// kRO : Lazrigees
 18,prtg_cas04,Skoegul,Agit#prtg_cas04			// kRO : Squagul
 19,prtg_cas05,Gondul,Agit#prtg_cas05			// kRO : Guindull
+
+// WOE NGuild castle
 20,nguild_alde,Earth,Agit_N01
 21,nguild_gef,Air,Agit_N02
 22,nguild_pay,Water,Agit_N03
 23,nguild_prt,Fire,Agit_N04
+
+// WOE SE castle
 24,schg_cas01,Himinn,Manager#schg_cas01			// kRO : Himinn
 25,schg_cas02,Andlangr,Manager#schg_cas02		// kRO : Andlangr
 26,schg_cas03,Viblainn,Manager#schg_cas03		// kRO : Viblainn

+ 33 - 9
doc/script_commands.txt

@@ -874,6 +874,9 @@ OnAgitInit:
 OnAgitStart2:
 OnAgitEnd2:
 OnAgitInit2:
+OnAgitStart3:
+OnAgitEnd3:
+OnAgitInit3:
 
 OnAgitStart will run whenever the server shifts into WoE mode, whether it is 
 done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd 
@@ -3177,7 +3180,7 @@ This command requests the guild data from the char server and merrily continues
 with the execution. Whenever the guild information becomes available (which 
 happens instantly if the guild information is already in memory, or later, if it 
 isn't and the map server has to wait for the char server to reply) it will run 
-the specified event as in a 'doevent' call.
+the specified event as in a 'donpcevent' call.
 
 ---------------------------------------
 
@@ -3656,10 +3659,11 @@ Name is optional, and defaults to the attached player if omitted.
 
 *agitcheck()
 *agitcheck2()
+*agitcheck3()
 
-These function will let you check whether the server is currently in WoE mode
-(or WoE SE mode if the second function is called) and will return 1 if War of
-Emperium is on and 0 if it isn't. 
+These function will let you check whether the server is currently in WoE:FE mode
+(agitcheck()), WoE:SE mode (agitcheck2()), or WoE:TE mode (agitcheck3()) and will
+return 1 if War of Emperium is on and 0 if it isn't. 
 
 ---------------------------------------
 
@@ -6611,15 +6615,19 @@ For examples, check the WoE scripts in the distribution.
 *agitend;
 *agitstart2;
 *agitend2;
+*agitstart3;
+*agitend3;
 
-These four commands will start and end War of Emperium or War of Emperium SE.
+These six commands will start and end War of Emperium, War of Emperium SE,
+or War of Emperium TE.
 
 This is a bit more complex than it sounds, since the commands themselves won't 
 actually do anything interesting, except causing all 'OnAgitStart:' and 
-'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of latter two
-commands, events to run everywhere, respectively. They are used as  simple 
-triggers to run a lot of complex scripts all across the server, and they, 
-in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
+'OnAgitEnd:', 'OnAgitStart2:' and 'OnAgitEnd2:', or 'OnAgitStart3:' and
+'OnAgitEnd3:' in the case of latter two commands, events to run everywhere,
+respectively. They are used as  simple triggers to run a lot of complex scripts
+all across the server, and they, in turn, are triggered by clock with an
+'OnClock<time>:' time-triggering label.
 
 ---------------------------------------
 
@@ -6676,6 +6684,22 @@ Type indicates what information to return:
  1 - max. hp
  2 - current hp
 
+---------------------------------------
+
+*getguildalliance(<guild id1>, <guild id2>);
+
+This command will return the relation between 2 guilds.
+
+NOTE: This should be use in collaboration with 'requestguildinfo' as the
+map-server needs to request for information from the char-server.
+
+Return values:
+	-2 - Guild ID1 does not exist
+	-1 - Guild ID2 does not exist
+	 0 - Both guilds have no relation OR guild ID aren't given
+	 1 - Both guilds are allies
+	 2 - Both guilds are antagonists
+
 ---------------------------------------
 //
 5,2.- End of guild-related commands

+ 14 - 0
npc/re/mapflag/gvg.txt

@@ -16,8 +16,22 @@
 //= 1.0 Renewal split. [Euphy]
 //============================================================
 
+// Guild Castles ==========
+te_aldecas1	mapflag	gvg_castle
+te_aldecas2	mapflag	gvg_castle
+te_aldecas3	mapflag	gvg_castle
+te_aldecas4	mapflag	gvg_castle
+te_aldecas5	mapflag	gvg_castle
+te_prtcas01	mapflag	gvg_castle
+te_prtcas02	mapflag	gvg_castle
+te_prtcas03	mapflag	gvg_castle
+te_prtcas04	mapflag	gvg_castle
+te_prtcas05	mapflag	gvg_castle
+
 // Guild Dungeons =========
 gld2_ald	mapflag	gvg_dungeon
 gld2_gef	mapflag	gvg_dungeon
 gld2_pay	mapflag	gvg_dungeon
 gld2_prt	mapflag	gvg_dungeon
+teg_dun01	mapflag	gvg_dungeon
+teg_dun02	mapflag	gvg_dungeon

+ 2 - 1
npc/re/scripts_guild.conf

@@ -8,10 +8,11 @@ npc: npc/re/guild/invest_main.txt
 npc: npc/re/guild/invest_npc.txt
 
 npc: npc/re/woe_te/main_TE.txt
+npc: npc/re/woe_te/te_controller.txt
+
 npc: npc/re/woe_te/te_mission_main.txt
 npc: npc/re/woe_te/te_merchant.txt
 
-npc: npc/re/woe_te/te_controller.txt
 npc: npc/re/woe_te/te_alde_cas1.txt
 npc: npc/re/woe_te/te_alde_cas2.txt
 npc: npc/re/woe_te/te_alde_cas3.txt

+ 19 - 6
npc/re/warps/guildcastles.txt

@@ -78,25 +78,38 @@ OnTouch:
 	end;
 
 S_Warp:
-	.@guild_id = getcastledata( getarg(0),1 );
 	if (CanParticipatewoeTE() == 0) {
 		mes "3rd and expansion job level can't enter in WoE TE.";
 		close;
 	}
-	// .@hour = OpenHour_SiegeMode 3 3600
-	if (.@hour != 0 && .@guild_id != getcharid(2)) {
-		// .@alliance = IsAllianceGuild( .@guild_id );
-		if (.@alliance == 0) {
+
+	.@guild_id = getcastledata(getarg(0),1);
+	.@my_guild_id = getcharid(2);
+
+	if (.@guild_id && .@guild_id == .@my_guild_id) {
+		// ResetBuffLowLevelSiege;
+		warp getarg(0),getarg(1),getarg(2);
+		end;
+	}
+
+	// .@hour = OpenHour_SiegeMode 3 3600 //!TODO
+	if (.@hour == 1) {
+		if (!.@guild_id || !.@my_guild_id) {
 			mes "It's time for preparing to WoE. Only Alliance guild is able to enter.";
 			close;
 		}
-		mes "Welcome alliance guild";
+		if (getguildalliance(.@my_guild_id,.@guild_id) != 1) {
+			mes "It's time for preparing to WoE. Only Alliance guild is able to enter.";
+			close;
+		}
+		mes "Welcome alliance guild.";
 		close2;
 	}
 	// ResetBuffLowLevelSiege;
 	warp getarg(0),getarg(1),getarg(2);
 	end;
 }
+
 te_prt_gld,129,65,0	duplicate(warp_TE_castle)	prtg-1_prtg-1-01#1_te	WARPNPC,1,1
 te_prt_gld,240,124,0	duplicate(warp_TE_castle)	prtg-2_prtg-2#2_te	WARPNPC,1,1
 te_prt_gld,153,141,0	duplicate(warp_TE_castle)	prtg-3_prtg-3#3_te	WARPNPC,1,1

+ 26 - 22
npc/re/woe_te/main_TE.txt

@@ -18,10 +18,11 @@ function	script	CanParticipatewoeTE	{
 }
 
 -	script	Manager_TE	-1,{
-OnAgitInit:
+OnAgitInit3:
 	.@map$ = strnpcinfo(4);
 	if (.@map$ == "") end;
-	if (getcastledata(.@map$,1) == 0) {
+	.@guild_id = getcastledata(.@map$,1);
+	if (.@guild_id == 0) {
 		killmonsterall .@map$;
 		donpcevent strnpcinfo(0)+"::OnEmpSpawn";
 		if (compare(.@map$,"te_aldecas")) {
@@ -74,6 +75,7 @@ OnAgitInit:
 		disablenpc "Kafra Staff#"+ .@map$;
 	}
 	else {
+		requestguildinfo .@guild_id;
 		donpcevent "::OnFlagTE" + strnpcinfo(2);// Guild emblem on flags.
 		if (getcastledata(.@map$,9)  == 0)
 			disablenpc "Kafra Staff#"+ .@map$;
@@ -109,10 +111,10 @@ OnEmpSpawn:
 	}
 	end;
 
-OnAgitStart:
+OnAgitStart3:
 	.@map$ = strnpcinfo(4);
 	if (.@map$ == "") end;
-	if (agitcheck()) {
+	if (agitcheck3()) {
 		maprespawnguildid .@map$, getcastledata(.@map$,1),6;// warp all non-guild members and remove monsters (like woe fe)
 		gvgon .@map$;
 		donpcevent strnpcinfo(0)+"::OnEmpSpawn";
@@ -120,7 +122,7 @@ OnAgitStart:
 	}
 	end;
 
-OnAgitEnd:
+OnAgitEnd3:
 	.@map$ = strnpcinfo(4);
 	if (.@map$ == "") end;
 	gvgoff .@map$;
@@ -148,7 +150,7 @@ OnAgitBreak:
 	// Reset Invest information and refresh castle data
 	for ( .@i = 4; .@i <= 9; .@i++ )
 		setcastledata .@map$,.@i,0;
-	donpcevent strnpcinfo(0) +"::OnAgitInit";
+	donpcevent strnpcinfo(0) +"::OnAgitInit3";
 
 	// Erase Guardian Database information if the new owners do not have Guardian Research.
 	if (getgdskilllv(.@guild_id,10002) == 0) {
@@ -162,7 +164,7 @@ OnAgitBreak:
 
 	// Respawn the Emperium, and display new owners.
 	sleep 500;
-	if (agitcheck())
+	if (agitcheck3())
 		donpcevent strnpcinfo(0) +"::OnEmpSpawn";
 	sleep 7000;
 	announce strnpcinfo(2) +" in the fortress of [" + getcastlename(.@map$) + "] is occupied by [" + getguildname(.@guild_id) + "] guild.", bc_all,"0xFF0000",FW_NORMAL,10;
@@ -176,7 +178,7 @@ OnGuildBreak:
 	setcastledata .@map$,1,0;
 	sleep 7000;
 	announce "Guild Base [" + getcastlename(.@map$) + "] has been abandoned.",bc_all;
-	donpcevent strnpcinfo(0) +"::OnAgitInit";
+	donpcevent strnpcinfo(0) +"::OnAgitInit3";
 	end;
 
 S_Message:
@@ -193,15 +195,15 @@ S_Message:
 		.@string$ = "prt0"+ charat( .@map$,getstrlen(.@map$)-1 );
 	donpcevent "#popswitch_"+ .@string$ +"::"+ getarg(0);// monsters for mission TE
 
-	if (.@map$ == "te_alde_cas1") {
-		donpcevent "Blacksmith Cano#tegod01::"+ getarg(0);// god item TE
+	if (.@map$ == "te_aldecas1") {
+		donpcevent "Blacksmith Cano#tegod01::OnInit";// god item TE
 		$@2012_tegod_kafra = 0;
 		$@2012_tegirls_alde01 = 0;
 	}
 	else if (.@map$ == "te_prtcas01") {
     	$@2012_tegod_gloria = 0;
     	$@2012_tegirls_prt01 = 0;
-    	donpcevent "Blacksmith Kai#tegod01#tegod01::"+ getarg(0);
+    	donpcevent "Blacksmith Kai#tegod01::OnInit";
 	}
 	return;
 }
@@ -327,15 +329,17 @@ function GuardianData;
 	next;
 	switch( select( "Check current status of the fortress", "Invest in commercial development level", "Invest in defense level", "Deploy guardians", "Employ / Dismiss a warehouseman", "Enter master's room" ) ) {
 	case 1:
+		.@economy_today = getcastledata(.@map$,4);
+		.@defense_today = getcastledata(.@map$,5);
 		mes .@npc_name$;
 		mes "Let me give you a report on the current status of the fortress.";
 		mes "";
 		mes "^0000ffThe current commercial level is " + getcastledata(.@map$,2) + "~.";
-		if (getcastledata(.@map$,4) > 0)
-			mes "You have invested ~ " + getcastledata(.@map$,4) + " times within the past 1 day.";
+		if (.@economy_today > 0)
+			mes "You have invested ~ " + .@economy_today + " times within the past 1 day.";
 		mes "The current defense level is " + getcastledata(.@map$,3) +  "~.^000000";
-		if (getcastledata(.@map$,5) > 0)
-			mes "^0000ff- Within the past 1 day, you have invested ~ " + getcastledata(.@map$,5) + " times.^000000";
+		if (.@defense_today > 0)
+			mes "^0000ff- Within the past 1 day, you have invested ~ " + .@defense_today + " times.^000000";
 		mes "";
 		mes "That's about it.";
 		close;
@@ -344,7 +348,7 @@ function GuardianData;
 		.@economy = getcastledata(.@map$,2);
 		setarray .@eco_invest[0], 5,5000, 10,10000, 15,20000, 20,35000, 25,55000, 30,80000, 35,110000, 40,145000, 45,185000, 50,230000,
 			55,280000, 60,335000, 65,395000, 70,460000, 75,530000, 80,605000, 85,685000, 90,770000, 95,860000, 100,955000;
-		for ( .@i = 0; .@i < 40; .@i += 2 )
+		for ( .@i = 0; .@i < getarraysize(.@eco_invest); .@i += 2 )
 			if (.@economy <= .@eco_invest[.@i]) break;
 		callsub( S_Invest, 4, .@eco_invest[.@i+1], getcastledata(.@map$,4), "commercial development", "number of items produced within the guild increases" );
 
@@ -352,7 +356,7 @@ function GuardianData;
 		.@defense = getcastledata(.@map$,3);
 		setarray .@def_invest[0], 5,10000, 10,20000, 15,40000, 20,70000, 25,110000, 30,160000, 35,220000, 40,290000, 45,370000, 50,460000,
 			55,560000, 60,670000, 65,790000, 70,920000, 75,1060000, 80,1210000, 85,1370000, 90,1540000, 95,1720000, 100,1910000;
-		for ( .@i = 0; .@i < 40; .@i += 2 )
+		for ( .@i = 0; .@i < getarraysize(.@def_invest); .@i += 2 )
 			if (.@defense <= .@def_invest[.@i]) break;
 		callsub( S_Invest, 5, .@def_invest[.@i+1], getcastledata(.@map$,5), "defense", "durability of guardian and Emperiums increase" );
 
@@ -362,7 +366,7 @@ function GuardianData;
 		mes "Select a guardian that you wish to install.";
 		next;
 		GuardianData( .@mob_id, .@x, .@y, .@name$ );
-		for ( .@i = 0; .@i < 8 ; .@i++ ) {
+		for ( .@i = 0; .@i < MAX_GUARDIANS ; .@i++ ) {
 			if (guardianinfo(.@map$,.@i,0))
 				.@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Implemented (" + guardianinfo(.@map$,.@i,2) + "/" + guardianinfo(.@map$,.@i,1) + "):";// hp/hpmax
 			else
@@ -647,11 +651,11 @@ function GuardianData {
 			1285, 32, 253, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
 			1285, 44, 248, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
 	}
-	for ( .@i = 0; .@i < 32; .@i += 4 ) {
+	for ( .@i = 0; .@i < getarraysize(.@data$); .@i += 4 ) {
 		set getelementofarray( getarg(0),.@index ), .@data$[.@i];
 		set getelementofarray( getarg(1),.@index ), .@data$[.@i+1];
 		set getelementofarray( getarg(2),.@index ), .@data$[.@i+2];
-		set getelementofarray( getarg(2),.@index ), .@data$[.@i+3];
+		set getelementofarray( getarg(3),.@index ), .@data$[.@i+3];
 		.@index++;
 	}
 }
@@ -660,7 +664,7 @@ OnSpawnGuardians:
 	GuardianData( .@mob_id, .@x, .@y, .@name$ );
 	.@map$ = strnpcinfo(4);
 	killmonster .@map$, "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied";
-	for ( .@i = 0; .@i < 8; .@i++ ) {
+	for ( .@i = 0; .@i < MAX_GUARDIANS; .@i++ ) {
 		if (getcastledata( .@map$,(.@i+10) ))
 			guardian .@map$, .@x[.@i], .@y[.@i], .@name$[.@i], .@mob_id[.@i], "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied",.@i;
 	}
@@ -1032,7 +1036,7 @@ OnClock0001:// Spawn Treasure Chests based on castle economy.
 			2457, 273,179;
 	}
 	.@treasure_num = ( 4 + ( .@economy /5 ) ) *3;// x3 <-> data[] size
-	for ( .@i = 0; .@i < 72 && .@treasure_num > .@i; .@i += 3 )// nb. [4;24] chests
+	for ( .@i = 0; .@i < getarraysize(.@data) && .@treasure_num > .@i; .@i += 3 )// nb. [4;24] chests
 		monster .@map$, .@data[.@i+1], .@data[.@i+2],"Treasure Chest", .@data[.@i],1, strnpcinfo(0)+"::OnTreasureDied";
 
 OnTreasureDied:

+ 2 - 2
npc/re/woe_te/te_controller.txt

@@ -12,7 +12,7 @@
 
 OnClock2100://start time for Tues(2), Thurs(4)
 OnClock2300://end time for Tues(2), Thurs(4)
-OnClock1600://start time for Sat(6)
+OnClock1600://start time for Sat(4)
 OnClock1800://end time for Sat(6)
 
 OnAgitInit:
@@ -28,7 +28,7 @@ OnAgitInit:
 	// end time checks
 	if ((gettime(4)==2) && (gettime(3)==23) ||
 	    (gettime(4)==4) && (gettime(3)==23) ||
-	    (gettime(4)==6) && (gettime(3)==18)) { 
+	    (gettime(4)==6) && (gettime(3)==18)) {
 		if (agitcheck())
 			agitend;
 		end;

+ 2 - 3
npc/re/woe_te/te_goditem_alde1.txt

@@ -16,7 +16,6 @@ te_aldecas1,226,34,3	script	Blacksmith Cano#tegod01	4_M_RACHMAN1,{
 	// .@siege_check = CheckSiegeTime 3
 
 	// .@time_check = OpenHour_SiegeMode 3 14400
-	.@siege_check = agitcheck();
 
 	.@guild_id = getcastledata( "te_aldecas1",1 );
 	.@economy = getcastledata("te_aldecas1",2);
@@ -34,7 +33,7 @@ te_aldecas1,226,34,3	script	Blacksmith Cano#tegod01	4_M_RACHMAN1,{
 		mes "Please, pretend not to see me.";
 		close;
 	}
-	if (.@time_check == 1 || .@siege_check == 1) {
+	if (.@time_check == 1 || agitcheck3() == 1) {
 		mes "From now on, I'll stay here quietly and not interrupt anyone until the siege ends.";
 		mes "Don't worry about me.";
 		close;
@@ -375,7 +374,7 @@ S_Fuse:
 	}
 
 OnInit:
-	if ($@2012_tegod_kafra == 3)
+	if ($@2012_tegod_kafra == 3 || agitcheck3())
 		disablenpc strnpcinfo(0);
 	else
 		enablenpc strnpcinfo(0);

+ 2 - 2
npc/re/woe_te/te_goditem_prt01.txt

@@ -30,7 +30,7 @@ te_prtcas01,204,204,3	script	Blacksmith Kai#tegod01	4_M_RACHMAN2,{
 		mes "Please, pretend not to see me.";
 		close;
 	}
-	if (.@time_check == 1 || .@siege_check == 1) {
+	if (.@time_check == 1 || agitcheck3() == 1) {
 		mes "From now on, I'll stay here quietly and not interrupt anyone until the siege ends.";
 		mes "Don't worry about me.";
 		close;
@@ -371,7 +371,7 @@ S_Fuse:
 	}
 
 OnInit:
-	if ($@2012_tegod_gloria == 3)
+	if ($@2012_tegod_gloria == 3 || agitcheck3())
 		disablenpc strnpcinfo(0);
 	else
 		enablenpc strnpcinfo(0);

+ 5 - 8
npc/re/woe_te/te_mission_main.txt

@@ -11,8 +11,7 @@
 -	script	#popswitch	-1,{
 OnInit:
 	if (strnpcinfo(4) == "") end;
-	// var sig = CheckSiegeTime 3
-	if (agitcheck() == 1)
+	if (agitcheck3() == 1)
 		donpcevent strnpcinfo(0) + "::OnCommandOn";
 	else
 		donpcevent strnpcinfo(0) + "::OnReset";
@@ -58,7 +57,7 @@ OnTimer12000:
 	stopnpctimer;
 OnCommandOn:
 	callsub S_Coord, .@item_id, .@mob_id, .@mob_name$, .@coord;
-	monster strnpcinfo(4), rand( .@coord[0],.@coord[1] ), rand( .@coord[2],.@coord[3] ),.@mob_name$,.@mob_id,1,strnpcinfo(0) + "::OnMyMobDead";// THIEF_PORING -> todo: not implemented
+	monster strnpcinfo(4), rand( .@coord[0],.@coord[1] ), rand( .@coord[2],.@coord[3] ),.@mob_name$,.@mob_id,1,strnpcinfo(0) + "::OnMyMobDead";// THIEF_PORING, BABY_STRANGE -> !TODO: not implemented
 	end;
 
 OnReset:
@@ -183,8 +182,7 @@ S_Coord:
 			close;
 		}
 		// .@time_check = OpenHour_SiegeMode 3 3600
-		// .@siege_check = agitcheck();
-		.@siege_check = 1;
+		.@siege_check = agitcheck3();
 		mes "You already know that you have to accept a mission in a certain period of time, right?";
 		if (.@time_check == 1 || .@siege_check == 1)
 			mes "Moreover, you have to keep in mind that you can't accept both high-level and low-level missions simultaneously if they are of the same content.";
@@ -493,9 +491,8 @@ S_Coord:
 
 S_Cancelquest:
 	.@npc_name$ = getarg(1);
-	// .@playtime_check = OpenHour_SiegeMode 3 3600
-	// .@siege_check = agitcheck();
-	.@siege_check = 1;// test
+	// .@time_check = = OpenHour_SiegeMode 3 3600
+	.@siege_check = agitcheck3();
 	if ((.@time_check == 1) || (.@siege_check == 1)) {
 		mes "It seems like you haven't accomplished the mission yet?";
 		mes getarg(2);

+ 64 - 20
src/map/atcommand.c

@@ -3457,78 +3457,120 @@ ACMD_FUNC(breakguild)
 	return 0;
 }
 
-/*==========================================
- *
- *------------------------------------------*/
+/**
+ * Start WoE:FE
+ */
 ACMD_FUNC(agitstart)
 {
 	nullpo_retr(-1, sd);
-	if (agit_flag == 1) {
+
+	if (agit_flag) {
 		clif_displaymessage(fd, msg_txt(sd,73)); // War of Emperium is currently in progress.
 		return -1;
 	}
 
-	agit_flag = 1;
+	agit_flag = true;
 	guild_agit_start();
 	clif_displaymessage(fd, msg_txt(sd,72)); // War of Emperium has been initiated.
 
 	return 0;
 }
 
-/*==========================================
- *
- *------------------------------------------*/
+/**
+ * Start WoE:SE
+ */
 ACMD_FUNC(agitstart2)
 {
 	nullpo_retr(-1, sd);
-	if (agit2_flag == 1) {
+
+	if (agit2_flag) {
 		clif_displaymessage(fd, msg_txt(sd,404)); // "War of Emperium SE is currently in progress."
 		return -1;
 	}
 
-	agit2_flag = 1;
+	agit2_flag = true;
 	guild_agit2_start();
 	clif_displaymessage(fd, msg_txt(sd,403)); // "War of Emperium SE has been initiated."
 
 	return 0;
 }
 
-/*==========================================
- *
- *------------------------------------------*/
+/**
+ * Start WoE:TE
+ */
+ACMD_FUNC(agitstart3)
+{
+	nullpo_retr(-1, sd);
+
+	if (agit3_flag) {
+		clif_displaymessage(fd, msg_txt(sd,742)); // "War of Emperium TE is currently in progress."
+		return -1;
+	}
+
+	agit3_flag = true;
+	guild_agit3_start();
+	clif_displaymessage(fd, msg_txt(sd,741)); // "War of Emperium TE has been initiated."
+
+	return 0;
+}
+
+/**
+ * End WoE:FE
+ */
 ACMD_FUNC(agitend)
 {
 	nullpo_retr(-1, sd);
-	if (agit_flag == 0) {
+
+	if (!agit_flag) {
 		clif_displaymessage(fd, msg_txt(sd,75)); // War of Emperium is currently not in progress.
 		return -1;
 	}
 
-	agit_flag = 0;
+	agit_flag = false;
 	guild_agit_end();
 	clif_displaymessage(fd, msg_txt(sd,74)); // War of Emperium has been ended.
 
 	return 0;
 }
 
-/*==========================================
- *
- *------------------------------------------*/
+/**
+ * End WoE:SE
+ */
 ACMD_FUNC(agitend2)
 {
 	nullpo_retr(-1, sd);
-	if (agit2_flag == 0) {
+
+	if (!agit2_flag) {
 		clif_displaymessage(fd, msg_txt(sd,406)); // "War of Emperium SE is currently not in progress."
 		return -1;
 	}
 
-	agit2_flag = 0;
+	agit2_flag = false;
 	guild_agit2_end();
 	clif_displaymessage(fd, msg_txt(sd,405)); // "War of Emperium SE has been ended."
 
 	return 0;
 }
 
+/**
+ * End WoE:TE
+ */
+ACMD_FUNC(agitend3)
+{
+	nullpo_retr(-1, sd);
+
+	if (!agit3_flag) {
+		clif_displaymessage(fd, msg_txt(sd,744));// War of Emperium TE is currently not in progress.
+		return -1;
+	}
+
+	agit3_flag = false;
+	guild_agit3_end();
+	clif_displaymessage(fd, msg_txt(sd,743));// War of Emperium TE has been ended.
+
+	return 0;
+}
+
 /*==========================================
  * @mapexit - shuts down the map server
  *------------------------------------------*/
@@ -10075,6 +10117,8 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(cloneequip),
 		ACMD_DEF(clonestat),
 		ACMD_DEF(bodystyle),
+		ACMD_DEF(agitstart3),
+		ACMD_DEF(agitend3),
 	};
 	AtCommandInfo* atcommand;
 	int i;

+ 2 - 2
src/map/battle.c

@@ -7503,7 +7503,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 		{
 			struct mob_data *md = BL_CAST(BL_MOB, t_bl);
 
-			if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+			if( !map_flag_gvg(m) && md->guardian_data && md->guardian_data->guild_id )
 				return 0; // Disable guardians/emperiums owned by Guilds on non-woe times.
 			break;
 		}
@@ -7571,7 +7571,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 		case BL_MOB:
 		{
 			struct mob_data *md = BL_CAST(BL_MOB, s_bl);
-			if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+			if( !map_flag_gvg(m) && md->guardian_data && md->guardian_data->guild_id )
 				return 0; // Disable guardians/emperium owned by Guilds on non-woe times.
 
 			if( !md->special_state.ai )

+ 1 - 1
src/map/clif.c

@@ -13212,7 +13212,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd){
 	if( !emblem_len || !sd->state.gmaster_flag )
 		return;
 
-	if(!(battle_config.emblem_woe_change) && (agit_flag || agit2_flag) ){
+	if(!(battle_config.emblem_woe_change) && is_agit_start() ){
 		clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,385)); //"You not allowed to change emblem during woe"
 		return;
 	}

+ 47 - 23
src/map/guild.c

@@ -598,7 +598,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
 
 	if(tsd->status.guild_id>0 ||
 		tsd->guild_invite>0 ||
-		((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
+		map_flag_gvg(tsd->bl.m))
 	{	//Can't invite people inside castles. [Skotlex]
 		clif_guild_inviteack(sd,0);
 		return 0;
@@ -762,7 +762,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, uint32 account_id, ui
 
 	if(sd->status.account_id!=account_id ||
 		sd->status.char_id!=char_id || sd->status.guild_id!=guild_id ||
-		((agit_flag || agit2_flag) && map[sd->bl.m].flag.gvg_castle))
+		map_flag_gvg(sd->bl.m))
 		return 0;
 
 	guild_trade_bound_cancel(sd);
@@ -794,7 +794,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, uint32 account_id
 	//Can't leave inside guild castles.
 	if ((tsd = map_id2sd(account_id)) &&
 		tsd->status.char_id == char_id &&
-		((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
+		map_flag_gvg(tsd->bl.m))
 		return 0;
 
 	// find the member and perform expulsion
@@ -1327,7 +1327,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id) {
 void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
 	struct skill_unit_group* group = NULL;
 	int type = status_skill2sc(skill_id);
-	if( !(battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) &&
+	if( !(battle_config.guild_aura&(is_agit_start()?2:1)) &&
 			!(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
 		return;
 	if( !skill_lv )
@@ -1395,7 +1395,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
 	struct guild *g[2];
 	int i;
 
-	if(agit_flag || agit2_flag) {	// Disable alliance creation during woe [Valaris]
+	if(is_agit_start()) {	// Disable alliance creation during woe [Valaris]
 		clif_displaymessage(sd->fd,msg_txt(sd,676)); //"Alliances cannot be made during Guild Wars!"
 		return 0;
 	}	// end addition [Valaris]
@@ -1511,7 +1511,7 @@ int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int fl
 int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
 	nullpo_ret(sd);
 
-	if(agit_flag || agit2_flag)	{	// Disable alliance breaking during woe [Valaris]
+	if(is_agit_start())	{	// Disable alliance breaking during woe [Valaris]
 		clif_displaymessage(sd->fd,msg_txt(sd,677)); //"Alliances cannot be broken during Guild Wars!"
 		return 0;
 	}	// end addition [Valaris]
@@ -1548,7 +1548,7 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) {
 				clif_guild_oppositionack(sd,2);
 				return 0;
 			}
-			if(agit_flag || agit2_flag) // Prevent the changing of alliances to oppositions during WoE.
+			if(is_agit_start()) // Prevent the changing of alliances to oppositions during WoE.
 				return 0;
 			//Change alliance to opposition.
 			intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id,
@@ -2006,6 +2006,7 @@ int guild_castledataloadack(int len, struct guild_castle *gc) {
 	if( ev < 0 ) { //No castles owned, invoke OnAgitInit as it is.
 		npc_event_doall("OnAgitInit");
 		npc_event_doall("OnAgitInit2");
+		npc_event_doall("OnAgitInit3");
 	} else // load received castles into memory, one by one
 	for( i = 0; i < n; i++, gc++ ) {
 		struct guild_castle *c = guild_castle_search(gc->castle_id);
@@ -2023,6 +2024,7 @@ int guild_castledataloadack(int len, struct guild_castle *gc) {
 			else { // last owned one
 				guild_npc_request_info(c->guild_id, "::OnAgitInit");
 				guild_npc_request_info(c->guild_id, "::OnAgitInit2");
+				guild_npc_request_info(c->guild_id, "::OnAgitInit3");
 			}
 		}
 	}
@@ -2030,38 +2032,60 @@ int guild_castledataloadack(int len, struct guild_castle *gc) {
 	return 0;
 }
 
-/*====================================================
- * Start normal woe and triggers all npc OnAgitStart
- *---------------------------------------------------*/
-void guild_agit_start(void) {	// Run All NPC_Event[OnAgitStart]
+/**
+ * Start WoE:FE and triggers all npc OnAgitStart
+ */
+void guild_agit_start(void)
+{
 	int c = npc_event_doall("OnAgitStart");
 	ShowStatus("NPC_Event:[OnAgitStart] Run (%d) Events by @AgitStart.\n",c);
 }
 
-/*====================================================
- * End normal woe and triggers all npc OnAgitEnd
- *---------------------------------------------------*/
-void guild_agit_end(void) {	// Run All NPC_Event[OnAgitEnd]
+/**
+ * End WoE:FE and triggers all npc OnAgitEnd
+ */
+void guild_agit_end(void)
+{
 	int c = npc_event_doall("OnAgitEnd");
 	ShowStatus("NPC_Event:[OnAgitEnd] Run (%d) Events by @AgitEnd.\n",c);
 }
 
-/*====================================================
- * Start woe2 and triggers all npc OnAgitStart2
- *---------------------------------------------------*/
-void guild_agit2_start(void) {	// Run All NPC_Event[OnAgitStart2]
+/**
+ * Start WoE:SE and triggers all npc OnAgitStart2
+ */
+void guild_agit2_start(void)
+{
 	int c = npc_event_doall("OnAgitStart2");
 	ShowStatus("NPC_Event:[OnAgitStart2] Run (%d) Events by @AgitStart2.\n",c);
 }
 
-/*====================================================
- * End woe2 and triggers all npc OnAgitEnd2
- *---------------------------------------------------*/
-void guild_agit2_end(void) {	// Run All NPC_Event[OnAgitEnd2]
+/**
+ * End WoE:SE and triggers all npc OnAgitEnd2
+ */
+void guild_agit2_end(void)
+{
 	int c = npc_event_doall("OnAgitEnd2");
 	ShowStatus("NPC_Event:[OnAgitEnd2] Run (%d) Events by @AgitEnd2.\n",c);
 }
 
+/**
+ * Start WoE:TE and triggers all npc OnAgitStart3
+ */
+void guild_agit3_start(void)
+{
+	int c = npc_event_doall("OnAgitStart3");
+	ShowStatus("NPC_Event:[OnAgitStart3] Run (%d) Events by @AgitStart3.\n",c);
+}
+
+/**
+ * End WoE:TE and triggers all npc OnAgitEnd3
+ */
+void guild_agit3_end(void)
+{
+	int c = npc_event_doall("OnAgitEnd3");
+	ShowStatus("NPC_Event:[OnAgitEnd3] Run (%d) Events by @AgitEnd3.\n",c);
+}
+
 // How many castles does this guild have?
 int guild_checkcastles(struct guild *g) {
 	int nb_cas = 0;

+ 4 - 0
src/map/guild.h

@@ -100,6 +100,10 @@ void guild_agit_end(void);
 
 void guild_agit2_start(void);
 void guild_agit2_end(void);
+
+void guild_agit3_start(void);
+void guild_agit3_end(void);
+
 /* guild flag cachin */
 void guild_flag_add(struct npc_data *nd);
 void guild_flag_remove(struct npc_data *nd);

+ 1 - 1
src/map/log.c

@@ -444,7 +444,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
 		return;
 	}
 
-	if( log_config.log_chat_woe_disable && ( agit_flag || agit2_flag ) )
+	if( log_config.log_chat_woe_disable && is_agit_start() )
 	{// no chat logging during woe
 		return;
 	}

+ 3 - 2
src/map/map.c

@@ -111,8 +111,9 @@ int map_port=0;
 int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
 int minsave_interval = 100;
 unsigned char save_settings = CHARSAVE_ALL;
-int agit_flag = 0;
-int agit2_flag = 0;
+bool agit_flag = false;
+bool agit2_flag = false;
+bool agit3_flag = false;
 int night_flag = 0; // 0=day, 1=night [Yor]
 
 #ifdef ADJUST_SKILL_DAMAGE

+ 8 - 4
src/map/map.h

@@ -273,9 +273,9 @@ enum e_mapid {
 #define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
 
 //Specifies maps where players may hit each other
-#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
+#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag || agit3_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
 //Specifies maps that have special GvG/WoE restrictions
-#define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle))
+#define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag || agit3_flag) && map[m].flag.gvg_castle))
 //Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status)
 #define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle)
 // No Kill Steal Protection
@@ -775,11 +775,15 @@ extern int map_num;
 extern int autosave_interval;
 extern int minsave_interval;
 extern unsigned char save_settings;
-extern int agit_flag;
-extern int agit2_flag;
 extern int night_flag; // 0=day, 1=night [Yor]
 extern int enable_spy; //Determines if @spy commands are active.
 
+// Agit Flags
+extern bool agit_flag;
+extern bool agit2_flag;
+extern bool agit3_flag;
+#define is_agit_start() (agit_flag || agit2_flag || agit3_flag)
+
 extern char motd_txt[];
 extern char help_txt[];
 extern char help2_txt[];

+ 1 - 0
src/map/npc.c

@@ -4439,6 +4439,7 @@ int npc_reload(void) {
 	/* refresh guild castle flags on both woe setups */
 	npc_event_doall("OnAgitInit");
 	npc_event_doall("OnAgitInit2");
+	npc_event_doall("OnAgitInit3");
 
 	//Execute the OnInit event for freshly loaded npcs. [Skotlex]
 	ShowStatus("Event '"CL_WHITE"OnInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n",npc_event_doall("OnInit"));

+ 143 - 16
src/map/script.c

@@ -12245,56 +12245,122 @@ BUILDIN_FUNC(maprespawnguildid)
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/// Siege commands
+
+/**
+ * Start WoE:FE
+ * agitstart();
+ */
 BUILDIN_FUNC(agitstart)
 {
-	if(agit_flag==1) return SCRIPT_CMD_SUCCESS;      // Agit already Start.
-	agit_flag=1;
+	if (agit_flag)
+		return SCRIPT_CMD_SUCCESS;// Agit already Started.
+	agit_flag = true;
 	guild_agit_start();
+
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/**
+ * End WoE:FE
+ * agitend();
+ */
 BUILDIN_FUNC(agitend)
 {
-	if(agit_flag==0) return SCRIPT_CMD_SUCCESS;      // Agit already End.
-	agit_flag=0;
+	if (!agit_flag)
+		return SCRIPT_CMD_SUCCESS;// Agit already Ended.
+	agit_flag = false;
 	guild_agit_end();
+
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/**
+ * Start WoE:SE
+ * agitstart2();
+ */
 BUILDIN_FUNC(agitstart2)
 {
-	if(agit2_flag==1) return SCRIPT_CMD_SUCCESS;      // Agit2 already Start.
-	agit2_flag=1;
+	if (agit2_flag)
+		return SCRIPT_CMD_SUCCESS;// Agit2 already Started.
+	agit2_flag = true;
 	guild_agit2_start();
+
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/**
+ * End WoE:SE
+ * agitend();
+ */
 BUILDIN_FUNC(agitend2)
 {
-	if(agit2_flag==0) return SCRIPT_CMD_SUCCESS;      // Agit2 already End.
-	agit2_flag=0;
+	if (!agit2_flag)
+		return SCRIPT_CMD_SUCCESS;// Agit2 already Ended.
+	agit2_flag = false;
 	guild_agit2_end();
+
 	return SCRIPT_CMD_SUCCESS;
 }
 
-/*==========================================
- * Returns whether woe is on or off.	// choice script
- *------------------------------------------*/
+/**
+ * Start WoE:TE
+ * agitstart3();
+ */
+BUILDIN_FUNC(agitstart3)
+{
+    if (agit3_flag)
+		return SCRIPT_CMD_SUCCESS;// AgitTE already Started.
+    agit3_flag = true;
+    guild_agit3_start();
+
+    return SCRIPT_CMD_SUCCESS;
+}
+
+/**
+ * End WoE:TE
+ * agitend3();
+ */
+BUILDIN_FUNC(agitend3)
+{
+    if (!agit3_flag)
+		return SCRIPT_CMD_SUCCESS;// AgitTE already Ended.
+    agit3_flag = false;
+    guild_agit3_end();
+
+    return SCRIPT_CMD_SUCCESS;
+}
+
+/**
+ * Returns whether WoE:FE is on or off.
+ * agitcheck();
+ */
 BUILDIN_FUNC(agitcheck)
 {
-	script_pushint(st,agit_flag);
+	script_pushint(st, agit_flag);
 	return SCRIPT_CMD_SUCCESS;
 }
 
-/*==========================================
- * Returns whether woese is on or off.	// choice script
- *------------------------------------------*/
+/**
+ * Returns whether WoE:SE is on or off.
+ * agitcheck2();
+ */
 BUILDIN_FUNC(agitcheck2)
 {
-	script_pushint(st,agit2_flag);
+	script_pushint(st, agit2_flag);
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/**
+ * Returns whether WoE:TE is on or off.
+ * agitcheck3();
+ */
+BUILDIN_FUNC(agitcheck3)
+{
+    script_pushint(st, agit3_flag);
+    return SCRIPT_CMD_SUCCESS;
+}
+
 /// Sets the guild_id of this npc.
 ///
 /// flagemblem <guild_id>;
@@ -21050,6 +21116,61 @@ BUILDIN_FUNC(opendressroom)
 #endif
 }
 
+/**
+ * Return alliance information between the two guilds.
+ * getguildalliance(<guild id1>,<guild id2>);
+ * Return values:
+ *	-2 - Guild ID1 does not exist
+ *	-1 - Guild ID2 does not exist
+ *	 0 - Both guilds have no relation OR guild ID aren't given
+ *	 1 - Both guilds are allies
+ *	 2 - Both guilds are antagonists
+ */
+BUILDIN_FUNC(getguildalliance)
+{
+	struct guild *guild_data1, *guild_data2;
+	int guild_id1, guild_id2, i = 0;
+
+	guild_id1 = script_getnum(st,2);
+	guild_id2 = script_getnum(st,3);
+
+	if (guild_id1 < 1 || guild_id2 < 1) {
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	if (guild_id1 == guild_id2) {
+		script_pushint(st, 1);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	guild_data1 = guild_search(guild_id1);
+	guild_data2 = guild_search(guild_id2);
+
+	if (guild_data1 == NULL) {
+		ShowWarning("buildin_getguildalliance: Requesting non-existent GuildID1 '%d'.\n", guild_id1);
+		script_pushint(st, -2);
+		return SCRIPT_CMD_FAILURE;
+	}
+	if (guild_data2 == NULL) {
+		ShowWarning("buildin_getguildalliance: Requesting non-existent GuildID2 '%d'.\n", guild_id2);
+		script_pushint(st, -1);
+		return SCRIPT_CMD_FAILURE;
+	}
+
+	ARR_FIND(0, MAX_GUILDALLIANCE, i, guild_data1->alliance[i].guild_id == guild_id2);
+	if (i == MAX_GUILDALLIANCE) {
+		script_pushint(st, 0);
+		return SCRIPT_CMD_SUCCESS;
+	}
+
+	if (guild_data1->alliance[i].opposition)
+		script_pushint(st, 2);
+	else
+		script_pushint(st, 1);
+
+	return SCRIPT_CMD_SUCCESS;
+}
 
 #include "../custom/script.inc"
 
@@ -21617,6 +21738,12 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(setquestinfo_req,"iii*"),
 	BUILDIN_DEF(setquestinfo_job,"ii*"),
 	BUILDIN_DEF(opendressroom,"i?"),
+	BUILDIN_DEF(getguildalliance,"ii"),
+
+	// WoE TE
+	BUILDIN_DEF(agitstart3,""),
+	BUILDIN_DEF(agitend3,""),
+	BUILDIN_DEF(agitcheck3,""),
 
 #include "../custom/script_def.inc"
 

+ 1 - 0
src/map/script_constants.h

@@ -16,6 +16,7 @@
 	export_constant(MAX_PARTY);
 	export_constant(MAX_GUILD);
 	export_constant(MAX_GUILDLEVEL);
+	export_constant(MAX_GUARDIANS);
 	export_constant(MAX_GUILD_STORAGE);
 	export_constant(MAX_BG_MEMBERS);
 	export_constant(MAX_CHAT_USERS);

+ 1 - 1
src/map/skill.c

@@ -720,7 +720,7 @@ bool skill_isNotOk(uint16 skill_id, struct map_session_data *sd)
 		case GD_EMERGENCYCALL:
 		case GD_ITEMEMERGENCYCALL:
 			if (
-				!(battle_config.emergency_call&((agit_flag || agit2_flag)?2:1)) ||
+				!(battle_config.emergency_call&((is_agit_start())?2:1)) ||
 				!(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) ||
 				(battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle)
 			)	{