class 1 trader_simplon : merchant_for_newbie
{
property:
	BuySellList SellList0 = {{"tights_pants";20};{"tights_shirt";20};{"bone_breastplate";20};{"bone_gaiters";20};{"piece_bone_breastplate";20};{"bronze_breastplate";20};{"hard_leather_gaiters";20};{"piece_bone_gaiters";20};{"hard_leather_shirt";20};{"bronze_gaiters";20};{"puma_skin_gaiters";20};{"ring_breastplate";20};{"iron_plate_gaiters";20};{"puma_skin_shirt";20};{"lion_skin_gaiters";20};{"lion_skin_shirt";20};{"mithril_breastplate";20};{"mithril_gaiters";20};{"round_shield";20};{"bone_shield";20};{"bronze_shield";20};{"aspis";20};{"leather_gloves";20};{"bracer";20};{"excellence_leather_gloves";20};{"leather_gauntlet";20};{"low_boots";20};{"boots";20};{"leather_boots";20};{"blue_buckskin_boots";20};{"leather_helmet";20};{"hard_leather_helmet";20};{"bone_helmet";20};{"bronze_helmet";20};{"mithril_banded_gaiters";20};{"mithril_banded_mail";20};{"cotton_shirt";20};{"linen_shirt";20};{"striped_cotton_shirt";20};{"striped_linen_shirt";20}};
	BuySellList SellList1 = {{"hose_of_devotion";20};{"tunic_of_devotion";20};{"hose_of_magicpower";20};{"tunic_of_magicpower";20};{"cursed_hose";20};{"cursed_tunic";20};{"dark_hose";20};{"white_tunic";20};{"mage_s_hose";20};{"mage_s_tunic";20};{"hose_of_knowledge";20};{"tunic_of_knowledge";20};{"round_shield";20};{"bone_shield";20};{"bronze_shield";20};{"aspis";20};{"leather_gloves";20};{"bracer";20};{"excellence_leather_gloves";20};{"leather_gauntlet";20};{"low_boots";20};{"boots";20};{"leather_boots";20};{"blue_buckskin_boots";20};{"leather_helmet";20};{"hard_leather_helmet";20};{"bone_helmet";20};{"bronze_helmet";20};{"cotton_shirt";20};{"linen_shirt";20};{"striped_cotton_shirt";20};{"striped_linen_shirt";20}};

handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,405) == 1 && myself::OwnItemCount(talker,1191) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to a Cleric");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1138) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to a Warrior");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1139) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to a Warrior");
			}
			if( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1143) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to a Warrior");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,405) == 1 && myself::OwnItemCount(talker,1191) == 1 ) )
					{
						myself::SetCurrentQuestID(405);
						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,1195) == 0 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"trader_simplon_q0405_01.htm");
								myself::GiveItem1(talker,1195,3);
								if( myself::OwnItemCount(talker,1195) >= 0 && myself::OwnItemCount(talker,1194) >= 1 && myself::OwnItemCount(talker,1196) >= 1 )
								{
									myself::SetFlagJournal(talker,405,2);
								}
							}
						}
						else if( myself::OwnItemCount(talker,1195) > 0 )
						{
							myself::ShowPage(talker,"trader_simplon_q0405_02.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1138) ) )
					{
						myself::SetCurrentQuestID(401);
						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,"trader_simplon_q0401_01.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1139) ) )
					{
						myself::SetCurrentQuestID(401);
						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,1140) < 1 )
						{
							myself::ShowPage(talker,"trader_simplon_q0401_03.htm");
						}
						else if( myself::OwnItemCount(talker,1140) < 10 )
						{
							myself::ShowPage(talker,"trader_simplon_q0401_04.htm");
						}
						else if( myself::OwnItemCount(talker,1140) >= 10 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::DeleteItem1(talker,1139,1);
								myself::DeleteItem1(talker,1140,myself::OwnItemCount(talker,1140));
								myself::GiveItem1(talker,1141,1);
								myself::GiveItem1(talker,1143,1);
								myself::ShowPage(talker,"trader_simplon_q0401_05.htm");
								myself::SetFlagJournal(talker,401,4);
							}
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,401) == 1 && myself::OwnItemCount(talker,1143) ) )
					{
						myself::SetCurrentQuestID(401);
						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,"trader_simplon_q0401_06.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 401 )
		{
			myself::SetCurrentQuestID(401);
			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 == 401 )
		{
			if( reply == 1 && myself::OwnItemCount(talker,1138) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"trader_simplon_q0401_02.htm");
					myself::DeleteItem1(talker,1138,1);
					myself::GiveItem1(talker,1139,1);
					myself::SetFlagJournal(talker,401,2);
				}
			}
		}
		super;
	}

}
