//===== eAthena Script =======================================
//= War of Emperium Treasure Rooms for Al De Baran Guild Castles
//===== By: ==================================================
//= jAthena - kalen (1.0)
//= 1.1 by Akaru, ho|yAnge|X, and Valaris
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
//= eAthena 0.1+; RO Episode 4+
//===== Description: =========================================
//=
//===== Additional Comments: =================================
//= v1.2 Optimized with functions.[kobra_k88]
//============================================================


//<=============================== Castle 1 =================================>\\

// Treasure Spawn -----------------------
aldeg_cas01,1,1,1	script	Treasure_A01	-1,{

OnRecvCastleA01:
	end;
OnInit:
	if($boxNumA01 == 0) end;
	set $@bxA01, $boxNumA01;
	callfunc "F_GldTreas","aldeg_cas01","A01",$boxNumA01,$@bxA01,$@boxIdA01,1324,114,218,123,227,1;
	end;

OnDied:
	mapannounce "aldeg_cas01","Treasure Chest Broken Open",17;
	set $boxNumA01, $boxNumA01 -1;
	if($boxNumA01 == 0) mapannounce "aldeg_cas01", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

// Treasure Room Switch --------------------
aldeg_cas01,123,223,0	script	Switch#TresA01	111,{
	callfunc "F_GldTreasSw", "aldeg_cas01",218,176;
	end;
}

// Treasure Room Protection ------------------------------------------------
aldeg_cas01,118,223,0	script	ban_warp#11	-1,8,8,{
OnTouch:
	callfunc "F_TreasProtect", "aldeg_cas01", "aldebaran",143,112;
	end;
}

//<================================ Castle 2 ================================>\\

// Treasure Spawn ----------------------------
aldeg_cas02,1,1,1	script	Treasure_A02	-1,{

OnRecvCastleA02:
	end;
OnInit:
	if($boxNumA02 == 0) end;
	set $@bxA02, $boxNumA02;
	callfunc "F_GldTreas","aldeg_cas02","A02",$boxNumA02,$@bxA02,$@boxIdA02,1326,130,226,138,235,1;
	end;

OnDied:
	mapannounce "aldeg_cas02","Treasure Chest Broken Open",17;
	set $boxNumA02, $boxNumA02 -1;
	if($boxNumA02 == 0) mapannounce "aldeg_cas02", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

// Treasure Room Switch ----------------------
aldeg_cas02,139,235,0	script	Switch#TresA02	111,{
	callfunc "F_GldTreasSw", "aldeg_cas02",78,75;
	end;
}


// Treasure Room Protection ------------------------------------------------
aldeg_cas02,135,230,0	script	ban_warp#12	-1,8,8,{
OnTouch:
	callfunc "F_TreasProtect", "aldeg_cas02", "aldebaran",143,112;
	end;
}

//<================================ Castle 3 ================================>\\

// Treasure Spawn ---------------------------
aldeg_cas03,1,1,1	script	Treasure_A03	-1,{

OnRecvCastleA03:
	end;
OnInit:
	if($boxNumA03 == 0) end;
	set $@bxA03, $boxNumA03;
	callfunc "F_GldTreas","aldeg_cas03","A03",$boxNumA03,$@bxA03,$@boxIdA03,1328,220,264,229,273,1;
	end;

OnDied:
	mapannounce "aldeg_cas03","Treasure Chest Broken Open",17;
	set $boxNumA03, $boxNumA03 -1;
	if($boxNumA03 == 0) mapannounce "aldeg_cas03", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

// Treasure Room Switch -----------------------
aldeg_cas03,229,267,0	script	Switch#TresA03	111,{
	callfunc "F_GldTreasSw", "aldeg_cas03",110,119;
	end;
}

// Treasure Room Protection ------------------------------------------------
aldeg_cas03,225,269,0	script	ban_warp#13	-1,8,8,{
OnTouch:
	callfunc "F_TreasProtect", "aldeg_cas03", "aldebaran",143,112;
	end;
}

//<================================ Castle 4 ================================>\\

// Treasure Spawn -------------------------------
aldeg_cas04,1,1,1	script	Treasure_A04	-1,{

OnRecvCastleA04:
	end;
OnInit:
	if($boxNumA04 == 0) end;
	set $@bxA04, $boxNumA04;
	callfunc "F_GldTreas","aldeg_cas04","A04",$boxNumA04,$@bxA04,$@boxIdA04,1330,80,8,89,17,1;
	end;

OnDied:
	mapannounce "aldeg_cas04","Treasure Chest Broken Open",17;
	set $boxNumA04, $boxNumA04 -1;
	if($boxNumA04 == 0) mapannounce "aldeg_cas04", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;

}
// Treasure Room Switch -------------------------
aldeg_cas04,83,17,0	script	Switch#TresA04	111,{
	callfunc "F_GldTreasSw", "aldeg_cas04",67,117;
	end;
}

// Treasure Room Protection ------------------------------------------------
aldeg_cas04,84,13,0	script	ban_warp#14	-1,8,8,{
OnTouch:
	callfunc "F_TreasProtect", "aldeg_cas04", "aldebaran",143,112;
	end;
}

//<================================ Castle 5 ================================>\\

// Treasure Spawn ------------------------------------
aldeg_cas05,1,1,1	script	Treasure_A05	-1,{

OnRecvCastleA05:
	end;
OnInit:
	if($boxNumA05 == 0) end;
	set $@bxA05, $boxNumA05;
	callfunc "F_GldTreas","aldeg_cas05","A05",$boxNumA05,$@bxA05,$@boxIdA05,1332,58,8,65,15,1;
	end;

OnDied:
	mapannounce "aldeg_cas05","Treasure Chest Broken Open",17;
	set $boxNumA05, $boxNumA05 -1;
	if($boxNumA05 == 0) mapannounce "aldeg_cas05", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

// Treasure Room Switch ---------------------------------
aldeg_cas05,64,8,0	script	Switch#TresA05	111,{
	callfunc "F_GldTreasSw", "aldeg_cas05",51,179;
	end;
}


// Treasure Room Protection ------------------------------------------------
aldeg_cas05,62,12,0	script	ban_warp#15	-1,8,8,{
OnTouch:
	callfunc "F_TreasProtect", "aldeg_cas05", "aldebaran",143,112;
	end;
}
