// CVC ]w
//###########################################################################################
// GVG - 00:00 2004/06/27 
// BY Michael p  http//www.99nest.com
//###########################################################################################
//npc "gef_fild13" "Xm" GUILD_FLAG 190 283 3 5 5
gef_fild13.gat,190,283,3	script	ģ߮#g4-1	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	if (GetCharID(2) == @GIDg4) goto L_Member;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;
L_Member:
	mes "[ TGڭ ]";
	mes "iH...";
	mes "n^zWAa?";
	next;
	menu "^쯵Ka ",L_Warp," ",-;
	close;
	end;
L_Warp:
	warp "gefg_cas04.gat",59,70;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gef_fild13" "Xm" GUILD_FLAG 199 274 3 5 5
gef_fild13.gat,199,274,3	script	ģ߮#g4-2	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	if (GetCharID(2) == @GIDg4) goto L_Member;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;
L_Member:
	mes "[ TGڭ ]";
	mes "iH...";
	mes "n^zWAa?";
	next;
	menu "^쯵Ka ",L_Warp," ",-;
	close;
	end;
L_Warp:
	warp "gefg_cas04.gat",59,70;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 24 157 4 5 5
gefg_cas04.gat,24,157,4	script	ģ߮#g4-3	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 35 158 4 5 5
gefg_cas04.gat,35,158,4	script	ģ߮#g4-4	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 44 184 4 5 5
gefg_cas04.gat,44,184,4	script	ģ߮#g4-5	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 51 184 4 5 5
gefg_cas04.gat,51,184,4	script	ģ߮#g4-6	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 39 212 7 5 5
gefg_cas04.gat,39,212,7	script	ģ߮#g4-7	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 29 212 1 5 5
gefg_cas04.gat,29,212,1	script	ģ߮#g4-8	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 24 73 1 5 5
gefg_cas04.gat,24,73,1	script	ģ߮#g4-9	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}

//npc "gefg_cas04" "Xm" GUILD_FLAG 35 73 4 5 5
gefg_cas04.gat,35,73,4	script	ģ߮#g4-10	722,{
	set @GIDg4,getcastledata("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "   o̤GASҦv";
	mes "   Xm";
	mes " ";
	mes "2. ԳӦubo̪AiȪ礧";
	mes "   }aRݪH";
	mes "   |礩";
	mes "   g{Ҫ";
	mes "   KaҦv";
	close;
	end;
L_Guild:
	mes "       [ wԤ  iO ]";
	mes " ";
	mes "1. ھڳo̪AwԤO";
	mes "    o̳Q{w ^ff0000" + GetGuildName(@GIDg4) + "^000000u|";
	mes "    p";
	mes " ";
	mes "2. ^ff0000" + GetGuildName(@GIDg4) + "^000000 u|DHO";
	mes "    ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 A L׬O";
	mes "    oƱN";
	mes "    ЧA|_zCAۤvWAa";
	close;
	end;

OnRecvCastleG04:
	FlagEmblem GetCastleData("gefg_cas04.gat",1);
	end;
}











//npc "gefg_cas04" " " HIDDEN_NPC 113 115 0 5 5
//gefg_cas04.gat,113,115,0	script	@	111,{
gefg_cas04.gat,117,123,0	script	@	111,{
	mes " ";
	mes "pԱ AAnUԶ? ";
	next;
	menu "ڭn ",L_Yes,"ڤn ",L_No;
L_Yes:
	warp "gefg_cas04.gat",73,47;
	end;
L_No:
	close;
	end;
}

//npc "gefg_cas04" " " HIDDEN_NPC 58 75 0 5 5
gefg_cas04.gat,58,75,0	script	@	111,{
	set @GIDg4,GetCastleData("gefg_cas04.gat",1);
	if (@GIDg4 > 0) goto L_Guild;
	mes " [ TGn ] ";
	mes " ' qL禨i𪺥DH ... AhM䥦窺' ";
	close;
	end;
L_Guild:
	mes "[ TGn ]";
	mes " ' ui𪺥DHA~౵'";
	next;
	mes " ";
	mes "pԱ AAnUԶ? ";
	next;
	menu "ڭn ",L_Yes,"ڤn ",L_No;
L_Yes:
	if (GetCharID(2) != @GIDg4) goto L_NotMember;
	warp "gld_dun04.gat",268,108;
	end;
L_NotMember:
	mes " ";
	mes " SoͥƱ ";
	close;
	end;
L_No:
	close;
	end;
}



//npc "gefg_cas04" "d ¾" 4_F_KAFRA1 59 70 3 5 5
gefg_cas04.gat,59,70,3	script	d ¾#gef4	117,{
//OnClick:
	cutin "kafra_01.bmp",2;
	set @GIDg4,GetCastleData("gefg_cas04.gat",1);
	if (@GIDg4 == GetCharID(2)) goto L_Member;
	mes "[d ¾]";
	mes "ڤwñqM^ff0000" + GetGuildName(@GIDg4) + "^000000 |A AШϥΧڭ̨䥦a誺d¾ ApKBqШ";
	cutin "kafra_01.bmp",255;
	close;
	end;
