public VendorItem(uint _item, int _maxcount, uint _incrtime, uint _ExtendedCost, ItemVendorType _Type) { item = _item; maxcount = (uint)_maxcount; incrtime = _incrtime; ExtendedCost = _ExtendedCost; Type = _Type; }
public bool RemoveItem(uint item_id, ItemVendorType type) { int i = m_items.RemoveAll(p => p.item == item_id && p.Type == type); if (i == 0) { return(false); } else { return(true); } }
public static void HandleBuyItem(ref PacketReader packet, ref WorldSession session) { Log.outDebug("WORLD: Received CMSG_BUY_ITEM"); ulong vendorguid = packet.ReadUInt64(); ItemVendorType itemType = (ItemVendorType)packet.ReadUInt8(); // 1 = item, 2 = currency uint item = packet.ReadUInt32(); uint slot = packet.ReadUInt32(); uint count = packet.ReadUInt32(); ulong bagGuid = packet.ReadUInt64(); byte bagSlot = packet.ReadUInt8(); // client expects count starting at 1, and we send vendorslot+1 to client already if (slot > 0) { --slot; } else { return; // cheating } Player pl = session.GetPlayer(); if (itemType == ItemVendorType.Item) { Item bagItem = pl.GetItemByGuid(bagGuid); byte bag = ItemConst.NullBag; if (bagItem != null && bagItem.IsBag()) { bag = bagItem.GetSlot(); } pl.BuyItemFromVendorSlot(vendorguid, slot, item, (byte)count, bag, bagSlot); } //else if (itemType == ItemVendorType.Currency) //pl.BuyCurrencyFromVendorSlot(vendorguid, slot, item, count); else { Log.outDebug("WORLD: received wrong itemType ({0} in HandleBuyItemOpcode", itemType); } }
public VendorItem FindItemCostPair(uint item_id, uint extendedCost, ItemVendorType type) { return(m_items.Find(p => p.item == item_id && p.ExtendedCost == extendedCost && p.Type == type)); }
public void AddItem(uint item, int maxcount, uint ptime, uint ExtendedCost, ItemVendorType type) { m_items.Add(new VendorItem(item, maxcount, ptime, ExtendedCost, type)); }