class 1 merchant : citizen
{
parameter:
	string	ShopName = "";
	string	fnHi = "mhi.htm";
	string	fnSell = "msell.htm";
	string	fnBuy = "mbye.htm";
	string	fnUnableItemSell = "muib.htm";
	string	fnYouAreChaotic = "mcm.htm";
	string	fnNowSiege = "mns.htm";

property:
	BuySellList SellList0 = {};
	BuySellList SellList1 = {};
	BuySellList SellList2 = {};
	BuySellList SellList3 = {};
	BuySellList SellList4 = {};
	BuySellList SellList5 = {};
	BuySellList SellList6 = {};
	BuySellList SellList7 = {};
	BuySellList BuyList0 = {{"adena";0};{"q_cybellins_dagger";0};{"apprentice_s_wand";0};{"apprentice_s_tunic";0};{"apprentice_s_hose";0};{"dagger";0};{"squire_s_shirt";0};{"squire_s_pants";0};{"training_gloves";0};{"squire_s_sword";0};{"union_member_s_club";0};{"gallins_oak_wand";0};{"rusted_bronze_sword3";0};{"netis_bow";0};{"netis_dagger";0};{"guards_bow";0};{"talins_spear";0};{"old_knight_sword";0};{"crescent_moon_bow";0};{"sword_of_binding";0};{"q_cybellins_dagger";0};{"rp_titan_key";0};{"rp_journeyman_ring";0};{"rp_amber_bead";0};{"q_rp_titans_powerstone";0};{"q_herb_of_breka";0};{"q_herb_of_vanor";0};{"q_herb_of_oel_mahum";0};{"q_blood_of_eva";0};{"q_athreas_coin";0};{"q_symbol_of_loyalty";0};{"q_mist_drake_egg";0};{"q_blitz_wyrm_egg";0};{"q_drake_egg";0};{"q_thunderwyrm_egg";0};{"q_nebulite_crystals";0};{"q_titan_powerstone";0};{"q_imperial_key";0};{"wolf_collar";0};{"dragonflute_of_wind";0};{"dragonflute_of_star";0};{"dragonflute_of_twilight";0};{"dragon_bugle_wind";0};{"dragon_bugle_star";0};{"dragon_bugle_dusk";0};{"manacles_of_redemption";0};{"adena_of_ancient";0};{"party_mask_01";0};{"the_infinity_blade";0};{"the_infinity_cleaver";0};{"the_infinity_axe";0};{"the_infinity_rod";0};{"the_infinity_crusher";0};{"the_infinity_scepter";0};{"the_infinity_stinger";0};{"the_infinity_fangs";0};{"the_infinity_bow";0};{"the_infinity_wings";0};{"the_infinity_spear";0};{"crown_of_lord";0};{"wings_of_destiny_circlet";0};{"l2_fair_2005_coin";0};{"q_escape_scroll_talking";0};{"q_escape_scroll_elf";0};{"q_escape_scroll_darkelf";0};{"q_escape_scroll_orc";0};{"q_escape_scroll_dwarf";0};{"q_escape_scroll_giran";0};{"guide_apprentice_s_staff";0};{"guide_bone_club";0};{"guide_shining_knife";0};{"guide_cestus";0};{"guide_bow_of_forest";0};{"guide_long_sword";0};{"guide_mace_of_prayer";0};{"guide_dark_elven_bow";0};{"guide_long_bow";0};{"guide_staff_of_mana";0};{"guide_bastard_sword";0};{"guide_divine_tome";0};{"guide_single-edged_jamadhr";0};{"guide_tomahawk";0};{"guide_poniard_dagger";0};{"guide_pike";0};{"q_adventure_coupon1";0};{"q_adventure_coupon2";0}};
	BuySellList BuyList1 = {{"adena";0};{"q_cybellins_dagger";0};{"apprentice_s_wand";0};{"apprentice_s_tunic";0};{"apprentice_s_hose";0};{"dagger";0};{"squire_s_shirt";0};{"squire_s_pants";0};{"training_gloves";0};{"squire_s_sword";0};{"union_member_s_club";0};{"gallins_oak_wand";0};{"rusted_bronze_sword3";0};{"netis_bow";0};{"netis_dagger";0};{"guards_bow";0};{"talins_spear";0};{"old_knight_sword";0};{"crescent_moon_bow";0};{"sword_of_binding";0};{"q_cybellins_dagger";0};{"rp_titan_key";0};{"rp_journeyman_ring";0};{"rp_amber_bead";0};{"q_rp_titans_powerstone";0};{"q_herb_of_breka";0};{"q_herb_of_vanor";0};{"q_herb_of_oel_mahum";0};{"q_blood_of_eva";0};{"q_athreas_coin";0};{"q_symbol_of_loyalty";0};{"q_mist_drake_egg";0};{"q_blitz_wyrm_egg";0};{"q_drake_egg";0};{"q_thunderwyrm_egg";0};{"q_nebulite_crystals";0};{"q_titan_powerstone";0};{"q_imperial_key";0};{"wolf_collar";0};{"dragonflute_of_wind";0};{"dragonflute_of_star";0};{"dragonflute_of_twilight";0};{"dragon_bugle_wind";0};{"dragon_bugle_star";0};{"dragon_bugle_dusk";0};{"manacles_of_redemption";0};{"adena_of_ancient";0};{"party_mask_01";0};{"the_infinity_blade";0};{"the_infinity_cleaver";0};{"the_infinity_axe";0};{"the_infinity_rod";0};{"the_infinity_crusher";0};{"the_infinity_scepter";0};{"the_infinity_stinger";0};{"the_infinity_fangs";0};{"the_infinity_bow";0};{"the_infinity_wings";0};{"the_infinity_spear";0};{"crown_of_lord";0};{"wings_of_destiny_circlet";0};{"l2_fair_2005_coin";0};{"q_escape_scroll_talking";0};{"q_escape_scroll_elf";0};{"q_escape_scroll_darkelf";0};{"q_escape_scroll_orc";0};{"q_escape_scroll_dwarf";0};{"q_escape_scroll_giran";0};{"guide_apprentice_s_staff";0};{"guide_bone_club";0};{"guide_shining_knife";0};{"guide_cestus";0};{"guide_bow_of_forest";0};{"guide_long_sword";0};{"guide_mace_of_prayer";0};{"guide_dark_elven_bow";0};{"guide_long_bow";0};{"guide_staff_of_mana";0};{"guide_bastard_sword";0};{"guide_divine_tome";0};{"guide_single-edged_jamadhr";0};{"guide_tomahawk";0};{"guide_poniard_dagger";0};{"guide_pike";0};{"q_adventure_coupon1";0};{"q_adventure_coupon2";0}};
	BuySellList BuyList2 = {{"adena";0};{"q_cybellins_dagger";0};{"apprentice_s_wand";0};{"apprentice_s_tunic";0};{"apprentice_s_hose";0};{"dagger";0};{"squire_s_shirt";0};{"squire_s_pants";0};{"training_gloves";0};{"squire_s_sword";0};{"union_member_s_club";0};{"gallins_oak_wand";0};{"rusted_bronze_sword3";0};{"netis_bow";0};{"netis_dagger";0};{"guards_bow";0};{"talins_spear";0};{"old_knight_sword";0};{"crescent_moon_bow";0};{"sword_of_binding";0};{"q_cybellins_dagger";0};{"rp_titan_key";0};{"rp_journeyman_ring";0};{"rp_amber_bead";0};{"q_rp_titans_powerstone";0};{"q_herb_of_breka";0};{"q_herb_of_vanor";0};{"q_herb_of_oel_mahum";0};{"q_blood_of_eva";0};{"q_athreas_coin";0};{"q_symbol_of_loyalty";0};{"q_mist_drake_egg";0};{"q_blitz_wyrm_egg";0};{"q_drake_egg";0};{"q_thunderwyrm_egg";0};{"q_nebulite_crystals";0};{"q_titan_powerstone";0};{"q_imperial_key";0};{"wolf_collar";0};{"dragonflute_of_wind";0};{"dragonflute_of_star";0};{"dragonflute_of_twilight";0};{"dragon_bugle_wind";0};{"dragon_bugle_star";0};{"dragon_bugle_dusk";0};{"manacles_of_redemption";0};{"adena_of_ancient";0};{"party_mask_01";0};{"the_infinity_blade";0};{"the_infinity_cleaver";0};{"the_infinity_axe";0};{"the_infinity_rod";0};{"the_infinity_crusher";0};{"the_infinity_scepter";0};{"the_infinity_stinger";0};{"the_infinity_fangs";0};{"the_infinity_bow";0};{"the_infinity_wings";0};{"the_infinity_spear";0};{"crown_of_lord";0};{"wings_of_destiny_circlet";0};{"l2_fair_2005_coin";0};{"q_escape_scroll_talking";0};{"q_escape_scroll_elf";0};{"q_escape_scroll_darkelf";0};{"q_escape_scroll_orc";0};{"q_escape_scroll_dwarf";0};{"q_escape_scroll_giran";0};{"guide_apprentice_s_staff";0};{"guide_bone_club";0};{"guide_shining_knife";0};{"guide_cestus";0};{"guide_bow_of_forest";0};{"guide_long_sword";0};{"guide_mace_of_prayer";0};{"guide_dark_elven_bow";0};{"guide_long_bow";0};{"guide_staff_of_mana";0};{"guide_bastard_sword";0};{"guide_divine_tome";0};{"guide_single-edged_jamadhr";0};{"guide_tomahawk";0};{"guide_poniard_dagger";0};{"guide_pike";0};{"q_adventure_coupon1";0};{"q_adventure_coupon2";0}};
	BuySellList BuyList3 = {{"adena";0};{"q_cybellins_dagger";0};{"apprentice_s_wand";0};{"apprentice_s_tunic";0};{"apprentice_s_hose";0};{"dagger";0};{"squire_s_shirt";0};{"squire_s_pants";0};{"training_gloves";0};{"squire_s_sword";0};{"union_member_s_club";0};{"gallins_oak_wand";0};{"rusted_bronze_sword3";0};{"netis_bow";0};{"netis_dagger";0};{"guards_bow";0};{"talins_spear";0};{"old_knight_sword";0};{"crescent_moon_bow";0};{"sword_of_binding";0};{"q_cybellins_dagger";0};{"rp_titan_key";0};{"rp_journeyman_ring";0};{"rp_amber_bead";0};{"q_rp_titans_powerstone";0};{"q_herb_of_breka";0};{"q_herb_of_vanor";0};{"q_herb_of_oel_mahum";0};{"q_blood_of_eva";0};{"q_athreas_coin";0};{"q_symbol_of_loyalty";0};{"q_mist_drake_egg";0};{"q_blitz_wyrm_egg";0};{"q_drake_egg";0};{"q_thunderwyrm_egg";0};{"q_nebulite_crystals";0};{"q_titan_powerstone";0};{"q_imperial_key";0};{"wolf_collar";0};{"dragonflute_of_wind";0};{"dragonflute_of_star";0};{"dragonflute_of_twilight";0};{"dragon_bugle_wind";0};{"dragon_bugle_star";0};{"dragon_bugle_dusk";0};{"manacles_of_redemption";0};{"adena_of_ancient";0};{"party_mask_01";0};{"the_infinity_blade";0};{"the_infinity_cleaver";0};{"the_infinity_axe";0};{"the_infinity_rod";0};{"the_infinity_crusher";0};{"the_infinity_scepter";0};{"the_infinity_stinger";0};{"the_infinity_fangs";0};{"the_infinity_bow";0};{"the_infinity_wings";0};{"the_infinity_spear";0};{"crown_of_lord";0};{"wings_of_destiny_circlet";0};{"l2_fair_2005_coin";0};{"q_escape_scroll_talking";0};{"q_escape_scroll_elf";0};{"q_escape_scroll_darkelf";0};{"q_escape_scroll_orc";0};{"q_escape_scroll_dwarf";0};{"q_escape_scroll_giran";0};{"guide_apprentice_s_staff";0};{"guide_bone_club";0};{"guide_shining_knife";0};{"guide_cestus";0};{"guide_bow_of_forest";0};{"guide_long_sword";0};{"guide_mace_of_prayer";0};{"guide_dark_elven_bow";0};{"guide_long_bow";0};{"guide_staff_of_mana";0};{"guide_bastard_sword";0};{"guide_divine_tome";0};{"guide_single-edged_jamadhr";0};{"guide_tomahawk";0};{"guide_poniard_dagger";0};{"guide_pike";0};{"q_adventure_coupon1";0};{"q_adventure_coupon2";0}};
	BuySellList BuyList4 = {{"adena";0};{"q_cybellins_dagger";0};{"apprentice_s_wand";0};{"apprentice_s_tunic";0};{"apprentice_s_hose";0};{"dagger";0};{"squire_s_shirt";0};{"squire_s_pants";0};{"training_gloves";0};{"squire_s_sword";0};{"union_member_s_club";0};{"gallins_oak_wand";0};{"rusted_bronze_sword3";0};{"netis_bow";0};{"netis_dagger";0};{"guards_bow";0};{"talins_spear";0};{"old_knight_sword";0};{"crescent_moon_bow";0};{"sword_of_binding";0};{"q_cybellins_dagger";0};{"rp_titan_key";0};{"rp_journeyman_ring";0};{"rp_amber_bead";0};{"q_rp_titans_powerstone";0};{"q_herb_of_breka";0};{"q_herb_of_vanor";0};{"q_herb_of_oel_mahum";0};{"q_blood_of_eva";0};{"q_athreas_coin";0};{"q_symbol_of_loyalty";0};{"q_mist_drake_egg";0};{"q_blitz_wyrm_egg";0};{"q_drake_egg";0};{"q_thunderwyrm_egg";0};{"q_nebulite_crystals";0};{"q_titan_powerstone";0};{"q_imperial_key";0};{"wolf_collar";0};{"dragonflute_of_wind";0};{"dragonflute_of_star";0};{"dragonflute_of_twilight";0};{"dragon_bugle_wind";0};{"dragon_bugle_star";0};{"dragon_bugle_dusk";0};{"manacles_of_redemption";0};{"adena_of_ancient";0};{"party_mask_01";0};{"the_infinity_blade";0};{"the_infinity_cleaver";0};{"the_infinity_axe";0};{"the_infinity_rod";0};{"the_infinity_crusher";0};{"the_infinity_scepter";0};{"the_infinity_stinger";0};{"the_infinity_fangs";0};{"the_infinity_bow";0};{"the_infinity_wings";0};{"the_infinity_spear";0};{"crown_of_lord";0};{"wings_of_destiny_circlet";0};{"l2_fair_2005_coin";0};{"q_escape_scroll_talking";0};{"q_escape_scroll_elf";0};{"q_escape_scroll_darkelf";0};{"q_escape_scroll_orc";0};{"q_escape_scroll_dwarf";0};{"q_escape_scroll_giran";0};{"guide_apprentice_s_staff";0};{"guide_bone_club";0};{"guide_shining_knife";0};{"guide_cestus";0};{"guide_bow_of_forest";0};{"guide_long_sword";0};{"guide_mace_of_prayer";0};{"guide_dark_elven_bow";0};{"guide_long_bow";0};{"guide_staff_of_mana";0};{"guide_bastard_sword";0};{"guide_divine_tome";0};{"guide_single-edged_jamadhr";0};{"guide_tomahawk";0};{"guide_poniard_dagger";0};{"guide_pike";0};{"q_adventure_coupon1";0};{"q_adventure_coupon2";0}};

handler:
	EventHandler TALKED(talker)
	{
		if( talker.karma > 0 )
		{
			myself::ShowPage(talker,fnYouAreChaotic);
		}
		else
		{
			myself::ShowPage(talker,fnHi);
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,item0)
	{
		if( ask == -1 )
		{
			if( reply == 0 )
			{
				myself::Sell(talker,SellList0,ShopName,fnBuy,"","");
			}
			if( reply == 1 )
			{
				myself::Sell(talker,SellList1,ShopName,fnBuy,"","");
			}
			if( reply == 2 )
			{
				myself::SellPreview(talker,SellList0,ShopName,fnBuy,"","");
			}
			if( reply == 3 )
			{
				myself::SellPreview(talker,SellList1,ShopName,fnBuy,"","");
			}
			if( reply == 4 )
			{
				myself::Sell(talker,SellList4,ShopName,fnBuy,"","");
			}
			if( reply == 5 )
			{
				myself::Sell(talker,SellList5,ShopName,fnBuy,"","");
			}
			if( reply == 6 )
			{
				myself::Sell(talker,SellList6,ShopName,fnBuy,"","");
			}
			if( reply == 7 )
			{
				myself::Sell(talker,SellList7,ShopName,fnBuy,"","");
			}
			if( reply == 8 )
			{
				myself::Buy(talker,BuyList0,ShopName,fnSell,fnUnableItemSell,-50);
			}
			if( reply == 9 )
			{
				myself::Buy(talker,BuyList1,ShopName,fnSell,fnUnableItemSell,-50);
			}
			if( reply == 10 )
			{
				myself::Buy(talker,BuyList2,ShopName,fnSell,fnUnableItemSell,-50);
			}
			if( reply == 11 )
			{
				myself::Buy(talker,BuyList3,ShopName,fnSell,fnUnableItemSell,-50);
			}
			if( reply == 12 )
			{
				myself::Buy(talker,BuyList4,ShopName,fnSell,fnUnableItemSell,-50);
			}
		}
		else if( ask == -506 )
		{
			myself::ShowMultisell(212,talker);
		}
		else if( ask == -507 )
		{
			myself::ShowMultisell(221,talker);
		}
		else if( ask == -1001 )
		{
			switch(reply)
			{
				case 0:
				{
					if( myself::OwnItemCount(talker,7585) > 0 )
					{
						myself::DeleteItem1(talker,7585,1);
						myself::GetItemData(talker,6650);
						myself::CreatePet(talker,6650,1012781,24);
						myself::ShowPage(talker,"pet_manager_trade_pet.htm");
					}
					else
					{
						myself::ShowPage(talker,"pet_manager_no_ticket.htm");
					}
					break;
				}
				case 1:
				{
					if( myself::OwnItemCount(talker,7583) > 0 )
					{
						myself::DeleteItem1(talker,7583,1);
						myself::GetItemData(talker,6648);
						myself::CreatePet(talker,6648,1012780,25);
						myself::ShowPage(talker,"pet_manager_trade_pet.htm");
					}
					else
					{
						myself::ShowPage(talker,"pet_manager_no_ticket.htm");
					}
					break;
				}
				case 2:
				{
					if( myself::OwnItemCount(talker,7584) > 0 )
					{
						myself::DeleteItem1(talker,7584,1);
						myself::GetItemData(talker,6649);
						myself::CreatePet(talker,6649,1012782,26);
						myself::ShowPage(talker,"pet_manager_trade_pet.htm");
					}
					else
					{
						myself::ShowPage(talker,"pet_manager_no_ticket.htm");
					}
					break;
				}
			}
		}
		else if( ask == -1002 )
		{
			i0 = 0;
			if( reply == 1 )
			{
				i0 = 2375;
				i1 = 9882;
				i2 = 1012077;
				i3 = 1016025;
				i4 = 55;
			}
			if( reply == 2 )
			{
				i0 = 6648;
				i1 = 10311;
				i2 = 1012780;
				i3 = 1016034;
				i4 = 55;
			}
			if( reply == 3 )
			{
				i0 = 6650;
				i1 = 10313;
				i2 = 1012781;
				i3 = 1016035;
				i4 = 55;
			}
			if( reply == 4 )
			{
				i0 = 6649;
				i1 = 10312;
				i2 = 1012782;
				i3 = 1016036;
				i4 = 55;
			}
			if( reply == 5 )
			{
				i0 = 9882;
				i1 = 10426;
				i2 = 1016025;
				i3 = 1016041;
				i4 = 70;
			}
			if( i0 > 0 )
			{
				c0 = myself::GetSummon(talker);
				if( c0 )
				{
					myself::ShowPage(talker,"pet_manager_unsummon.htm");
					return;
				}
				if( myself::OwnItemCount(talker,i0) == 1 )
				{
					item0 = myself::GetItemData(talker,i0);
					if( item0 )
					{
						if( item0.pet_level >= i4 )
						{
							myself::EvolvePet(talker,item0.dbid,i2,i1,i3,item0.pet_level);
							myself::ShowPage(talker,fnHi);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
						}
						else
						{
							myself::ShowPage(talker,"pet_manager_evolve_no.htm");
						}
					}
					else
					{
						myself::ShowPage(talker,"pet_manager_evolve_no.htm");
					}
				}
				else
				{
					myself::ShowPage(talker,"pet_manager_evolve_no.htm");
				}
			}
		}
		super;
	}

}