L_Member:
	mes " [d ¾]";
	mes "w{ ^ff0000" + GetGuildName(@GIDg4) + "^000000 | ";
	mes "dԪA(q) AûbU쨭䬰zA";
	next;
	menu "ϥέܮwA",L_M1,"ϥΪŶʪA",L_M2,"ϥΤA ",L_M3,"",L_M4;
	L_M1:
		if (getskilllv(1) < 6) goto L_M1_A;
		mes "[d ¾]";
		mes "n}ܮwF";
		mes "±zϥΡC";
		cutin "kafra_01.bmp",255;
		openstorage;
		close;
		end;
		L_M1_A://Basic Skill < 6
			mes "[d ¾]";
			mes "Qnϥέܮw AǪ̧ޯ൥ŭn6HW~";
			cutin "kafra_01.bmp",255;
			close;
			end;
	L_M2:
		mes "[d ¾]";
		mes "лXتaa";
		next;
		menu "N  -> 200 z",L_M2_M1,"  ",L_M2_M2;
		L_M2_M1:
			if (Zeny < 200) goto L_M2_M1_A;
			set Zeny,Zeny-200;
//			set kf_10_pit,kf_10_pit+2;
			warp "geffen.gat",113,103;
			end;
			L_M2_M1_A:
				mes "[d ¾]";
				mes "|/pj AAҤIB AЭsT{";
				cutin "kafra_01.bmp",255;
				close;
				end;
		L_M2_M2:
			cutin "kafra_01.bmp",255;
			close;
			end;
	L_M3:
		if ((Class != 5) && (Class != 10)) goto L_M3_A;
		if (checkcart != 0) goto L_M3_B;
		mes "[d ¾]";
		mes "ϥζOO 800  AаݧAnϥζ?";
		next;
		menu "ϥ ",L_M3_M1," ",L_M3_M2;
		L_M3_M1:
			if (Zeny < 800) goto L_M3_M1_A;
//			set kf_10_pit,kf_10_pit+8;
			set Zeny,Zeny-800;
			setcart;
			cutin "kafra_01.bmp",255;
			close;
			end;
			L_M3_M1_A:
				mes "[d ¾]";
				mes "U AAҤIB AϥζOO800 ";
				cutin "kafra_01.bmp",255;
				close;
				end;
		L_M3_M2:
			cutin "kafra_01.bmp",255;
			close;
			end;
		L_M3_A:
			mes "[d ¾]";
			mes "藍_ AOӤHMKKAMΪA";
			cutin "kafra_01.bmp",255;
			close;
			end;
		L_M3_B:
			mes "[d ¾]";
			mes "UȧA{bwgA˳ƤF";
			cutin "kafra_01.bmp",255;
			close;
			end;
	L_M4:
		mes "[d ¾]";
		mes "ڭ̥dԪA(q)|ѧ󧹬A AMY檺~Ⱥ޲z AUUȦw߫KQϥΡA̤jؼ";
		mes "P§Aϥ AdԪA(q) ";
		cutin "kafra_01.bmp",255;
		close;	
		end;
OnInit:
	disablenpc "d ¾#gef4";
	End;
}


//npc "gefg_cas04" "ڥ" 1_M_JOBTESTER 73 46 3 5 5
gefg_cas04.gat,73,46,3	script	ڥ#gef4	55,{
//OnClick:
	set @GIDg4,GetCastleData("gefg_cas04.gat",1);
	if (@GIDg4 == 0) goto L_Waiting;
	if (strcharinfo(0) != GetGuildMaster(@GIDg4)) goto L_Member;
	goto L_Castle;
	end;
// -------u|DH bɭ------------------------------------------
L_Waiting:
	mes "[޲zHڥ]";
	mes "  ڱN̾ڧڪRB AbݧڪDH";
	mes "ih...@UARBa ...";
	close;
	end;
// -----------------------------------------------------------------------------
// --------Oڪ u|DH? -----------------------------------------------
L_Member:
	mes "[޲zHڥ]";
	mes "ާA̫¯٧ Aڥu@NlHڪDH ^ff0000" + GetGuildMaster(@GIDg4) + "^000000 ! @HA̦b̧r! ֧oǵLzå̻a!";
	close;
	end;
//-----------------------------------------------------------------------------
L_Castle:
	mes "[޲zHڥ]";
	mes "w{ A ڪDH^ff0000" + GetGuildMaster(@GIDg4) + "^000000/pj...";
	mes "оާhJ AڱNۦaA";
	next;
//	choose menu "dݯKap" "ӷ~oi" "꨾m" "]m@H " " / Ѷ ܮw¾" "iJDHж" "XKa"
	menu "dݯKap",L_M1,"ӷ~oi",L_M2,"꨾m",L_M3,"]m@H ",L_M4," / Ѷ ܮw¾",L_M5,"iJDHж",L_M6;
// ---------dݯKap---------------------------------------------------
	L_M1:
		mes "[޲zHڥ]";
		mes "{bVAiKap";
		mes "^0000ff ";
		mes "   {bӷ~oi׬O" + GetCastleData("gefg_cas04.gat",2) +  " ";
		if (GetCastleData("gefg_cas04.gat",4) > 0 ) mes "   - bLh@ѤAF " + GetCastleData("gefg_cas04.gat",4) + "  ";
		mes "   {bm׬O" + GetCastleData("gefg_cas04.gat",3) +  " ";
		if (GetCastleData("gefg_cas04.gat",5) > 0 ) mes "   - bLh@ѤAF " + GetCastleData("gefg_cas04.gat",5) + "  ";
		mes "^000000 ";
		mes "i";
		close;
		end;
