class 1 obi : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,i1,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,649) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"A Looter and A Railroad Man");
			}
			if( myself::HaveMemo(talker,649) == 1 && myself::GetMemoState(talker,649) == 2 && myself::OwnItemCount(talker,8099) == 200 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"A Looter and A Railroad Man (Continue)");
			}
			if( myself::HaveMemo(talker,649) == 1 && myself::GetMemoState(talker,649) == 1 && myself::OwnItemCount(talker,8099) < 200 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"A Looter and A Railroad Man (Continue)");
			}
			if( myself::HaveMemo(talker,116) == 1 && myself::GetMemoState(talker,116) == 2 && myself::OwnItemCount(talker,8098) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Beyond the Hills of Winter (Continue)");
			}
			if( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 2 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"The Ocean of Distant Stars (Continue)");
			}
			if( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 6 && myself::OwnItemCount(talker,8488) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"The Ocean of Distant Stars (Continue)");
			}
			if( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 8 && myself::OwnItemCount(talker,8495) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"The Ocean of Distant Stars (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,649) == 0 )
					{
						myself::SetCurrentQuestID(649);
						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) < 16 )
						{
							if( talker.level < 30 )
							{
								myself::ShowPage(talker,"obi_q649_01.htm");
							}
							else
							{
								myself::FHTML_SetFileName(fhtml0,"obi_q649_02.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",649);
								myself::ShowFHTML(talker,fhtml0);
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,649) == 1 && myself::GetMemoState(talker,649) == 2 && myself::OwnItemCount(talker,8099) == 200 ) )
					{
						myself::SetCurrentQuestID(649);
						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,"obi_q649_02.htm");
						myself::DeleteItem1(talker,8099,200);
						myself::GiveItem1(talker,57,21698);
						myself::RemoveMemo(talker,649);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,649) == 1 && myself::GetMemoState(talker,649) == 1 && myself::OwnItemCount(talker,8099) < 200 ) )
					{
						myself::SetCurrentQuestID(649);
						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,"obi_q649_03.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,116) == 1 && myself::GetMemoState(talker,116) == 2 && myself::OwnItemCount(talker,8098) == 1 ) )
					{
						myself::SetCurrentQuestID(116);
						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,"obi_q116_01.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 2 ) )
					{
						myself::SetCurrentQuestID(117);
						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,"obi_q117_01.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 6 && myself::OwnItemCount(talker,8488) == 1 ) )
					{
						myself::SetCurrentQuestID(117);
						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,"obi_q117_03.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,117) == 1 && myself::GetMemoState(talker,117) == 8 && myself::OwnItemCount(talker,8495) == 1 ) )
					{
						myself::SetCurrentQuestID(117);
						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,"obi_q117_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,fhtml0,quest_id,reply,talker)
	{
		if( ask == 116 )
		{
			myself::SetCurrentQuestID(116);
			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 == 116 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"obi_q116_03.htm");
				myself::DeleteItem1(talker,8098,1);
				myself::GiveItem1(talker,1463,1650);
				myself::RemoveMemo(talker,116);
				myself::SetOneTimeQuestFlag(talker,116,1);
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"obi_q116_03.htm");
				myself::DeleteItem1(talker,8098,1);
				myself::GiveItem1(talker,57,16500);
				myself::RemoveMemo(talker,116);
				myself::SetOneTimeQuestFlag(talker,116,1);
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
		}
		if( ask == 117 )
		{
			if( reply == 1 )
			{
				myself::SetMemoState(talker,117,3);
				myself::SetFlagJournal(talker,117,3);
				myself::ShowPage(talker,"obi_q117_02.htm");
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 2 )
			{
				myself::SetMemoState(talker,117,7);
				myself::SetFlagJournal(talker,117,7);
				myself::ShowPage(talker,"obi_q117_04.htm");
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 3 )
			{
				myself::SetMemoState(talker,117,9);
				myself::SetFlagJournal(talker,117,9);
				myself::DeleteItem1(talker,8495,1);
				myself::ShowPage(talker,"obi_q117_06.htm");
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
		}
		super;
	}

}
