class 1 gremory1 : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,i1,talker)
	{
		if( _from_choice == 0 )
		{
			if( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::GetMemoState(talker,639) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Guardians of the Holy Grail - In Progress");
			}
			if( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::OwnItemCount(talker,8071) == 1 && myself::GetMemoState(talker,639) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(2,"Guardians of the Holy Grail - In Progress");
			}
			if( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::GetMemoState(talker,639) == 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(3,"Guardians of the Holy Grail - In Progress");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::GetMemoState(talker,639) == 1 ) )
					{
						myself::SetCurrentQuestID(639);
						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,"priest_gremory_q639_001.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::OwnItemCount(talker,8071) == 1 && myself::GetMemoState(talker,639) == 3 ) )
					{
						myself::SetCurrentQuestID(639);
						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,"priest_gremory_q639_007.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( talker.level >= 73 && myself::HaveMemo(talker,639) == 1 && myself::GetMemoState(talker,639) == 4 ) )
					{
						myself::SetCurrentQuestID(639);
						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,"priest_gremory_q639_009.htm");
					}
					break;
				}
			}
		}
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 639 )
		{
			myself::SetCurrentQuestID(639);
			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 == 639 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"priest_gremory_q639_005.htm");
				myself::GiveItem1(talker,8070,1);
				myself::SetMemoState(talker,639,2);
				myself::SetFlagJournal(talker,639,2);
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"priest_gremory_q639_008.htm");
				myself::DeleteItem1(talker,8071,1);
				myself::SetMemoState(talker,639,4);
				myself::SetFlagJournal(talker,639,4);
			}
			if( reply == 3 )
			{
				if( myself::OwnItemCount(talker,8069) >= 4000 )
				{
					myself::ShowPage(talker,"priest_gremory_q639_010.htm");
					myself::DeleteItem1(talker,8069,4000);
					myself::GiveItem1(talker,959,1);
				}
				else
				{
					myself::ShowPage(talker,"priest_gremory_q639_011.htm");
				}
			}
			if( reply == 4 )
			{
				if( myself::OwnItemCount(talker,8069) >= 400 )
				{
					myself::ShowPage(talker,"priest_gremory_q639_010.htm");
					myself::DeleteItem1(talker,8069,400);
					myself::GiveItem1(talker,960,1);
				}
				else
				{
					myself::ShowPage(talker,"priest_gremory_q639_011.htm");
				}
			}
		}
		super;
	}

}