// ---------ӷ~oi
	L_M2:
		mes "[޲zHڥ]";
		mes "ӷ~oiת Abu|̥Ͳ~ƶq|W[AFH۷QܡAण";
		mes " ";
		mes "ӭ覡A@ѥu@ AphI@I A@ѥiH⦸";
		set @TriggerE,GetCastleData("gefg_cas04.gat",4);
		set @Economy,GetCastleData("gefg_cas04.gat",2);
		if (@Economy >= 100) goto L_M2_A;
		if (@TriggerE > 1) goto L_M2_B;
		if (@TriggerE == 0) goto L_M2_C;
		goto L_M2_D;
		L_M2_A://economyOK == 0
			mes " ";
			mes "^ff0000]ѩ AKaӷ~oiסAwgO̰100% FAҥHݭn ADHGuAO֦W㪺z^000000";
			close;
			end;
		L_M2_B://economyOK == 1
			mes " ";
			mes "^ff0000iOAwgAbѤF⦸AAF.^000000oi׻֤WɡAݵ۴IQlo";
			close;
			end;
//		gold = AgitGet AGIT_E_FUND 
		L_M2_C://economyOK == 2
//Ĥ@һݪB
			if ((@Economy >= 0) && (@Economy <= 4)) set @gold,5000;
			if ((@Economy >= 5) && (@Economy <= 9)) set @gold,10000;
			if ((@Economy >= 10) && (@Economy <= 14)) set @gold,20000;
			if ((@Economy >= 15) && (@Economy <= 19)) set @gold,35000;
			if ((@Economy >= 20) && (@Economy <= 24)) set @gold,55000;
			if ((@Economy >= 25) && (@Economy <= 29)) set @gold,80000;
			if ((@Economy >= 30) && (@Economy <= 34)) set @gold,110000;
			if ((@Economy >= 35) && (@Economy <= 39)) set @gold,145000;
			if ((@Economy >= 40) && (@Economy <= 44)) set @gold,185000;
			if ((@Economy >= 45) && (@Economy <= 49)) set @gold,230000;
			if ((@Economy >= 50) && (@Economy <= 54)) set @gold,280000;
			if ((@Economy >= 55) && (@Economy <= 59)) set @gold,335000;
			if ((@Economy >= 60) && (@Economy <= 64)) set @gold,395000;
			if ((@Economy >= 65) && (@Economy <= 69)) set @gold,460000;
			if ((@Economy >= 70) && (@Economy <= 74)) set @gold,530000;
			if ((@Economy >= 75) && (@Economy <= 79)) set @gold,605000;
			if ((@Economy >= 80) && (@Economy <= 84)) set @gold,685000;
			if ((@Economy >= 85) && (@Economy <= 89)) set @gold,770000;
			if ((@Economy >= 90) && (@Economy <= 94)) set @gold,860000;
			if ((@Economy >= 95) && (@Economy <= 99)) set @gold,995000;
			mes " ";
			mes "{bݭnBO ^ff0000" + @gold + "^000000  AаݧAn?";
			goto L_M2_Go;
		L_M2_D://economyOK == else
//ĤGһݪB
			if ((@Economy >= 0) && (@Economy <= 4)) set @gold,20000;
			if ((@Economy >= 5) && (@Economy <= 9)) set @gold,40000;
			if ((@Economy >= 10) && (@Economy <= 14)) set @gold,80000;
			if ((@Economy >= 15) && (@Economy <= 19)) set @gold,140000;
			if ((@Economy >= 20) && (@Economy <= 24)) set @gold,220000;
			if ((@Economy >= 25) && (@Economy <= 29)) set @gold,320000;
			if ((@Economy >= 30) && (@Economy <= 34)) set @gold,440000;
			if ((@Economy >= 35) && (@Economy <= 39)) set @gold,580000;
			if ((@Economy >= 40) && (@Economy <= 44)) set @gold,740000;
			if ((@Economy >= 45) && (@Economy <= 49)) set @gold,920000;
			if ((@Economy >= 50) && (@Economy <= 54)) set @gold,1120000;
			if ((@Economy >= 55) && (@Economy <= 59)) set @gold,1340000;
			if ((@Economy >= 60) && (@Economy <= 64)) set @gold,1580000;
			if ((@Economy >= 65) && (@Economy <= 69)) set @gold,1840000;
			if ((@Economy >= 70) && (@Economy <= 74)) set @gold,2120000;
			if ((@Economy >= 75) && (@Economy <= 79)) set @gold,2420000;
			if ((@Economy >= 80) && (@Economy <= 84)) set @gold,2740000;
			if ((@Economy >= 85) && (@Economy <= 89)) set @gold,3080000;
			if ((@Economy >= 90) && (@Economy <= 94)) set @gold,3440000;
			if ((@Economy >= 95) && (@Economy <= 99)) set @gold,3820000;
			mes " ";
			mes "{bAwgF@... ٭nA? ٻݭnl[^ff0000" + @gold + "^000000  ";
			goto L_M2_Go;
		L_M2_Go:
		next;
		menu "ӷ~oiק",L_M2_Go_M1," ",L_M2_Go_M2;
		L_M2_Go_M1:
			if (Zeny < @gold) goto L_M2_Go_M1_A;
			set Zeny,Zeny-@gold;
//			AgitFunc AF_INVEST_E 0 0
			SetCastleData "gefg_cas04.gat",4,@TriggerE+1;
			SetCastleData "gefg_cas04.gat",2,@Economy+1;
			mes "[޲zHڥ]";
			mes "QaF! ݵۧڭ̩n{ AѪܵoi׷|W ";
			close;
			end;
			L_M2_Go_M1_A:
				mes "[޲zHڥ]";
				mes "DHui Au|xWAF쨬HꪺB AҥHꥢѤF";
				close;
				end;
		L_M2_Go_M2:
			mes "[޲zHڥ]";
			mes "ڱN̷ӧAhJh AOڪDH ... nӵ۫ Aڭ̷|oܦn ";
			close;
			end;
