@LabelIndex 54133
@StringIndex 0
class 0 sanctuary_outta_guard_basic : citizen {
parameter:
	int	ChangeItem = 8064;
	int	ChangedItem = 8065;
	string	DoorName = "sanctuary_outta_guard_basic_default";
	string	GateOpenHTML = "sanctuary_outta_guard002.htm";
	string	GateOpenFailHTML = "sanctuary_outta_guard003.htm";

handler:
	EventHandler CREATED() {
		myself::AddTimerEx(3456,( 15 * 1000 ));
	}

	EventHandler TALKED(talker) {
		myself::ShowPage(talker,fnHi);
		super;
	}

	EventHandler MENU_SELECTED(talker,ask,reply) {
		if( ask == 502 && reply == 2 ) {
			gg::Castle_GateOpenClose2(DoorName,0);
			myself::ShowPage(talker,GateOpenHTML);
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == 3456 ) {
			myself::LookNeighbor(300);
			myself::AddTimerEx(3456,( 15 * 1000 ));
		}
		super;
	}

	EventHandler SEE_CREATURE(creature) {
		if( creature.is_pc == 0 && myself::IsInCategory(12,creature.class_id) == 0 ) {
			return;
		}
		if( myself.sm.alive == 0 ) {
			return;
		}
		if( gg::OwnItemCount(creature,ChangeItem) >= 1 ) {
			myself::DeleteItem1(creature,ChangeItem,1);
			myself::GiveItem1(creature,ChangedItem,1);
		}
	}

}
