class 1 father_manuell : cleric_coach
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,409) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to an Oracle");
			}
			if( myself::HaveMemo(talker,409) == 1 && myself::OwnItemCount(talker,1231) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to an Oracle (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,409) == 0 )
					{
						myself::SetCurrentQuestID(409);
						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 )
						{
							if( myself::OwnItemCount(talker,1235) == 0 )
							{
								myself::FHTML_SetFileName(fhtml0,"father_manuell_q0409_01.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",409);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"father_manuell_q0409_04.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,409) == 1 && myself::OwnItemCount(talker,1231) ) )
					{
						myself::SetCurrentQuestID(409);
						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,1232) == 0 && myself::OwnItemCount(talker,1233) == 0 && myself::OwnItemCount(talker,1234) == 0 && myself::OwnItemCount(talker,1236) == 0 )
						{
							if( myself::GetMemoState(talker,409) == 2 )
							{
								myself::SetMemoState(talker,409,1);
								myself::ShowPage(talker,"father_manuell_q0409_09.htm");
								myself::SetFlagJournal(talker,409,8);
							}
							else
							{
								myself::SetMemoState(talker,409,1);
								myself::ShowPage(talker,"father_manuell_q0409_06.htm");
							}
						}
						else if( myself::OwnItemCount(talker,1232) == 1 && myself::OwnItemCount(talker,1233) == 1 && myself::OwnItemCount(talker,1234) == 1 && myself::OwnItemCount(talker,1236) == 0 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"father_manuell_q0409_08.htm");
								myself::DeleteItem1(talker,1232,1);
								myself::DeleteItem1(talker,1233,1);
								myself::DeleteItem1(talker,1234,1);
								myself::DeleteItem1(talker,1231,1);
								myself::GiveItem1(talker,1235,1);
								myself::IncrementParam(talker,0,3200);
								myself::IncrementParam(talker,1,1130);
								myself::RemoveMemo(talker,409);
								myself::AddLog(2,talker,409);
								myself::SoundEffect(talker,"ItemSound.quest_finish");
							}
						}
						else
						{
							myself::ShowPage(talker,"father_manuell_q0409_07.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 409 )
		{
			myself::SetCurrentQuestID(409);
			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( talker.level >= 19 && talker.occupation == 25 && myself::OwnItemCount(talker,1235) == 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::SetMemo(talker,409);
					myself::AddLog(1,talker,409);
					myself::SetMemoState(talker,409,1);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::GiveItem1(talker,1231,1);
					myself::SetFlagJournal(talker,409,1);
					myself::ShowPage(talker,"father_manuell_q0409_05.htm");
				}
			}
			else if( talker.occupation != 25 )
			{
				if( talker.occupation == 29 )
				{
					myself::ShowPage(talker,"father_manuell_q0409_02a.htm");
				}
				else
				{
					myself::ShowPage(talker,"father_manuell_q0409_02.htm");
				}
			}
			else if( talker.level < 19 && talker.occupation == 25 )
			{
				myself::ShowPage(talker,"father_manuell_q0409_03.htm");
			}
			else if( talker.level >= 19 && talker.occupation == 25 && myself::OwnItemCount(talker,1235) == 1 )
			{
				myself::ShowPage(talker,"father_manuell_q0409_04.htm");
			}
			return;
		}
		super;
	}

}
