class 1 ivan : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( talker.level >= 26 && myself::HaveMemo(talker,651) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Runaway Youth");
			}
			if( myself::HaveMemo(talker,651) == 1 && myself::GetMemoState(talker,651) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Runaway Youth - In Progress");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( talker.level >= 26 && myself::HaveMemo(talker,651) == 0 ) )
					{
						myself::SetCurrentQuestID(651);
						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::GetMemoCount(talker) < 25 )
						{
							myself::FHTML_SetFileName(fhtml0,"ivan_q0651_001.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",651);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,651) == 1 && myself::GetMemoState(talker,651) == 1 ) )
					{
						myself::SetCurrentQuestID(651);
						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,"ivan_q0651_003.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 651 )
		{
			if( myself::OwnItemCount(talker,736) >= 1 )
			{
				myself::DeleteItem1(talker,736,1);
				myself::SetMemo(talker,651);
				myself::SetMemoState(talker,651,1);
				myself::AddLog(1,talker,651);
				myself::SetFlagJournal(talker,651,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"ivan_q0651_003.htm");
				myself::Despawn();
			}
			else
			{
				myself::ShowPage(talker,"ivan_q0651_002.htm");
			}
		}
		super;
	}

}
