class 1 caradine : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 15 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"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 = 1;
				myself::AddChoice(1,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 16 * 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) == ( ( 16 * 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) == ( ( 18 * 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) == ( ( 18 * 10 ) + 1 ) && talker.subjob_id == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Possessor of a Precious Soul - 1 (Continue)");
			}
			if( talker.level >= 65 && myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Possessor of a Precious Soul - 3");
			}
			if( talker.level < 65 && myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 0 && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Possessor of a Precious Soul - 3");
			}
			if( myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Possessor of a Precious Soul - 3 (End)");
			}
			if( myself::HaveMemo(talker,246) == 1 && myself::GetOneTimeQuestFlag(talker,246) == 0 && myself::GetMemoState(talker,246) == ( ( 1 * 10 ) + 1 ) && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Possessor of a Precious Soul - 3 (Continue)");
			}
			if( myself::HaveMemo(talker,247) == 0 && talker.level >= 75 && myself::GetOneTimeQuestFlag(talker,247) == 0 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Possessor of a Precious Soul - 4");
			}
			if( myself::HaveMemo(talker,247) == 0 && talker.level < 75 && myself::GetOneTimeQuestFlag(talker,247) == 0 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 11;
				myself::AddChoice(11,"Possessor of a Precious Soul - 4");
			}
			if( myself::HaveMemo(talker,247) == 0 && myself::GetOneTimeQuestFlag(talker,247) == 1 && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 12;
				myself::AddChoice(12,"Possessor of a Precious Soul - 4 (End)");
			}
			if( myself::HaveMemo(talker,247) == 1 && myself::GetMemoState(talker,247) == 1 && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 13;
				myself::AddChoice(13,"Possessor of a Precious Soul - 4 (Continue)");
			}
			if( myself::HaveMemo(talker,247) == 1 && myself::GetMemoState(talker,247) == 2 && talker.subjob_id != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 14;
				myself::AddChoice(14,"Possessor of a Precious Soul - 4 (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) == ( ( 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::SetHTMLCookie(talker,241,15);
						myself::ShowPage(talker,"caradine_q0241_1501.htm");
					}
					break;
				}
				case 1:
				{
					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 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 16 * 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,"caradine_q0241_1602.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( talker.subjob_id == 0 && myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 16 * 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) == ( ( 18 * 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,18);
						myself::ShowPage(talker,"caradine_q0241_1801.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,241) == 1 && myself::GetMemoState(talker,241) == ( ( 18 * 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 || ( talker.level >= 65 && myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 0 ) )
					{
						myself::SetCurrentQuestID(246);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7678) >= 0 ) || 1 == 0 ) && ( ( 1 == 1 && myself::GetOneTimeQuestFlag(talker,242) == 1 ) || 1 == 0 ) ) && ( ( 1 == 1 && talker.subjob_id != 0 ) || 1 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"caradine_q0246_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",246);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"caradine_q0246_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( talker.level < 65 && myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 0 && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(246);
						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,"caradine_q0246_0103.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,246) == 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(246);
						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 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,246) == 1 && myself::GetOneTimeQuestFlag(talker,246) == 0 && myself::GetMemoState(talker,246) == ( ( 1 * 10 ) + 1 ) && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(246);
						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,"caradine_q0246_0105.htm");
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,247) == 0 && talker.level >= 75 && myself::GetOneTimeQuestFlag(talker,247) == 0 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 ) )
					{
						myself::SetCurrentQuestID(247);
						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,"caradine_q0247_01.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",247);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 11:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,247) == 0 && talker.level < 75 && myself::GetOneTimeQuestFlag(talker,247) == 0 && talker.subjob_id != 0 && myself::GetOneTimeQuestFlag(talker,246) == 1 ) )
					{
						myself::SetCurrentQuestID(247);
						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,"caradine_q0247_02.htm");
					}
					break;
				}
				case 12:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,247) == 0 && myself::GetOneTimeQuestFlag(talker,247) == 1 && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(247);
						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 13:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,247) == 1 && myself::GetMemoState(talker,247) == 1 && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(247);
						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,"caradine_q0247_04.htm");
					}
					break;
				}
				case 14:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,247) == 1 && myself::GetMemoState(talker,247) == 2 && talker.subjob_id != 0 ) )
					{
						myself::SetCurrentQuestID(247);
						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,"caradine_q0247_06.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 246 )
		{
			myself::SetCurrentQuestID(246);
			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,246);
				myself::SetMemoState(talker,246,( ( 1 * 10 ) + 1 ));
				myself::DeleteItem1(talker,7678,myself::OwnItemCount(talker,7678));
				myself::AddLog(1,talker,246);
				myself::SetFlagJournal(talker,246,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"caradine_q0246_0104.htm");
			}
			return;
		}
		if( quest_id == 247 )
		{
			myself::SetCurrentQuestID(247);
			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,247,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"caradine_q0247_03.htm");
				myself::SetFlagJournal(talker,247,1);
				myself::AddLog(1,talker,quest_id);
				myself::DeleteItem1(talker,7679,myself::OwnItemCount(talker,7679));
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,i0,i1,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,( 16 - 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,"caradine_q0241_1601.htm");
						myself::SetMemoState(talker,241,( ( 16 * 10 ) + 1 ));
						myself::SetFlagJournal(talker,241,19);
						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 && myself::GetOneTimeQuestFlag(talker,241) == 0 )
		{
			i0 = myself::GetHTMLCookie(talker,241,( 19 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 3 && myself::HaveMemo(talker,241) == 1 && myself::GetOneTimeQuestFlag(talker,241) == 0 )
				{
					if( ( ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::DeleteItem1(talker,0,myself::OwnItemCount(talker,0));
							myself::GiveItem1(talker,7677,1);
						}
						myself::AddLog(2,talker,241);
						myself::RemoveMemo(talker,241);
						myself::SetOneTimeQuestFlag(talker,241,1);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"caradine_q0241_1901.htm");
					}
					else
					{
						myself::ShowPage(talker,"caradine_q0241_1902.htm");
					}
				}
			}
		}
		if( ask == 247 )
		{
			myself::SetCurrentQuestID(247);
			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 == 247 )
		{
			if( reply == 1 && myself::HaveMemo(talker,247) == 1 && talker.subjob_id != 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::InstantTeleport(talker,143180,43930,-3024);
					myself::SetMemoState(talker,247,2);
					myself::ShowPage(talker,"caradine_q0247_05.htm");
					myself::SetFlagJournal(talker,247,2);
				}
			}
		}
		super;
	}

}
