class 1 allana : citizen
{
parameter:
	string	Privates = "";

handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,409) == 1 && myself::OwnItemCount(talker,1231) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to an Oracle (Continue)");
			}
			if( myself::HaveMemo(talker,226) == 1 && myself::GetMemoState(talker,226) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Test of the Healer (Continue)");
			}
			if( myself::HaveMemo(talker,226) == 1 && myself::GetMemoState(talker,226) == 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Test of the Healer (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,409) == 1 && myself::OwnItemCount(talker,1231) ) )
					{
						myself::SetCurrentQuestID(409);
						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();
							if( myself::OwnItemCount(talker,1232) == 0 && myself::OwnItemCount(talker,1233) == 0 && myself::OwnItemCount(talker,1234) == 0 && myself::OwnItemCount(talker,1236) == 0 )
							{
								if( myself::GetMemoState(talker,409) == 2 )
								{
									myself::ShowPage(talker,"allana_q0409_05.htm");
								}
								else if( myself::GetMemoState(talker,409) == 1 )
								{
									myself::ShowPage(talker,"allana_q0409_01.htm");
									myself::SetFlagJournal(talker,409,2);
								}
							}
							else if( myself::OwnItemCount(talker,1232) == 0 && myself::OwnItemCount(talker,1233) == 0 && myself::OwnItemCount(talker,1234) == 1 && myself::OwnItemCount(talker,1236) == 0 )
							{
								myself::SetMemoState(talker,409,2);
								myself::ShowPage(talker,"allana_q0409_02.htm");
								myself::GiveItem1(talker,1236,1);
								myself::SetFlagJournal(talker,409,4);
							}
							else if( myself::OwnItemCount(talker,1232) == 0 && myself::OwnItemCount(talker,1233) == 0 && myself::OwnItemCount(talker,1234) == 1 && myself::OwnItemCount(talker,1236) == 1 )
							{
								if( myself::GetMemoState(talker,409) == 3 && myself::OwnItemCount(talker,1275) == 0 )
								{
									myself::SetMemoState(talker,409,2);
									myself::ShowPage(talker,"allana_q0409_06.htm");
									myself::SetFlagJournal(talker,409,4);
								}
								else
								{
									myself::ShowPage(talker,"allana_q0409_03.htm");
								}
							}
							else if( myself::OwnItemCount(talker,1232) == 1 && myself::OwnItemCount(talker,1233) == 0 && myself::OwnItemCount(talker,1234) == 1 && myself::OwnItemCount(talker,1236) == 1 )
							{
								myself::ShowPage(talker,"allana_q0409_04.htm");
								myself::DeleteItem1(talker,1236,1);
								myself::GiveItem1(talker,1233,1);
								myself::SetFlagJournal(talker,409,9);
							}
							else if( myself::OwnItemCount(talker,1232) == 1 && myself::OwnItemCount(talker,1234) == 1 && myself::OwnItemCount(talker,1236) == 0 && myself::OwnItemCount(talker,1233) )
							{
								myself::ShowPage(talker,"allana_q0409_05.htm");
								myself::SetFlagJournal(talker,409,7);
							}
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,226) == 1 && myself::GetMemoState(talker,226) == 3 ) )
					{
						myself::SetCurrentQuestID(226);
						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,"allana_q0226_01.htm");
						myself::SetMemoState(talker,226,4);
						myself::SetFlagJournal(talker,226,4);
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,226) == 1 && myself::GetMemoState(talker,226) == 4 ) )
					{
						myself::SetCurrentQuestID(226);
						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,"allana_q0226_02.htm");
						myself::SetMemoState(talker,226,4);
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 409 )
		{
			myself::SetCurrentQuestID(409);
			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 == 409 )
		{
			if( reply == 1 )
			{
				if( myself::GetMemoState(talker,409) == 1 )
				{
					myself::ShowPage(talker,"allana_q0409_07.htm");
				}
			}
			else if( reply == 2 )
			{
				myself::ShowPage(talker,"allana_q0409_08.htm");
			}
			else if( reply == 3 )
			{
				myself::ShowPage(talker,"allana_q0409_09.htm");
			}
			else if( reply == 4 )
			{
				myself::CreateOnePrivate(1027032,"q409_lizardman_warrior",0,1);
				myself::CreateOnePrivate(1027033,"q409_lizardman_scout",0,1);
				myself::CreateOnePrivate(1027034,"q409_lizardman",0,1);
				myself::SetMemoState(talker,409,2);
			}
		}
		super;
	}

}
