class 1 seer_somak : mage_coach
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3402) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 && myself::OwnItemCount(talker,3401) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Test of the Lord (Continue)");
			}
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3401) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 && myself::OwnItemCount(talker,3402) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Test of the Lord (Continue)");
			}
			if( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3404) >= 1 && myself::OwnItemCount(talker,3394) == 0 && myself::OwnItemCount(talker,3402) == 0 && myself::OwnItemCount(talker,3401) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Test of the Lord (Continue)");
			}
			if( myself::HaveMemo(talker,233) == 0 && myself::GetOneTimeQuestFlag(talker,233) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Test of the War Spirit");
			}
			if( myself::HaveMemo(talker,233) == 0 && myself::GetOneTimeQuestFlag(talker,233) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Test of the War Spirit (Complete)");
			}
			if( myself::HaveMemo(talker,233) == 1 && myself::OwnItemCount(talker,2880) == 0 && myself::OwnItemCount(talker,2882) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Test of the War Spirit (Continue)");
			}
			if( myself::HaveMemo(talker,233) == 1 && myself::OwnItemCount(talker,2880) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Test of the War Spirit (Continue)");
			}
			if( myself::HaveMemo(talker,233) == 1 && myself::OwnItemCount(talker,2882) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Test of the War Spirit (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,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3402) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 && myself::OwnItemCount(talker,3401) >= 1 ) )
					{
						myself::SetCurrentQuestID(232);
						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,"seer_somak_q0232_01.htm");
							myself::DeleteItem1(talker,3401,1);
							myself::GiveItem1(talker,3402,1);
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3404) == 0 && myself::OwnItemCount(talker,3401) == 0 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3394) >= 1 && myself::OwnItemCount(talker,3402) >= 1 ) )
					{
						myself::SetCurrentQuestID(232);
						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,"seer_somak_q0232_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,232) == 1 && myself::OwnItemCount(talker,3391) >= 1 && myself::OwnItemCount(talker,3404) >= 1 && myself::OwnItemCount(talker,3394) == 0 && myself::OwnItemCount(talker,3402) == 0 && myself::OwnItemCount(talker,3401) == 0 ) )
					{
						myself::SetCurrentQuestID(232);
						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,"seer_somak_q0232_03.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,233) == 0 && myself::GetOneTimeQuestFlag(talker,233) == 0 ) )
					{
						myself::SetCurrentQuestID(233);
						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.race != 3 )
							{
								myself::ShowPage(talker,"seer_somak_q0233_01.htm");
							}
							else if( talker.race == 3 && talker.occupation != 50 )
							{
								myself::ShowPage(talker,"seer_somak_q0233_02.htm");
							}
							else if( talker.race == 3 && talker.occupation == 50 )
							{
								if( talker.level < 39 )
								{
									myself::ShowPage(talker,"seer_somak_q0233_03.htm");
								}
								else
								{
									myself::FHTML_SetFileName(fhtml0,"seer_somak_q0233_04.htm");
									myself::FHTML_SetInt(fhtml0,"quest_id",233);
									myself::ShowFHTML(talker,fhtml0);
								}
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,233) == 0 && myself::GetOneTimeQuestFlag(talker,233) == 1 ) )
					{
						myself::SetCurrentQuestID(233);
						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,233) == 1 && myself::OwnItemCount(talker,2880) == 0 && myself::OwnItemCount(talker,2882) == 0 ) )
					{
						myself::SetCurrentQuestID(233);
						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,2887) >= 1 && myself::OwnItemCount(talker,2901) >= 1 && myself::OwnItemCount(talker,2910) >= 1 && myself::OwnItemCount(talker,2894) >= 1 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"seer_somak_q0233_07.htm");
								myself::DeleteItem1(talker,2887,myself::OwnItemCount(talker,2887));
								myself::DeleteItem1(talker,2901,myself::OwnItemCount(talker,2901));
								myself::DeleteItem1(talker,2910,myself::OwnItemCount(talker,2910));
								myself::DeleteItem1(talker,2894,1);
								myself::GiveItem1(talker,2880,1);
							}
						}
						else
						{
							myself::ShowPage(talker,"seer_somak_q0233_06.htm");
						}
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,233) == 1 && myself::OwnItemCount(talker,2880) == 1 ) )
					{
						myself::SetCurrentQuestID(233);
						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,2881) < 13 )
						{
							myself::ShowPage(talker,"seer_somak_q0233_08.htm");
						}
						else if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::ShowPage(talker,"seer_somak_q0233_09.htm");
							myself::DeleteItem1(talker,2880,1);
							myself::GiveItem1(talker,2882,1);
							myself::GiveItem1(talker,2911,1);
							myself::GiveItem1(talker,2913,1);
							myself::GiveItem1(talker,2914,1);
							myself::GiveItem1(talker,2912,1);
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,233) == 1 && myself::OwnItemCount(talker,2882) == 1 ) )
					{
						myself::SetCurrentQuestID(233);
						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,"seer_somak_q0233_10.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 233 )
		{
			myself::SetCurrentQuestID(233);
			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");
				myself::ShowPage(talker,"seer_somak_q0233_05.htm");
			}
			return;
		}
		super;
	}

}
