コード例 #1
0
        private void Handle_UserMove(WvsGameClient c, CInPacket p)
        {
            var v1          = p.Decode8();
            var portalCount = p.Decode1(); //CField::GetFieldKey(v20);
            var v2          = p.Decode8();
            var mapCrc      = p.Decode4();
            var dwKey       = p.Decode4();
            var dwKeyCrc    = p.Decode4();

            var movePath = p.DecodeBuffer(p.Available);

            c.Character.Position.DecodeMovePath(movePath);

            c.GetCharField().Broadcast(CPacket.UserMovement(c.Character.CharId, movePath), c);
        }
コード例 #2
0
        /// <summary>
        /// Move an item from the character's account cash locker to the character's storage.
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        public static void MoveLToS(WvsShopClient c, CInPacket p)
        {
            if (p.Available < 8)
            {
                return;
            }

            var sn = p.Decode8();

            var cashItem = c.CashLocker.GetBySN(sn);

            // unable to find item
            if (cashItem == null)
            {
                return;
            }

            var nTargetSlot = InventoryManipulator.InsertInto(c.Character, cashItem.Item);

            // item insertion failed
            if (nTargetSlot == 0)
            {
                return;                               // TODO proper error code/response
            }
            c.CashLocker.Remove(cashItem);

            c.SendPacket(CPacket.CCashShop.MoveLtoSResponse(cashItem, nTargetSlot));
        }
コード例 #3
0
        public void OnPetPacket(RecvOps opCode, CInPacket p)
        {
            switch (opCode)
            {
            case RecvOps.CP_PetDropPickUpRequest:

                break;

            case RecvOps.CP_PetInteractionRequest:

                break;

            case RecvOps.CP_UserActivatePetRequest:

                break;

            case RecvOps.CP_UserDestroyPetItemRequest:

                break;

            default:
                var liPetLockerSN = p.Decode8();

                var item = Pets.FirstOrDefault(pet => pet.liPetLockerSN == liPetLockerSN);

                if (item is null)
                {
                    return;
                }

                switch (opCode)
                {
                case RecvOps.CP_PetMove:
                    item.Move(p);
                    break;

                case RecvOps.CP_PetStatChangeItemUseRequest:                                 //  CPet::OnNameChanged(v4, iPacket);
                    break;

                case RecvOps.CP_PetUpdateExceptionListRequest:
                    break;

                case RecvOps.CP_PetAction:
                case RecvOps.CP_PetActionCommand:

                    var tick    = p.Decode4();
                    var nType   = p.Decode1();
                    var nAction = p.Decode1();
                    var sMsg    = p.DecodeString();                                  // rebroadcasting this is bad practice

                    Parent.Field.Broadcast(item.PetActionCommand((PetActType)nType, nAction, true, true), Parent);

                    break;
                }
                break;
            }
        }
コード例 #4
0
ファイル: WvsShop.cs プロジェクト: yeethawe/Rebirth95.Server
        private void Handle_CashItemGachaponRequest(WvsShopClient c, CInPacket p)
        {
            // Recv [CP_CashItemGachaponRequest] [B9 00] [02 5A 62 02 00 00 00 00]
            var liItemSN = p.Decode8();

            if (c.Account.AccountData.Locker.GetBySN(liItemSN) is CashItemInfo item && item.nItemID == 5222000)
            {
                return;                 // not working right now
                //var commodity = MasterManager.EtcTemplates.commodities
                //		.Where(cm => cm.OnSale
                //		             && cm.Count <= 1
                //		             && cm.ItemID / 10000 != 910
                //		             && cm.ItemID / 100 != 11128)
                //		.Random();

                //var rand_item = MasterManager.CreateCashCommodityItem(commodity.CashItemSN);
                //c.Account.AccountData.Locker.Add(rand_item);
                //c.SendPacket(CPacket.CCashShop.CashItemGachaponSuccess(liItemSN, item.Count - 1, rand_item, false));
                //c.Account.AccountData.Locker.Remove(item);
            }
コード例 #5
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));
        }