class 1 flauron : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,636) == 1 && myself::GetMemoState(talker,636) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Truth Beyond the Gate - In Progress");
			}
			if( talker.level >= 73 && myself::HaveMemo(talker,637) == 0 && myself::OwnItemCount(talker,8065) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Through the Gate Once More");
			}
			if( ( talker.level < 73 && myself::HaveMemo(talker,637) == 0 ) || myself::OwnItemCount(talker,8065) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Through the Gate Once More");
			}
			if( talker.level >= 73 && myself::HaveMemo(talker,637) == 1 && myself::GetMemoState(talker,637) == 2 && myself::OwnItemCount(talker,8066) == 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Through the Gate Once More - In Progress");
			}
			if( myself::GetMemoState(talker,637) == 1 && myself::OwnItemCount(talker,8066) < 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Through the Gate Once More - In Progress");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,636) == 1 && myself::GetMemoState(talker,636) == 1 ) )
					{
						myself::SetCurrentQuestID(636);
						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,"flauron_q0636_0101.htm");
					}
					return;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level >= 73 && myself::HaveMemo(talker,637) == 0 && myself::OwnItemCount(talker,8065) >= 1 ) )
					{
						myself::SetCurrentQuestID(637);
						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) < 26 )
						{
							myself::FHTML_SetFileName(fhtml0,"flauron_q0637_0101.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",637);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( ( talker.level < 73 && myself::HaveMemo(talker,637) == 0 ) || myself::OwnItemCount(talker,8065) == 0 ) )
					{
						myself::SetCurrentQuestID(637);
						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,"flauron_q0637_0106.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( talker.level >= 73 && myself::HaveMemo(talker,637) == 1 && myself::GetMemoState(talker,637) == 2 && myself::OwnItemCount(talker,8066) == 10 && myself::OwnItemCount(talker,8065) >= 1 ) )
					{
						myself::SetCurrentQuestID(637);
						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,"flauron_q0637_0105.htm");
						myself::DeleteItem1(talker,8065,1);
						myself::DeleteItem1(talker,8066,10);
						myself::GiveItem1(talker,8067,1);
						myself::GiveItem1(talker,8273,10);
						myself::AddLog(2,talker,637);
						myself::RemoveMemo(talker,637);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::GetMemoState(talker,637) == 1 && myself::OwnItemCount(talker,8066) < 10 ) )
					{
						myself::SetCurrentQuestID(637);
						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,"flauron_q0637_0104.htm");
					}
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 637 )
		{
			myself::SetCurrentQuestID(637);
			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::SetMemo(talker,637);
				myself::SetMemoState(talker,637,1);
				myself::AddLog(1,talker,637);
				myself::SetFlagJournal(talker,637,1);
				myself::ShowPage(talker,"flauron_q0637_0103.htm");
				myself::SoundEffect(talker,"ItemSound.quest_accept");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,quest_id,reply,talker)
	{
		if( ask == 636 )
		{
			myself::SetCurrentQuestID(636);
			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( ask == 636 )
		{
			i0 = myself::GetHTMLCookie(talker,636,1);
			if( reply == 1 && myself::HaveMemo(talker,636) == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,8064,1);
					myself::AddLog(2,talker,636);
					myself::RemoveMemo(talker,636);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"flauron_q0636_0102.htm");
				}
				else
				{
					myself::ShowPage(talker,"flauron_q0636_0103.htm");
				}
			}
		}
		super;
	}

}
