class 1 preacher_sla : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,227) == 1 && myself::OwnItemCount(talker,2823) == 1 && myself::GetMemoState(talker,227) == 4 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Test of the Reformer (Continue)");
			}
			if( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) >= 11 && myself::GetMemoState(talker,227) < 18 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Test of the Reformer (Continue)");
			}
			if( myself::HaveMemo(talker,227) == 1 && myself::OwnItemCount(talker,2824) == 1 && myself::GetMemoState(talker,227) == 5 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Test of the Reformer (Continue)");
			}
			if( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Test of the Reformer (Continue)");
			}
			if( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 18 && myself::OwnItemCount(talker,2827) >= 1 && myself::OwnItemCount(talker,3037) >= 1 && myself::OwnItemCount(talker,2828) >= 1 && myself::OwnItemCount(talker,2830) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Test of the Reformer (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,227) == 1 && myself::OwnItemCount(talker,2823) == 1 && myself::GetMemoState(talker,227) == 4 ) )
					{
						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;
						}
						myself::ShowPage(talker,"preacher_sla_q0227_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) >= 11 && myself::GetMemoState(talker,227) < 18 ) )
					{
						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;
						}
						myself::ShowPage(talker,"preacher_sla_q0227_06b.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,227) == 1 && myself::OwnItemCount(talker,2824) == 1 && myself::GetMemoState(talker,227) == 5 ) )
					{
						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;
						}
						myself::ShowPage(talker,"preacher_sla_q0227_05.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 10 ) )
					{
						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();
							if( myself::OwnItemCount(talker,2826) == 1 )
							{
								myself::ShowPage(talker,"preacher_sla_q0227_06.htm");
								myself::SetMemoState(talker,227,11);
								myself::DeleteItem1(talker,2826,myself::OwnItemCount(talker,2826));
								myself::GiveItem1(talker,2825,1);
								myself::GiveItem1(talker,5567,1);
								myself::GiveItem1(talker,5568,1);
								myself::SetFlagJournal(talker,227,10);
							}
							else
							{
								myself::ShowPage(talker,"preacher_sla_q0227_06a.htm");
								myself::SetMemoState(talker,227,11);
								myself::GiveItem1(talker,2825,1);
								myself::GiveItem1(talker,5567,1);
								myself::GiveItem1(talker,5568,1);
								myself::SetFlagJournal(talker,227,10);
							}
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,227) == 1 && myself::GetMemoState(talker,227) == 18 && myself::OwnItemCount(talker,2827) >= 1 && myself::OwnItemCount(talker,3037) >= 1 && myself::OwnItemCount(talker,2828) >= 1 && myself::OwnItemCount(talker,2830) >= 1 ) )
					{
						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::GiveItem1(talker,2821,1);
							myself::IncrementParam(talker,0,164032);
							myself::IncrementParam(talker,1,17500);
							myself::ShowPage(talker,"preacher_sla_q0227_07.htm");
							myself::RemoveMemo(talker,227);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::SetOneTimeQuestFlag(talker,227,1);
							myself::DeleteItem1(talker,2827,myself::OwnItemCount(talker,2827));
							myself::DeleteItem1(talker,3037,myself::OwnItemCount(talker,3037));
							myself::DeleteItem1(talker,2828,myself::OwnItemCount(talker,2828));
							myself::DeleteItem1(talker,2830,myself::OwnItemCount(talker,2830));
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 227 )
		{
			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( ask == 227 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"preacher_sla_q0227_03.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"preacher_sla_q0227_02.htm");
			}
			if( reply == 3 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"preacher_sla_q0227_04.htm");
					myself::GiveItem1(talker,2824,1);
					myself::DeleteItem1(talker,2823,myself::OwnItemCount(talker,2823));
					myself::SetMemoState(talker,227,5);
					myself::SetFlagJournal(talker,227,5);
				}
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"preacher_sla_q0227_02.htm");
			}
		}
		super;
	}

}
