class 1 elder_ashas_barka_durai : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( talker.level >= 74 && myself::HaveMemo(talker,612) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"War with Ketra Orcs");
			}
			if( talker.level < 74 && myself::HaveMemo(talker,612) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"War with Ketra Orcs");
			}
			if( myself::HaveMemo(talker,612) == 1 && myself::GetMemoState(talker,612) == ( ( 1 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"War with Ketra Orcs (Continue)");
			}
			if( talker.level >= 75 && myself::HaveMemo(talker,613) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Prove Your Courage! (Balka)");
			}
			if( talker.level < 75 && myself::HaveMemo(talker,613) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Prove Your Courage! (Balka)");
			}
			if( myself::HaveMemo(talker,613) == 1 && myself::GetMemoState(talker,613) >= ( ( 1 * 10 ) + 1 ) && myself::GetMemoState(talker,613) <= ( ( 1 * 10 ) + 2 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Prove Your Courage! (Balka)(Continue)");
			}
			if( talker.level >= 75 && myself::HaveMemo(talker,614) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Slay the Enemy Commander! (Balka)");
			}
			if( talker.level < 75 && myself::HaveMemo(talker,614) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Slay the Enemy Commander! (Balka)");
			}
			if( myself::HaveMemo(talker,614) == 1 && myself::GetMemoState(talker,614) >= ( ( 1 * 10 ) + 1 ) && myself::GetMemoState(talker,614) <= ( ( 1 * 10 ) + 2 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Slay the Enemy Commander! (Balka)(Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( talker.level >= 74 && myself::HaveMemo(talker,612) == 0 ) )
					{
						myself::SetCurrentQuestID(612);
						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( ( ( ( 0 == 1 && myself::OwnItemCount(talker,6623) >= 1 ) || 0 == 0 ) && ( ( 0 == 1 && myself::GetOneTimeQuestFlag(talker,0) == 1 ) || 0 == 0 ) ) && ( ( 0 == 1 && talker.subjob_id != 0 ) || 0 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"elder_ashas_barka_durai_q0612_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",612);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level < 74 && myself::HaveMemo(talker,612) == 0 ) )
					{
						myself::SetCurrentQuestID(612);
						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,"elder_ashas_barka_durai_q0612_0103.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,612) == 1 && myself::GetMemoState(talker,612) == ( ( 1 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(612);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7234) == 0 ) || 1 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) == 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) == 0 ) || 0 == 0 ) )
						{
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0106.htm");
						}
						else
						{
							myself::SetHTMLCookie(talker,612,1);
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0105.htm");
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( talker.level >= 75 && myself::HaveMemo(talker,613) == 0 ) )
					{
						myself::SetCurrentQuestID(613);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7223) >= 1 ) || 1 == 0 ) && ( ( 0 == 1 && myself::GetOneTimeQuestFlag(talker,0) == 1 ) || 0 == 0 ) ) && ( ( 0 == 1 && talker.subjob_id != 0 ) || 0 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"elder_ashas_barka_durai_q0613_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",613);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( talker.level < 75 && myself::HaveMemo(talker,613) == 0 ) )
					{
						myself::SetCurrentQuestID(613);
						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,"elder_ashas_barka_durai_q0613_0103.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,613) == 1 && myself::GetMemoState(talker,613) >= ( ( 1 * 10 ) + 1 ) && myself::GetMemoState(talker,613) <= ( ( 1 * 10 ) + 2 ) ) )
					{
						myself::SetCurrentQuestID(613);
						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::GetMemoState(talker,613) == ( ( 1 * 10 ) + 2 ) && ( ( 1 == 1 && myself::OwnItemCount(talker,7240) >= 1 ) || 1 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
						{
							myself::SetHTMLCookie(talker,613,1);
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0105.htm");
						}
						else
						{
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0106.htm");
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( talker.level >= 75 && myself::HaveMemo(talker,614) == 0 ) )
					{
						myself::SetCurrentQuestID(614);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7224) >= 1 ) || 1 == 0 ) && ( ( 0 == 1 && myself::GetOneTimeQuestFlag(talker,0) == 1 ) || 0 == 0 ) ) && ( ( 0 == 1 && talker.subjob_id != 0 ) || 0 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"elder_ashas_barka_durai_q0614_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",614);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( talker.level < 75 && myself::HaveMemo(talker,614) == 0 ) )
					{
						myself::SetCurrentQuestID(614);
						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,"elder_ashas_barka_durai_q0614_0103.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,614) == 1 && myself::GetMemoState(talker,614) >= ( ( 1 * 10 ) + 1 ) && myself::GetMemoState(talker,614) <= ( ( 1 * 10 ) + 2 ) ) )
					{
						myself::SetCurrentQuestID(614);
						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::GetMemoState(talker,614) == ( ( 1 * 10 ) + 2 ) && ( ( 1 == 1 && myself::OwnItemCount(talker,7241) >= 1 ) || 1 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
						{
							myself::SetHTMLCookie(talker,614,1);
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0105.htm");
						}
						else
						{
							myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0106.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 612 )
		{
			myself::SetCurrentQuestID(612);
			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::SetMemo(talker,612);
				myself::SetMemoState(talker,612,( ( 1 * 10 ) + 1 ));
				myself::AddLog(1,talker,612);
				myself::SetFlagJournal(talker,612,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0104.htm");
			}
			return;
		}
		if( quest_id == 613 )
		{
			myself::SetCurrentQuestID(613);
			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::SetMemo(talker,613);
				myself::SetMemoState(talker,613,( ( 1 * 10 ) + 1 ));
				myself::AddLog(1,talker,613);
				myself::SetFlagJournal(talker,613,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0104.htm");
			}
			return;
		}
		if( quest_id == 614 )
		{
			myself::SetCurrentQuestID(614);
			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::SetMemo(talker,614);
				myself::SetMemoState(talker,614,( ( 1 * 10 ) + 1 ));
				myself::AddLog(1,talker,614);
				myself::SetFlagJournal(talker,614,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0104.htm");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,i1,quest_id,reply,talker)
	{
		if( ask == 612 )
		{
			myself::SetCurrentQuestID(612);
			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 == 612 )
		{
			i0 = myself::GetHTMLCookie(talker,612,( 2 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 1 && myself::HaveMemo(talker,612) == 1 )
				{
					myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0201.htm");
				}
				if( reply == 3 && myself::HaveMemo(talker,612) == 1 )
				{
					if( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7234) >= 100 ) || 1 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
					{
						i1 = gg::Rand(1000);
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::DeleteItem1(talker,7234,100);
							myself::DeleteItem1(talker,0,0);
							myself::DeleteItem1(talker,0,0);
							if( i1 < 1000 && 1000 != 0 )
							{
								myself::GiveItem1(talker,7187,20);
							}
							else if( i1 < ( 1000 + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( 1000 + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( 1000 + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
							else if( i1 < ( ( ( ( ( ( ( ( ( 1000 + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) + 0 ) && 0 != 0 )
							{
							}
						}
						myself::AddLog(3,talker,612);
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0202.htm");
					}
					else
					{
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0203.htm");
					}
				}
				if( reply == 4 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::DeleteItem1(talker,7234,myself::OwnItemCount(talker,7234));
						myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
						myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
						myself::AddLog(2,talker,612);
						myself::RemoveMemo(talker,612);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0612_0204.htm");
					}
				}
			}
		}
		if( ask == 613 )
		{
			myself::SetCurrentQuestID(613);
			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 == 613 )
		{
			i0 = myself::GetHTMLCookie(talker,613,( 2 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 3 && myself::HaveMemo(talker,613) == 1 )
				{
					if( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7240) >= 1 ) || 1 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::DeleteItem1(talker,7240,myself::OwnItemCount(talker,7240));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::GiveItem1(talker,7229,1);
						}
						myself::AddLog(2,talker,613);
						myself::RemoveMemo(talker,613);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0201.htm");
					}
					else
					{
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0613_0202.htm");
					}
				}
			}
		}
		if( ask == 614 )
		{
			myself::SetCurrentQuestID(614);
			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 == 614 )
		{
			i0 = myself::GetHTMLCookie(talker,614,( 2 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 3 && myself::HaveMemo(talker,614) == 1 )
				{
					if( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7241) >= 1 ) || 1 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::DeleteItem1(talker,7241,myself::OwnItemCount(talker,7241));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::GiveItem1(talker,7230,1);
						}
						myself::AddLog(2,talker,614);
						myself::RemoveMemo(talker,614);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0201.htm");
					}
					else
					{
						myself::ShowPage(talker,"elder_ashas_barka_durai_q0614_0202.htm");
					}
				}
			}
		}
		super;
	}

}
