class 1 guard_alvah : guard_fixed
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,171) == 0 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Acts of Evil");
			}
			if( myself::HaveMemo(talker,171) == 0 && myself::GetOneTimeQuestFlag(talker,171) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Acts of Evil (Complete)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Acts of Evil (Continue)");
			}
			if( ( myself::HaveMemo(talker,171) == 1 && ( myself::GetMemoState(talker,171) == 2 || myself::GetMemoState(talker,171) == 3 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 4 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Acts of Evil (Continue)");
			}
			if( ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 5 && ( myself::OwnItemCount(talker,4241) == 0 || myself::OwnItemCount(talker,4242) == 0 || myself::OwnItemCount(talker,4243) == 0 || myself::OwnItemCount(talker,4244) == 0 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 5 && myself::OwnItemCount(talker,4241) >= 1 && myself::OwnItemCount(talker,4242) >= 1 && myself::OwnItemCount(talker,4243) >= 1 && myself::OwnItemCount(talker,4244) >= 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Acts of Evil (Continue)");
			}
			if( ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 6 && ( myself::OwnItemCount(talker,4245) == 0 || myself::OwnItemCount(talker,4246) == 0 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 6 && myself::OwnItemCount(talker,4245) >= 1 && myself::OwnItemCount(talker,4246) >= 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 7 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 8 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 9 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 11;
				myself::AddChoice(11,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 10 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 12;
				myself::AddChoice(12,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 11 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 13;
				myself::AddChoice(13,"Acts of Evil (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,171) == 0 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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 < 27 )
							{
								myself::ShowPage(talker,"guard_alvah_q0171_01.htm");
							}
							else if( talker.level >= 27 )
							{
								myself::FHTML_SetFileName(fhtml0,"guard_alvah_q0171_02.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",171);
								myself::ShowFHTML(talker,fhtml0);
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 0 && myself::GetOneTimeQuestFlag(talker,171) == 1 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"finishedquest.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_04.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,171) == 1 && ( myself::GetMemoState(talker,171) == 2 || myself::GetMemoState(talker,171) == 3 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_05.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 4 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_06.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 5 && ( myself::OwnItemCount(talker,4241) == 0 || myself::OwnItemCount(talker,4242) == 0 || myself::OwnItemCount(talker,4243) == 0 || myself::OwnItemCount(talker,4244) == 0 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_08.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 5 && myself::OwnItemCount(talker,4241) >= 1 && myself::OwnItemCount(talker,4242) >= 1 && myself::OwnItemCount(talker,4243) >= 1 && myself::OwnItemCount(talker,4244) >= 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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::DeleteItem1(talker,4241,myself::OwnItemCount(talker,4241));
						myself::DeleteItem1(talker,4242,myself::OwnItemCount(talker,4242));
						myself::DeleteItem1(talker,4243,myself::OwnItemCount(talker,4243));
						myself::DeleteItem1(talker,4244,myself::OwnItemCount(talker,4244));
						myself::SetMemoState(talker,171,6);
						myself::SetFlagJournal(talker,171,6);
						myself::ShowPage(talker,"guard_alvah_q0171_09.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 6 && ( myself::OwnItemCount(talker,4245) == 0 || myself::OwnItemCount(talker,4246) == 0 ) ) && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_10.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 6 && myself::OwnItemCount(talker,4245) >= 1 && myself::OwnItemCount(talker,4246) >= 1 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_11.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 7 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_13.htm");
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 8 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_14.htm");
					}
					break;
				}
				case 11:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 9 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_15.htm");
					}
					break;
				}
				case 12:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 10 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"guard_alvah_q0171_16.htm");
					}
					break;
				}
				case 13:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 11 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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::GiveItem1(talker,57,90000);
							myself::RemoveMemo(talker,171);
							myself::AddLog(2,talker,171);
							myself::SetOneTimeQuestFlag(talker,171,1);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::ShowPage(talker,"guard_alvah_q0171_17.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 171 )
		{
			myself::SetCurrentQuestID(171);
			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 == 171 )
		{
			if( reply == 1 )
			{
				myself::SetMemoState(talker,171,5);
				myself::SetFlagJournal(talker,171,5);
				myself::ShowPage(talker,"guard_alvah_q0171_07.htm");
			}
			if( reply == 2 )
			{
				myself::SetMemoState(talker,171,7);
				myself::SetFlagJournal(talker,171,7);
				myself::ShowPage(talker,"guard_alvah_q0171_12.htm");
			}
		}
		super;
	}

}
