class 1 temple_gatekeeper1 : citizen
{
parameter:
	string	fnHi = "Temple_Gatekeeper1_001.htm";
	string	DoorName1 = "temple_gate";

handler:
	EventHandler CREATED()
	{
		myself.i_ai1 = 0;
	}

	EventHandler MENU_SELECTED(reply,talker)
	{
		if( reply == 1 )
		{
			if( talker.level >= 73 && (myself::OwnItemCount(talker,8067) >= 1 || myself::OwnItemCount(talker,8064) >= 1 || myself::OwnItemCount(talker,8065) >= 1 )
			{
				myself::Castle_GateOpenClose2(DoorName1,0);
				if( myself.i_ai1 == 0 )
				{
					myself.i_ai1 = 1;
					myself::AddTimerEx(3001,30000);
				}
			}
			else
			{
				myself::ShowPage(talker,"Temple_Gatekeeper1_002.htm");
			}
		}
		if( reply == 2 )
		{
			if( talker.level >= 73 && myself::OwnItemCount(talker,8064) >= 1 )
			{
				myself::DeleteItem1(talker,8064,1);
				myself::GiveItem1(talker,8065,1);
			}
			else
			{
				myself::ShowPage(talker,"Temple_Gatekeeper1_002.htm");
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 3001 )
		{
			myself::Castle_GateOpenClose2(DoorName1,1);
			myself.i_ai1 = 0;
		}
		super;
	}

}
