class 1 ol_mahum_pilgrim : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 7 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Test of the Reformer (Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			if( _code == 0 )
			{
				if( _from_choice == 0 || ( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 7 ) )
				{
					myself::SetCurrentQuestID(227);
					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,"ol_mahum_pilgrim_q0227_01.htm");
						myself::SetMemoState(talker,227,8);
						myself::GiveItem1(talker,2826,1);
					}
				}
			}
			return;
		}
		super;
	}

	EventHandler ATTACKED(attacker)
	{
		myself::SetCurrentQuestID(227);
		myself::AddAttackDesire(attacker,1,2000);
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(227);
		if( timer_id == 7778 )
		{
			if( myself.i_quest0 < 60 )
			{
				myself.i_quest0 = ( myself.i_quest0 + 1 );
				myself::AddTimerEx(7778,( 1000 * 5 ));
			}
			else
			{
				myself::Despawn();
			}
		}
		super;
	}

	EventHandler CREATED()
	{
		myself::SetCurrentQuestID(227);
		myself::AddTimerEx(7778,( 1000 * 5 ));
		myself.i_quest0 = 0;
		super;
	}

}
