class 1 rapunzel : teleporter
{
parameter:
	int	PrimeHours = 1;

property:
	TelPosList Position = {{"The Village of Gludin"; -80749; 149834; -3043; 18000; 0 };{"Dark Elf Village"; 9716; 15502; -4500; 24000; 0 };{"Dwarven Village"; 115120; -178112; -916; 46000; 0 };{"Elven Village"; 46890; 51531; -2976; 23000; 0 };{"Orc Village"; -45186; -112459; -236; 35000; 0 };{"Kamael Village"; -117251; 46771; 360; 20000; 0 };{"Elven Ruins"; -112367; 234703; -3688; 830; 0 };{"Singing Waterfall"; -111728; 244330; -3448; 770; 0 };{"Talking Island, Western Territory (Northern Area)"; -106696; 214691; -3424; 1000; 0 };{"Obelisk of Victory"; -99586; 237637; -3568; 470; 0 }};
	TelPosList PositionPrimeHours = {{"The Village of Gludin"; -80749; 149834; -3043; 9000; 0 };{"Dark Elf Village"; 9716; 15502; -4500; 12000; 0 };{"Dwarven Village"; 115120; -178112; -916; 23000; 0 };{"Elven Village"; 46890; 51531; -2976; 11500; 0 };{"Orc Village"; -45186; -112459; -236; 17500; 0 };{"Kamael Village"; -117251; 46771; 360; 10000; 0 };{"Elven Ruins"; -112367; 234703; -3688; 415; 0 };{"Singing Waterfall"; -111728; 244330; -3448; 385; 0 };{"Talking Island, Western Territory (Northern Area)"; -106696; 214691; -3424; 500; 0 };{"Obelisk of Victory"; -99586; 237637; -3568; 235; 0 }};
	TelPosList PositionNoblessNeedItemTown = {{"Gludin Village"; -80749; 149834; -3043; 1; 0 };{"Gludio Castle Town"; -12787; 122779; -3114; 1; 0 };{"Dion Castle Town"; 15671; 142994; -2704; 1; 0 };{"Heine"; 111455; 219400; -3546; 1; 0 };{"Giran Castle Town"; 83336; 147972; -3404; 1; 0 };{"The Town of Oren"; 83011; 53207; -1470; 1; 0 };{"Hunters Village"; 117088; 76931; -2670; 1; 0 };{"Aden Castle Town"; 146783; 25808; -2000; 1; 0 };{"Rune Castle Town"; 43826; -47688; -792; 1; 0 };{"Goddard Castle Town"; 147978; -55408; -2728; 1; 0 };{"Town of Schuttgart"; 87478; -142297; -1352; 1; 0 };{"Gludin Arena"; -87328; 142266; -3640; 1; 0 };{"Giran Arena"; 73579; 142709; -3768; 1; 0 };{"Coliseum"; 146440; 46723; -3400; 1; 0 }};
	TelPosList PositionNoblessNeedItemField = {{"Gludin Arena"; -87328; 142266; -3640; 1; 0 };{"Giran Arena"; 73579; 142709; -3768; 1; 0 };{"Center of the Elven Ruins"; 49315; 248452; -5960; 1; 0 };{"Coliseum"; 146440; 46723; -3400; 1; 0 }};
	TelPosList PositionNoblessNeedItemSSQ = {{"Necropolis of Sacrifice"; -41184; 206752; -3357; 1; 0 };{"Heretics Catacomb"; 39232; 143568; -3651; 1; 0 };{"Pilgrims Necropolis"; 45600; 126944; -3686; 1; 0 };{"Catacomb of the Branded"; 43200; 170688; -3251; 1; 0 };{"Worshipers Necropolis"; 107514; 174329; -3704; 1; 0 };{"Catacomb of the Apostate"; 74672; 78032; -3398; 1; 0 };{"Patriots Necropolis"; -25472; 77728; -3446; 1; 0 };{"Catacomb of the Witch"; 136672; 79328; -3702; 1; 0 };{"Ascetics Necropolis"; -56064; 78720; -3011; 1; 0 };{"Martyr's Necropolis"; 114496; 132416; -3101; 1; 0 };{"Disciples Necropolis"; 168560; -17968; -3174; 1; 0 };{"Saints Necropolis"; 79296; 209584; -3709; 1; 0 };{"Catacomb of Dark Omens"; -22480; 13872; -3174; 1; 0 };{"Catacomb of the Forbidden Path"; 110912; 84912; -4816; 1; 0 }};
	TelPosList PositionNoblessNoItemTown = {{"Gludin Village"; -80749; 149834; -3043; 1000; 0 };{"Gludio Castle Town"; -12787; 122779; -3114; 1000; 0 };{"Dion Castle Town"; 15671; 142994; -2704; 1000; 0 };{"Heine"; 111455; 219400; -3546; 1000; 0 };{"Giran Castle Town"; 83336; 147972; -3404; 1000; 0 };{"The Town of Oren"; 83011; 53207; -1470; 1000; 0 };{"Hunters Village"; 117088; 76931; -2670; 1000; 0 };{"Aden Castle Town"; 146783; 25808; -2000; 1000; 0 };{"Rune Castle Town"; 43826; -47688; -792; 1000; 0 };{"Goddard Castle Town"; 147978; -55408; -2728; 1000; 0 };{"Town of Schuttgart"; 87478; -142297; -1352; 1000; 0 };{"Gludin Harbor Arena"; -87328; 142266; -3640; 1000; 0 };{"Giran Arena"; 73579; 142709; -3768; 1000; 0 };{"Coliseum"; 146440; 46723; -3400; 1000; 0 }};
	TelPosList PositionNoblessNoItemField = {{"Gludin Arena"; -87328; 142266; -3640; 1000; 0 };{"Giran Arena"; 73579; 142709; -3768; 1000; 0 };{"Center of the Elven Ruins"; 49315; 248452; -5960; 1000; 0 };{"Coliseum"; 146440; 46723; -3400; 1000; 0 }};
	TelPosList PositionNoblessNoItemSSQ = {{"Necropolis of Sacrifice"; -41184; 206752; -3357; 1000; 0 };{"Heretics Catacomb"; 39232; 143568; -3651; 1000; 0 };{"Pilgrims Necropolis"; 45600; 126944; -3686; 1000; 0 };{"Catacomb of the Branded"; 43200; 170688; -3251; 1000; 0 };{"Worshipers Necropolis"; 107514; 174329; -3704; 1000; 0 };{"Catacomb of the Apostate"; 74672; 78032; -3398; 1000; 0 };{"Patriots Necropolis"; -25472; 77728; -3446; 1000; 0 };{"Catacomb of the Witch"; 136672; 79328; -3702; 1000; 0 };{"Ascetics Necropolis"; -56064; 78720; -3011; 1000; 0 };{"Martyr's Necropolis"; 114496; 132416; -3101; 1000; 0 };{"Disciples Necropolis"; 168560; -17968; -3174; 1000; 0 };{"Saints Necropolis"; 79296; 209584; -3709; 1000; 0 };{"Catacomb of Dark Omens"; -22480; 13872; -3174; 1000; 0 };{"Catacomb of the Forbidden Path"; 110912; 84912; -4816; 1000; 0 }};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,1) && myself::GetOneTimeQuestFlag(talker,1) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Letters of Love (Continue)");
			}
			if( talker.level >= 3 && myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Step into the Future");
			}
			if( talker.level < 3 && myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Step into the Future");
			}
			if( myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Step into the Future (End)");
			}
			if( myself::HaveMemo(talker,6) == 1 && myself::GetOneTimeQuestFlag(talker,6) == 0 && myself::GetMemoState(talker,6) == ( ( 1 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Step into the Future (Continue)");
			}
			if( myself::HaveMemo(talker,6) == 1 && myself::GetMemoState(talker,6) == ( ( 3 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Step into the Future (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,1) && myself::GetOneTimeQuestFlag(talker,1) == 0 ) )
					{
						myself::SetCurrentQuestID(1);
						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,688) == 0 && myself::OwnItemCount(talker,687) )
							{
								myself::GiveItem1(talker,688,1);
								myself::DeleteItem1(talker,687,1);
								myself::ShowPage(talker,"rapunzel_q0001_01.htm");
								myself::SetFlagJournal(talker,1,2);
								myself::SetMemoState(talker,1,2);
							}
							else if( myself::OwnItemCount(talker,1080) || myself::OwnItemCount(talker,1079) )
							{
								myself::ShowPage(talker,"rapunzel_q0001_03.htm");
							}
							else if( myself::OwnItemCount(talker,688) )
							{
								myself::ShowPage(talker,"rapunzel_q0001_02.htm");
							}
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level >= 3 && myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 0 ) )
					{
						myself::SetCurrentQuestID(6);
						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( ( ( ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 1 ) || 0 == 0 ) && ( ( 0 == 1 && myself::GetOneTimeQuestFlag(talker,0) == 1 ) || 0 == 0 ) ) && ( ( 0 == 1 && talker.subjob_id != 0 ) || 0 == 0 ) ) && ( ( 1 == 1 && talker.race == 0 ) || 1 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"rapunzel_q0006_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",6);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"rapunzel_q0006_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( talker.level < 3 && myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 0 ) )
					{
						myself::SetCurrentQuestID(6);
						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,"rapunzel_q0006_0103.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,6) == 0 && myself::GetOneTimeQuestFlag(talker,6) == 1 ) )
					{
						myself::SetCurrentQuestID(6);
						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 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,6) == 1 && myself::GetOneTimeQuestFlag(talker,6) == 0 && myself::GetMemoState(talker,6) == ( ( 1 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(6);
						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,"rapunzel_q0006_0105.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,6) == 1 && myself::GetMemoState(talker,6) == ( ( 3 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(6);
						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,6,3);
						myself::ShowPage(talker,"rapunzel_q0006_0301.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,i0,i1,quest_id,reply,talker)
	{
		if( ask == 6 )
		{
			myself::SetCurrentQuestID(6);
			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 == 6 && myself::GetOneTimeQuestFlag(talker,6) == 0 )
		{
			i0 = myself::GetHTMLCookie(talker,6,( 4 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 3 && myself::HaveMemo(talker,6) == 1 && myself::GetOneTimeQuestFlag(talker,6) == 0 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::GiveItem1(talker,7559,1);
						myself::GiveItem1(talker,7570,1);
					}
					myself::AddLog(2,talker,6);
					myself::RemoveMemo(talker,6);
					myself::SetOneTimeQuestFlag(talker,6,1);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"rapunzel_q0006_0401.htm");
				}
			}
		}
		super;
	}

}
