class 1 swan : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Jovial Accordion (Continue)");
			}
			if( ( myself::HaveMemo(talker,364) == 1 && ( myself::GetMemoState(talker,364) == 2 || myself::GetMemoState(talker,364) == 3 ) ) && ( myself::OwnItemCount(talker,4324) == 1 || myself::OwnItemCount(talker,4323) == 1 || myself::OwnItemCount(talker,4322) == 1 || myself::OwnItemCount(talker,4321) == 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Jovial Accordion (Continue)");
			}
			if( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 4 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4321) == 0 && myself::OwnItemCount(talker,4322) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Jovial Accordion (Continue)");
			}
			if( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 3 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4321) == 0 && myself::OwnItemCount(talker,4322) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Jovial Accordion (Continue)");
			}
			if( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 2 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4322) == 0 && myself::OwnItemCount(talker,4321) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Jovial Accordion (Continue)");
			}
			if( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) >= 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Jovial Accordion (Continue)");
			}
			if( myself::HaveMemo(talker,362) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Bard's Mandolin");
			}
			if( myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) >= 1 && myself::GetMemoState(talker,362) < 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Bard's Mandolin (Continue)");
			}
			if( myself::HaveMemo(talker,362) == 1 && ( myself::GetMemoState(talker,362) == 3 || myself::GetMemoState(talker,362) == 4 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Bard's Mandolin (Continue)");
			}
			if( myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) == 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Bard's Mandolin (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,364) == 1 && myself::GetMemoState(talker,364) == 1 ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( ( myself::HaveMemo(talker,364) == 1 && ( myself::GetMemoState(talker,364) == 2 || myself::GetMemoState(talker,364) == 3 ) ) && ( myself::OwnItemCount(talker,4324) == 1 || myself::OwnItemCount(talker,4323) == 1 || myself::OwnItemCount(talker,4322) == 1 || myself::OwnItemCount(talker,4321) == 1 ) ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_03.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 4 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4321) == 0 && myself::OwnItemCount(talker,4322) == 0 ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_04.htm");
						myself::SetMemoState(talker,364,5);
						myself::SetFlagJournal(talker,364,3);
						myself::GiveItem1(talker,57,100);
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 3 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4321) == 0 && myself::OwnItemCount(talker,4322) == 0 ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_05.htm");
						myself::SetMemoState(talker,364,5);
						myself::SetFlagJournal(talker,364,3);
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) == 2 && myself::OwnItemCount(talker,4324) == 0 && myself::OwnItemCount(talker,4323) == 0 && myself::OwnItemCount(talker,4322) == 0 && myself::OwnItemCount(talker,4321) == 0 ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_06.htm");
						myself::SoundEffect(talker,"ItemSound.quest_giveup");
						myself::RemoveMemo(talker,364);
						myself::AddLog(3,talker,364);
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,364) == 1 && myself::GetMemoState(talker,364) >= 5 ) )
					{
						myself::SetCurrentQuestID(364);
						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,"swan_q0364_07.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || myself::HaveMemo(talker,362) == 0 )
					{
						myself::SetCurrentQuestID(362);
						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 >= 15 )
							{
								myself::FHTML_SetFileName(fhtml0,"swan_q0362_01.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",362);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"swan_q0362_02.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) >= 1 && myself::GetMemoState(talker,362) < 3 ) )
					{
						myself::SetCurrentQuestID(362);
						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,"swan_q0362_04.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,362) == 1 && ( myself::GetMemoState(talker,362) == 3 || myself::GetMemoState(talker,362) == 4 ) ) )
					{
						myself::SetCurrentQuestID(362);
						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::GetMemoState(talker,362) == 3 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::SetFlagJournal(talker,362,4);
								myself::GiveItem1(talker,4317,1);
								myself::SetMemoState(talker,362,4);
								myself::ShowPage(talker,"swan_q0362_05.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"swan_q0362_05.htm");
						}
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) == 5 ) )
					{
						myself::SetCurrentQuestID(362);
						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,"swan_q0362_06.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 364 )
		{
			myself::SetCurrentQuestID(364);
			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 == 364 )
		{
			if( reply == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,4323,1);
					myself::GiveItem1(talker,4324,1);
					myself::SetMemoState(talker,364,2);
					myself::SetFlagJournal(talker,364,2);
					myself::ShowPage(talker,"swan_q0364_02.htm");
				}
			}
		}
		if( ask == 362 )
		{
			myself::SetCurrentQuestID(362);
			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 == 362 )
		{
			if( reply == 3 && myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) == 5 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,57,10000);
					myself::GiveItem1(talker,4410,1);
					myself::ShowPage(talker,"swan_q0362_07.htm");
					myself::RemoveMemo(talker,362);
					myself::AddLog(3,talker,362);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
				}
			}
			if( reply == 4 && myself::HaveMemo(talker,362) == 1 && myself::GetMemoState(talker,362) == 5 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,57,10000);
					myself::GiveItem1(talker,4410,1);
					myself::ShowPage(talker,"swan_q0362_08.htm");
					myself::RemoveMemo(talker,362);
					myself::AddLog(3,talker,362);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
				}
			}
		}
		super;
	}

}