// --------- m  ---------------------------------------------------
	L_M3:
		mes "[޲zHڥ]";
		mes "mO A@HMRݪ@[׷|W[ AҼ{쩹᪺Ԫ Ao";
		mes " ";
		mes "ӭ覡A@ѥu@ AphI@I A@ѥiH⦸";
		set @TriggerD,GetCastleData("gefg_cas04.gat",5);
		set @Deffence,GetCastleData("gefg_cas04.gat",3);
		if (@Deffence >= 100) goto L_M3_A;
		if (@TriggerD > 1) goto L_M3_B;
		if (@TriggerD == 0) goto L_M3_C;
		goto L_M3_D;
		L_M3_A://if defenseOK == 0
			mes " ";
			mes "^ff0000]ѩ AKaӷ~oiסAwgO̰100% FAҥHݭn ADHGuAO֦W㪺z^000000";
			close;
			end;
		L_M3_B://if defenseOK == 1
			mes " ";
			mes "^ff0000iOAwgAbѤF⦸AAF.^000000oi׻֤WɡAݵ۴IQlo";
			close;
			end;
//		gold = AgitGet AGIT_D_FUND 
		L_M3_C://if defenseOK == 2
//Ĥ@һݪB
			if ((@Deffence >= 0) && (@Deffence <= 4)) set @gold,10000;
			if ((@Deffence >= 5) && (@Deffence <= 9)) set @gold,20000;
			if ((@Deffence >= 10) && (@Deffence <= 14)) set @gold,40000;
			if ((@Deffence >= 15) && (@Deffence <= 19)) set @gold,70000;
			if ((@Deffence >= 20) && (@Deffence <= 24)) set @gold,110000;
			if ((@Deffence >= 25) && (@Deffence <= 29)) set @gold,160000;
			if ((@Deffence >= 30) && (@Deffence <= 34)) set @gold,220000;
			if ((@Deffence >= 35) && (@Deffence <= 39)) set @gold,290000;
			if ((@Deffence >= 40) && (@Deffence <= 44)) set @gold,370000;
			if ((@Deffence >= 45) && (@Deffence <= 49)) set @gold,460000;
			if ((@Deffence >= 50) && (@Deffence <= 54)) set @gold,560000;
			if ((@Deffence >= 55) && (@Deffence <= 59)) set @gold,670000;
			if ((@Deffence >= 60) && (@Deffence <= 64)) set @gold,790000;
			if ((@Deffence >= 65) && (@Deffence <= 69)) set @gold,920000;
			if ((@Deffence >= 70) && (@Deffence <= 74)) set @gold,1060000;
			if ((@Deffence >= 75) && (@Deffence <= 79)) set @gold,1210000;
			if ((@Deffence >= 80) && (@Deffence <= 84)) set @gold,1370000;
			if ((@Deffence >= 85) && (@Deffence <= 89)) set @gold,1540000;
			if ((@Deffence >= 90) && (@Deffence <= 94)) set @gold,1720000;
			if ((@Deffence >= 95) && (@Deffence <= 99)) set @gold,1910000;
			mes " ";
			mes "{bݭnBO ^ff0000" + @gold + "^000000  AаݧAn?";
			goto L_M3_Go;
		L_M3_D://else
//ĤGһݪB
			if ((@Deffence >= 0) && (@Deffence <= 4)) set @gold,40000;
			if ((@Deffence >= 5) && (@Deffence <= 9)) set @gold,80000;
			if ((@Deffence >= 10) && (@Deffence <= 14)) set @gold,160000;
			if ((@Deffence >= 15) && (@Deffence <= 19)) set @gold,280000;
			if ((@Deffence >= 20) && (@Deffence <= 24)) set @gold,440000;
			if ((@Deffence >= 25) && (@Deffence <= 29)) set @gold,640000;
			if ((@Deffence >= 30) && (@Deffence <= 34)) set @gold,880000;
			if ((@Deffence >= 35) && (@Deffence <= 39)) set @gold,1160000;
			if ((@Deffence >= 40) && (@Deffence <= 44)) set @gold,1480000;
			if ((@Deffence >= 45) && (@Deffence <= 49)) set @gold,1840000;
			if ((@Deffence >= 50) && (@Deffence <= 54)) set @gold,2240000;
			if ((@Deffence >= 55) && (@Deffence <= 59)) set @gold,2680000;
			if ((@Deffence >= 60) && (@Deffence <= 64)) set @gold,3160000;
			if ((@Deffence >= 65) && (@Deffence <= 69)) set @gold,3680000;
			if ((@Deffence >= 70) && (@Deffence <= 74)) set @gold,4240000;
			if ((@Deffence >= 75) && (@Deffence <= 79)) set @gold,4840000;
			if ((@Deffence >= 80) && (@Deffence <= 84)) set @gold,5480000;
			if ((@Deffence >= 85) && (@Deffence <= 89)) set @gold,6160000;
			if ((@Deffence >= 90) && (@Deffence <= 94)) set @gold,6880000;
			if ((@Deffence >= 95) && (@Deffence <= 99)) set @gold,7640000;
			mes " ";
			mes "{bAwgF@... ٭nA? ٻݭnl[^ff0000" + @gold + "^000000  ";
			goto L_M3_Go;
		L_M3_Go:
		next;
		menu "慨m ",L_M3_Go_M1,"",L_M3_Go_M2;
		L_M3_Go_M1:
			if (Zeny < @gold) goto L_M3_Go_M1_A;
			set Zeny,Zeny-@gold;
