//===== eAthena Script =======================================
//= War of Emperium - Geffen Guild Wars Events
//===== By: ==================================================
//= jAthena (1.0)
//= 1.1 by Akaru and ho|yAnge|
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
//= eAthena 0.1+; RO Episode 4+
//===== Description: =========================================
//= Event Triggers of Geffen Guild Wars
//===== Additional Comments: =================================
//= v1.2 Now using functions for OnAgitStart and OnAgitBreak. [kobra_k88]
//= 1.3 Added code for abandoning captured castles on /breakguild [Lupus]
//= 1.4 Small updated. Changed "EMPERIUM" to "Emperium". [L0ne_W0lf]
//= 1.5 Quick fix "emps not respawning if the emp breaker logs off".
//=     (from r11630 bureport:369) [FlavioJS]
//============================================================


// Castle 1 ================================================================
gefg_cas01,198,182,0	script	Agit_G01	-1,{
OnInterIfInitOnce:
	GetCastleData "gefg_cas01",0,"::OnRecvCastleG01";
	end;
OnRecvCastleG01:
	RequestGuildInfo GetCastleData("gefg_cas01",1);
	end;
OnAgitStart:
	callfunc "F_AgitStart","gefg_cas01","G01",198,182;
	end;
OnAgitBreak:
	callfunc "F_AgitBreak","gefg_cas01","G01";
	goto OnAgitEliminate;
OnGuildBreak:
	callfunc "F_GuildBreak","gefg_cas01","G01";
	end;
OnAgitEliminate:
	sleep getbattleflag("gvg_eliminate_time");
	MapRespawnGuildID "gefg_cas01",GetCastleData("gefg_cas01",1),6;
	sleep 6333-getbattleflag("gvg_eliminate_time");// wait for emp animation to end
	Monster "gefg_cas01",198,182,"Emperium",1288,1,"Agit_G01::OnAgitBreak";
	end;
OnAgitEnd:
	callfunc "F_AgitEnd","gefg_cas01","G01";
	end;
}

// Castle 2 ================================================================
gefg_cas02,176,178,0	script	Agit_G02	-1,{
OnInterIfInitOnce:
	GetCastleData "gefg_cas02",0,"::OnRecvCastleG02";
	end;
OnRecvCastleG02:
	RequestGuildInfo GetCastleData("gefg_cas02",1);
	end;
OnAgitStart:
	callfunc "F_AgitStart","gefg_cas02","G02",176,178;
	end;
OnAgitBreak:
	callfunc "F_AgitBreak","gefg_cas02","G02";
	goto OnAgitEliminate;
OnGuildBreak:
	callfunc "F_GuildBreak","gefg_cas02","G02";
	end;
OnAgitEliminate:
	sleep getbattleflag("gvg_eliminate_time");
	MapRespawnGuildID "gefg_cas02",GetCastleData("gefg_cas02",1),6;
	sleep 6333-getbattleflag("gvg_eliminate_time");// wait for emp animation to end
	Monster "gefg_cas02",176,178,"Emperium",1288,1,"Agit_G02::OnAgitBreak";
	end;
OnAgitEnd:
	callfunc "F_AgitEnd","gefg_cas02","G02";
	end;
}

// Castle 3 ================================================================
gefg_cas03,245,167,0	script	Agit_G03	-1,{
OnInterIfInitOnce:
	GetCastleData "gefg_cas03",0,"::OnRecvCastleG03";
	end;
OnRecvCastleG03:
	RequestGuildInfo GetCastleData("gefg_cas03",1);
	end;
OnAgitStart:
	callfunc "F_AgitStart","gefg_cas03","G03",245,167;
	end;
OnAgitBreak:
	callfunc "F_AgitBreak","gefg_cas03","G03";
	goto OnAgitEliminate;
OnGuildBreak:
	callfunc "F_GuildBreak","gefg_cas03","G03";
	end;
OnAgitEliminate:
	sleep getbattleflag("gvg_eliminate_time");
	MapRespawnGuildID "gefg_cas03",GetCastleData("gefg_cas03",1),6;
	sleep 6333-getbattleflag("gvg_eliminate_time");// wait for emp animation to end
	Monster "gefg_cas03",245,167,"Emperium",1288,1,"Agit_G03::OnAgitBreak";
	end;
OnAgitEnd:
	callfunc "F_AgitEnd","gefg_cas03","G03";
	end;
}

// Castle 4 ================================================================
gefg_cas04,174,178,0	script	Agit_G04	-1,{
OnInterIfInitOnce:
	GetCastleData "gefg_cas04",0,"::OnRecvCastleG04";
	end;
OnRecvCastleG04:
	RequestGuildInfo GetCastleData("gefg_cas04",1);
	end;
OnAgitStart:
	callfunc "F_AgitStart","gefg_cas04","G04",174,178;
	end;
OnAgitBreak:
	callfunc "F_AgitBreak","gefg_cas04","G04";
	goto OnAgitEliminate;
OnGuildBreak:
	callfunc "F_GuildBreak","gefg_cas04","G04";
	end;
OnAgitEliminate:
	sleep getbattleflag("gvg_eliminate_time");
	MapRespawnGuildID "gefg_cas04",GetCastleData("gefg_cas04",1),6;
	sleep 6333-getbattleflag("gvg_eliminate_time");// wait for emp animation to end
	Monster "gefg_cas04",174,178,"Emperium",1288,1,"Agit_G04::OnAgitBreak";
	end;
OnAgitEnd:
	callfunc "F_AgitEnd","gefg_cas04","G04";
	end;
}

// Castle 5 ================================================================
gefg_cas05,194,184,0	script	Agit_G05	-1,{
OnInterIfInitOnce:
	GetCastleData "gefg_cas05",0,"::OnRecvCastleG05";
	end;
OnRecvCastleG05:
	RequestGuildInfo GetCastleData("gefg_cas05",1);
	end;
OnAgitStart:
	callfunc "F_AgitStart","gefg_cas05","G05",194,184;
	end;
OnAgitBreak:
	callfunc "F_AgitBreak","gefg_cas05","G05";
	goto OnAgitEliminate;
OnGuildBreak:
	callfunc "F_GuildBreak","gefg_cas05","G05";
	end;
OnAgitEliminate:
	sleep getbattleflag("gvg_eliminate_time");
	MapRespawnGuildID "gefg_cas05",GetCastleData("gefg_cas05",1),6;
	sleep 6333-getbattleflag("gvg_eliminate_time");// wait for emp animation to end
	Monster "gefg_cas05",194,184,"Emperium",1288,1,"Agit_G05::OnAgitBreak";
	end;
OnAgitEnd:
	callfunc "F_AgitEnd","gefg_cas05","G05";
	end;
}
