public static void TryToBuy(Item item, Mobile from)
{
PlayerVendor vendor = item.RootParent as PlayerVendor;
if (vendor == null || !vendor.CanInteractWith(from, false))
{
return;
}
if (vendor.IsOwner(from))
{
vendor.SayTo(from, 503212); // You own this shop, just take what you want.
return;
}
VendorItem vi = vendor.GetVendorItem(item);
if (vi == null)
{
vendor.SayTo(from, 503216); // You can't buy that.
}
else if (!vi.IsForSale)
{
vendor.SayTo(from, 503202); // This item is not for sale.
}
else
{
from.CloseGump(typeof(PlayerVendorBuyGump));
from.SendGump(new PlayerVendorBuyGump(vendor, vi));
}
}