class 1 collector_trumpin : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,343) == 1 && myself::IsInCategory(2,talker.occupation) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Under the Shadow of the Ivory Tower (Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			if( _code == 0 )
			{
				if( _from_choice == 0 || ( myself::HaveMemo(talker,343) == 1 && myself::IsInCategory(2,talker.occupation) ) )
				{
					myself::SetCurrentQuestID(343);
					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;
					}
					talker.param1 = 0;
					myself::ShowPage(talker,"collector_trumpin_q0343_01.htm");
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,reply,talker)
	{
		if( ask == 343 )
		{
			myself::SetCurrentQuestID(343);
			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 == 343 && myself::HaveMemo(talker,343) == 1 && myself::IsInCategory(2,talker.occupation) )
		{
			if( reply == 1 )
			{
				if( myself::OwnItemCount(talker,4364) < 10 )
				{
					myself::ShowPage(talker,"collector_trumpin_q0343_03.htm");
				}
				else if( myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param2 = gg::Rand(2);
					myself::ShowPage(talker,"collector_trumpin_q0343_04.htm");
				}
			}
			if( reply == 2 )
			{
				if( talker.param2 == 0 && talker.param1 == 0 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 1;
					myself::ShowPage(talker,"collector_trumpin_q0343_05.htm");
				}
				else if( talker.param2 == 0 && talker.param1 == 1 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 2;
					myself::ShowPage(talker,"collector_trumpin_q0343_05a.htm");
				}
				else if( talker.param2 == 0 && talker.param1 == 2 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 3;
					myself::ShowPage(talker,"collector_trumpin_q0343_05b.htm");
				}
				else if( talker.param2 == 0 && talker.param1 == 3 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 4;
					myself::ShowPage(talker,"collector_trumpin_q0343_05c.htm");
				}
				else if( talker.param2 == 0 && talker.param1 == 4 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,310);
						myself::ShowPage(talker,"collector_trumpin_q0343_05d.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
				else if( talker.param2 == 1 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					myself::DeleteItem1(talker,4364,10);
					myself::ShowPage(talker,"collector_trumpin_q0343_06.htm");
					talker.param1 = 0;
					talker.param2 = 2;
				}
				else if( myself::OwnItemCount(talker,4364) < 10 )
				{
					myself::ShowPage(talker,"collector_trumpin_q0343_03.htm");
				}
			}
			if( reply == 3 )
			{
				if( talker.param2 == 0 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					myself::DeleteItem1(talker,4364,10);
					myself::ShowPage(talker,"collector_trumpin_q0343_07.htm");
					talker.param1 = 0;
					talker.param2 = 2;
				}
				else if( talker.param2 == 1 && talker.param1 == 0 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 1;
					myself::ShowPage(talker,"collector_trumpin_q0343_08.htm");
				}
				else if( talker.param2 == 1 && talker.param1 == 1 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 2;
					myself::ShowPage(talker,"collector_trumpin_q0343_08a.htm");
				}
				else if( talker.param2 == 1 && talker.param1 == 2 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 3;
					myself::ShowPage(talker,"collector_trumpin_q0343_08b.htm");
				}
				else if( talker.param2 == 1 && talker.param1 == 3 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					talker.param1 = 4;
					myself::ShowPage(talker,"collector_trumpin_q0343_08c.htm");
				}
				else if( talker.param2 == 1 && talker.param1 == 4 && myself::OwnItemCount(talker,4364) >= 10 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,310);
						myself::ShowPage(talker,"collector_trumpin_q0343_08d.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
				else if( myself::OwnItemCount(talker,4364) < 10 )
				{
					myself::ShowPage(talker,"collector_trumpin_q0343_03.htm");
				}
			}
			if( reply == 4 )
			{
				if( talker.param1 == 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,10);
						myself::ShowPage(talker,"collector_trumpin_q0343_09.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
				else if( talker.param1 == 2 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,30);
						myself::ShowPage(talker,"collector_trumpin_q0343_09a.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
				else if( talker.param1 == 3 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,70);
						myself::ShowPage(talker,"collector_trumpin_q0343_09b.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
				else if( talker.param1 == 4 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,4364,150);
						myself::ShowPage(talker,"collector_trumpin_q0343_09c.htm");
						talker.param1 = 0;
						talker.param2 = 2;
					}
				}
			}
			if( reply == 5 )
			{
				talker.param1 = 0;
				myself::ShowPage(talker,"collector_trumpin_q0343_10.htm");
			}
		}
		super;
	}

}
