class 1 pixy_murika : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,i0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,266) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Pleas of Pixies");
			}
			if( myself::HaveMemo(talker,266) == 1 && myself::OwnItemCount(talker,1334) < 100 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Pleas of Pixies (Continue)");
			}
			if( myself::HaveMemo(talker,266) == 1 && myself::OwnItemCount(talker,1334) >= 100 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Pleas of Pixies (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,266) == 0 )
					{
						myself::SetCurrentQuestID(266);
						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( talker.level >= 3 && talker.race == 1 )
							{
								myself::FHTML_SetFileName(fhtml0,"pixy_murika_q0266_02.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",266);
								myself::ShowFHTML(talker,fhtml0);
							}
							else if( talker.race != 1 )
							{
								myself::ShowPage(talker,"pixy_murika_q0266_00.htm");
							}
							else if( talker.level < 3 )
							{
								myself::ShowPage(talker,"pixy_murika_q0266_01.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,266) == 1 && myself::OwnItemCount(talker,1334) < 100 ) )
					{
						myself::SetCurrentQuestID(266);
						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,"pixy_murika_q0266_04.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,266) == 1 && myself::OwnItemCount(talker,1334) >= 100 ) )
					{
						myself::SetCurrentQuestID(266);
						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::DeleteItem1(talker,1334,myself::OwnItemCount(talker,1334));
							i0 = gg::Rand(100);
							if( i0 < 2 )
							{
								myself::GiveItem1(talker,1337,1);
								myself::GiveItem1(talker,3032,1);
								myself::SoundEffect(talker,"ItemSound.quest_jackpot");
							}
							else if( i0 < 20 )
							{
								myself::GiveItem1(talker,2176,1);
								myself::GiveItem1(talker,1338,1);
							}
							else if( i0 < 45 )
							{
								myself::GiveItem1(talker,1339,1);
								myself::GiveItem1(talker,1061,1);
							}
							else
							{
								myself::GiveItem1(talker,1336,1);
								myself::GiveItem1(talker,1060,1);
							}
							myself::ShowPage(talker,"pixy_murika_q0266_05.htm");
							myself::RemoveMemo(talker,266);
							myself::AddLog(2,talker,266);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 266 )
		{
			myself::SetCurrentQuestID(266);
			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,266);
				myself::AddLog(1,talker,266);
				myself::SetFlagJournal(talker,266,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"pixy_murika_q0266_03.htm");
			}
			return;
		}
		super;
	}

}
