class 1 wharf_manager_singsing : wharf_keeper
{
property:
	BuySellList SellList0 = {{"boat_ticket_rune_to_primeval_isle";20};{"boat_ticket_primeval_isle_to_rune";20}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( talker.level >= 75 && myself::HaveMemo(talker,643) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Rise and Fall of the Elroki Tribe");
			}
			if( talker.level >= 75 && myself::HaveMemo(talker,643) == 1 && myself::OwnItemCount(talker,8776) > 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Rise and Fall of the Elroki Tribe - 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 >= 75 && myself::HaveMemo(talker,643) == 0 ) )
					{
						myself::SetCurrentQuestID(643);
						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,"wharf_manager_singsing_q0643_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level >= 75 && myself::HaveMemo(talker,643) == 1 && myself::OwnItemCount(talker,8776) > 0 ) )
					{
						myself::SetCurrentQuestID(643);
						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,"wharf_manager_singsing_q0643_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 643 )
		{
			myself::SetCurrentQuestID(643);
			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 == 643 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_02.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_03.htm");
				myself::SetMemoState(talker,643,1);
				myself::SetFlagJournal(talker,643,1);
			}
			if( reply == 3 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_04.htm");
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_06.htm");
			}
			if( reply == 5 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_07.htm");
			}
			if( reply == 6 )
			{
				myself::ShowPage(talker,"wharf_manager_singsing_q0643_08.htm");
				myself::GiveItem1(talker,57,( myself::OwnItemCount(talker,8776) * 1374 ));
				myself::DeleteItem1(talker,8776,myself::OwnItemCount(talker,8776));
				myself::RemoveMemo(talker,643);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
			}
		}
		super;
	}

}
