class 1 prefect_tazki : fighter_coach
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,75) == 0 && myself::GetOneTimeQuestFlag(talker,75) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Saga of the Titan");
			}
			if( myself::HaveMemo(talker,75) == 0 && myself::GetOneTimeQuestFlag(talker,75) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Saga of the Titan (End)");
			}
			if( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Saga of the Titan (Continue)");
			}
			if( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 15 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Saga of the Titan (Continue)");
			}
			if( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 16 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Saga of the Titan (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,75) == 0 && myself::GetOneTimeQuestFlag(talker,75) == 0 ) )
					{
						myself::SetCurrentQuestID(75);
						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( talker.level >= 76 && talker.occupation == 46 )
							{
								myself::ShowPage(talker,"prefect_tazki_q0075_0101.htm");
							}
							else
							{
								myself::ShowPage(talker,"prefect_tazki_q0075_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,75) == 0 && myself::GetOneTimeQuestFlag(talker,75) == 1 ) )
					{
						myself::SetCurrentQuestID(75);
						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,"finishedquest.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 1 ) )
					{
						myself::SetCurrentQuestID(75);
						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,"prefect_tazki_q0075_0104.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 15 ) )
					{
						myself::SetCurrentQuestID(75);
						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,"prefect_tazki_q0075_0106.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 16 ) )
					{
						myself::SetCurrentQuestID(75);
						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 >= 76 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::AddUseSkillDesire(talker,1110785,1,0,1000000);
								myself::ClassChange(talker,113);
								myself::SetOneTimeQuestFlag(talker,75,1);
								myself::GiveItem1(talker,57,5000000);
								myself::GiveItem1(talker,6622,1);
								myself::IncrementParam(talker,0,2299404);
								myself::RemoveMemo(talker,75);
								myself::ShowPage(talker,"prefect_tazki_q0075_0109.htm");
								myself::ShowSystemMessage(talker,1606);
							}
						}
						else
						{
							myself::ShowPage(talker,"prefect_tazki_q0075_0110.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker)
	{
		if( ask == 75 )
		{
			myself::SetCurrentQuestID(75);
			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 == 75 )
		{
			if( reply == 1 )
			{
				if( myself::HaveMemo(talker,75) == 0 && talker.occupation == 46 && talker.level >= 76 && myself::GetOneTimeQuestFlag(talker,75) == 0 )
				{
					myself::FHTML_SetFileName(fhtml0,"prefect_tazki_q0075_0105.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",75);
					myself::ShowFHTML(talker,fhtml0);
				}
			}
			else if( reply == 2 )
			{
				if( myself::HaveMemo(talker,75) == 1 && talker.occupation == 46 && myself::GetMemoState(talker,75) == 15 )
				{
					if( talker.level >= 76 )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::AddUseSkillDesire(talker,1110785,1,0,1000000);
							myself::DeleteItem1(talker,7098,myself::OwnItemCount(talker,7098));
							myself::ClassChange(talker,113);
							myself::SetOneTimeQuestFlag(talker,75,1);
							myself::GiveItem1(talker,57,5000000);
							myself::GiveItem1(talker,6622,1);
							myself::IncrementParam(talker,0,2299404);
							myself::RemoveMemo(talker,75);
							myself::ShowPage(talker,"prefect_tazki_q0075_0107.htm");
							myself::ShowSystemMessage(talker,1606);
						}
					}
					else
					{
						myself::SetMemoState(talker,75,16);
						myself::SetFlagJournal(talker,75,20);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
						myself::DeleteItem1(talker,7098,myself::OwnItemCount(talker,7098));
						myself::ShowPage(talker,"prefect_tazki_q0075_0108.htm");
					}
				}
			}
		}
		super;
	}

}
