class 1 wharf_manager_felton : wharf_keeper
{
property:
	BuySellList SellList0 = {{"boat_ticket_kiran_talk";20}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,35) == 1 && myself::GetOneTimeQuestFlag(talker,35) == 0 && myself::GetMemoState(talker,35) == ( ( 1 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Find Glittering Jewelry");
			}
			if( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 2 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Find Glittering Jewelry");
			}
			if( myself::HaveMemo(talker,65) == 1 && myself::GetMemoState(talker,65) == 11 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Certified Soul Breaker (Continue)");
			}
			if( myself::HaveMemo(talker,65) == 1 && myself::GetMemoState(talker,65) == 12 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Certified Soul Breaker (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,35) == 1 && myself::GetOneTimeQuestFlag(talker,35) == 0 && myself::GetMemoState(talker,35) == ( ( 1 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(35);
						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::SetHTMLCookie(talker,35,1);
						myself::ShowPage(talker,"wharf_manager_felton_q0035_0101.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 2 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(35);
						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_felton_q0035_0202.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,65) == 1 && myself::GetMemoState(talker,65) == 11 ) )
					{
						myself::SetCurrentQuestID(65);
						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_felton_q065_01.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,65) == 1 && myself::GetMemoState(talker,65) == 12 ) )
					{
						myself::SetCurrentQuestID(65);
						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_felton_q065_04.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,quest_id,reply,talker)
	{
		if( ask == 35 )
		{
			myself::SetCurrentQuestID(35);
			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;
			}
			i0 = myself::GetHTMLCookie(talker,35,( 2 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 1 && myself::HaveMemo(talker,35) == 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"wharf_manager_felton_q0035_0201.htm");
						myself::SetMemoState(talker,35,( ( 2 * 10 ) + 1 ));
						myself::SetFlagJournal(talker,35,2);
						myself::ShowQuestMark(talker,35);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
				}
			}
		}
		if( ask == 65 )
		{
			myself::SetCurrentQuestID(65);
			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 )
			{
				myself::ShowPage(talker,"wharf_manager_felton_q065_03.htm");
				myself::SetMemoState(talker,65,12);
				myself::SetFlagJournal(talker,65,12);
			}
		}
		super;
	}

}
