class 1 enter_catacomb3 : ssq_npc_ss_teleporter
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,385) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Yoke of the Past");
			}
			if( myself::HaveMemo(talker,385) == 1 && myself::OwnItemCount(talker,5902) < 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Yoke of the Past (Continue)");
			}
			if( myself::HaveMemo(talker,385) == 1 && myself::OwnItemCount(talker,5902) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Yoke of the Past (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,385) == 0 )
					{
						myself::SetCurrentQuestID(385);
						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 >= 20 )
							{
								myself::ShowPage(talker,"enter_necropolis1_q0385_01.htm");
							}
							else if( talker.level < 20 )
							{
								myself::ShowPage(talker,"enter_necropolis1_q0385_02.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,385) == 1 && myself::OwnItemCount(talker,5902) < 1 ) )
					{
						myself::SetCurrentQuestID(385);
						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,"enter_necropolis1_q0385_08.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,385) == 1 && myself::OwnItemCount(talker,5902) >= 1 ) )
					{
						myself::SetCurrentQuestID(385);
						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,5965,myself::OwnItemCount(talker,5902));
							myself::DeleteItem1(talker,5902,myself::OwnItemCount(talker,5902));
							myself::AddLog(3,talker,385);
							myself::ShowPage(talker,"enter_necropolis1_q0385_09.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker)
	{
		if( ask == 385 )
		{
			myself::SetCurrentQuestID(385);
			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 == 385 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"enter_necropolis1_q0385_03.htm");
			}
			if( reply == 2 )
			{
				myself::FHTML_SetFileName(fhtml0,"enter_necropolis1_q0385_04.htm");
				myself::FHTML_SetInt(fhtml0,"quest_id",385);
				myself::ShowFHTML(talker,fhtml0);
			}
			if( reply == 3 )
			{
				myself::FHTML_SetFileName(fhtml0,"enter_necropolis1_q0385_07.htm");
				myself::FHTML_SetInt(fhtml0,"quest_id",385);
				myself::ShowFHTML(talker,fhtml0);
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"enter_necropolis1_q0385_06.htm");
			}
			if( reply == 5 )
			{
				myself::RemoveMemo(talker,385);
				myself::AddLog(2,talker,385);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
				myself::ShowPage(talker,"enter_necropolis1_q0385_10.htm");
			}
			if( reply == 6 )
			{
				myself::ShowPage(talker,"enter_necropolis1_q0385_11.htm");
			}
		}
		super;
	}

}
