Esempio n. 1
0
        public static void OnStorageDropRequest(GameClient client, ClientDropStorageRequestPacket packet)
        {
            var hero = client.HeroEntity;

            for (int i = 0; i < packet.Amount; i++)
                hero.Backpack.RemoveSingleAt(packet.SlotId);

            var outboundPacket = new ServerSendHeroStoragePacket(hero.Backpack, StorageType.Inventory);
            client.Send(outboundPacket);
        }
Esempio n. 2
0
        public static void OnStorageSlotMoveRequest(GameClient client, ClientStorageMoveSlotPacket packet)
        {
            var hero = client.HeroEntity;

            bool moveSuccessful = false;

            switch (packet.StorageType)
            {
                case StorageType.Inventory:
                    moveSuccessful = hero.Backpack.MoveTo(packet.SourceSlot, packet.DestSlot);
                    break;
            }

            // Send a full inventory update to the client
            var outboundPacket = new ServerSendHeroStoragePacket(hero.Backpack, packet.StorageType);
            client.Send(outboundPacket);
        }
 private void PlayerOnBackpackChanged(Player player)
 {
     var inventoryUpdate = new ServerSendHeroStoragePacket(player.Backpack, StorageType.Inventory);
     player.Client.Send(inventoryUpdate);
 }