class 1 potter : cleric_coach
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 9 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Trial of the Pilgrim (Continue)");
			}
			if( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Trial of the Pilgrim (Continue)");
			}
			if( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 11 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Trial of the Pilgrim (Continue)");
			}
			if( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 12 && myself::OwnItemCount(talker,2730) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Trial of the Pilgrim (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,215) == 1 && myself::GetMemoState(talker,215) == 9 ) )
					{
						myself::SetCurrentQuestID(215);
						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,"potter_q0215_01.htm");
							myself::GiveItem1(talker,2728,1);
							myself::SetMemoState(talker,215,10);
							myself::SetFlagJournal(talker,215,10);
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 10 ) )
					{
						myself::SetCurrentQuestID(215);
						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,"potter_q0215_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 11 ) )
					{
						myself::SetCurrentQuestID(215);
						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,"potter_q0215_03.htm");
							myself::GiveItem1(talker,2730,1);
							myself::DeleteItem1(talker,2728,myself::OwnItemCount(talker,2728));
							myself::DeleteItem1(talker,2729,myself::OwnItemCount(talker,2729));
							myself::SetMemoState(talker,215,12);
							myself::SetFlagJournal(talker,215,12);
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,215) == 1 && myself::GetMemoState(talker,215) == 12 && myself::OwnItemCount(talker,2730) ) )
					{
						myself::SetCurrentQuestID(215);
						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,"potter_q0215_04.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

}
