class 1 virgil : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 9 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 9 * 10 ) + 1 ) && talker.subjob_id == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 10 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( talker.subjob_id == 0 && myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 10 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 14 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 14 * 10 ) + 1 ) && talker.subjob_id == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 15 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( talker.subjob_id == 0 && myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 15 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,242) == 0 && talker.subjob_id != 0 && talker.level >= 60 && myself::GetOneTimeQuestFlag(talker,241) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Possessor of a Precious Soul - 2");
			}
			if( myself::HaveMemo(talker,242) == 0 && talker.subjob_id != 0 && talker.level < 60 && myself::GetOneTimeQuestFlag(talker,241) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Possessor of a Precious Soul - 2");
			}
			if( myself::HaveMemo(talker,242) == 0 && myself::GetOneTimeQuestFlag(talker,242) == 1 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Possessor of a Precious Soul - 2 (End)");
			}
			if( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 11;
				myself::AddChoice(11,"Possessor of a Precious Soul - 2 (Continue)");
			}
			if( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) > 1 && myself::GetMemoState(talker,242) < 11 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 12;
				myself::AddChoice(12,"Possessor of a Precious Soul - 2 (Continue)");
			}
			if( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) >= 11 && myself::GetOneTimeQuestFlag(talker,242) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 13;
				myself::AddChoice(13,"Possessor of a Precious Soul - 2 (Continue)");
			}
			if( myself::HaveMemo(talker,242) == 1 && talker.subjob_id == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 14;
				myself::AddChoice(14,"Possessor of a Precious Soul - 2 (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,241) == 1 && myself::GetMemoState(talker,241) == ( ( 9 * 10 ) + 1 ) && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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::SetHTMLCookie(talker,241,9);
						myself::ShowPage(talker,"virgil_q0241_0901.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 9 * 10 ) + 1 ) && talker.subjob_id == 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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,"quest_not_subclass001.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 10 * 10 ) + 1 ) && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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,"virgil_q0241_1002.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( talker.subjob_id == 0 && myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 10 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(241);
						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,"quest_not_subclass001.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 14 * 10 ) + 1 ) && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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::SetHTMLCookie(talker,241,14);
						myself::ShowPage(talker,"virgil_q0241_1401.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 14 * 10 ) + 1 ) && talker.subjob_id == 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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,"quest_not_subclass001.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 15 * 10 ) + 1 ) && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(241);
						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,"virgil_q0241_1502.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( talker.subjob_id == 0 && myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 15 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(241);
						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,"quest_not_subclass001.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 0 && talker.subjob_id != 0 && talker.level >= 60 && myself::GetOneTimeQuestFlag(talker,241) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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 )
						{
							myself::FHTML_SetFileName(fhtml0,"virgil_q0242_01.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",242);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 0 && talker.subjob_id != 0 && talker.level < 60 && myself::GetOneTimeQuestFlag(talker,241) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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,"virgil_q0242_02.htm");
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 0 && myself::GetOneTimeQuestFlag(talker,242) == 1 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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 11:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) == 1 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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,"virgil_q0242_04.htm");
					}
					break;
				}
				case 12:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) > 1 && myself::GetMemoState(talker,242) < 11 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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,"virgil_q0242_05.htm");
					}
					break;
				}
				case 13:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 1 && talker.subjob_id != 0 && myself::GetMemoState(talker,242) >= 11 && myself::GetOneTimeQuestFlag(talker,242) == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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,"virgil_q0242_06.htm");
					}
					break;
				}
				case 14:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,242) == 1 && talker.subjob_id == 0 ) )
					{
						myself::SetCurrentQuestID(242);
						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,"quest_not_subclass001.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 242 )
		{
			myself::SetCurrentQuestID(242);
			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,242,1);
				myself::SetMemoStateEx(talker,242,1,0);
				myself::SetFlagJournal(talker,242,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"virgil_q0242_03.htm");
				myself::AddLog(1,talker,quest_id);
				myself::DeleteItem1(talker,7677,myself::OwnItemCount(talker,7677));
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,quest_id,reply,talker)
	{
		if( ask == 241 )
		{
			myself::SetCurrentQuestID(241);
			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 == 241 )
		{
			i0 = myself::GetHTMLCookie(talker,241,( 10 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 1 && myself::HaveMemo(talker,241) == 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"virgil_q0241_1001.htm");
						myself::SetMemoState(talker,241,( ( 10 * 10 ) + 1 ));
						myself::SetFlagJournal(talker,241,12);
						myself::ShowQuestMark(talker,241);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
				}
			}
		}
		if( ask == 241 )
		{
			myself::SetCurrentQuestID(241);
			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 == 241 )
		{
			i0 = myself::GetHTMLCookie(talker,241,( 15 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 1 && myself::HaveMemo(talker,241) == 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"virgil_q0241_1501.htm");
						myself::SetMemoState(talker,241,( ( 15 * 10 ) + 1 ));
						myself::SetFlagJournal(talker,241,18);
						myself::ShowQuestMark(talker,241);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
				}
			}
		}
		super;
	}

}
