class 1 mantarasa_egg : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,124) == 0 )
			{
				if( myself::GetOneTimeQuestFlag(talker,124) == 0 )
				{
					_choiceN = ( _choiceN + 1 );
					_code = 0;
					myself::AddChoice(0,"Meeting the Elroki");
				}
				else
				{
					_choiceN = ( _choiceN + 1 );
					_code = 1;
					myself::AddChoice(1,"Meeting the Elroki - Complete");
				}
			}
			else
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Meeting the Elroki - In Progress");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					myself::ShowPage(talker,"mantarasa_egg_q124_003.htm");
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(124);
					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,"mantarasa_egg_q124_003.htm");
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(124);
					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::GetMemoState(talker,124) < 5 )
					{
						myself::ShowPage(talker,"mantarasa_egg_q124_003.htm");
					}
					if( myself::GetMemoState(talker,124) == 5 )
					{
						myself::ShowPage(talker,"mantarasa_egg_q124_001.htm");
					}
					if( myself::GetMemoState(talker,124) == 6 )
					{
						myself::ShowPage(talker,"mantarasa_egg_q124_002.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 124 )
		{
			myself::SetCurrentQuestID(124);
			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( reply == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					if( myself::OwnItemCount(talker,8778) > 0 )
					{
						myself::DeleteItem1(talker,8778,myself::OwnItemCount(talker,8778));
					}
					myself::SetMemoState(talker,124,6);
					myself::SetFlagJournal(talker,124,6);
					myself::GiveItem1(talker,8778,1);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
					myself::ShowPage(talker,"mantarasa_egg_q124_002.htm");
					return;
				}
			}
		}
		super;
	}

}
