Exemple #1
0
        /// <summary>
        /// Move an item from the character's storage to the character's account cash locker
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        public static void MoveSToL(WvsShopClient c, CInPacket p)
        {
            if (p.Available < 9)
            {
                return;
            }

            var cashCommodityId = p.Decode8();
            var nTI             = (InventoryType)p.Decode1();

            var(itemSlot, item) = InventoryManipulator.GetItemByCashSN(c.Character, nTI, cashCommodityId);

            // unable to find item in inventory
            if (item is null)
            {
                return;
            }

            if (ItemConstants.IsRing(item.nItemID))
            {
                c.SendPacket(CPacket.CCashShop.RequestFailPacket(CashItemOps.CashItemRes_MoveStoL_Failed, CashItemFailed.NotAvailableTime));
                return;
            }

            var newItem = MasterManager.CreateCashCommodityItem(item.liCashItemSN);

            newItem.Item.nNumber     = item.nNumber;
            newItem.Item.liSN        = item.liSN;
            newItem.Item.tDateExpire = item.tDateExpire;
            //newItem.dwCharacterID = // TODO
            newItem.dwAccountID = c.Character.Account.ID;

            c.CashLocker.Add(newItem);
            InventoryManipulator.RemoveFrom(c.Character, nTI, itemSlot, -1);

            c.SendPacket(CPacket.CCashShop.MoveSToLResponse(c.CashLocker, newItem));
        }