//			AgitFunc AF_INVEST_D 0 0                  
			SetCastleData "gefg_cas04.gat",5,@TriggerD+1;
			SetCastleData "gefg_cas04.gat",3,@Deffence+1;
			mes "[޲zHڥ]";
			mes "QaF! ݵۧڭ̩n{ AѪܨm׷|W ";
			close;
			end;
			L_M3_Go_M1_A:
				mes "[޲zHڥ]";
				mes "DHui Au|xWAF쨬HꪺB AҥHꥢѤF";
				close;
				end;
		L_M3_Go_M2:
			mes "[޲zHڥ]";
			mes "ڱN̷ӧAhJh AOڪDH ... nӵ۫ Aڭ̷|oܦn ";
			close;
			end;
// ---------]m @H---------------------------------------------------
	L_M4:
		mes "[޲zHڥ]";
		mes "аݧAn]m@H? @HYNAڭ̯Kaۦu@ ";
		mes " пܭn]m@H";
		next;
//		if (GetCastleData("gefg_cas04.gat",3) >= 1200) menu "çL 1",L_M4_M1,"çL 2",L_M4_M2,"}b 1",L_M4_M3,"}b 2",L_M4_M4,"}b 3",L_M4_M5,"Mh 1",L_M4_M6,"Mh 2",L_M4_M7,"Mh 3",L_M4_M8;
//		if (GetCastleData("gefg_cas04.gat",3) >= 600) menu "çL 1",L_M4_M1,"çL 2",L_M4_M2,"}b 1",L_M4_M3,"}b 2",L_M4_M4,"}b 3",L_M4_M5;
//		menu "çL 1",L_M4_M1,"çL 2",L_M4_M2;
		set @GD1$,"~ }b @H";
		set @GD2$,"~ }b @H";
		set @GD3$,"~ hL @H";
		set @GD4$," hL @H";
		set @GD5$," Mh  @H";
		set @GD6$," hL @H";
		set @GD7$," Mh  @H";
		set @GD8$," @H";
		if (GetCastleData("gefg_cas04.gat",10) > 0) set @GD1$,@GD1$+" - w]m (53 , 191)";
		if (GetCastleData("gefg_cas04.gat",10) == 0) set @GD1$,@GD1$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",11) > 0) set @GD2$,@GD2$+" - w]m (31 , 178)";
		if (GetCastleData("gefg_cas04.gat",11) == 0) set @GD2$,@GD2$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",12) > 0) set @GD3$,@GD3$+" - w]m (49 , 220)";
		if (GetCastleData("gefg_cas04.gat",12) == 0) set @GD3$,@GD3$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",13) > 0) set @GD4$,@GD4$+" - w]m (29 , 46)";
		if (GetCastleData("gefg_cas04.gat",13) == 0) set @GD4$,@GD4$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",14) > 0) set @GD5$,@GD5$+" - w]m (57 , 46)";
		if (GetCastleData("gefg_cas04.gat",14) == 0) set @GD5$,@GD5$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",15) > 0) set @GD6$,@GD6$+" - w]m (147 , 65)";
		if (GetCastleData("gefg_cas04.gat",15) == 0) set @GD6$,@GD6$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",16) > 0) set @GD7$,@GD7$+" - w]m (160 , 50)";
		if (GetCastleData("gefg_cas04.gat",16) == 0) set @GD7$,@GD7$+" - S]m";
		if (GetCastleData("gefg_cas04.gat",17) > 0) set @GD8$,@GD8$+" - w]m (148 , 189)";
		if (GetCastleData("gefg_cas04.gat",17) == 0) set @GD8$,@GD8$+" - S]m";
		menu @GD1$,L_M4_M1,@GD2$,L_M4_M2,@GD3$,L_M4_M3,@GD4$,L_M4_M4,@GD5$,L_M4_M5,@GD6$,L_M4_M6,@GD7$,L_M4_M7,@GD8$,L_M4_M8;
		L_M4_M1:
			set @GDnum,10;
			goto L_M4_MC;
		L_M4_M2:
			set @GDnum,11;
			goto L_M4_MC;
		L_M4_M3:
			set @GDnum,12;
			goto L_M4_MC;
		L_M4_M4:
			set @GDnum,13;
			goto L_M4_MC;
		L_M4_M5:
			set @GDnum,14;
			goto L_M4_MC;
		L_M4_M6:
			set @GDnum,15;
			goto L_M4_MC;
		L_M4_M7:
			set @GDnum,16;
			goto L_M4_MC;
		L_M4_M8:
			set @GDnum,17;
			goto L_M4_MC;
		L_M4_MC:
		mes "[޲zHڥ]";
		mes "Twn]mwܪ@H? ]mɻݭn 10000 .";
		next;
		menu "n]m ",L_M4_MC_M1," ",L_M4_MC_M2;
		L_M4_MC_M1:
