//===================================================================
//Ragnarok Online EP2.5 GVG Script	ev_agit_common      by kalen
//CP]wץ by Deme
// ~ƩMץ : FPE
// Jathena++ ׾¡Ghttp://www.foxofice.net/bbs
//===================================================================

//=========================================================================
// 𫰾Ԫ}lPp
//	qconst.txto]wɶ
//	]GvGWeekDay, GvGTimeST, GvGTimeST, GvGTime*ST, GvGTime*ED^
//
// MAPAȾҰʫ᪺60P_O_}l
//-------------------------------------------------------------------------

-	script	#AgitConfig	-1,{
	end;
OnInit:
	if(GvGWeekDay == 0)
		end;
	//pG}Ҥu|ԡA줸1
	for(set '@i,0; '@i<7; set '@i,'@i+1) {
		set '@mask,1<<'@i;
		set 'open['@i],(GvGWeekDay & '@mask)? 1: 0;
	}
	//]wCgu|԰_lɶ
	if(GvGTimeST == GvGTimeED) {
		setarray 'dbt,GvGTime0ST,GvGTime1ST,GvGTime2ST,GvGTime3ST,GvGTime4ST,GvGTime5ST,GvGTime6ST;
		setarray 'fin,GvGTime0ED,GvGTime1ED,GvGTime2ED,GvGTime3ED,GvGTime4ED,GvGTime5ED,GvGTime6ED;
	}
	//CѳOۦPɶ
	else {
		cleararray 'dbt,GvGTimeST,7;
		cleararray 'fin,GvGTimeED,7;
	}
	set 'flag,1;
	initnpctimer;
	end;

