class 1 elliany : merchant
{
property:
	BuySellList SellList0 = {{"necklace_of_wisdom";10};{"blue_diamond_necklace";10};{"necklace_of_devotion";10};{"enchanted_necklace";10};{"near_forest_necklace";10};{"elven_necklace";10};{"cat_seye_earing";10};{"coral_earing";10};{"red_cresent_earing";10};{"enchanted_earing";10};{"tiger_seye_earing";10};{"elven_earing";10};{"ring_of_wisdom";10};{"blue_coral_ring";10};{"ring_of_devotion";10};{"enchanted_ring";10};{"black_pearl_ring";10};{"elven_ring";10};{"moonstone_earing";10};{"aquastone_ring";10};{"aquastone_necklace";10}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,419) && myself::OwnItemCount(talker,3417) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Get a Pet (Continue)");
			}
			if( talker.level >= 60 && myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Let's Find Glittering Jewelry!");
			}
			if( talker.level < 60 && myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Let's Find Glittering Jewelry!");
			}
			if( myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Let's Find Glittering Jewelry! (End)");
			}
			if( myself::HaveMemo(talker,35) == 1 && myself::GetOneTimeQuestFlag(talker,35) == 0 && myself::GetMemoState(talker,35) == ( ( 1 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Let's Find Glittering Jewelry! (Continue)");
			}
			if( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 2 * 10 ) + 2 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Let's Find Glittering Jewelry! (Continue)");
			}
			if( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 3 * 10 ) + 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Let's Find Glittering Jewelry! (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,419) && myself::OwnItemCount(talker,3417) == 1 ) )
					{
						myself::SetCurrentQuestID(419);
						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;
						}
						talker::SetMemoState(419,myself::GetMemoState(talker,419),8);
						myself::ShowPage(talker,"elliany_q0419_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( talker.level >= 60 && myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 0 ) )
					{
						myself::SetCurrentQuestID(35);
						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,7164) >= 1 ) || 1 == 0 ) && ( ( 0 == 1 && myself::GetOneTimeQuestFlag(talker,0) == 1 ) || 0 == 0 ) ) && ( ( 0 == 1 && talker.subjob_id != 0 ) || 0 == 0 ) )
							{
								myself::FHTML_SetFileName(fhtml0,"elliany_q0035_0101.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",35);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"elliany_q0035_0102.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( talker.level < 60 && myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 0 ) )
					{
						myself::SetCurrentQuestID(35);
						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,"elliany_q0035_0103.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,35) == 0 && myself::GetOneTimeQuestFlag(talker,35) == 1 ) )
					{
						myself::SetCurrentQuestID(35);
						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,35) == 1 && myself::GetOneTimeQuestFlag(talker,35) == 0 && myself::GetMemoState(talker,35) == ( ( 1 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(35);
						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,"elliany_q0035_0105.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 2 * 10 ) + 2 ) ) )
					{
						myself::SetCurrentQuestID(35);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7162) >= 10 ) || 1 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) ) && ( ( 0 == 1 && myself::OwnItemCount(talker,0) >= 0 ) || 0 == 0 ) )
						{
							myself::SetHTMLCookie(talker,35,2);
							myself::ShowPage(talker,"elliany_q0035_0201.htm");
						}
						else
						{
							myself::ShowPage(talker,"elliany_q0035_0202.htm");
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,35) == 1 && myself::GetMemoState(talker,35) == ( ( 3 * 10 ) + 1 ) ) )
					{
						myself::SetCurrentQuestID(35);
						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( ( ( ( 1 == 1 && myself::OwnItemCount(talker,1893) >= 5 ) || 1 == 0 ) && ( ( 1 == 1 && myself::OwnItemCount(talker,1873) >= 500 ) || 1 == 0 ) ) && ( ( 1 == 1 && myself::OwnItemCount(talker,4044) >= 150 ) || 1 == 0 ) )
						{
							myself::SetHTMLCookie(talker,35,3);
							myself::ShowPage(talker,"elliany_q0035_0303.htm");
						}
						else
						{
							myself::ShowPage(talker,"elliany_q0035_0304.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,i0,i1,quest_id,reply,talker)
	{
		if( ask == 35 )
		{
			myself::SetCurrentQuestID(35);
			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 == 35 )
		{
			i0 = myself::GetHTMLCookie(talker,35,( 3 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 1 && myself::HaveMemo(talker,35) == 1 )
				{
					if( ( ( ( 1 == 1 && myself::OwnItemCount(talker,7162) >= 10 ) || 1 == 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,7162,10);
							myself::DeleteItem1(talker,0,0);
							myself::DeleteItem1(talker,0,0);
							myself::ShowPage(talker,"elliany_q0035_0301.htm");
							myself::SetMemoState(talker,35,( ( 3 * 10 ) + 1 ));
							myself::SetFlagJournal(talker,35,4);
							myself::ShowQuestMark(talker,35);
							myself::SoundEffect(talker,"ItemSound.quest_middle");
						}
					}
					else
					{
						myself::ShowPage(talker,"elliany_q0035_0302.htm");
					}
				}
			}
		}
		if( ask == 35 )
		{
			myself::SetCurrentQuestID(35);
			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 == 35 && myself::GetOneTimeQuestFlag(talker,35) == 0 )
		{
			i0 = myself::GetHTMLCookie(talker,35,( 4 - 1 ));
			if( i0 != -1 )
			{
				if( reply == 3 && myself::HaveMemo(talker,35) == 1 && myself::GetOneTimeQuestFlag(talker,35) == 0 )
				{
					if( ( ( ( 1 == 1 && myself::OwnItemCount(talker,1893) >= 5 ) || 1 == 0 ) && ( ( 1 == 1 && myself::OwnItemCount(talker,1873) >= 500 ) || 1 == 0 ) ) && ( ( 1 == 1 && myself::OwnItemCount(talker,4044) >= 150 ) || 1 == 0 ) )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::DeleteItem1(talker,1893,5);
							myself::DeleteItem1(talker,1873,500);
							myself::DeleteItem1(talker,4044,150);
							myself::GiveItem1(talker,7077,1);
						}
						myself::AddLog(2,talker,35);
						myself::RemoveMemo(talker,35);
						myself::SetOneTimeQuestFlag(talker,35,1);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"elliany_q0035_0401.htm");
					}
					else
					{
						myself::ShowPage(talker,"elliany_q0035_0402.htm");
					}
				}
			}
		}
		super;
	}

}
