class 1 ein : fighter_coach
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,401) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to a Warrior");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1138) > 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to a Warrior (Continue)");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1139) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to a Warrior (Continue)");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1143) && myself::OwnItemCount(talker,1141) && myself::OwnItemCount(talker,1139) == 0 && myself::OwnItemCount(talker,1138) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to a Warrior (Continue)");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1142) && myself::OwnItemCount(talker,1139) == 0 && myself::OwnItemCount(talker,1138) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path to a Warrior (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,401) == 0 )
					{
						myself::SetCurrentQuestID(401);
						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::ShowPage(talker,"ein_q0401_01.htm");
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1138) > 0 ) )
					{
						myself::SetCurrentQuestID(401);
						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,"ein_q0401_07.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1139) == 1 ) )
					{
						myself::SetCurrentQuestID(401);
						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,"ein_q0401_08.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1143) && myself::OwnItemCount(talker,1141) && myself::OwnItemCount(talker,1139) == 0 && myself::OwnItemCount(talker,1138) == 0 ) )
					{
						myself::SetCurrentQuestID(401);
						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,"ein_q0401_09.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1142) && myself::OwnItemCount(talker,1139) == 0 && myself::OwnItemCount(talker,1138) == 0 ) )
					{
						myself::SetCurrentQuestID(401);
						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,1144) < 20 )
						{
							myself::ShowPage(talker,"ein_q0401_12.htm");
						}
						else if( myself::OwnItemCount(talker,1144) > 19 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::DeleteItem1(talker,1144,myself::OwnItemCount(talker,1144));
								myself::DeleteItem1(talker,1142,1);
								myself::GiveItem1(talker,1145,1);
								myself::IncrementParam(talker,0,3200);
								myself::IncrementParam(talker,1,1500);
								myself::ShowPage(talker,"ein_q0401_13.htm");
								myself::RemoveMemo(talker,401);
								myself::AddLog(2,talker,401);
								myself::SoundEffect(talker,"ItemSound.quest_finish");
							}
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,fhtml0,quest_id,reply,talker)
	{
		if( ask == 401 )
		{
			myself::SetCurrentQuestID(401);
			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 == 401 )
		{
			if( reply == 1 )
			{
				if( talker.occupation == 0 )
				{
					if( talker.level >= 19 )
					{
						if( myself::OwnItemCount(talker,1145) > 0 )
						{
							myself::ShowPage(talker,"ein_q0401_04.htm");
						}
						else
						{
							myself::FHTML_SetFileName(fhtml0,"ein_q0401_05.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",401);
							myself::ShowFHTML(talker,fhtml0);
						}
					}
					else
					{
						myself::ShowPage(talker,"ein_q0401_02.htm");
					}
				}
				else if( talker.occupation == 1 )
				{
					myself::ShowPage(talker,"ein_q0401_02a.htm");
				}
				else
				{
					myself::ShowPage(talker,"ein_q0401_03.htm");
				}
			}
			else if( reply == 2 )
			{
				myself::ShowPage(talker,"ein_q0401_10.htm");
			}
			else if( reply == 3 && myself::OwnItemCount(talker,1143) > 0 && myself::OwnItemCount(talker,1141) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"ein_q0401_11.htm");
					myself::DeleteItem1(talker,1143,1);
					myself::DeleteItem1(talker,1141,1);
					myself::GiveItem1(talker,1142,1);
					myself::SetFlagJournal(talker,401,5);
				}
			}
		}
		super;
	}

}
