class 1 trader_holly : merchant
{
property:
	BuySellList SellList0 = {{"soulshot_none";20};{"spiritshot_none";20};{"blessed_spiritshot_none";20};{"comp_bspiritshot_none";20};{"comp_spiritshot_none";20};{"comp_soulshot_none";20};{"adv_comp_bspiritshot_none";20};{"adv_comp_spiritshot_none";20};{"adv_comp_soulshot_none";20};{"wooden_arrow";20};{"bone_arrow";20};{"fine_steel_arrow";20};{"lesser_healing_potion";20};{"healing_potion";20};{"antidote";20};{"advanced_antidote";20};{"bandage";20};{"emergency_dressing";20};{"quick_step_potion";20};{"swift_attack_potion";20};{"potion_of_acumen2";20};{"scroll_of_awake";20};{"scroll_of_escape";20};{"scroll_of_resurrection";20};{"scroll_of_escape_to_agit";20};{"scroll_of_escape_to_castle";20};{"spirit_ore";20};{"soul_ore";20};{"energy_stone";20};{"key_of_thief";20};{"rope_of_magic_d";20};{"rope_of_magic_c";20};{"rope_of_magic_b";20};{"rope_of_magic_a";20};{"rope_of_magic_s";20};{"gemstone_d";20};{"bone_bolt";20};{"steel_bolt";20};{"scroll_recovery_ng";20};{"scroll_recovery_d";20};{"scroll_recovery_c";20};{"scroll_recovery_b";20};{"scroll_recovery_a";20};{"scroll_recovery_s";20};{"elixir_of_life_ng";20};{"elixir_of_life_d";20};{"elixir_of_life_c";20};{"elixir_of_cp_ng";20};{"elixir_of_cp_d";20};{"elixir_of_cp_c";20};{"elixir_of_cp_b";20};{"elixir_of_cp_a";20};{"elixir_of_cp_s";20};{"summoning_crystal";20};{"mysterious_solvent";20};{"strategy_guide";20};{"a_bottle_of_souls";20};{"dice_heart";20};{"dice_spade";20};{"dice_clover";20};{"dice_diamond";20}};

handler:
	EventHandler TALK_SELECTED(fhtml0,i1,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,372) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Legacy of Insolence");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			if( _code == 0 )
			{
				if( _from_choice == 0 || myself::HaveMemo(talker,372) == 1 )
				{
					myself::SetCurrentQuestID(372);
					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,5984) < 1 || myself::OwnItemCount(talker,5985) < 1 || myself::OwnItemCount(talker,5986) < 1 || myself::OwnItemCount(talker,5987) < 1 || myself::OwnItemCount(talker,5988) < 1 )
						{
							myself::ShowPage(talker,"trader_holly_q0372_01.htm");
						}
						else if( myself::OwnItemCount(talker,5984) >= 1 && myself::OwnItemCount(talker,5985) >= 1 && myself::OwnItemCount(talker,5986) >= 1 && myself::OwnItemCount(talker,5987) >= 1 && myself::OwnItemCount(talker,5988) >= 1 )
						{
							myself::DeleteItem1(talker,5984,1);
							myself::DeleteItem1(talker,5985,1);
							myself::DeleteItem1(talker,5986,1);
							myself::DeleteItem1(talker,5987,1);
							myself::DeleteItem1(talker,5988,1);
							i1 = gg::Rand(100);
							if( i1 < 30 )
							{
								myself::GiveItem1(talker,5496,1);
							}
							else if( i1 < 60 )
							{
								myself::GiveItem1(talker,5508,1);
							}
							else if( i1 < 80 )
							{
								myself::GiveItem1(talker,5525,1);
							}
							else if( i1 < 90 )
							{
								myself::GiveItem1(talker,5496,1);
								myself::GiveItem1(talker,5508,1);
								myself::GiveItem1(talker,5525,1);
							}
							else if( i1 < 100 )
							{
								myself::GiveItem1(talker,57,4000);
							}
							myself::ShowPage(talker,"trader_holly_q0372_02.htm");
						}
					}
				}
			}
			return;
		}
		super;
	}

}