OnTimer60000:
	//Ұ60iP_
	if('flag) {
		set '@day,gettime(4);
		set '@min,gettime(3)*100+gettime(2);
		//eɶu|Ԯɶ
		if('open['@day] && '@min>='dbt['@day] && '@min<'fin['@day]) {
			announce "𫰾ԭs}l",8;
			debugmes "𫰾ԭs}l [ " +gettimestr("%H:%M",6)+ " ]";
			agitstart;
		}
		set 'flag,0;
		setnpctimer gettime(1)*1000;	//{bɨ謰0ɪץ
		end;
	}
	if(gettime(1) > 0)	//1HWͮɪץ
		setnpctimer gettime(1)*1000;
	else
		initnpctimer;
	//24Iɪҥ~Bz
	set '@day,gettime(4);
	set '@min,gettime(3)*100+gettime(2);
	if('@min == 0) {
		set '@prev,('@day>0)? '@day-1: 6;
		if('open['@prev] && 'fin['@prev]==2400) {
			if('open['@day]==0 || 'dbt['@day]>0) {
				announce "𫰾Ե",8;
				debugmes "𫰾Ե [ " +gettimestr("%H:%M",6)+ " ]";
				agitend;
			}
			end;
		}
	}
	if('open['@day]==0)
		end;
	if('@min == 'dbt['@day]) {
		announce "𫰾Զ}l",8;
		debugmes "𫰾Զ}l [ " +gettimestr("%H:%M",6)+ " ]";
		agitstart;
	}
	else if('@min == 'fin['@day]) {
		announce "𫰾Ե",8;
		debugmes "𫰾Ե [ " +gettimestr("%H:%M",6)+ " ]";
		agitend;
	}
	end;
}


//-----GMMΪոյ{-----
//===========================================================
//prontera.gat,152,208,0	script	GvGx	111,{
//	if(getgmlevel()==0)
//		end;
//	mes "[GvG-Control^ff0000(GMM)^000000]";
//	mes "𫰾ԼҦ]w";
//	next;
//	switch (select("}l","","ո","")) {
//	case 1:
//		announce "𫰾Զ}l",0;
//		agitstart;
//		break;
//	case 2:
//		announce "𫰾Ե",0;
//		agitend;
//		break;
//	case 3:
//		setarray '@chr$,"","@","G","T","|","","";
//		for(set '@i,0; '@i<7; set '@i,'@i+1)
//			mes '@chr$['@i]+ "P G " +(getelementofarray( getvariableofnpc('open,"#AgitConfig"),'@i ))? "": "";
//		next;
//		if(GvGTimeST != GvGTimeED) {
//			mes "CѮɶ@" +GvGTimeST+ "  " +GvGTimeED;
//			break;
//		}
//		for(set '@i,0; '@i<7; set '@i,'@i+1) {
//			mes '@chr$['@i]+ "P G " +getelementofarray( getvariableofnpc('dbt,"#AgitConfig"),'@i )+
//						"  " +getelementofarray( getvariableofnpc('fin,"#AgitConfig"),'@i );
//		}
//		break;
//	}
//	close;
//}
//===========================================================

//--------------------------------------------------------------------
prontera.gat,159,208,0	script	u|_cx	111,{
	if ( !(getgmlevel()) ) close;
	mes "[TBOX Control^ff0000(GMM)^000000]";
	mes "nXu|_cܡH";
	next;
	if ( select("O","_") == 2 ) close;
	callsub Ltbox;
	mes "[TBOX Control^ff0000(GMM)^000000]";
	mes "wgXu|_cFC";
	close;
OnClock0000:
	callsub Ltbox;
	end;
Ltbox:
	callfunc "make_t_box","aldeg_cas01.gat",114,218,123,227,1324,1325;
	callfunc "make_t_box","aldeg_cas02.gat",130,226,139,235,1326,1327;
	callfunc "make_t_box","aldeg_cas03.gat",220,264,229,273,1328,1329;
	callfunc "make_t_box","aldeg_cas04.gat",80,8,89,17,1330,1331;
	callfunc "make_t_box","aldeg_cas05.gat",58,8,67,17,1332,1333;
	callfunc "make_t_box","gefg_cas01.gat",150,108,157,115,1334,1335;
	callfunc "make_t_box","gefg_cas02.gat",136,112,145,118,1336,1337;
	callfunc "make_t_box","gefg_cas03.gat",266,286,273,293,1338,1339;
	callfunc "make_t_box","gefg_cas04.gat",112,114,119,123,1340,1341;
	callfunc "make_t_box","gefg_cas05.gat",140,106,147,113,1342,1343;
	callfunc "make_t_box","payg_cas01.gat",286,4,295,7,1344,1345;
	callfunc "make_t_box","payg_cas02.gat",140,140,149,143,1346,1347;
	callfunc "make_t_box","payg_cas03.gat",154,164,162,172,1348,1349;
	callfunc "make_t_box","payg_cas04.gat",142,44,151,51,1350,1351;
	callfunc "make_t_box","payg_cas05.gat",152,128,161,131,1352,1353;
	callfunc "make_t_box","prtg_cas01.gat",7,205,15,212,1354,1355;
	callfunc "make_t_box","prtg_cas02.gat",198,224,205,231,1356,1357;
	callfunc "make_t_box","prtg_cas03.gat",184,128,192,135,1358,1359;
	callfunc "make_t_box","prtg_cas04.gat",266,158,273,165,1360,1361;
	callfunc "make_t_box","prtg_cas05.gat",272,174,279,181,1362,1363;
	return;
}

//====================================================================
//Function
//====================================================================
//---------------------------------------------------------------
//MůKaƾڨí]Ǫ
//callfunc "resetcastledata",MAPW,"::OnRecvCastleYYY","kapra_XXXgYY",@GIDXX,"::OnGDEMPSetYYY";
function	script	resetcastledata	{
	killmonsterall getarg(0);
	disablenpc getarg(2);
	setcastledata getarg(0),1,0;
	setcastledata getarg(0),2,1;
	setcastledata getarg(0),3,1;
	setcastledata getarg(0),4,0;
	setcastledata getarg(0),5,0;
	setcastledata getarg(0),6,0;
	setcastledata getarg(0),7,0;
	setcastledata getarg(0),8,0;
	setcastledata getarg(0),9,0;
	setcastledata getarg(0),10,0;
	setcastledata getarg(0),11,0;
	setcastledata getarg(0),12,0;
	setcastledata getarg(0),13,0;
	setcastledata getarg(0),14,0;
	setcastledata getarg(0),15,0;
	setcastledata getarg(0),16,0;
	setcastledata getarg(0),17,0;
	getcastledata getarg(0),0,getarg(1);
	announce "Ka [" + getcastlename(getarg(0)) + "] Q [" + getguildname(getarg(3)) + "] u|XFC",0;
	maprespawnguildid getarg(0),getcastledata(getarg(0),1),7;
	if (agitcheck(0)) donpcevent getarg(4);
	end;
	return;
}
//---------------------------------------------------------------
//Rݪ}aMKaƾڧs
//callfunc "resetcastledata2","MAP","::OnRecvCastleYYY";
function	script	resetcastledata2	{
	killmonsterall getarg(0);
	set @WinGuildID,getcharid(2);
	if (@WinGuildID <= 0) end;
	setcastledata getarg(0),1,@WinGuildID;
	set @Economy,getcastledata(getarg(0),2)-5;
	if (@Economy<1) set @Economy,1;
	setcastledata getarg(0),2,@Economy;
	set @Deffence,getcastledata(getarg(0),3)-5;
	if (@Deffence<1) set @Deffence,1;
	setcastledata getarg(0),3,@Deffence;
	setcastledata getarg(0),4,0;
	setcastledata getarg(0),5,0;
	setcastledata getarg(0),6,0;
	setcastledata getarg(0),7,0;
	setcastledata getarg(0),8,0;
	setcastledata getarg(0),9,0;
	setcastledata getarg(0),10,0;
	setcastledata getarg(0),11,0;
	setcastledata getarg(0),12,0;
	setcastledata getarg(0),13,0;
	setcastledata getarg(0),14,0;
	setcastledata getarg(0),15,0;
	setcastledata getarg(0),16,0;
	setcastledata getarg(0),17,0;
	announce "Ka [" + getcastlename(getarg(0)) + "] Q [" + getguildname(@WinGuildID) + "] u|FC",0;
	mapannounce getarg(0),"RݳQ}aF",17;
	getcastledata getarg(0),0,getarg(1);
	return;
}
//---------------------------------------------------------------
//Ѵu|ɪKaƾڧs
//callfunc "resetcastledata3","MAP","::OnRecvCastleYYY","::OnGDEMPSetYYY";
function	script	resetcastledata3	{
	killmonsterall getarg(0);
	setcastledata getarg(0),1,0;
	setcastledata getarg(0),2,1;
	setcastledata getarg(0),3,1;
	setcastledata getarg(0),4,0;
	setcastledata getarg(0),5,0;
	setcastledata getarg(0),6,0;
	setcastledata getarg(0),7,0;
	setcastledata getarg(0),8,0;
	setcastledata getarg(0),9,0;
	setcastledata getarg(0),10,0;
	setcastledata getarg(0),11,0;
	setcastledata getarg(0),12,0;
	setcastledata getarg(0),13,0;
	setcastledata getarg(0),14,0;
	setcastledata getarg(0),15,0;
	setcastledata getarg(0),16,0;
	setcastledata getarg(0),17,0;
	getcastledata getarg(0),0,getarg(1);
	maprespawnguildid getarg(0),getcastledata(getarg(0),1),7;
	if (agitcheck(0)) donpcevent getarg(2);
	end;
	return;
}
//---------------------------------------------------------------
//u|_csBz
//callfunc "make_t_box","MAP",x0,y0,x1,y1,MobID1,MobID2;
function	script	make_t_box	{
	setcastledata getarg(0),2,getcastledata(getarg(0),2)+getcastledata(getarg(0),4);
	setcastledata getarg(0),3,getcastledata(getarg(0),3)+getcastledata(getarg(0),5);
	setcastledata getarg(0),4,0;//mӷ~ת
	setcastledata getarg(0),5,0;//m꨾mת
	killmonster getarg(0),"TresureBox";
	set $@boxnum1,2+(getcastledata(getarg(0),2)+5)/10;
	set $@boxnum2,2+getcastledata(getarg(0),2)/10;
	if ($@boxnum1 > 12)	set $@boxnum1,12;
	if ($@boxnum2 > 12)	set $@boxnum2,12;
	areamonster getarg(0),getarg(1),getarg(2),getarg(3),getarg(4),"_c",getarg(5),$@boxnum1,"TresureBox";
	areamonster getarg(0),getarg(1),getarg(2),getarg(3),getarg(4),"_c",getarg(6),$@boxnum2,"TresureBox";
	return;
}
//---------------------------------------------------------------
//𫰾Զ}lBz
//callfunc "agitstarting","MAP","OnGDEMPSetYYY";
function	script	agitstarting	{
	maprespawnguildid getarg(0),getcastledata(getarg(0),1),2;
	donpcevent getarg(1);
	GvgOn getarg(0);
	return;
}
//---------------------------------------------------------------
//X
//callfunc "flagsc","MAP",AreaFlag,ReturnFlag,X,Y;
//*AreaFlag 1=Aldebaran,2=Other
//*ReturnFlag 1=Allow,2=Deny
function	script	flagsc	{
	set @GID,getcastledata(getarg(0),1);
	if (@GID != 0) goto LStartg;
		mes "[ wԤ  iO ]";
		mes " ";
		mes "1.";
		switch ( getarg(1) ) {
		case 1:	mes "o̬OwԤ";
			mes "ھڭ׵o@Mꪺw";
			break;
		case 2:	mes "o̬OwԤ";
			mes "ھڳo̪wԤO";
		}
		mes "o̤GSҦvXm";
		next;
		mes " ";
		mes "2.";
		mes "ԳӦubo̪iȪ礧";
		mes "ï}aRݪH";
		mes "|礩g{ҪKaҦv";
		close;
LStartg:
		if ((getcharid(2) == @GID) && (getarg(2) == 1)) goto LStartg2;
		mes "[ wԤ  iO ]";
		mes " ";
		mes "1.";
		switch ( getarg(1) ) {
		case 1:	mes "o̬OwԤ";
			mes "ھڭ׵o@Mꪺw";
			break;
		case 2:	mes "o̬OwԤ";
			mes "ھڳo̪wԤO";
		}
		mes "o̳Q{w ^ff0000 " + getguildname(@GID) + " ^000000 u|p";
		next;
		mes " ";
		mes "2.";
		mes "^ff0000 " + getguildname(@GID) + " ^000000 u|DHO";
		mes "^ff0000 " + getguildmaster(@GID) + " ^000000 C";
		mes "L׬O֡AoƱN̡A";
		mes "ЧA|_zCAۤvWAaC";
Lclose:
		close;
LStartg2:
		mes "[ n ]";
		mes "ihڡK";
		mes "n^zWAaܡH";
		next;
		menu "^쯵Ka",-,"",Lclose;
			warp getarg(0),getarg(3),getarg(4);end;
		return;
}
//==============================================================================
//-------------------------------------------------------
//޲zH
//callfunc "Steward_menu0","MAP","NAME";
function	script	Steward_menu0	{
	set @GID,getcastledata(getarg(0),1);
	if (@GID == 0) goto LStart;
	if (getcharid(2) != @GID) goto LStart2;
	if (getcharid(0) == getguildmasterid(@GID)) goto LStart3;
	goto LStart2;
LStart:
	mes "[޲zH"+getarg(1)+"]";
	mes "ڱN̾ڧڪRB";
	mes "bݧڪDHC";
	mes "ihڡK";
	mes "@UARBaC";
	close;
LStart2:
	mes "[޲zH"+getarg(1)+"]";
	mes "ާA̫¯٧";
	mes "ڥu@NlHڪDH^ff0000" + getguildmaster(@GID);
	mes "^000000@HA̦b̧rI";
	mes "֧oӵLzå뻰aI";
	close;
LStart3:
	mes "[޲zH"+getarg(1)+"]";
	mes "w{AڪDH ^ff0000"+getguildmaster(@GID)+"^000000 /pjC";
	mes "оާhJAڱNۦazȡC";
	next;
	return;
}
//-------------------------------------------------------
//޲zH1udݯKapv() x2004/08/05jRO
//callfunc "Steward_menu1","MAP","NAME";
function	script	Steward_menu1	{
	mes "[޲zH"+getarg(1)+"]";
	mes "{bVziKapC";
	mes " ";
	mes "^0000ff{bӷ~oi׬O"+getcastledata(getarg(0),2)+"C";
	if (getcastledata(getarg(0),4) != 0) mes "- bLh1ѤAF "+getcastledata(getarg(0),4)+" C";
	mes "{bm׬O"+getcastledata(getarg(0),3)+"C^000000";
	if (getcastledata(getarg(0),5) != 0) mes "^0000ff- bLh1ѤAF "+getcastledata(getarg(0),5)+" C^000000";
	mes " ";
	mes "iC";
	close;
	return;
}
//-------------------------------------------------------
//޲zH㢱uӷ~oiסv() x2004/08/25jRO
//callfunc "Steward_menu2","MAP","NAME";
function	script	Steward_menu2	{
	mes "[޲zH"+getarg(1)+"]";
	mes "ӷ~oiת";
	mes "bu|̥Ͳ~ƶq|W[";
	mes "FH۷Q";
	mes "णڡC";
	next;
	mes "[޲zH"+getarg(1)+"]";
	mes "ӭ覡A@ѥu@";
	mes "phI@I";
	mes "@ѥiH⦸C";
	next;
	set @TriggerE,getcastledata(getarg(0),4);
	set @Economy,getcastledata(getarg(0),2);
	if(@Economy == 100) goto L2_error2;
	set @tmp,(@Economy-@TriggerE)/5;
	set @InvestE,5000*(1+(1+@tmp)*@tmp/2)*(1+3*@TriggerE);
	if (@TriggerE == 0) goto L2_1;
	if (@TriggerE == 1) goto L2_2;
		mes "[޲zH"+getarg(1)+"]";
		mes "^ff0000iOzwgbѤF⦸";
		mes "AFC";
		mes "^000000oi׻֤W";
		mes "ݵ۴IQloC";
		close;
L2_1:
	mes "[޲zH"+getarg(1)+"]";
	mes "{bݭnBO";
	mes "^ff0000"+ @InvestE +"^000000 Zeny";
	mes "аݱznܡH";
	next;
	menu "ӷ~oiק",L2_1_1,"",L2_1_0;
L2_2:
	mes "[޲zH"+getarg(1)+"]";
	mes "{bzwgF@";
	mes "٭nAܡH";
	mes "ݭnO ^ff0000"+ @InvestE +"^000000 Zeny";
	next;
	menu "ӷ~oiק",L2_1_1,"",L2_1_0;
	L2_1_0:
		mes "[޲zH"+getarg(1)+"]";
		mes "کդFC";
		mes "ݭnӵ۫檺C";
		mes "nDiHHɧiDڡC";
		close;
	L2_1_1:
		if(Zeny < @InvestE) goto L2_error;
		set Zeny,Zeny-@InvestE;
		setcastledata getarg(0),4,@TriggerE+1;
		mes "[޲zH"+getarg(1)+"]";
		mes "QaFI";
		mes "᪺lN|VӶVּ֡C";
		mes "qѶ}loi׷|WɪC";
		close;
L2_error:/**/
	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "SBiC";
	mes "QFC";
	close;
L2_error2:/*פw*/
	mes "[޲zH"+getarg(1)+"]";
	mes "^ff0000{boiפwgO̤jȤFC";
	mes "^000000ҥHݭnAFC";
 	close;
	return;
}

//-------------------------------------------------------
//޲zH㢲u꨾mסv() x2004/08/25jRO
//callfunc "Steward_menu3","MAP","NAME";
function	script	Steward_menu3	{
	mes "[޲zH"+getarg(1)+"]";
	mes "mO";
	mes "@HMRݪ@[׷|W[C";
	mes "Ҽ{H᪺Ԫ";
	mes "[jmפ~OWC";
	next;
	mes "[޲zH"+getarg(1)+"]";
	mes "ӭ覡A@ѥu@";
	mes "phI@I";
	mes "@ѥiH⦸C";
	next;
	set @TriggerD,getcastledata(getarg(0),5);
	set @Deffence,getcastledata(getarg(0),3);
	if(@Deffence == 100) goto L3_error2;
	set @tmp,(@Deffence-@TriggerD)/5;
	set @InvestD,10000*(1+(1+@tmp)*@tmp/2)*(1+3*@TriggerD);
	if (@TriggerD == 0) goto L3_1;
	if (@TriggerD == 1) goto L3_2;
		mes "[޲zH"+getarg(1)+"]";
		mes "^ff0000iOAwgbѤF⦸";
		mes "AFC";
		mes "^000000ݨmת[jC";
		close;
L3_1:
	mes "[޲zH"+getarg(1)+"]";
	mes "{bݭnBO^ff0000"+ @InvestD +"^000000 Zeny";
	mes "аݱznܡH";
	next;
	menu "慨mק",L3_1_1,"",L3_1_0;
L3_2:
	mes "[޲zH"+getarg(1)+"]";
	mes "{bzwgF@";
	mes "٭nAܡH";
	mes "ݭnO ^ff0000"+ @InvestD +"^000000 Zeny";
	next;
	menu "慨mק",L3_1_1,"",L3_1_0;
	L3_1_0:
		mes "[޲zH"+getarg(1)+"]";
		mes "کդFC";
		mes "ݭnӵ۫檺C";
		mes "nDiHHɧiDڡC";
		close;
	L3_1_1:
		if(Zeny < @InvestD) goto L3_error;
		set Zeny,Zeny-@InvestD;
		setcastledata getarg(0),5,@TriggerD+1;
		mes "[޲zH"+getarg(1)+"]";
		mes "QaFI";
		mes "᪺lN|VӶVּ֡C";
		mes "qѶ}lm׷|WɪC";
		close;
L3_error:/**/
	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "SBiC";
	mes "QFC";
	close;
L3_error2:/*פw*/
	mes "[޲zH"+getarg(1)+"]";
	mes "^ff0000{bmפwgO100%FC";
	mes "^000000ҥHݭnAFC";
	close;
	return;
}
//-------------------------------------------------------
//޲zH㢳u]m@Hv(ɧU)
//callfunc "Steward_menu4","MAP","NAME";
function	script	Steward_menu4	{
	mes "[޲zH"+getarg(1)+"]";
	mes "аݭn]m@HܡH";
	mes "@HYN";
	mes "ڭ̯Kaۦu@̡C";
	mes "пܭn]m@HC";
	next;
	menu	"@H 1",L4_1,
		"@H 2",L4_2,
		"@H 3",L4_3,
		"@H 4",L4_4,
		"@H 5",L4_5,
		"@H 6",L4_6,
		"@H 7",L4_7,
		"@H 8",L4_8;

//ڪMenu(ѦB5)
//menu "}b @H - ]m",L_MENU_1,"}b @H - ]m",L_MENU_2,"hL @H - ]m",L_MENU_3,"hL @H - ]m",L_MENU_4,"Mh @H - ]m",L_MENU_5,"hL @H - ]m",L_MENU_6,"Mh @H - ]m",L_MENU_7," @H - ]m (31214 / 31214)",L_MENU_8;
//
//]mNrXQUOB~FXHPsrC
//eFB~FXNi]mʧ@iNqBDUXHPy^_BrOXrC
		L4_1:
			if (getcastledata(getarg(0),10) == 1) goto L4Error2;
			set @GDnum,10;goto L4_9;
		L4_2:
			if (getcastledata(getarg(0),11) == 1) goto L4Error2;
			set @GDnum,11;goto L4_9;
		L4_3:
			if (getcastledata(getarg(0),12) == 1) goto L4Error2;
			set @GDnum,12;goto L4_9;
		L4_4:
			if (getcastledata(getarg(0),13) == 1) goto L4Error2;
			set @GDnum,13;goto L4_9;
		L4_5:
			if (getcastledata(getarg(0),14) == 1) goto L4Error2;
			set @GDnum,14;goto L4_9;
		L4_6:
			if (getcastledata(getarg(0),15) == 1) goto L4Error2;
			set @GDnum,15;goto L4_9;
		L4_7:
			if (getcastledata(getarg(0),16) == 1) goto L4Error2;
			set @GDnum,16;goto L4_9;
		L4_8:
			if (getcastledata(getarg(0),17) == 1) goto L4Error2;
			set @GDnum,17;goto L4_9;
L4Error:
	mes "[޲zH"+getarg(1)+"]";
	mes "DHK]m@Hs";
	mes "ڭ̥MC";
	mes "Qnֿn]m@HѪ";
	mes "nǲߤu|ޯतC";
	mes "^ff0000@Hs@s";
	close;
L4Error2:/*wg]mF@H*/
	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "̤wg]m@HFC";
	mes " ";
	mes "]m@HQFC";
	close;
L4Error3:/**/
	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "SBiC";
	mes "QFC";
	close;
	L4_9:
		mes "[޲zH"+getarg(1)+"]";
		mes "Twn]mwܪ@HܡH";
		mes "]mɻݭn^ff0000 10000 ^000000Zeny";
		next;
		menu "]m",L4_9_1,"",-;
			mes "[޲zH"+getarg(1)+"]";
			mes "դFC";
			mes "pIWeΪ";
			mes "]m@H~OWC";
			close;
		L4_9_1:
		if (getgdskilllv(@GID,GD_GUARDIANRESEARCH) == 0) goto L4Error;
		if (Zeny < 10000) goto L4Error3;
		set Zeny,Zeny-10000;
		setcastledata getarg(0),@GDnum,1;
	return;
}
//-------------------------------------------------------
//޲zH㢴uMdԭqv()
//callfunc "Steward_menu5","MAP","NAME","Kapra_xxx";
function	script	Steward_menu5	{
	if (getcastledata(getarg(0),9) == 1) goto Lkafra_dimi;
//(When Karfa off) Employment
	mes "[޲zH"+getarg(1)+"]";
	mes "Md`qqA";
	mes "nbKa̭AΥd¾ܡH";
	mes "ήɻݭn^ff0000 10000 ^000000ZenyK";
	next;
	menu "",-,"",L_k_e;
		if (getgdskilllv(@GID,GD_KAFRACONTACT) != 0) goto L_k_0;
		mes "[޲zH"+getarg(1)+"]";
		mes "DHKMd`qq߫C";
		mes "pGq߫ܡA";
		mes "O๵Υd¾C";
		next;
		mes "[޲zH"+getarg(1)+"]";
		mes "nd`qñq";
		mes "ݭnǲߤu|ޯत";
		mes "^ff0000Mdԭq^000000C";
		close;
	L_k_0:/**/
		if (Zeny > 10000) goto L_k_1;
		mes "[޲zH"+getarg(1)+"]";
		mes "DHIBڡI";
		close;
	L_k_1:/*\q߫*/
		set Zeny,Zeny-10000;
		enablenpc getarg(2);
		setcastledata getarg(0),9,1;
		mes "[޲zH"+getarg(1)+"]";
		mes "\Md`qqF";
		next;
		cutin "kafra_01",2;
		mes "[d ¾]";
		mes "zn";
		mes "ڬO`qӪd¾C";
		mes "ڤ|u|WAgWIAҥHڷ|VOu@I";
		next;
		cutin "kafra_01",255;
		mes "[޲zH"+getarg(1)+"]";
		mes "Fu|MdԤqqߪ";
		mes "CӤI@wZenyC";
		mes "()";
		close;
L_k_e:
		mes "[޲zH"+getarg(1)+"]";
		mes "դFC";
		mes "OAF|̴ѤKA";
		mes "鹵Υd¾~OWC";
		close;
//(When karfa ON) Dismissal
Lkafra_dimi:
	mes "[޲zH"+getarg(1)+"]";
	mes "nѶd¾ܡH";
	next;
	menu "Ѷ",-,"",L_D_1;
		cutin "kafra_01",2;
		mes "[d ¾]";
		mes "Lhڦa˿FܡH";
		mes "ڷ|[pߪK";
		mes "Э̧ڪLaK";
		next;
		menu "Ѷ",-,"",L_D_2;
				mes "[d ¾]";
				mes "zڡIQѶFIiHo˰ ~";
				next;
				disablenpc getarg(2);
				setcastledata getarg(0),9,0;
				cutin "kafra_01",255;
				mes "[޲zH"+getarg(1)+"]";
				mes "K";
				mes "wgMdԭqߪFC";
				close;
			L_D_2:
				mes "[d ¾]";
				mes "¡C";
				mes "ڷ|ܺɥOA̪AȪI";
				close2;
				cutin "kafra_01",255;
				end;
		L_D_1:
			mes "[޲zH"+getarg(1)+"]";
			mes "դFC";
			close;
	return;
}
//-------------------------------------------------------
//޲zH6uiJDHжv() x2004/08/25jRO
//callfunc "Steward_menu6","MAP","Name",x,y;
function	script	Steward_menu6	{
	mes "[޲zH"+getarg(1)+"]";
	mes "nڭ̥ͲöQ~жܡH";
	mes "̬Ou\DHiJжC";
	next;
	menu "iJDHж",-,"",L6_1;
		mes "[޲zH"+getarg(1)+"]";
		mes "ڱNzAȨ쯵KqD̡AиڨӡC";
		mes "^ӪɭԡAUK}YiC";
		close2;
		warp getarg(0),getarg(2),getarg(3);
		end;
	L6_1:
		mes "[޲zH"+getarg(1)+"]";
		mes "Ͳ~@ѥuͲ@";
		mes "Ͳ~xsWɴN|~W[FC";
		mes "Fu|oiA";
		mes "ӺɶqIɶhڡC";
		close;
		return;
}
//-------------------------------------------------------
//޲zH7uXKav(ɧU)
//callfunc "Steward_menu7","MAP","NAME";
function	script	Steward_menu7	{

	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "unXKaܡIH";
	mes " ";
	mes "ЭsҼ{aADHI";
	next;

	menu "XKa",L7_1,"",L7_2;

L7_1:
	mes "[޲zH"+getarg(1)+"]";
	mes "DHI";
	mes "ЭsҼ{@MaK";
	mes "ФTӫ!!!!!!!!";
	next;

	menu "",L7_2,"XKa",-;

	mes "[޲zH"+getarg(1)+"]";
	mes "DH!!K";
	mes "KKKnKKڡKK";
	next;
	return;

L7_2:
	mes "[޲zH"+getarg(1)+"]";
	mes "DH^^!";
	mes "UFAYϬO}AФU@nAoد^^.";
	close;
}
//-------------------------------------------------------
//u|}
//callfunc "gdswitch","MAP",x,y;
function	script	gdswitch	{
	mes "pC";
	mes "nԤUܡH";
	next;
	menu "",-,"",L2;
	warp getarg(0),getarg(1),getarg(2);
	end;
L2:
	close;
	return;
}
//-------------------------------------------------------
//u|}
//callfunc "gdswitch2","MAP1","MAP2",x,y;
function	script	gdswitch2	{
	mes "[n]";
	mes "qL禨i𪺥DHKAhM䥦窺";
	next;
	mes " ";
	mes "pC";
	mes "nԤUܡH";
	next;
	menu "",-,"",L2;
	set @GID,getcastledata(getarg(0),1);
	if (getcharid(2) != @GID) goto L1n;
	if (0 == @GID) goto L1n;
	warp getarg(1),getarg(2),getarg(3);
	end;
L1n:
	mes " ";
	mes "SoͥƱC";
L2:
	close;
	return;
}
//==============================================================================
//-------------------------------------------------------
//dԡuv
//callfunc "gkfmenu","MAP";
function	script	gkfmenu	{
	cutin "kafra_01",2;
	set @GID,getcastledata(getarg(0),1);
	if (getcharid(2) == @GID) goto LStartg;
	mes "[d ¾]";
	mes "ڤwñqM";
	mes "^ff0000" + getguildname(@GID) + "^000000u||AȡC";
	mes "ШϥΧڭ̨䥦a誺d¾A";
	mes "pKBqШ̡C";
	close2;
	cutin "kafra_01",255;
	end;
LStartg:
	mes "[d ¾]";
	mes "w{^ff0000" + getguildname(@GID) + "^000000u||";
	mes "dԪA(q)AûbU쨭䬰zAȡC";
	next;
	return;
}
//-------------------------------------------------------
//dԡuŶʪAȡv
//callfunc "gkfwarp","JMAPNAME","MAP",x,y;
function	script	gkfwarp	{
	mes "[d ¾]";
	mes "пܥتaaC";
	next;
	menu ""+getarg(0)+" -> 200 z",L3_1,"",L3_2;
		L3_1:
			if (Zeny < 200) goto Lerror3;
			set Zeny,Zeny-200;set KF_PIT,KF_PIT+20;
			warp getarg(1),getarg(2),getarg(3);
			end;
		L3_2:
				mes "[d ¾]";
				mes "¡C";
				mes "wAϥΡC";
				close2;
				cutin "kafra_01",255;
				end;
		Lerror3:
				mes "[d ¾]";
				mes "|/pj";
				mes "zҫBAЭsT{C";
				cutin "kafra_01",255;
				close2;
				cutin "kafra_01",255;
				end;
	return;
}