class 1 merc_kahman : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,628) == 0 && talker.level >= 66 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Hunt of the Golden Ram Mercenary Force");
			}
			if( myself::HaveMemo(talker,628) == 0 && talker.level < 66 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Hunt of the Golden Ram Mercenary Force");
			}
			if( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) < 100 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Hunt of the Golden Ram Mercenary Force (Continue)");
			}
			if( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) >= 100 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Hunt of the Golden Ram Mercenary Force (Continue)");
			}
			if( myself::HaveMemo(talker,628) == 1 && ( myself::OwnItemCount(talker,7246) >= 1 && ( myself::OwnItemCount(talker,7247) < 1 && ( myself::OwnItemCount(talker,7248) < 100 || myself::OwnItemCount(talker,7249) < 100 ) ) ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Hunt of the Golden Ram Mercenary Force (Continue)");
			}
			if( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) >= 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) >= 100 && myself::OwnItemCount(talker,7249) >= 100 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Hunt of the Golden Ram Mercenary Force (Continue)");
			}
			if( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7247) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Hunt of the Golden Ram Mercenary Force (Continue)");
			}
			if( talker.level >= 66 && myself::HaveMemo(talker,640) == 0 && myself::GetOneTimeQuestFlag(talker,109) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"The Zero Hour");
			}
			if( talker.level < 66 && myself::HaveMemo(talker,640) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"The Zero Hour");
			}
			if( talker.level >= 66 && myself::HaveMemo(talker,640) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"The Zero Hour - In Progress");
			}
			if( talker.level >= 66 && myself::HaveMemo(talker,109) == 1 && myself::GetMemoState(talker,109) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"In Search of the Nest - In Progress");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 0 && talker.level >= 66 ) )
					{
						myself::SetCurrentQuestID(628);
						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) < 16 )
						{
							myself::FHTML_SetFileName(fhtml0,"merc_kahman_q0628_01.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",628);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 0 && talker.level < 66 ) )
					{
						myself::SetCurrentQuestID(628);
						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,"merc_kahman_q0628_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) < 100 ) )
					{
						myself::SetCurrentQuestID(628);
						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,"merc_kahman_q0628_06.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) >= 100 ) )
					{
						myself::SetCurrentQuestID(628);
						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,"merc_kahman_q0628_07.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 1 && ( myself::OwnItemCount(talker,7246) >= 1 && ( myself::OwnItemCount(talker,7247) < 1 && ( myself::OwnItemCount(talker,7248) < 100 || myself::OwnItemCount(talker,7249) < 100 ) ) ) ) )
					{
						myself::SetCurrentQuestID(628);
						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,"merc_kahman_q0628_09.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) >= 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) >= 100 && myself::OwnItemCount(talker,7249) >= 100 ) )
					{
						myself::SetCurrentQuestID(628);
						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,7247,1);
							myself::DeleteItem1(talker,7246,myself::OwnItemCount(talker,7246));
							myself::DeleteItem1(talker,7248,myself::OwnItemCount(talker,7248));
							myself::DeleteItem1(talker,7249,myself::OwnItemCount(talker,7249));
							myself::ShowPage(talker,"merc_kahman_q0628_10.htm");
							myself::SetFlagJournal(talker,628,3);
							myself::AddLog(3,talker,628);
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7247) >= 1 ) )
					{
						myself::SetCurrentQuestID(628);
						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,"merc_kahman_q0628_11.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( talker.level >= 66 && myself::HaveMemo(talker,640) == 0 && myself::GetOneTimeQuestFlag(talker,109) == 1 ) )
					{
						myself::SetCurrentQuestID(640);
						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) < 25 )
						{
							myself::FHTML_SetFileName(fhtml0,"merc_kahman_q640_001.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",640);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( talker.level < 66 && myself::HaveMemo(talker,640) == 0 ) )
					{
						myself::SetCurrentQuestID(640);
						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,"merc_kahman_q640_005.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( talker.level >= 66 && myself::HaveMemo(talker,640) == 1 ) )
					{
						myself::SetCurrentQuestID(640);
						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,"merc_kahman_q640_003.htm");
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( talker.level >= 66 && myself::HaveMemo(talker,109) == 1 && myself::GetMemoState(talker,109) == 3 ) )
					{
						myself::SetCurrentQuestID(109);
						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,57,5168);
							myself::RemoveMemo(talker,109);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::ShowPage(talker,"merc_kahman_q0109_001.htm");
							myself::AddLog(2,talker,109);
							myself::SetOneTimeQuestFlag(talker,109,1);
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 628 )
		{
			myself::SetCurrentQuestID(628);
			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::HaveMemo(talker,628) == 0 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 )
			{
				myself::SetMemo(talker,quest_id);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::SetFlagJournal(talker,628,1);
				myself::ShowPage(talker,"merc_kahman_q0628_03.htm");
			}
			else if( myself::HaveMemo(talker,628) == 0 && myself::OwnItemCount(talker,7246) >= 1 && myself::OwnItemCount(talker,7247) < 1 )
			{
				myself::SetMemo(talker,quest_id);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::SetFlagJournal(talker,628,2);
				myself::ShowPage(talker,"merc_kahman_q0628_04.htm");
			}
			else if( myself::HaveMemo(talker,628) == 0 && myself::OwnItemCount(talker,7247) >= 1 )
			{
				myself::SetMemo(talker,quest_id);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"merc_kahman_q0628_05.htm");
				myself::SetFlagJournal(talker,628,3);
			}
			myself::AddLog(1,talker,quest_id);
			return;
		}
		if( quest_id == 640 )
		{
			myself::SetMemo(talker,640);
			myself::SetMemoState(talker,640,1);
			myself::AddLog(1,talker,640);
			myself::SetFlagJournal(talker,640,1);
			myself::SoundEffect(talker,"ItemSound.quest_accept");
			myself::ShowPage(talker,"merc_kahman_q640_002.htm");
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 628 )
		{
			myself::SetCurrentQuestID(628);
			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 == 628 )
		{
			if( reply == 1 && myself::HaveMemo(talker,628) == 1 && myself::OwnItemCount(talker,7246) < 1 && myself::OwnItemCount(talker,7247) < 1 && myself::OwnItemCount(talker,7248) >= 100 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,7246,1);
					myself::DeleteItem1(talker,7248,myself::OwnItemCount(talker,7248));
					myself::ShowPage(talker,"merc_kahman_q0628_08.htm");
					myself::SetFlagJournal(talker,628,2);
					myself::AddLog(3,talker,628);
				}
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"merc_kahman_q0628_12.htm");
			}
			if( reply == 3 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::DeleteItem1(talker,7246,myself::OwnItemCount(talker,7246));
					myself::DeleteItem1(talker,7247,myself::OwnItemCount(talker,7247));
					myself::DeleteItem1(talker,7248,myself::OwnItemCount(talker,7248));
					myself::DeleteItem1(talker,7249,myself::OwnItemCount(talker,7249));
					myself::RemoveMemo(talker,628);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"merc_kahman_q0628_13.htm");
					myself::AddLog(2,talker,628);
				}
			}
		}
		if( ask == 640 )
		{
			myself::SetCurrentQuestID(640);
			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 == 640 )
		{
			if( reply == 1 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 12 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,4042,1);
				myself::DeleteItem1(talker,8085,12);
			}
			if( reply == 2 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 6 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,4043,1);
				myself::DeleteItem1(talker,8085,6);
			}
			if( reply == 3 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 6 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,4044,1);
				myself::DeleteItem1(talker,8085,6);
			}
			if( reply == 4 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 81 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,1887,10);
				myself::DeleteItem1(talker,8085,81);
			}
			if( reply == 5 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 33 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,1888,5);
				myself::DeleteItem1(talker,8085,33);
			}
			if( reply == 6 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 30 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,1889,10);
				myself::DeleteItem1(talker,8085,30);
			}
			if( reply == 7 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 150 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,5550,10);
				myself::DeleteItem1(talker,8085,150);
			}
			if( reply == 8 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 131 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,1890,10);
				myself::DeleteItem1(talker,8085,131);
			}
			if( reply == 9 && myself::GetMemoState(talker,640) == 1 && myself::OwnItemCount(talker,8085) >= 123 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_006.htm");
				myself::GiveItem1(talker,1893,5);
				myself::DeleteItem1(talker,8085,123);
			}
			if( reply == 10 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_007.htm");
			}
			if( reply == 11 )
			{
				myself::ShowPage(talker,"merc_kahman_q640_008.htm");
				myself::RemoveMemo(talker,640);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
			}
		}
		super;
	}

}
