class 1 warehouse_keeper_kluck : warehouse_keeper
{
handler:
	EventHandler TALK_SELECTED(fhtml0,quest_id,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,354) == 0 && talker.level < 38 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Conquest of Alligator Island");
			}
			if( myself::HaveMemo(talker,354) == 0 && talker.level > 37 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Conquest of Alligator Island");
			}
			if( myself::HaveMemo(talker,354) == 1 && myself::OwnItemCount(talker,5864) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Conquest of Alligator Island (Continue)");
			}
			if( myself::HaveMemo(talker,354) == 1 && myself::OwnItemCount(talker,5864) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Conquest of Alligator Island (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,354) == 0 && talker.level < 38 ) )
					{
						myself::SetCurrentQuestID(354);
						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,"warehouse_keeper_kluck_q0354_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,354) == 0 && talker.level > 37 ) )
					{
						myself::SetCurrentQuestID(354);
						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::FHTML_SetFileName(fhtml0,"warehouse_keeper_kluck_q0354_02.htm");
						myself::FHTML_SetInt(fhtml0,"quest_id",354);
						myself::ShowFHTML(talker,fhtml0);
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,354) == 1 && myself::OwnItemCount(talker,5864) == 0 ) )
					{
						myself::SetCurrentQuestID(354);
						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,"warehouse_keeper_kluck_q0354_04.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,354) == 1 && myself::OwnItemCount(talker,5864) >= 1 ) )
					{
						myself::SetCurrentQuestID(354);
						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,"warehouse_keeper_kluck_q0354_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 354 )
		{
			myself::SetCurrentQuestID(354);
			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( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::SetMemo(talker,quest_id);
					myself::SetJournal(talker,354,1);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_03.htm");
					myself::AddLog(1,talker,quest_id);
				}
			}
			else
			{
				myself::ShowPage(talker,"fullquest.htm");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,quest_id,reply,talker)
	{
		if( ask == 354 )
		{
			myself::SetCurrentQuestID(354);
			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 == 354 )
		{
			if( reply == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					if( myself::OwnItemCount(talker,5863) >= 100 )
					{
						myself::GiveItem1(talker,57,( ( myself::OwnItemCount(talker,5863) * 220 ) + 10700 ));
						myself::DeleteItem1(talker,5863,myself::OwnItemCount(talker,5863));
						myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_06b.htm");
					}
					else if( myself::OwnItemCount(talker,5863) > 0 && myself::OwnItemCount(talker,5863) < 100 )
					{
						myself::GiveItem1(talker,57,( ( myself::OwnItemCount(talker,5863) * 220 ) + 3100 ));
						myself::DeleteItem1(talker,5863,myself::OwnItemCount(talker,5863));
						myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_06a.htm");
					}
					else if( myself::OwnItemCount(talker,5863) == 0 )
					{
						myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_06.htm");
					}
				}
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_07.htm");
			}
			if( reply == 3 )
			{
				myself::RemoveMemo(talker,354);
				myself::AddLog(2,talker,quest_id);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
				myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_08.htm");
			}
			if( reply == 4 && myself::OwnItemCount(talker,5864) > 0 && myself::OwnItemCount(talker,5864) < 10 )
			{
				myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_09.htm");
			}
			if( reply == 4 && myself::OwnItemCount(talker,5864) >= 10 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,5915,1);
					myself::DeleteItem1(talker,5864,10);
					myself::ShowPage(talker,"warehouse_keeper_kluck_q0354_10.htm");
				}
			}
		}
		super;
	}

}
