class 1 maestro_nikola : citizen
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 15 && myself::OwnItemCount(talker,2759) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Testimony of Trust (Continue)");
			}
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 16 && myself::OwnItemCount(talker,2761) < 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Testimony of Trust (Continue)");
			}
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 16 && myself::OwnItemCount(talker,2761) == 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Testimony of Trust (Continue)");
			}
			if( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 17 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Testimony of Trust (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) == 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3270) >= 1 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3271) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3272) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3245) == 0 && myself::OwnItemCount(talker,3030) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3272) >= 1 && myself::OwnItemCount(talker,3030) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3245) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Testimony of Prosperity (Continue)");
			}
			if( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3245) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Testimony of Prosperity (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) == 15 && myself::OwnItemCount(talker,2759) ) )
					{
						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,"maestro_nikola_q0217_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 16 && myself::OwnItemCount(talker,2761) < 10 ) )
					{
						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,"maestro_nikola_q0217_03.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 16 && myself::OwnItemCount(talker,2761) == 10 ) )
					{
						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,"maestro_nikola_q0217_04.htm");
						myself::DeleteItem1(talker,2761,myself::OwnItemCount(talker,2761));
						myself::DeleteItem1(talker,2760,myself::OwnItemCount(talker,2760));
						myself::SetMemoState(talker,217,17);
						myself::SetFlagJournal(talker,217,21);
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,217) == 1 && myself::GetMemoState(talker,217) == 17 ) )
					{
						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,"maestro_nikola_q0217_05.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) == 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_01.htm");
						myself::DeleteItem1(talker,3269,myself::OwnItemCount(talker,3269));
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3270) >= 1 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_05.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3271) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3272) == 0 && myself::OwnItemCount(talker,3245) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_06.htm");
							myself::DeleteItem1(talker,3271,1);
							myself::GiveItem1(talker,3272,1);
							myself::GiveItem1(talker,3023,1);
							myself::SetFlagJournal(talker,221,7);
						}
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3272) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3245) == 0 && myself::OwnItemCount(talker,3030) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_07.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3272) >= 1 && myself::OwnItemCount(talker,3030) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3245) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_08.htm");
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,221) == 1 && myself::OwnItemCount(talker,3240) >= 1 && myself::OwnItemCount(talker,3245) >= 1 && myself::OwnItemCount(talker,3270) == 0 && myself::OwnItemCount(talker,3271) == 0 && myself::OwnItemCount(talker,3272) == 0 ) )
					{
						myself::SetCurrentQuestID(221);
						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,"maestro_nikola_q0221_09.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 217 )
		{
			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( ask == 217 )
		{
			if( reply == 1 && myself::OwnItemCount(talker,2759) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"maestro_nikola_q0217_02.htm");
					myself::GiveItem1(talker,2760,1);
					myself::DeleteItem1(talker,2759,1);
					myself::SetMemoState(talker,217,16);
					myself::SetFlagJournal(talker,217,19);
				}
			}
		}
		if( ask == 221 )
		{
			myself::SetCurrentQuestID(221);
			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 == 221 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"maestro_nikola_q0221_02.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"maestro_nikola_q0221_03.htm");
			}
			if( reply == 3 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"maestro_nikola_q0221_04.htm");
					myself::GiveItem1(talker,3270,1);
					myself::SetFlagJournal(talker,221,5);
				}
			}
		}
		super;
	}

}
