class 1 urutu_chief_hatos : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,107) == 0 && myself::GetOneTimeQuestFlag(talker,107) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Merciless Punishment");
			}
			if( myself::HaveMemo(talker,107) == 0 && myself::GetOneTimeQuestFlag(talker,107) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Merciless Punishment (Complete)");
			}
			if( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Merciless Punishment (Continue)");
			}
			if( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Merciless Punishment (Continue)");
			}
			if( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 2 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Merciless Punishment (Continue)");
			}
			if( ( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 3 ) && myself::GetOneTimeQuestFlag(talker,107) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Merciless Punishment (Continue)");
			}
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3391) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3394) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Test of the Lord (Continue)");
			}
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Test of the Lord (Continue)");
			}
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3394) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3404) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Test of the Lord (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,107) == 0 && myself::GetOneTimeQuestFlag(talker,107) == 0 ) )
					{
						myself::SetCurrentQuestID(107);
						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.race != 3 )
							{
								myself::ShowPage(talker,"urutu_chief_hatos_q0107_00.htm");
							}
							else if( talker.level >= 12 )
							{
								myself::FHTML_SetFileName(fhtml0,"urutu_chief_hatos_q0107_02.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",107);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"urutu_chief_hatos_q0107_01.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,107) == 0 && myself::GetOneTimeQuestFlag(talker,107) == 1 ) )
					{
						myself::SetCurrentQuestID(107);
						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,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 0 ) )
					{
						myself::SetCurrentQuestID(107);
						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,"urutu_chief_hatos_q0107_04.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 1 ) )
					{
						myself::SetCurrentQuestID(107);
						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,"urutu_chief_hatos_q0107_05.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 2 ) )
					{
						myself::SetCurrentQuestID(107);
						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,"urutu_chief_hatos_q0107_08.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( ( ( myself::HaveMemo(talker,107) == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 3 ) && myself::GetOneTimeQuestFlag(talker,107) == 0 ) )
					{
						myself::SetCurrentQuestID(107);
						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( talker.level < 25 && myself::IsNewbie(talker) )
							{
								myself::VoiceEffect(talker,"tutorial_voice_026",1000);
								myself::GiveItem1(talker,5789,7000);
							}
							myself::ShowPage(talker,"urutu_chief_hatos_q0107_10.htm");
							myself::GiveItem1(talker,1060,100);
							myself::GiveItem1(talker,4414,10);
							myself::GiveItem1(talker,4415,10);
							myself::GiveItem1(talker,4416,10);
							myself::GiveItem1(talker,4413,10);
							myself::GiveItem1(talker,4412,10);
							myself::DeleteItem1(talker,1556,myself::OwnItemCount(talker,1556));
							myself::DeleteItem1(talker,1557,myself::OwnItemCount(talker,1557));
							myself::DeleteItem1(talker,1558,myself::OwnItemCount(talker,1558));
							myself::DeleteItem1(talker,1555,myself::OwnItemCount(talker,1555));
							myself::GiveItem1(talker,1510,1);
							myself::RemoveMemo(talker,107);
							myself::AddLog(2,talker,107);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::SetOneTimeQuestFlag(talker,107,1);
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3391) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3394) == 0 ) )
					{
						myself::SetCurrentQuestID(232);
						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,"urutu_chief_hatos_q0232_01.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 ) )
					{
						myself::SetCurrentQuestID(232);
						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,3402) == 1 && myself::OwnItemCount(talker,3403) >= 10 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"urutu_chief_hatos_q0232_04.htm");
								myself::DeleteItem1(talker,3394,myself::OwnItemCount(talker,3394));
								myself::DeleteItem1(talker,3402,myself::OwnItemCount(talker,3402));
								myself::DeleteItem1(talker,3403,myself::OwnItemCount(talker,3403));
								myself::GiveItem1(talker,3404,1);
							}
						}
						else
						{
							myself::ShowPage(talker,"urutu_chief_hatos_q0232_03.htm");
						}
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3394) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3404) >= 1 ) )
					{
						myself::SetCurrentQuestID(232);
						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,"urutu_chief_hatos_q0232_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 107 )
		{
			myself::SetCurrentQuestID(107);
			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 == 107 && reply == 1 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 1 )
		{
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
			{
				talker.quest_last_reward_time = myself::GetCurrentTick();
				myself::ShowPage(talker,"urutu_chief_hatos_q0107_06.htm");
				myself::DeleteItem1(talker,1554,myself::OwnItemCount(talker,1554));
				myself::DeleteItem1(talker,1556,myself::OwnItemCount(talker,1556));
				myself::DeleteItem1(talker,1557,myself::OwnItemCount(talker,1557));
				myself::DeleteItem1(talker,1558,myself::OwnItemCount(talker,1558));
				myself::DeleteItem1(talker,1553,myself::OwnItemCount(talker,1553));
				myself::DeleteItem1(talker,1555,myself::OwnItemCount(talker,1555));
				myself::GiveItem1(talker,57,100);
				myself::RemoveMemo(talker,107);
				myself::AddLog(2,talker,107);
				myself::SoundEffect(talker,"ItemSound.quest_giveup");
			}
		}
		else if( ( ask == 107 && reply == 2 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 1 )
		{
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
			{
				talker.quest_last_reward_time = myself::GetCurrentTick();
				myself::ShowPage(talker,"urutu_chief_hatos_q0107_07.htm");
				myself::SetFlagJournal(talker,107,4);
				myself::DeleteItem1(talker,1553,myself::OwnItemCount(talker,1553));
				if( myself::OwnItemCount(talker,1554) == 0 )
				{
					myself::GiveItem1(talker,1554,1);
				}
			}
		}
		else if( ( ask == 107 && reply == 3 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 2 )
		{
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
			{
				talker.quest_last_reward_time = myself::GetCurrentTick();
				myself::ShowPage(talker,"urutu_chief_hatos_q0107_06.htm");
				myself::DeleteItem1(talker,1554,myself::OwnItemCount(talker,1554));
				myself::DeleteItem1(talker,1556,myself::OwnItemCount(talker,1556));
				myself::DeleteItem1(talker,1557,myself::OwnItemCount(talker,1557));
				myself::DeleteItem1(talker,1558,myself::OwnItemCount(talker,1558));
				myself::DeleteItem1(talker,1553,myself::OwnItemCount(talker,1553));
				myself::DeleteItem1(talker,1555,myself::OwnItemCount(talker,1555));
				myself::GiveItem1(talker,57,200);
				myself::RemoveMemo(talker,107);
				myself::AddLog(2,talker,107);
				myself::SoundEffect(talker,"ItemSound.quest_giveup");
			}
		}
		else if( ( ask == 107 && reply == 4 && ( myself::OwnItemCount(talker,1553) || myself::OwnItemCount(talker,1554) || myself::OwnItemCount(talker,1555) ) ) && ( ( myself::OwnItemCount(talker,1558) + myself::OwnItemCount(talker,1557) ) + myself::OwnItemCount(talker,1556) ) == 2 )
		{
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
			{
				talker.quest_last_reward_time = myself::GetCurrentTick();
				myself::ShowPage(talker,"urutu_chief_hatos_q0107_09.htm");
				myself::SetFlagJournal(talker,107,6);
				myself::DeleteItem1(talker,1554,myself::OwnItemCount(talker,1554));
				if( myself::OwnItemCount(talker,1555) == 0 )
				{
					myself::GiveItem1(talker,1555,1);
				}
			}
		}
		if( ask == 232 )
		{
			myself::SetCurrentQuestID(232);
			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 == 232 )
		{
			if( reply == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"urutu_chief_hatos_q0232_02.htm");
					myself::GiveItem1(talker,3394,1);
				}
			}
		}
		super;
	}

}
