//===== rAthena Script =======================================
//= War of Emperium (Payon)
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= NPCs that relate to Payon Guild Castle 1
//===== Additional Comments: =================================
//= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
//= 1.1 Corrected flag-in spawn point. [L0ne_W0lf]
//= 1.2 Removed dialog from interior flags. [L0ne_W0lf]
//=     Fixed position of Guild dungeon switch.
//============================================================

// Guild Flag (Town)
//============================================================
payon,166,161,3	script	Bright Arbor#f1-1::BrightArbor	722,{
	end;

OnRecvCastlePy01:
	FlagEmblem GetCastleData("payg_cas01",1);
	end;
}

payon,90,322,4	duplicate(BrightArbor)	Bright Arbor#f1-2	722

// Guild Flag (Outside Castle)
//============================================================
pay_gld,125,236,4	script	Bright Arbor#f1-3::BrightArbor2	722,{
	set .@GID, GetCastleData("payg_cas01",1);
	if (.@GID == 0) {
		mes " [ Edict of the Divine Rune Midgard Kingdom ]";
		mes " ";
		mes "1. Follow the ordinance of The Divine Rune Midgard Kingdom, ";
		mes "We declare that";
		mes "there is no formal master of this castle.";
		mes " ";
		mes "2. To the one who can ";
		mes "overcome all trials";
		mes "and destroy the Emperium,";
		mes "the king will endow the one with";
		mes "ownership of this castle.";
	}
	else {
		if (getcharid(2) == .@GID) {
			mes "Brave ones...";
			mes "Do you wish to return to your honorable place?";
			next;
			if (select("Return to the guild castle.:Quit.") == 1) {
				if (getcharid(2) == GetCastleData("payg_cas01",1)) {
					warp "payg_cas01",212,108;
					//warp "payg_cas01",54 144;
					end;
				}
			}
			close;
		}
		mes "[ Edict of the Divine Rune Midgard Kingdom ]";
		mes " ";
		mes "1. Following the ordinance of the";
		mes "Divine Rune Midgard Kingdom,";
		mes "we approve that this place is in";
		mes "the private possession of ^ff0000" + GetGuildName(.@GID) + "^000000 Guild.";
		mes " ";
		mes "2. The guild Master of ^ff0000"+ GetGuildName(.@GID) + "^000000 Guild is";
		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000";
		mes "If there is anyone who objects to this,";
		mes " prove your strength and honor with a steel blade in your hand.";
	}
	close;

OnRecvCastlePy01:
	FlagEmblem GetCastleData("payg_cas01",1);
	end;
}

pay_gld,110,233,4	duplicate(BrightArbor2)	Bright Arbor#f1-4	722
pay_gld,116,233,4	duplicate(BrightArbor2)	Bright Arbor#f1-5	722
pay_gld,91,239,2	duplicate(BrightArbor2)	Bright Arbor#f1-6	722

// Guild Flag (Inside Castle)
//============================================================
payg_cas01,238,67,4	script	Bright Arbor#f1-7::BrightArbor3	722,{
	end;

OnRecvCastlePy01:
	FlagEmblem GetCastleData("payg_cas01",1);
	end;
}

payg_cas01,233,67,4	duplicate(BrightArbor3)	Bright Arbor#f1-8	722
payg_cas01,221,123,4	duplicate(BrightArbor3)	Bright Arbor#f1-9	722
payg_cas01,221,116,4	duplicate(BrightArbor3)	Bright Arbor#f1-10	722
payg_cas01,206,108,4	duplicate(BrightArbor3)	Bright Arbor#f1-11	722
payg_cas01,212,108,4	duplicate(BrightArbor3)	Bright Arbor#f1-12	722

// AGIT Manager
//============================================================
payg_cas01,139,139,0	duplicate(Gld_Agit_Manager)	Agit#payg_cas01	-1

// Steward
//============================================================
payg_cas01,120,58,4	duplicate(Gld_Mngr_Template)	Kurunnadi#payg_cas01	55

// Guardians
//============================================================
payg_cas01,120,58,4	duplicate(Gld_Guard_Template)	Guardian#payg_cas01	-1

// Kafra Staff
//============================================================
payg_cas01,128,58,3	duplicate(Gld_Kafra_Template)	Kafra Staff#payg_cas01	117

// Master's Room Exit
//============================================================
payg_cas01,295,8,0	script	#switch_Py01	111,{
	mes " ";
	mes "There's a small lever. Will you pull it? ";
	next;
	if(select("Pull.:Do not.") == 2) close;
	warp "payg_cas01",120,59;
	end;
}

// Guild Treasure Protection
//============================================================
payg_cas01,291,8,0	duplicate(Gld_Trea_Protect)	ban_warp#payg_cas01	-1,6,6

// Guild Treasure Spawns
//============================================================
payg_cas01,291,8,0	duplicate(Gld_Trea_Spawn)	Treasure#payg_cas01	-1

// Guild Dungeon Switch
//============================================================
payg_cas01,101,25,0	duplicate(Gld_Dun_Template)	#payg_cas01	111
