class 1 parina : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,404) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to a Wizard");
			}
			if( myself::HaveMemo(talker,404) != 0 && ( myself::OwnItemCount(talker,1282) == 0 || myself::OwnItemCount(talker,1285) == 0 || myself::OwnItemCount(talker,1288) == 0 || myself::OwnItemCount(talker,1291) == 0 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to a Wizard (Continue)");
			}
			if( myself::HaveMemo(talker,404) != 0 && myself::OwnItemCount(talker,1282) != 0 && myself::OwnItemCount(talker,1285) != 0 && myself::OwnItemCount(talker,1288) != 0 && myself::OwnItemCount(talker,1291) != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to a Wizard (Continue)");
			}
			if( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2841) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Test of Magus (Continue)");
			}
			if( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2842) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Test of Magus (Continue)");
			}
			if( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2843) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Test of Magus (Continue)");
			}
			if( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2847) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Test of Magus (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,404) == 0 )
					{
						myself::SetCurrentQuestID(404);
						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 )
						{
							myself::FHTML_SetFileName(fhtml0,"parina_q0404_04.htm");
							myself::FHTML_SetInt(fhtml0,"quest_id",404);
							myself::ShowFHTML(talker,fhtml0);
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,404) != 0 && ( myself::OwnItemCount(talker,1282) == 0 || myself::OwnItemCount(talker,1285) == 0 || myself::OwnItemCount(talker,1288) == 0 || myself::OwnItemCount(talker,1291) == 0 ) ) )
					{
						myself::SetCurrentQuestID(404);
						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,"parina_q0404_05.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,404) != 0 && myself::OwnItemCount(talker,1282) != 0 && myself::OwnItemCount(talker,1285) != 0 && myself::OwnItemCount(talker,1288) != 0 && myself::OwnItemCount(talker,1291) != 0 ) )
					{
						myself::SetCurrentQuestID(404);
						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::DeleteItem1(talker,1282,myself::OwnItemCount(talker,1282));
							myself::DeleteItem1(talker,1285,myself::OwnItemCount(talker,1285));
							myself::DeleteItem1(talker,1288,myself::OwnItemCount(talker,1288));
							myself::DeleteItem1(talker,1291,myself::OwnItemCount(talker,1291));
							myself::RemoveMemo(talker,404);
							myself::AddLog(2,talker,404);
							myself::IncrementParam(talker,0,3200);
							myself::IncrementParam(talker,1,2020);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							if( myself::OwnItemCount(talker,1292) == 0 )
							{
								myself::GiveItem1(talker,1292,1);
							}
							myself::ShowPage(talker,"parina_q0404_06.htm");
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2841) == 1 ) )
					{
						myself::SetCurrentQuestID(228);
						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,"parina_q0228_01.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2842) == 1 ) )
					{
						myself::SetCurrentQuestID(228);
						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,"parina_q0228_03.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2843) == 1 ) )
					{
						myself::SetCurrentQuestID(228);
						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,"parina_q0228_04.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,228) == 1 && myself::OwnItemCount(talker,2847) == 1 ) )
					{
						myself::SetCurrentQuestID(228);
						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,"parina_q0228_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 404 )
		{
			myself::SetCurrentQuestID(404);
			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( talker.occupation == 10 )
			{
				if( talker.level >= 19 )
				{
					if( myself::OwnItemCount(talker,1292) )
					{
						myself::ShowPage(talker,"parina_q0404_03.htm");
					}
					else if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"parina_q0404_08.htm");
						myself::SetMemo(talker,quest_id);
						myself::AddLog(1,talker,404);
						myself::SoundEffect(talker,"ItemSound.quest_accept");
						myself::SetFlagJournal(talker,404,1);
					}
				}
				else
				{
					myself::ShowPage(talker,"parina_q0404_02.htm");
				}
			}
			else if( talker.occupation == 11 )
			{
				myself::ShowPage(talker,"parina_q0404_02a.htm");
			}
			else
			{
				myself::ShowPage(talker,"parina_q0404_01.htm");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 228 )
		{
			myself::SetCurrentQuestID(228);
			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 == 228 )
		{
			if( reply == 1 )
			{
				if( myself::OwnItemCount(talker,2841) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"parina_q0228_02.htm");
						myself::DeleteItem1(talker,2841,1);
						myself::GiveItem1(talker,2842,1);
						myself::SetFlagJournal(talker,228,2);
					}
				}
			}
		}
		super;
	}

}
