class 1 hestui_totem_spirit : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,416) == 1 && myself::OwnItemCount(talker,1620) && myself::OwnItemCount(talker,1621) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to an Orc Shaman (Continue)");
			}
			if( myself::HaveMemo(talker,416) == 1 && myself::OwnItemCount(talker,1622) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to an Orc Shaman (Continue)");
			}
			if( ( myself::HaveMemo(talker,416) == 1 && ( myself::OwnItemCount(talker,1625) || myself::OwnItemCount(talker,1624) || myself::OwnItemCount(talker,1626) || myself::OwnItemCount(talker,1627) || myself::OwnItemCount(talker,1628) || myself::OwnItemCount(talker,1630) ) ) || myself::OwnItemCount(talker,1623) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to an Orc Shaman (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,416) == 1 && myself::OwnItemCount(talker,1620) && myself::OwnItemCount(talker,1621) ) )
					{
						myself::SetCurrentQuestID(416);
						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,"hestui_totem_spirit_q0416_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,416) == 1 && myself::OwnItemCount(talker,1622) ) )
					{
						myself::SetCurrentQuestID(416);
						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,"hestui_totem_spirit_q0416_04.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,416) == 1 && ( myself::OwnItemCount(talker,1625) || myself::OwnItemCount(talker,1624) || myself::OwnItemCount(talker,1626) || myself::OwnItemCount(talker,1627) || myself::OwnItemCount(talker,1628) || myself::OwnItemCount(talker,1630) ) ) || myself::OwnItemCount(talker,1623) ) )
					{
						myself::SetCurrentQuestID(416);
						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,"hestui_totem_spirit_q0416_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 416 )
		{
			myself::SetCurrentQuestID(416);
			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 == 416 && reply == 1 )
		{
			myself::ShowPage(talker,"hestui_totem_spirit_q0416_02.htm");
		}
		if( ask == 416 && reply == 2 && myself::OwnItemCount(talker,1620) > 0 && myself::OwnItemCount(talker,1621) > 0 )
		{
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
			{
				talker.quest_last_reward_time = myself::GetCurrentTick();
				myself::ShowPage(talker,"hestui_totem_spirit_q0416_03.htm");
				myself::DeleteItem1(talker,1620,1);
				myself::DeleteItem1(talker,1621,1);
				myself::GiveItem1(talker,1622,1);
				myself::SetFlagJournal(talker,416,4);
			}
		}
		super;
	}

}
