class 1 warehouse_chief_klump : master_lv3_ware
{
parameter:
	int	Cell0 = 0;
	int	Cell1 = 0;
	int	Cell2 = 0;
	int	Cell3 = 0;
	int	Cell4 = 0;

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,662) == 0 && talker.level > 60 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"A Game of Cards");
			}
			if( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::OwnItemCount(talker,8765) < 50 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"A Game of Cards (Continue)");
			}
			if( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::OwnItemCount(talker,8765) > 49 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"A Game of Cards (Continue)");
			}
			if( myself::HaveMemo(talker,662) == 1 && talker.level < 61 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"A Game of Cards (Delevel?)");
			}
			if( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::GetMemoState(talker,662) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"A Game of Cards (Disconnect?)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,662) == 0 && talker.level > 60 ) )
					{
						myself::SetCurrentQuestID(662);
						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_chief_klump_q0662_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::OwnItemCount(talker,8765) < 50 ) )
					{
						myself::SetCurrentQuestID(662);
						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_chief_klump_q0662_04.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::OwnItemCount(talker,8765) > 49 ) )
					{
						myself::SetCurrentQuestID(662);
						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_chief_klump_q0662_05.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,662) == 1 && talker.level < 61 ) )
					{
						myself::SetCurrentQuestID(662);
						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_chief_klump_q0662_02.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,662) == 1 && talker.level > 60 && myself::GetMemoState(talker,662) == 1 ) )
					{
						myself::SetCurrentQuestID(662);
						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_chief_klump_q0662_11a.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(talker)
	{
		myself::SetCurrentQuestID(662);
		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,662);
				myself::SetJournal(talker,662,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_03.htm");
				myself::AddLog(1,talker,662);
			}
		}
		else
		{
			myself::ShowPage(talker,"fullquest.htm");
		}
		return;
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker,fhtml0,i0)
	{
		if( ask == 662 )
		{
			if( reply == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"warehouse_chief_klump_q0662_06.htm");
				}
			}
			if( reply == 2 )
			{
				myself::RemoveMemo(talker,662);
				myself::AddLog(2,talker,662);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_07.htm");
			}
			if( reply == 3 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_08.htm");
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_09.htm");
			}
			if( reply == 5 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_10.htm");
			}
			if( reply == 6 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_09a.htm");
			}
			if( reply == 7 && myself::OwnItemCount(talker,8765) < 50 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_04.htm");
			}
			if( reply == 7 && myself::OwnItemCount(talker,8765) > 49 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_05.htm");
			}
			if( reply == 8 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_09b.htm");
			}
			if( reply == 10 )
			{
				myself::SetCookie(talker,"klump0",0);
				myself::SetCookie(talker,"klump1",0);
				myself::SetCookie(talker,"klump2",0);
				myself::SetCookie(talker,"klump3",0);
				myself::SetCookie(talker,"klump4",0);
				myself::DeleteItem1(talker,8765,50);
				myself::SetMemoState(talker,662,1);
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::ShowFHTML(talker,fhtml0);
				myself.i_ai0 = 0;
			}
			if( reply == 11 )
			{
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::SetMemoState(talker,662,0);
				i0 = gg::Rand(14);
				i0 = ( i0 + 1 );
				if( myself.i_ai0 == 0 )
				{
					myself::FHTML_SetInt(fhtml0,"Cell1",i0);
					myself::ShowFHTML(talker,fhtml0);
					myself::SetCookie(talker,"klump0",i0);
					myself.i_ai0 = ( myself.i_ai0 + 1 );
					return;
				}
				if( myself.i_ai0 == 1 )
				{
					myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
					myself::FHTML_SetInt(fhtml0,"Cell2",i0);
					myself::ShowFHTML(talker,fhtml0);
					myself::SetCookie(talker,"klump1",i0);
					myself.i_ai0 = ( myself.i_ai0 + 1 );
					return;
				}
				if( myself.i_ai0 == 2 )
				{
					myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
					myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
					myself::FHTML_SetInt(fhtml0,"Cell3",i0);
					myself::ShowFHTML(talker,fhtml0);
					myself::SetCookie(talker,"klump2",i0);
					myself.i_ai0 = ( myself.i_ai0 + 1 );
					return;
				}
				if( myself.i_ai0 == 3 )
				{
					myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
					myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
					myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
					myself::FHTML_SetInt(fhtml0,"Cell4",i0);
					myself::ShowFHTML(talker,fhtml0);
					myself::SetCookie(talker,"klump" + myself.i_ai0,i0);
					myself.i_ai0 = ( myself.i_ai0 + 1 );
					return;
				}
				if( myself.i_ai0 == 4 )
				{
					myself::SetCookie(talker,"klump" + myself.i_ai0,i0);
					myself.i_ai0 = ( myself.i_ai0 + 1 );
					i0 = myself::GetCookie(talker,"klump0");
					i1 = myself::GetCookie(talker,"klump1");
					i2 = myself::GetCookie(talker,"klump2");
					i3 = myself::GetCookie(talker,"klump3");
					i4 = myself::GetCookie(talker,"klump4");
					if( i0 == i1 && i1 == i2 && i2 == i3 && i3 == i4 )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_13.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,959,3);
						myself::GiveItem1(talker,729,1);
						myself::GiveItem1(talker,8868,43);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( ( i0 == i1 && i1 == i2 && i2 == i3 ) || ( ( i1 == i2 && i2 == i3 && i3 == i4 ) || ( ( i0 == i2 && i2 == i3 && i3 == i4 ) || ( ( i0 == i1 && i1 == i3 && i3 == i4 ) || ( i0 == i1 && i1 == i2 && i2 == i4 ) ) ) ) )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_14.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,959,2);
						myself::GiveItem1(talker,951,2);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( ( i0 == i1 && i1 == i2 && i3 == i4 ) || ( ( i0 == i1 && i1 == i3 && i2 == i4 ) || ( ( i0 == i2 && i2 == i3 && i1 == i4 ) || ( ( i2 == i1 && i2 == i3 && i0 == i4 ) || ( ( i2 == i1 && i4 == i2 && i3 == i0 ) || ( ( i1 == i3 && i3 == i4 && i0 == i2 ) || ( ( i0 == i1 && i2 == i3 && i3 == i4 ) || ( ( i2 == i1 && i0 == i3 && i3 == i4 ) || ( ( i0 == i1 && i2 == i3 && i1 == i4 ) || ( i0 == i2 && i2 == i4 && i1 == i3 ) ) ) ) ) ) ) ) ) )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_15.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,947,2);
						myself::GiveItem1(talker,729,1);
						myself::GiveItem1(talker,955,1);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( ( i0 == i1 && i1 == i2 ) || ( ( i0 == i1 && i1 == i3 ) || ( ( i1 == i3 && i1 == i4 ) || ( ( i1 == i2 && i2 == i3 ) || ( ( i1 == i2 && i2 == i4 ) || ( ( i3 == i2 && i3 == i4 ) || ( ( i0 == i1 && i0 == i4 ) || ( ( i0 == i2 && i0 == i3 ) || ( ( i0 == i2 && i0 == i4 ) || ( i0 == i3 && i0 == i4 ) ) ) ) ) ) ) ) ) )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_16.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,951,2);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( ( i0 == i1 && i1 == i2 ) || ( ( i0 == i1 && i2 == i3 ) || ( ( i0 == i1 && i3 == i4 ) || ( ( i1 == i2 && i2 == i3 ) || ( ( i1 == i2 && i3 == i4 ) || ( ( i2 == i3 && i3 == i4 ) || ( ( i0 == i4 && i1 == i3 ) || ( ( i0 == i3 && i1 == i2 ) || ( ( i0 == i2 && i1 == i3 ) || ( ( i0 == i2 && i1 == i4 ) || ( ( i0 == i4 && i1 == i2 ) || ( ( i0 == i1 && i2 == i4 ) || ( ( i1 == i4 && i2 == i3 ) || ( ( i0 == i3 && i1 == i4 ) || ( ( i1 == i3 && i2 == i4 ) || ( ( i0 == i3 && i2 == i4 ) || ( ( i0 == i3 && i2 == i4 ) || ( i0 == i4 && i2 == i3 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_17.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,951,1);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( i0 == i1 || i0 == i2 || i0 == i3 || i0 == i4 || i1 == i2 || i1 == i3 || i1 == i4 || i2 == i3 || i2 == i4 || i3 == i4 )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_18.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::GiveItem1(talker,956,2);
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
					if( i0 != i1 && i0 != i2 && i0 != i3 && i0 != i4 && i1 != i2 && i1 != i3 && i1 != i4 && i2 != i3 && i2 != i4 && i3 != i4 )
					{
						myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_19.htm");
						myself::FHTML_SetInt(fhtml0,"Cell1",myself::GetCookie(talker,"klump0"));
						myself::FHTML_SetInt(fhtml0,"Cell2",myself::GetCookie(talker,"klump1"));
						myself::FHTML_SetInt(fhtml0,"Cell3",myself::GetCookie(talker,"klump2"));
						myself::FHTML_SetInt(fhtml0,"Cell4",myself::GetCookie(talker,"klump3"));
						myself::FHTML_SetInt(fhtml0,"Cell5",myself::GetCookie(talker,"klump4"));
						myself::ShowFHTML(talker,fhtml0);
						return;
					}
				}
				return;
			}
			if( reply == 12 )
			{
				myself::SetMemoState(talker,662,0);
				i0 = gg::Rand(14);
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::FHTML_SetInt(fhtml0,"Cell1",i0);
				myself::ShowFHTML(talker,fhtml0);
				return;
			}
			if( reply == 13 )
			{
				myself::SetMemoState(talker,662,0);
				i0 = gg::Rand(14);
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::FHTML_SetInt(fhtml0,"Cell2",i0);
				myself::ShowFHTML(talker,fhtml0);
				return;
			}
			if( reply == 14 )
			{
				myself::SetMemoState(talker,662,0);
				i0 = gg::Rand(14);
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::FHTML_SetInt(fhtml0,"Cell3",i0);
				myself::ShowFHTML(talker,fhtml0);
				return;
			}
			if( reply == 15 )
			{
				myself::FHTML_SetFileName(fhtml0,"warehouse_chief_klump_q0662_11.htm");
				myself::FHTML_SetInt(fhtml0,"Cell4",i0);
				myself::ShowFHTML(talker,fhtml0);
				return;
			}
			if( reply == 20 && myself::OwnItemCount(talker,8765) > 49 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_20.htm");
			}
			if( reply == 20 && myself::OwnItemCount(talker,8765) < 50 )
			{
				myself::ShowPage(talker,"warehouse_chief_klump_q0662_21.htm");
			}
		}
		super;
	}

}