//			npcStatus = AgitNpcGet no AN_VISIBLE
//			skLevel = AgitGet AGIT_GUARDIAN_SKILL
//------u|ޯ ASs@ A@HsO?-----------------
			set @Guardian_Skill,getgdskilllv(@GIDg4,GD_GUARDIANRESEARCH);
			if (@Guardian_Skill == 0) goto L_M4_MC_M1_A;
			if (GetCastleData("gefg_cas04.gat",@GDnum) != 0) goto L_M4_MC_M1_B;
			if (Zeny < 10000) goto L_M4_MC_M1_C;
			set Zeny,Zeny-10000;
//			AgitNpcSet no AN_VISIBLE 1
			setcastledata "gefg_cas04.gat",@GDnum,1;
			mes "[޲zHڥ]";
			mes "]m@HF A{b}lwgFAO@ڭ̯KajڭxF";
			close;
			end;
			L_M4_MC_M1_A:
				mes "[޲zHڥ]";
				mes "DH A]m@Hs Aڭ̥M AQnֿn]m@HѪ Anǲߤu|ޯत^ff0000@Hs@s^000000. nMNO A@H]m";
				close;
				end;
			L_M4_MC_M1_B:
				mes "[޲zHڥ]";
				mes "DH... @HwgODH]m@HFAA]mF";
				close;
				end;
			L_M4_MC_M1_C:
				mes "[޲zHڥ]";
				mes "]m@H Aܩp... ]m@HѤF";
				close;
				end;
		L_M4_MC_M2:
			mes "[޲zHڥ]";
			mes "ڤwgӧAhJF ApIWeΪܡA@wn]m@HAOn";
			close;
			end;
//ܮw¾   / Ѷ
	L_M5:
//		npcStatus = AgitNpcGet AGIT_NPC_CONTAINER AN_VISIBLE 
		if (GetCastleData("gefg_cas04.gat",9) == 1) goto L_M5_A;
		goto L_M5_B;
		L_M5_A://if npcStatus == 1
			mes "[޲zHڥ]";
			mes "{bwgO AΥd¾Ao... AnѶd¾ ?";
			next;
			menu "nѶ ",L_M5_A_M1," ",L_M5_A_M2;
			L_M5_A_M1:
				cutin "kafra_01.bmp",2;
				mes "[ Ϊ d¾ ]";
				mes "LhڨΤߪu@F... AunڸѶ?... ХDHo̤jqA@|...ЧAAҼ{@n ...";
				next;
				menu "nѶ ",L_M5_A_M1_M1," ",L_M5_A_M1_M2;
				L_M5_A_M1_M1:
					mes "[ Ϊ  d¾ ]";
					mes "z! ӹLF! iHo˰ ~";
					next;
					cutin "kafra_01.bmp",255;
//					AgitNpcSet AGIT_NPC_CONTAINER AN_VISIBLE 0
					disablenpc "d ¾#gef4";
					setcastledata "gefg_cas04.gat",9,0;
					mes "[޲zHڥ]";
					mes "....";
					mes "wgd¾ѶF... L A٦a褣N?";
					close;
					end;
				L_M5_A_M1_M2:
					mes "[ Ϊ  d¾ ]";
					mes "ڷ|VO...  ";
					close;
					end;
			L_M5_A_M2:
				mes "[޲zHڥ]";
				mes "̧ڬݡAd¾D`VOu@ AF䥦|̵۷QAN~dۦoa";
				close;
				end;
		L_M5_B://else()
			mes "[޲zHڥ]";
			mes "Md`qq AQnbKa̭ AΥd¾ ?";
			mes "^ff0000 QnΪܡAݭn 10000... ";
			next;
			menu "n ",L_M5_B_M1," ",L_M5_B_M2;
			L_M5_B_M1:
//				skLevel = AgitGet AGIT_KAFRA_SKILL
// -----u|ޯ AMdԭqޯ? --------------------
				set @Kafra_Skill,getgdskilllv(@GIDg4,GD_KAFRACONTACT);
				if (@Kafra_Skill == 0) goto L_M5_B_M1_A;
				if (Zeny < 10000) goto L_M5_B_M1_B;
				set Zeny,Zeny-10000;
//				AgitNpcSet AGIT_NPC_CONTAINER AN_VISIBLE 1
//				AgitFunc AF_SET_PAY_TIME 0 0
				enablenpc "d ¾#gef4";
				setcastledata "gefg_cas04.gat",9,1;
				mes "[޲zHڥ]";
				mes "\Md`qqFAAwgΥd¾F";
				next;
				cutin "kafra_01.bmp",2;
				mes "[ Ϊ d¾ ]";
				mes "zn AڬO`qӪd¾";
				mes "ڤ|u|WAgWI AҥHڷ|VOu@";
				next;
				cutin "kafra_01.bmp",255;
				mes "[޲zHڥ]";
				mes "Ϊd¾ A@Ӥ몺 ALF@ӤAbúB";
				mes "{b}lA|̪ҷ|CCF ";
				close;
				end;
				L_M5_B_M1_A:
					mes "[޲zHڥ]";
					mes "DH Ap٨Sd`qqpAҥH٤๵Υd¾ ApQnd`qñq AǷ|u|ޯत ^ff0000Mdԭq^000000 ޯa";
					close;
					end;
				L_M5_B_M1_B://if v[VAR_MONEY] <  10000
					mes "[޲zHڥ]";
					mes "ܩp... {bu|̪xW AһݪBAҥHΥd¾ .";
					close;
					end;
			L_M5_B_M2:
				mes "[޲zHڥ]";
				mes "ڤwgӧAhJF AL]nFW|۷QA鹵Υd¾W";
				close;
				end;
	L_M6:
		mes "[޲zHڥ]";
		mes "nڭ̥Ͳ~ynAuQ~ж?";
		mes "ӦaOFڭ̪DHAMݩAa... FA~A䥦HӤJ";
		next;
		menu "niJDHж",L_M6_M1,"",L_M6_M2;
		L_M6_M1:
			mes "[޲zHڥ]";
			mes "ڱNAAȨ쯵KqD̡Aиڨ ";
			mes "^ӪɭԡAUKsYi ";
			next;
			warp "gefg_cas04.gat",116,123;
			end;
		L_M6_M2:
			mes "[޲zHڥ]";
			mes "Ͳ~@ѥuͲ@ . . .   pSYɦܡAU@NiӤF";
			mes "ҥHFڭ̤u|oiAɶqIɶh";
			close;
			end;
