class 1 magister_clayton : mage_coach
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 5 && myself::OwnItemCount(talker,2748) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Testimony of Trust");
			}
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 6 && myself::OwnItemCount(talker,2755) && ( ( myself::OwnItemCount(talker,2754) + myself::OwnItemCount(talker,2753) ) + myself::OwnItemCount(talker,2752) ) < 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Testimony of Trust");
			}
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 6 && myself::OwnItemCount(talker,2755) && ( ( myself::OwnItemCount(talker,2754) + myself::OwnItemCount(talker,2753) ) + myself::OwnItemCount(talker,2752) ) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Testimony of Trust");
			}
			if( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 2 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Certified Arbalester (Continue)");
			}
			if( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Certified Arbalester (Continue)");
			}
			if( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 4 && myself::OwnItemCount(talker,9773) >= 30 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Certified Arbalester (Continue)");
			}
			if( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Certified Arbalester (Continue)");
			}
			if( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) < 6 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"More Than Meets The Eye (Continue)");
			}
			if( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 6 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"More Than Meets The Eye (Continue)");
			}
			if( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 7 && myself::OwnItemCount(talker,9789) < 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"More Than Meets The Eye (Continue)");
			}
			if( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 8 && myself::OwnItemCount(talker,9789) >= 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"More Than Meets The Eye (Continue)");
			}
			if( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) > 8 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 11;
				myself::AddChoice(11,"More Than Meets The Eye Progress (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,217) == 1 && myself::GetMemoState(talker,217) == 5 && myself::OwnItemCount(talker,2748) ) )
					{
						myself::SetCurrentQuestID(217);
						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_clayton_q0217_01.htm");
							myself::GiveItem1(talker,2755,1);
							myself::DeleteItem1(talker,2748,1);
							myself::SetMemoState(talker,217,6);
							myself::SetFlagJournal(talker,217,6);
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 6 && myself::OwnItemCount(talker,2755) && ( ( myself::OwnItemCount(talker,2754) + myself::OwnItemCount(talker,2753) ) + myself::OwnItemCount(talker,2752) ) < 3 ) )
					{
						myself::SetCurrentQuestID(217);
						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_clayton_q0217_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 6 && myself::OwnItemCount(talker,2755) && ( ( myself::OwnItemCount(talker,2754) + myself::OwnItemCount(talker,2753) ) + myself::OwnItemCount(talker,2752) ) == 3 ) )
					{
						myself::SetCurrentQuestID(217);
						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_clayton_q0217_03.htm");
						myself::SetFlagJournal(talker,217,8);
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 2 ) )
					{
						myself::SetCurrentQuestID(66);
						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_clayton_q066_01.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 3 ) )
					{
						myself::SetCurrentQuestID(66);
						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_clayton_q066_06.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,64) == 1 && myself::GetMemoState(talker,64) == 4 && myself::OwnItemCount(talker,9773) >= 30 ) )
					{
						myself::SetCurrentQuestID(64);
						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_clayton_q066_07.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,66) == 1 && myself::GetMemoState(talker,66) == 5 ) )
					{
						myself::SetCurrentQuestID(66);
						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_clayton_q066_09.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) < 6 ) )
					{
						myself::SetCurrentQuestID(136);
						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_clayton_q0136_08.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 6 ) )
					{
						myself::SetCurrentQuestID(136);
						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_clayton_q0136_09.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 7 && myself::OwnItemCount(talker,9789) < 5 ) )
					{
						myself::SetCurrentQuestID(136);
						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_clayton_q0136_12.htm");
					}
					break;
				}
				case 10:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) == 8 && myself::OwnItemCount(talker,9789) >= 5 ) )
					{
						myself::SetCurrentQuestID(136);
						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_clayton_q0136_13.htm");
						myself::DeleteItem1(talker,9789,myself::OwnItemCount(talker,9789));
						myself::GiveItem1(talker,9790,1);
						myself::SetMemoState(talker,136,9);
						myself::SetFlagJournal(talker,136,9);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 11:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,136) == 1 && myself::GetMemoState(talker,136) > 8 ) )
					{
						myself::SetCurrentQuestID(136);
						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_clayton_q0136_14.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,quest_id,reply,talker)
	{
		if( ask == 66 )
		{
			myself::SetCurrentQuestID(66);
			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( reply == 1 )
			{
				myself::ShowPage(talker,"magister_clayton_q066_05.htm");
				myself::SetMemoState(talker,66,3);
				myself::SetFlagJournal(talker,66,3);
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"magister_clayton_q066_08.htm");
				myself::DeleteItem1(talker,9773,30);
				myself::GiveItem1(talker,9774,1);
				myself::SetMemoState(talker,66,5);
				myself::SetFlagJournal(talker,66,5);
			}
		}
		if( ask == 136 )
		{
			myself::SetCurrentQuestID(136);
			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( reply == 1 )
			{
				myself::ShowPage(talker,"magister_clayton_q0136_10.htm");
				myself::DeleteItem1(talker,9788,myself::OwnItemCount(talker,9788));
				myself::SetMemoState(talker,136,7);
				myself::SetFlagJournal(talker,136,7);
			}
		}
		super;
	}

}
