public override void Handle(EzClient client, EzPacket packet)
        {
            int itemSlot      = packet.Data.ReadInt32();
            int equipmentSlot = packet.Data.ReadInt32();

            packet.Data.ReadInt32();

            InventoryItem item  = client.Inventory.GetItem(itemSlot);
            InventoryItem equip = client.Inventory.GetEquip(equipmentSlot);

            if (!client.Inventory.Equip(itemSlot, equipmentSlot))
            {
                _logger.Error("couldn't apply itemSlot {0} and equipmentSlot {1}", itemSlot, equipmentSlot);
                return;
            }

            if (item != null && !Database.UpdateInventoryItem(item))
            {
                _logger.Error("Couldn't save item to database {0}", item.Item.Name);
                return;
            }

            if (equip != null && !Database.UpdateInventoryItem(equip))
            {
                _logger.Error("Couldn't save item to database {0}", equip.Item.Name);
                return;
            }

            _logger.Debug("applied itemSlot {0} and equipmentSlot {1}", itemSlot, equipmentSlot);
            IBuffer showInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x1E, showInventoryPacket);
        }
        private void OnSessionResponse(Response <Session> result, EzClient client, EzPacket packet)
        {
            _logger.Debug("Client ({0}) entered world (SessionKey: {1})", client.Identity, result.Result.Key);


            client.Session = result.Result;

            Channel channel = Server.GetChannel(client.Mode, client.Session.ChannelId);

            channel.Join(client);

            IBuffer response = EzServer.Buffer.Provide();

            response.WriteByte(1);
            response.WriteByte(0);
            response.WriteByte(7);                              //0A?
            response.WriteByte(0);
            response.WriteByte((byte)client.Mode);              // Mode 0=RubyMix  1=STREET MIX  2=CLUB MIX
            response.WriteByte(0);
            response.WriteByte((byte)client.Session.ChannelId); //1-xCH / 0=1ch 1=2ch 2=3ch 3=4ch
            response.WriteByte(0);
            Send(client, 1, response);

            IBuffer characterList = LobbyCharacterListPacket.Create(channel);

            Send(channel.GetLobbyClients(), 2, characterList);

            IBuffer announceRoomPacket = RoomPacket.CreateAnnounceRoomPacket(channel);

            Send(client.Channel.GetLobbyClients(), 13, announceRoomPacket);

            IBuffer applyInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x21, applyInventoryPacket);

            IBuffer djPointsPacket = SongPacket.CreateDjPointsPacket();

            Send(client, 0x2B, djPointsPacket); //43

            IBuffer settings = SettingsPacket.Create(client.Setting, client.Mode);

            Send(client, 0x2D, settings); //45
        }
Beispiel #3
0
        public override void Handle(EzClient client, EzPacket packet)
        {
            byte unknown         = packet.Data.ReadByte();
            byte sourceSlot      = packet.Data.ReadByte();
            int  itemId          = packet.Data.ReadInt16(Endianness.Big);
            byte destinationSlot = packet.Data.ReadByte();

            InventoryItem source      = client.Inventory.GetItem(sourceSlot);
            InventoryItem destination = client.Inventory.GetItem(destinationSlot);

            if (source == null)
            {
                _logger.Error("Source item could not be found");
                return;
            }

            if (!client.Inventory.Move(sourceSlot, destinationSlot))
            {
                _logger.Error("Couldn't move item {0}, destination is occupied", source.Item.Name);
                return;
            }

            if (!Database.UpdateInventoryItem(source))
            {
                _logger.Error("Couldn't save source item to database {0}", source.Item.Name);
                return;
            }

            if (destination != null && !Database.UpdateInventoryItem(destination))
            {
                _logger.Error("Couldn't save destination item to database {0}", source.Item.Name);
                return;
            }

            _logger.Debug("Move ItemId {0} from slot {1} to {2}", itemId, sourceSlot, destinationSlot);
            IBuffer showInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x1E, showInventoryPacket);
        }
        public override void Handle(EzClient client, EzPacket packet)
        {
            byte  unknown  = packet.Data.ReadByte();
            short itemId   = packet.Data.ReadInt16(Endianness.Big);
            byte  itemSlot = packet.Data.ReadByte();

            InventoryItem inventoryItem = client.Inventory.GetItem(itemSlot);

            if (inventoryItem == null)
            {
                _logger.Error("Item could not be found");
                return;
            }

            if (inventoryItem.Item.Id != itemId)
            {
                _logger.Error("InventoryItem Id {0} does not match clients {1}", inventoryItem.Item.Id, itemId);
                return;
            }

            if (!client.Inventory.RemoveItem(inventoryItem))
            {
                _logger.Error("Could not remove item {0} from bag", inventoryItem.Item.Name);
                return;
            }

            if (!Database.DeleteInventoryItem(inventoryItem.Id))
            {
                _logger.Error("Could not deleye item {0} from database", inventoryItem.Item.Name);
                return;
            }

            _logger.Debug("Deleted Item {0} from slot {1}", inventoryItem.Item.Name, inventoryItem.Slot);
            IBuffer showInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x1E, showInventoryPacket);
        }
        public override int Id => 0x19;//25 = 내가방 버튼

        public override void Handle(EzClient client, EzPacket packet)
        {
            IBuffer showInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x24, showInventoryPacket);//36 = 가방 열림,목록
        }