class 1 enku_chief_kepra : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3212) == 0 && myself::OwnItemCount(talker,3229) == 0 && myself::OwnItemCount(talker,3225) == 0 && myself::OwnItemCount(talker,3224) < 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Testimony of Glory (Continue)");
			}
			if( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3229) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Testimony of Glory (Continue)");
			}
			if( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3225) && myself::OwnItemCount(talker,3224) < 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Testimony of Glory (Continue)");
			}
			if( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3224) >= 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Testimony of Glory (Continue)");
			}
			if( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3212) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Testimony of Glory (Continue)");
			}
			if( myself::HaveMemo(talker,220) == 1 && ( myself::OwnItemCount(talker,3216) || myself::OwnItemCount(talker,3217) || myself::OwnItemCount(talker,3220) ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Testimony of Glory (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,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3212) == 0 && myself::OwnItemCount(talker,3229) == 0 && myself::OwnItemCount(talker,3225) == 0 && myself::OwnItemCount(talker,3224) < 4 ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3229) ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3225) && myself::OwnItemCount(talker,3224) < 4 ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_05.htm");
						if( myself::Maker_GetNpcCount() < 5 )
						{
							myself::CreateOnePrivate(1027082,"enku_orc_overlord",0,1);
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3224) >= 4 ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_06.htm");
							myself::GiveItem1(talker,3212,1);
							myself::DeleteItem1(talker,3224,myself::OwnItemCount(talker,3224));
							if( myself::OwnItemCount(talker,3214) >= 1 && myself::OwnItemCount(talker,3211) >= 1 && myself::OwnItemCount(talker,3215) >= 1 && myself::OwnItemCount(talker,3213) >= 1 )
							{
								myself::SetFlagJournal(talker,220,5);
							}
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,220) == 1 && myself::OwnItemCount(talker,3209) && myself::OwnItemCount(talker,3210) && myself::OwnItemCount(talker,3212) ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_07.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,220) == 1 && ( myself::OwnItemCount(talker,3216) || myself::OwnItemCount(talker,3217) || myself::OwnItemCount(talker,3220) ) ) )
					{
						myself::SetCurrentQuestID(220);
						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,"enku_chief_kepra_q0220_08.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 220 )
		{
			myself::SetCurrentQuestID(220);
			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 == 220 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"enku_chief_kepra_q0220_03.htm");
			}
			else if( reply == 2 && myself::OwnItemCount(talker,3229) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"enku_chief_kepra_q0220_04.htm");
					myself::CreateOnePrivate(1027082,"enku_orc_overlord",0,1);
					myself::CreateOnePrivate(1027082,"enku_orc_overlord",0,1);
					myself::CreateOnePrivate(1027082,"enku_orc_overlord",0,1);
					myself::CreateOnePrivate(1027082,"enku_orc_overlord",0,1);
					myself::GiveItem1(talker,3225,1);
					myself::DeleteItem1(talker,3229,1);
				}
			}
		}
		super;
	}

}