// XKa
//~	L_M7:
//~	mes "[޲zHڥ]";
//~	mes "DH!!";
//~	mes "AunAڭ̥A崫ӪKa?!";
//~	mes "punܡAboǤlHӡAڭ̩ҬyA쩳NqO!";
//~	mes "ЦAҼ{Ҽ{a! DH!!";
//~	next;
//~	menu "XKa",L_M7_M1,"",L_M7_M2;
//~	L_M7_M1:
//~		mes "[޲zHڥ]";
//~		mes "DH!!ФTӫ ADH!!";
//~		mes "oҬy!! Q쨺묹Ao˰!!";
//~		next;
//~		menu "",L_M7_M1_M1,"XKa",L_M7_M2_M2;
//~		L_M7_M1_M1:
//~			mes "[޲zHڥ]";
//~			mes "ڴNDA|o˰ ADH!!";
//~			mes "UAF  AYɬO}AЧAU@noظ";
//~			close;
//~			end;
//~		L_M7_M1_M2:
//~			mes "[޲zHڥ]";
//~			mes "DH!!.....";
//~			mes "......D .....DH ......";
//~//			AgitSet AGIT_GUILD 0 
//~			close;
//~			setcastledata "gefg_cas04.gat",1,0;
//~			setcastledata "gefg_cas04.gat",2,0;
//~			setcastledata "gefg_cas04.gat",3,0;
//~			setcastledata "gefg_cas04.gat",4,0;
//~			setcastledata "gefg_cas04.gat",5,0;
//~			setcastledata "gefg_cas04.gat",6,0;
//~			setcastledata "gefg_cas04.gat",7,0;
//~			setcastledata "gefg_cas04.gat",8,0;
//~			setcastledata "gefg_cas04.gat",9,0;
//~			setcastledata "gefg_cas04.gat",10,0;
//~			setcastledata "gefg_cas04.gat",11,0;
//~			setcastledata "gefg_cas04.gat",12,0;
//~			setcastledata "gefg_cas04.gat",13,0;
//~			setcastledata "gefg_cas04.gat",14,0;
//~			setcastledata "gefg_cas04.gat",15,0;
//~			setcastledata "gefg_cas04.gat",16,0;
//~			setcastledata "gefg_cas04.gat",17,0;
//~			Announce "Ka[" + GetCastleName("gefg_cas04.gat") + "]Q[" + GetGuildName(@GIDg4) + "]u|XF",0;
//~			MapRespawnGuildID "gefg_cas04.gat",GetCastleData("gefg_cas04.gat",1),7;
//~			end;
//~	L_M7_M2:
//~		mes "[޲zHڥ]";
//~		mes "ڴNDA|o˰ ADH!!";
//~		mes "UAF  AYɬO}AЧAU@noظ";
//~		close;
//~		end;

OnClock0000://sPCѯ2Iƭ
	SetCastleData "gefg_cas04.gat",4,0;
	SetCastleData "gefg_cas04.gat",5,0;
	end;

OnAgitStart:
	disablenpc "d ¾#gef4";
	End;
OnRecvCastleG04:
	if ($@vMap_AgitFlag_G04 >= 1) end;
OnAgitEnd:
	if (getcastledata("gefg_cas04.gat",9) != 0) enablenpc "d ¾#gef4";
	End;
}

