class 1 magister_talbot : mage_coach
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,413) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to a Shillien Oracle");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			if( _code == 0 )
			{
				if( _from_choice == 0 || myself::HaveMemo(talker,413) == 1 )
				{
					myself::SetCurrentQuestID(413);
					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::OwnItemCount(talker,1262) == 1 )
					{
						myself::ShowPage(talker,"magister_talbot_q0413_01.htm");
					}
					else if( myself::OwnItemCount(talker,1263) == 5 && myself::OwnItemCount(talker,1264) == 0 )
					{
						myself::ShowPage(talker,"magister_talbot_q0413_03.htm");
					}
					else if( myself::OwnItemCount(talker,1264) > 0 && myself::OwnItemCount(talker,1264) < 5 )
					{
						myself::ShowPage(talker,"magister_talbot_q0413_04.htm");
					}
					else if( myself::OwnItemCount(talker,1264) >= 5 )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::ShowPage(talker,"magister_talbot_q0413_05.htm");
							myself::DeleteItem1(talker,1264,myself::OwnItemCount(talker,1264));
							myself::GiveItem1(talker,1265,1);
							myself::GiveItem1(talker,1266,1);
							myself::SetFlagJournal(talker,413,4);
						}
					}
					else if( ( ( myself::OwnItemCount(talker,1266) + myself::OwnItemCount(talker,1267) ) + myself::OwnItemCount(talker,1268) ) > 0 )
					{
						myself::ShowPage(talker,"magister_talbot_q0413_06.htm");
					}
					else if( myself::OwnItemCount(talker,1269) == 1 && myself::OwnItemCount(talker,1265) == 1 )
					{
						myself::ShowPage(talker,"magister_talbot_q0413_07.htm");
					}
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 413 )
		{
			myself::SetCurrentQuestID(413);
			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 == 413 )
		{
			if( reply == 1 && myself::OwnItemCount(talker,1262) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"magister_talbot_q0413_02.htm");
					myself::DeleteItem1(talker,1262,1);
					myself::GiveItem1(talker,1263,5);
					myself::SetFlagJournal(talker,413,2);
				}
			}
		}
		super;
	}

}
