class 1 elder_arin : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,295) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Dreaming of the Skies");
			}
			if( myself::HaveMemo(talker,295) == 1 && myself::OwnItemCount(talker,1492) < 50 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Dreaming of the Skies (Continue)");
			}
			if( myself::HaveMemo(talker,295) == 1 && myself::OwnItemCount(talker,1492) >= 50 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Dreaming of the Skies (Continue)");
			}
			if( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 1 && myself::OwnItemCount(talker,2866) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Test of the Maestro (Continue)");
			}
			if( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 3 && myself::OwnItemCount(talker,2871) && myself::OwnItemCount(talker,2872) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Test of the Maestro (Continue)");
			}
			if( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 3 && myself::OwnItemCount(talker,2872) >= 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Test of the Maestro (Continue)");
			}
			if( myself::HaveMemo(talker,231) == 1 && myself::OwnItemCount(talker,2866) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Test of the Maestro (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3251) >= 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3256) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3256) == 0 && myself::OwnItemCount(talker,3251) == 0 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3256) >= 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3251) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3262) >= 1 && myself::OwnItemCount(talker,3256) == 0 && myself::OwnItemCount(talker,3251) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Testimony of Prosperity (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,295) == 0 )
					{
						myself::SetCurrentQuestID(295);
						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 >= 11 )
							{
								myself::FHTML_SetFileName(fhtml0,"elder_arin_q0295_02.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",295);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"elder_arin_q0295_01.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,295) == 1 && myself::OwnItemCount(talker,1492) < 50 ) )
					{
						myself::SetCurrentQuestID(295);
						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,"elder_arin_q0295_04.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,295) == 1 && myself::OwnItemCount(talker,1492) >= 50 ) )
					{
						myself::SetCurrentQuestID(295);
						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,1509) < 1 )
							{
								myself::ShowPage(talker,"elder_arin_q0295_05.htm");
								myself::GiveItem1(talker,1509,1);
								myself::IncrementParam(talker,1,500);
								myself::DeleteItem1(talker,1492,myself::OwnItemCount(talker,1492));
								myself::RemoveMemo(talker,295);
								myself::AddLog(2,talker,295);
								myself::SoundEffect(talker,"ItemSound.quest_finish");
							}
							else if( myself::OwnItemCount(talker,1509) >= 1 )
							{
								myself::ShowPage(talker,"elder_arin_q0295_06.htm");
								myself::GiveItem1(talker,57,2400);
								myself::IncrementParam(talker,1,500);
								myself::DeleteItem1(talker,1492,myself::OwnItemCount(talker,1492));
								myself::RemoveMemo(talker,295);
								myself::AddLog(2,talker,295);
								myself::SoundEffect(talker,"ItemSound.quest_finish");
							}
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 1 && myself::OwnItemCount(talker,2866) == 0 ) )
					{
						myself::SetCurrentQuestID(231);
						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::ShowPage(talker,"elder_arin_q0231_01.htm");
							myself::GiveItem1(talker,2871,1);
							myself::SetMemoState(talker,231,3);
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 3 && myself::OwnItemCount(talker,2871) && myself::OwnItemCount(talker,2872) == 0 ) )
					{
						myself::SetCurrentQuestID(231);
						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,"elder_arin_q0231_02.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,231) == 1 && myself::GetMemoState(talker,231) == 3 && myself::OwnItemCount(talker,2872) >= 5 ) )
					{
						myself::SetCurrentQuestID(231);
						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::ShowPage(talker,"elder_arin_q0231_03.htm");
							myself::GiveItem1(talker,2866,1);
							myself::DeleteItem1(talker,2872,myself::OwnItemCount(talker,2872));
							myself::SetMemoState(talker,231,1);
							if( myself::OwnItemCount(talker,2864) >= 1 && myself::OwnItemCount(talker,2865) >= 1 )
							{
								myself::SetFlagJournal(talker,231,2);
							}
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,231) == 1 && myself::OwnItemCount(talker,2866) ) )
					{
						myself::SetCurrentQuestID(231);
						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,"elder_arin_q0231_04.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3251) >= 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3256) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"elder_arin_q0221_01.htm");
						myself::DeleteItem1(talker,3251,myself::OwnItemCount(talker,3251));
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3256) == 0 && myself::OwnItemCount(talker,3251) == 0 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"elder_arin_q0221_02.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3256) >= 1 && myself::OwnItemCount(talker,3262) == 0 && myself::OwnItemCount(talker,3251) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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::ShowPage(talker,"elder_arin_q0221_03.htm");
							myself::DeleteItem1(talker,3256,1);
							myself::GiveItem1(talker,3262,1);
						}
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3239) >= 1 && myself::OwnItemCount(talker,3246) >= 1 && myself::OwnItemCount(talker,3262) >= 1 && myself::OwnItemCount(talker,3256) == 0 && myself::OwnItemCount(talker,3251) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"elder_arin_q0221_04.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

}
