protected override void OnTarget(Mobile from, object targeted) { Container cont = from.Backpack; if (targeted is Item && cont != null && ((Item)targeted).IsChildOf(cont)) { IShopSellInfo[] info = m_Vendor.GetSellInfo(); Item item = targeted as Item; int totalCost = 0; string name = null; foreach (IShopSellInfo ssi in info) { if (ssi.IsSellable(item)) { totalCost = ssi.GetBuyPriceFor(item); name = ssi.GetNameFor(item); break; } } if (name == null) { m_Vendor.SayTo(from, "I won't buy that."); } else if (totalCost == 0) { m_Vendor.SayTo(from, "I won't negotiate on free items."); } else { int commerceCost = totalCost; string commerceSkill = "non-existent"; LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Commerce; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); switch (rating) { case SuccessRating.CriticalFailure: commerceCost = (int)(totalCost / CriticalFailure); commerceSkill = "horrible"; break; case SuccessRating.HazzardousFailure: commerceCost = (int)(totalCost / HazzardousFailure); commerceSkill = "terrible"; break; case SuccessRating.Failure: commerceCost = (int)(totalCost / Failure); commerceSkill = "lousy"; break; case SuccessRating.PartialSuccess: commerceCost = (int)(totalCost / PartialSuccess); commerceSkill = "mediocre"; break; case SuccessRating.Success: commerceCost = (int)(totalCost / Success); commerceSkill = "good"; break; case SuccessRating.CompleteSuccess: commerceCost = (int)(totalCost / CompleteSuccess); commerceSkill = "adept"; break; case SuccessRating.ExceptionalSuccess: commerceCost = (int)(totalCost / ExceptionalSuccess); commerceSkill = "exceptional"; break; case SuccessRating.TooEasy: commerceCost = (int)(totalCost / TooEasy); commerceSkill = "unquestionable"; break; default: case SuccessRating.TooDifficult: commerceCost = (int)(totalCost / TooDifficult); commerceSkill = "non-existent"; break; } m_Vendor.SayTo(from, "Normally, I would pay {0} for that (1), but due to your {2} commerce skill, I am paying you {3}.", totalCost, name, commerceSkill, commerceCost); totalCost = commerceCost; item.Consume(); if (totalCost > 1000) { from.AddToBackpack(new BankCheck(totalCost)); } else if (totalCost > 0) { from.AddToBackpack(new Gold(totalCost)); } } } else { from.SendMessage("You can only sell items in your backpack."); } }