class 1 magister_mirien : wizard_coach
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,330) == 1 && myself::OwnItemCount(talker,1420) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Adept of Taste (Continue)");
			}
			if( myself::HaveMemo(talker,330) == 1 && ( ( ( ( ( ( ( myself::OwnItemCount(talker,1424) + myself::OwnItemCount(talker,1425) ) + myself::OwnItemCount(talker,1429) ) + myself::OwnItemCount(talker,1430) ) + myself::OwnItemCount(talker,1433) ) + myself::OwnItemCount(talker,1437) ) + myself::OwnItemCount(talker,1438) ) + myself::OwnItemCount(talker,1441) ) == 0 && myself::OwnItemCount(talker,1420) == 0 && ( ( ( ( myself::OwnItemCount(talker,1442) + myself::OwnItemCount(talker,1443) ) + myself::OwnItemCount(talker,1444) ) + myself::OwnItemCount(talker,1445) ) + myself::OwnItemCount(talker,1446) ) == 1 && ( ( ( ( myself::OwnItemCount(talker,1447) + myself::OwnItemCount(talker,1574) ) + myself::OwnItemCount(talker,1575) ) + myself::OwnItemCount(talker,1576) ) + myself::OwnItemCount(talker,1577) ) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Adept of Taste (Continue)");
			}
			if( myself::HaveMemo(talker,330) == 1 && ( ( ( ( ( ( ( myself::OwnItemCount(talker,1424) + myself::OwnItemCount(talker,1425) ) + myself::OwnItemCount(talker,1429) ) + myself::OwnItemCount(talker,1430) ) + myself::OwnItemCount(talker,1433) ) + myself::OwnItemCount(talker,1437) ) + myself::OwnItemCount(talker,1438) ) + myself::OwnItemCount(talker,1441) ) == 0 && myself::OwnItemCount(talker,1420) == 0 && ( ( ( ( myself::OwnItemCount(talker,1442) + myself::OwnItemCount(talker,1443) ) + myself::OwnItemCount(talker,1444) ) + myself::OwnItemCount(talker,1445) ) + myself::OwnItemCount(talker,1446) ) == 0 && ( ( ( ( myself::OwnItemCount(talker,1447) + myself::OwnItemCount(talker,1574) ) + myself::OwnItemCount(talker,1575) ) + myself::OwnItemCount(talker,1576) ) + myself::OwnItemCount(talker,1577) ) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Adept of Taste (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 0 && myself::GetOneTimeQuestFlag(talker,214) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Trial of the Scholar");
			}
			if( myself::HaveMemo(talker,214) == 0 && myself::GetOneTimeQuestFlag(talker,214) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Trial of the Scholar (Complete)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2675) == 1 && myself::OwnItemCount(talker,2693) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Trial of the Scholar (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2675) == 1 && myself::OwnItemCount(talker,2693) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Trial of the Scholar (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2676) == 1 && myself::OwnItemCount(talker,2698) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Trial of the Scholar (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2676) == 1 && myself::OwnItemCount(talker,2698) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Trial of the Scholar (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2678) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Trial of the Scholar (Continue)");
			}
			if( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2677) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Trial of the Scholar (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,330) == 1 && myself::OwnItemCount(talker,1420) == 1 ) )
					{
						myself::SetCurrentQuestID(330);
						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,"magister_mirien_q0330_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,330) == 1 && ( ( ( ( ( ( ( myself::OwnItemCount(talker,1424) + myself::OwnItemCount(talker,1425) ) + myself::OwnItemCount(talker,1429) ) + myself::OwnItemCount(talker,1430) ) + myself::OwnItemCount(talker,1433) ) + myself::OwnItemCount(talker,1437) ) + myself::OwnItemCount(talker,1438) ) + myself::OwnItemCount(talker,1441) ) == 0 && myself::OwnItemCount(talker,1420) == 0 && ( ( ( ( myself::OwnItemCount(talker,1442) + myself::OwnItemCount(talker,1443) ) + myself::OwnItemCount(talker,1444) ) + myself::OwnItemCount(talker,1445) ) + myself::OwnItemCount(talker,1446) ) == 1 && ( ( ( ( myself::OwnItemCount(talker,1447) + myself::OwnItemCount(talker,1574) ) + myself::OwnItemCount(talker,1575) ) + myself::OwnItemCount(talker,1576) ) + myself::OwnItemCount(talker,1577) ) == 0 ) )
					{
						myself::SetCurrentQuestID(330);
						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,1442) == 1 )
							{
								myself::ShowPage(talker,"magister_mirien_q0330_02t1.htm");
								myself::DeleteItem1(talker,1442,1);
								myself::GiveItem1(talker,1447,1);
							}
							if( myself::OwnItemCount(talker,1443) == 1 )
							{
								myself::ShowPage(talker,"magister_mirien_q0330_02t2.htm");
								myself::DeleteItem1(talker,1443,1);
								myself::GiveItem1(talker,1574,1);
							}
							if( myself::OwnItemCount(talker,1444) == 1 )
							{
								myself::ShowPage(talker,"magister_mirien_q0330_02t3.htm");
								myself::DeleteItem1(talker,1444,1);
								myself::GiveItem1(talker,1575,1);
							}
							if( myself::OwnItemCount(talker,1445) == 1 )
							{
								myself::ShowPage(talker,"magister_mirien_q0330_02t4.htm");
								myself::DeleteItem1(talker,1445,1);
								myself::GiveItem1(talker,1576,1);
							}
							if( myself::OwnItemCount(talker,1446) == 1 )
							{
								myself::ShowPage(talker,"magister_mirien_q0330_02t5.htm");
								myself::DeleteItem1(talker,1446,1);
								myself::GiveItem1(talker,1577,1);
							}
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,330) == 1 && ( ( ( ( ( ( ( myself::OwnItemCount(talker,1424) + myself::OwnItemCount(talker,1425) ) + myself::OwnItemCount(talker,1429) ) + myself::OwnItemCount(talker,1430) ) + myself::OwnItemCount(talker,1433) ) + myself::OwnItemCount(talker,1437) ) + myself::OwnItemCount(talker,1438) ) + myself::OwnItemCount(talker,1441) ) == 0 && myself::OwnItemCount(talker,1420) == 0 && ( ( ( ( myself::OwnItemCount(talker,1442) + myself::OwnItemCount(talker,1443) ) + myself::OwnItemCount(talker,1444) ) + myself::OwnItemCount(talker,1445) ) + myself::OwnItemCount(talker,1446) ) == 0 && ( ( ( ( myself::OwnItemCount(talker,1447) + myself::OwnItemCount(talker,1574) ) + myself::OwnItemCount(talker,1575) ) + myself::OwnItemCount(talker,1576) ) + myself::OwnItemCount(talker,1577) ) == 1 ) )
					{
						myself::SetCurrentQuestID(330);
						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,"magister_mirien_q0330_04.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 0 && myself::GetOneTimeQuestFlag(talker,214) == 0 ) )
					{
						myself::SetCurrentQuestID(214);
						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.occupation == 11 || talker.occupation == 26 || talker.occupation == 39 ) == 0
							{
								myself::ShowPage(talker,"magister_mirien_q0214_01.htm");
							}
							else if( ( talker.occupation == 11 || talker.occupation == 26 || talker.occupation == 39 ) && talker.level < 35 )
							{
								myself::ShowPage(talker,"magister_mirien_q0214_02.htm");
							}
							else
							{
								myself::FHTML_SetFileName(fhtml0,"magister_mirien_q0214_03.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",214);
								myself::ShowFHTML(talker,fhtml0);
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 0 && myself::GetOneTimeQuestFlag(talker,214) == 1 ) )
					{
						myself::SetCurrentQuestID(214);
						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 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2675) == 1 && myself::OwnItemCount(talker,2693) == 0 ) )
					{
						myself::SetCurrentQuestID(214);
						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,"magister_mirien_q0214_05.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2675) == 1 && myself::OwnItemCount(talker,2693) == 1 ) )
					{
						myself::SetCurrentQuestID(214);
						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,"magister_mirien_q0214_06.htm");
							myself::SetFlagJournal(talker,214,15);
							myself::DeleteItem1(talker,2693,myself::OwnItemCount(talker,2693));
							myself::DeleteItem1(talker,2675,1);
							myself::GiveItem1(talker,2676,1);
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2676) == 1 && myself::OwnItemCount(talker,2698) == 0 ) )
					{
						myself::SetCurrentQuestID(214);
						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,"magister_mirien_q0214_07.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2676) == 1 && myself::OwnItemCount(talker,2698) == 1 ) )
					{
						myself::SetCurrentQuestID(214);
						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,"magister_mirien_q0214_08.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2678) == 1 ) )
					{
						myself::SetCurrentQuestID(214);
						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.level < 36 )
						{
							myself::ShowPage(talker,"magister_mirien_q0214_11.htm");
						}
						else if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::ShowPage(talker,"magister_mirien_q0214_12.htm");
							myself::SetFlagJournal(talker,214,19);
							myself::DeleteItem1(talker,2678,1);
							myself::GiveItem1(talker,2677,1);
						}
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,214) == 1 && myself::OwnItemCount(talker,2677) == 1 ) )
					{
						myself::SetCurrentQuestID(214);
						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::OwnItemCount(talker,2720) == 0 )
						{
							myself::ShowPage(talker,"magister_mirien_q0214_13.htm");
						}
						else if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::IncrementParam(talker,0,80265);
							myself::IncrementParam(talker,1,30000);
							myself::GiveItem1(talker,7562,8);
							myself::ShowPage(talker,"magister_mirien_q0214_14.htm");
							myself::RemoveMemo(talker,214);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::SetOneTimeQuestFlag(talker,214,1);
							myself::DeleteItem1(talker,2720,myself::OwnItemCount(talker,2720));
							myself::DeleteItem1(talker,2677,1);
							myself::GiveItem1(talker,2674,1);
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 214 )
		{
			myself::SetCurrentQuestID(214);
			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::SoundEffect(talker,"ItemSound.quest_accept");
				if( myself::OwnItemCount(talker,2675) == 0 )
				{
					myself::GiveItem1(talker,2675,1);
				}
				myself::ShowPage(talker,"magister_mirien_q0214_04.htm");
				myself::SetFlagJournal(talker,214,1);
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 214 )
		{
			myself::SetCurrentQuestID(214);
			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 == 214 )
		{
			if( reply == 1 )
			{
				if( talker.level < 36 )
				{
					if( myself::OwnItemCount(talker,2676) >= 1 )
					{
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::ShowPage(talker,"magister_mirien_q0214_09.htm");
							myself::DeleteItem1(talker,2698,myself::OwnItemCount(talker,2698));
							myself::DeleteItem1(talker,2676,1);
							myself::GiveItem1(talker,2678,1);
						}
					}
				}
				else if( myself::OwnItemCount(talker,2676) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"magister_mirien_q0214_10.htm");
						myself::SetFlagJournal(talker,214,19);
						myself::DeleteItem1(talker,2698,myself::OwnItemCount(talker,2698));
						myself::DeleteItem1(talker,2676,1);
						myself::GiveItem1(talker,2677,1);
					}
				}
			}
		}
		super;
	}

}
