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)); } }
public override void GetChildNameProperties(ObjectPropertyList list, Item item) { base.GetChildNameProperties(list, item); PlayerVendor pv = RootParent as PlayerVendor; if (pv == null) { return; } VendorItem vi = pv.GetVendorItem(item); if (vi == null) { return; } if (!vi.IsForSale) { list.Add(1043307); // Price: Not for sale. } else if (vi.IsForFree) { list.Add(1043306); // Price: FREE! } else { list.Add(1043304, vi.FormattedPrice); // Price: ~1_COST~ } }
public override void OnSingleClickContained(Mobile from, Item item) { if (RootParent is PlayerVendor) { PlayerVendor vendor = (PlayerVendor)RootParent; VendorItem vi = vendor.GetVendorItem(item); if (vi != null) { if (!vi.IsForSale) { item.LabelTo(from, 1043307); // Price: Not for sale. } else if (vi.IsForFree) { item.LabelTo(from, 1043306); // Price: FREE! } else { item.LabelTo(from, 1043304, vi.FormattedPrice); // Price: ~1_COST~ } if (!String.IsNullOrEmpty(vi.Description)) { // The localized message (1043305) is no longer valid - <br>Seller's Description:<br>"~1_DESC~" item.LabelTo(from, "Description: {0}", vi.Description); } } } base.OnSingleClickContained(from, item); }
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 if (vi.Created + TimeSpan.FromMinutes(1.0) > DateTime.Now) { from.SendMessage("You cannot buy this item right now. Please wait one minute and try again."); } else { from.CloseGump(typeof(PlayerVendorBuyGump)); from.SendGump(new PlayerVendorBuyGump(vendor, vi)); } }
public override void GetChildProperties(ObjectPropertyList list, Item item) { base.GetChildProperties(list, item); PlayerVendor pv = RootParent as PlayerVendor; if (pv == null) { return; } VendorItem vi = pv.GetVendorItem(item); if (vi != null && vi.Description != null && vi.Description.Length > 0) { list.Add(1043305, vi.Description); // <br>Seller's Description:<br>"~1_DESC~" } }
public override void GetChildContextMenuEntries(Mobile from, List <ContextMenuEntry> list, Item item) { base.GetChildContextMenuEntries(from, list, item); PlayerVendor pv = RootParent as PlayerVendor; if (pv == null || pv.IsOwner(from)) { return; } VendorItem vi = pv.GetVendorItem(item); if (vi != null) { list.Add(new BuyEntry(item)); } }
private static void processContainer(PlayerVendor vendor, Container container) { foreach (Item i in container.Items) { VendorItem vi = vendor.GetVendorItem(i); if (vi != null) { if (vi.IsForSale) { MyVendorItem mvi = new MyVendorItem(); mvi.Name = vi.Item is BaseContainer ? "container" : StringUtils.GetString(vi.Item.Name, Sphere.ComputeName(vi.Item)); mvi.Description = vi.Description; mvi.Price = vi.Price; if (vi.Item is CommodityDeed) { Item commodity = (vi.Item as CommodityDeed).Commodity; if (commodity == null) // skip empty deeds continue; mvi.Amount = commodity.Amount; mvi.Name += " - " + Sphere.ComputeName(commodity); } else { mvi.Amount = vi.Item.Amount; } if (mvi.Amount != 0) { mvi.PricePer = mvi.Price / mvi.Amount; } else { mvi.PricePer = mvi.Price; } mvi.VendorName = vendor.Name; mvi.OwnerName = vendor.Owner.Name; mvi.Location = StringUtils.GetString(vendor.Region.Name, BaseRegion.GetRuneNameFor(vendor.Region)) + " " + vendor.Location.X + "," + vendor.Location.Y; m_VendorItems.Add(mvi); } else if (vi.Item is Container) { processContainer(vendor, vi.Item as Container); } } } }
private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item) { VendorItem vi = pv.GetVendorItem(item); if ( vi == null ) return; if ( vi.IsForSale ) { if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list. return; string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " "); string name = item.Name; if (string.IsNullOrEmpty(name)) { name = item.GetType().ToString(); if (name.LastIndexOf('.') >= 0) name = name.Substring(name.LastIndexOf('.') + 1); } if (name.Length > 25) name = name.Substring(0, 25); string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description); op.WriteLine( "<tr><td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/pouch.bmp align=\"absmiddle\"> {0} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/bodscroll.bmp align=\"absmiddle\"> {1,-25} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/gold.bmp align=\"absmiddle\"> {2,7} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/scroll.bmp align=\"absmiddle\"> {3} </td></tr>", item.Amount, name, vi.Price.ToString(), des );//Note want to add bag icon here } else if ( item is Container) { foreach ( Item containerItem in item.Items) { GetVendorItemsDisplay( op, pv, containerItem);// } } }