class 1 chest_of_hallate : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,234) == 1 && myself::GetMemoState(talker,234) == 2 && myself::OwnItemCount(talker,4669) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Fate's Whisper (Continue)");
			}
			if( myself::HaveMemo(talker,234) == 1 && ( myself::GetMemoState(talker,234) != 2 || myself::OwnItemCount(talker,4669) == 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Fate's Whisper (Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,234) == 1 && myself::GetMemoState(talker,234) == 2 && myself::OwnItemCount(talker,4669) == 0 ) )
					{
						myself::SetCurrentQuestID(234);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::GiveItem1(talker,4669,1);
							myself::ShowPage(talker,"chest_of_hallate_q0234_01.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,234) == 1 && ( myself::GetMemoState(talker,234) != 2 || myself::OwnItemCount(talker,4669) == 1 ) ) )
					{
						myself::SetCurrentQuestID(234);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"chest_of_hallate_q0234_02.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(234);
		if( timer_id == 23404 )
		{
			myself::Despawn();
		}
		super;
	}

	EventHandler CREATED(i0)
	{
		myself::SetCurrentQuestID(234);
		myself::AddTimerEx(23404,( 1000 * 120 ));
		super;
	}

}
