//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2015  Hercules Dev Team
//= Copyright (C)  L0ne_W0lf
//= Copyright (C)  kobra_k88
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= War of Emperium Dungeon Switch for NGuild Castles
//================= Description ===========================================
//= Switch that warps guild members to the guild dungeon
//================= Current Version =======================================
//= 1.1
//=========================================================================

function	script	F_GldDunSw	{
	.@GID = getcastledata(getarg(0),1);
	if (.@GID == 0) {
		mes "[ Echoing Voice ]";
		mes " ' The one who can overcome an ordeal and show true bravery... will find the way... ' ";
		close;
	}
	else {
		mes "[ Echoing Voice ]";
		mes " ' Only the one who can show true bravery can take this test. '";
		next;
		mes " ";
		mes "There's a small lever. Will you pull it?";
		next;

		if (select("Pull.", "Do not.") == 1) {
			if (getcharid(CHAR_ID_GUILD) == .@GID) {
				warp "gld_dun"+getarg(1),getarg(2),getarg(3);
				end;
			}
			mes " ";
			mes " Nothing happened.";
		}
		return;
	}
}

//== Castle 1 ==============================================
nguild_alde,212,181,0	script	Switch#DunN01	HIDDEN_NPC,{
	callfunc "F_GldDunSw","nguild_alde","02",32,122;
	close;
}

//== Castle 2 ==============================================
nguild_gef,78,84,0	script	Switch#DunN02	HIDDEN_NPC,{
	callfunc "F_GldDunSw","nguild_gef","04",39,258;
	close;
}

//== Castle 3 ==============================================
nguild_pay,101,25,0	script	Switch#DunN03	HIDDEN_NPC,{
	callfunc "F_GldDunSw","nguild_pay","01",186,165;
	close;
}

//== Castle 4 ==============================================
nguild_prt,94,200,0	script	Switch#DunN04	HIDDEN_NPC,{
	callfunc "F_GldDunSw","nguild_prt","03",28,251;
	close;
}