gefg_cas04.gat,1,1,1	script	GDgef04	-1,{
OnAgitStart:
//OnRecvCastleG04:
// u|̪ŵLHɡAiHl]HIW.
	if (GetCastleData("gefg_cas04.gat",1) == 0) goto L_Mob;
	if (GetCastleData("gefg_cas04.gat",1) != 0) goto L_Guardian;
	end;

L_Mob:
	areamonster "gefg_cas04.gat",0,0,300,300,"x",1117,10;
	areamonster "gefg_cas04.gat",0,0,300,300,"]Ův",1263,11;
	areamonster "gefg_cas04.gat",0,0,300,300,"űC",1102,10;
	areamonster "gefg_cas04.gat",0,0,300,300,"nʥ",1130,10;
	areamonster "gefg_cas04.gat",0,0,300,300,"J",1140,20;
	areamonster "gefg_cas04.gat",0,0,300,300,"FCh",1163,9;
	areamonster "gefg_cas04.gat",0,0,300,300,"RRk",1275,1;
	areamonster "gefg_cas04.gat",0,0,300,300,"`WMh",1219,1;
	areamonster "gefg_cas04.gat",0,0,300,300,"]",1150,1;
	areamonster "gefg_cas04.gat",0,0,300,300,"ָ̮",1159,1;
	monster "gefg_cas04.gat",174,177,"I",1203,1;
	monster "gefg_cas04.gat",174,177,"~H^",1087,1;
	monster "gefg_cas04.gat",174,177,"~HԤh",1213,10;
	monster "gefg_cas04.gat",174,177,"~H}b",1189,10;
	end;

L_Guardian:
	if (GetCastleData("gefg_cas04.gat",10) != 0) monster "gefg_cas04.gat",53,191,"~ }b @H",1285,1,"GDgef04::OnGD1Dead";
	if (GetCastleData("gefg_cas04.gat",11) != 0) monster "gefg_cas04.gat",31,178,"~ }b @H",1285,1,"GDgef04::OnGD2Dead";
	if (GetCastleData("gefg_cas04.gat",12) != 0) monster "gefg_cas04.gat",49,220,"~ hL @H",1287,1,"GDgef04::OnGD3Dead";
	if (GetCastleData("gefg_cas04.gat",13) != 0) monster "gefg_cas04.gat",29,46," hL @H",1287,1,"GDgef04::OnGD4Dead";
	if (GetCastleData("gefg_cas04.gat",14) != 0) monster "gefg_cas04.gat",57,46," Mh  @H",1286,1,"GDgef04::OnGD5Dead";
	if (GetCastleData("gefg_cas04.gat",15) != 0) monster "gefg_cas04.gat",147,65," hL @H",1287,1,"GDgef04::OnGD6Dead";
	if (GetCastleData("gefg_cas04.gat",16) != 0) monster "gefg_cas04.gat",160,50," Mh  @H",1286,1,"GDgef04::OnGD7Dead";
	if (GetCastleData("gefg_cas04.gat",17) != 0) monster "gefg_cas04.gat",148,189," @H",1286,1,"GDgef04::OnGD8Dead";
	end;

OnGD1Dead:
	setcastledata "gefg_cas04.gat",10,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡yԤhz01 Q}aF",17;
//	set @Deffence,GetCastleData("gefg_cas04.gat",3);
//	if (@Deffence < 100) End;
//	set @Deffence,@Deffence-100;
//	SetCastleData "gefg_cas04.gat",3,@Deffence;
	end;

OnGD2Dead:
	SetCastleData "gefg_cas04.gat",11,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡yԤhz02 Q}aF, mפU",17;
	end;

OnGD3Dead:
	SetCastleData "gefg_cas04.gat",12,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡y}bz01 Q}aF, mפU",17;
	end;

OnGD4Dead:
	SetCastleData "gefg_cas04.gat",13,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡y}bz02 Q}aF, mפU",17;
	end;

OnGD5Dead:
	SetCastleData "gefg_cas04.gat",14,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡y}bz03 Q}aF, mפU",17;
	end;

OnGD6Dead:
	SetCastleData "gefg_cas04.gat",15,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡yMhz01 Q}aF, mפU",17;
	end;

OnGD7Dead:
	SetCastleData "gefg_cas04.gat",16,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡yMhz02 Q}aF, mפU",17;
	end;

OnGD8Dead:
	SetCastleData "gefg_cas04.gat",17,0;
//	MapAnnounce "gefg_cas04.gat","u|u@̡yMhz03 Q}aF, mפU",17;
	end;

OnAgitEnd:
	KillMonster "gefg_cas04.gat","GDgef04::OnGD1Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD2Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD3Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD4Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD5Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD6Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD7Dead";
	KillMonster "gefg_cas04.gat","GDgef04::OnGD8Dead";
	end;
}

gefg_cas04.gat,116,123,0	script	DHЪ_c#gef4	-1,{
OnClock0010:
	killmonster "gefg_cas04.gat","T_Box_G04";
	end;
OnClock0030:
	if (GetCastleData("gefg_cas04.gat",1) == 0) end;
	set $@vMap_Economy_G04,GetCastleData("gefg_cas04.gat",2);
	//Basic T_Box
	monster "gefg_cas04.gat",115,119,"_c",rand(1340,1341),1,"T_Box_G04";
	monster "gefg_cas04.gat",116,119,"_c",rand(1340,1341),1,"T_Box_G04";
	monster "gefg_cas04.gat",116,118,"_c",rand(1340,1341),1,"T_Box_G04";
	monster "gefg_cas04.gat",115,118,"_c",rand(1340,1341),1,"T_Box_G04";
	//Economy T_Box
	if ($@vMap_Economy_G04 >=  5) monster "gefg_cas04.gat",113,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 10) monster "gefg_cas04.gat",114,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 15) monster "gefg_cas04.gat",115,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 20) monster "gefg_cas04.gat",116,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 25) monster "gefg_cas04.gat",117,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 30) monster "gefg_cas04.gat",118,121,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 35) monster "gefg_cas04.gat",118,120,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 40) monster "gefg_cas04.gat",118,119,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 45) monster "gefg_cas04.gat",118,118,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 50) monster "gefg_cas04.gat",118,117,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 55) monster "gefg_cas04.gat",118,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 60) monster "gefg_cas04.gat",117,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 65) monster "gefg_cas04.gat",116,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 70) monster "gefg_cas04.gat",115,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 75) monster "gefg_cas04.gat",114,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 80) monster "gefg_cas04.gat",113,116,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 85) monster "gefg_cas04.gat",113,117,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 90) monster "gefg_cas04.gat",113,118,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >= 95) monster "gefg_cas04.gat",113,119,"_c",rand(1340,1341),1,"T_Box_G04";
	if ($@vMap_Economy_G04 >  99) monster "gefg_cas04.gat",113,120,"_c",rand(1340,1341),1,"T_Box_G04";
	end;

}