public override void OnResponse(Mobile from, string text) { if (!m_Vendor.CanInteractWith(from, true)) { return; } text = text.Trim(); int amount = Utility.ToInt32(text); GiveGold(from, amount); }
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 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 OnResponse(Mobile from, string text) { if (!m_Vendor.CanInteractWith(from, true)) { return; } text = text.Trim(); int amount; if (!int.TryParse(text, out amount)) { amount = 0; } GiveGold(from, amount); }
public override void OnResponse(Mobile from, string text) { if (!m_VI.Valid || !m_Vendor.CanInteractWith(from, true)) { return; } string firstWord; int sep = text.IndexOfAny(new char[] { ' ', ',' }); if (sep >= 0) { firstWord = text.Substring(0, sep); } else { firstWord = text; } int price; string description; try { price = Convert.ToInt32(firstWord); if (sep >= 0) { description = text.Substring(sep + 1).Trim(); } else { description = String.Empty; } } catch { price = -1; description = text.Trim(); } SetInfo(from, price, Utility.FixHtml(description)); }
public override void OnResponse(Mobile from, string text) { if (!m_Vendor.CanInteractWith(from, true)) { return; } string name = text.Trim(); if (!NameVerification.Validate(name, 1, 20, true, true, true, 0, NameVerification.Empty)) { m_Vendor.SayTo(from, "That name is unacceptable."); return; } m_Vendor.ShopName = Utility.FixHtml(name); from.SendGump(new NewPlayerVendorOwnerGump(m_Vendor)); }