示例#1
0
        /// <summary>
        /// Delete <see cref="Item"/> at supplied <see cref="ItemLocation"/>, this is called directly from a packet hander.
        /// </summary>
        public Item ItemDelete(ItemLocation from)
        {
            Bag srcBag = GetBag(from.Location);

            if (srcBag == null)
            {
                throw new InvalidPacketValueException();
            }

            Item srcItem = srcBag.GetItem(from.BagIndex);

            if (srcItem == null)
            {
                throw new InvalidPacketValueException();
            }

            srcBag.RemoveItem(srcItem);
            srcItem.EnqueueDelete();
            deletedItems.Add(srcItem);

            player.Session.EnqueueMessageEncrypted(new ServerItemDelete
            {
                Guid = srcItem.Guid
            });

            return(srcItem);
        }
示例#2
0
        private Item ItemDelete(Bag bag, Item item, ItemUpdateReason reason)
        {
            bag.RemoveItem(item);
            if (!item.PendingCreate)
            {
                item.EnqueueDelete();
                deletedItems.Add(item);
            }

            player.Session.EnqueueMessageEncrypted(new ServerItemDelete
            {
                Guid   = item.Guid,
                Reason = reason
            });

            return(item);
        }