Esempio n. 1
0
        public static void InteractItem(PlayerSocket socket, Packet packet)
        {
            byte    interactionType = packet.ReadByte();
            IMobile player          = socket.Mobile;

            switch (interactionType)
            {
            case 0x42:    //Drop Item
                byte dropInvID = packet.ReadByte();
                player.DropItem(dropInvID);
                break;

            case 0x43:    //Use Inventory Item from location
                byte useInvID = packet.ReadByte();
                player.UseItem(useInvID);
                break;

            case 0x44:    //Unequip Item
                byte equipSlotID = packet.ReadByte();
                player.UnequipItem(equipSlotID);
                break;

            case 0x45:    //Drop Item x Amount
                byte dropInvID2      = (byte)packet.ReadByte();
                int  largeDropAmount = (byte)packet.ReadByte();

                int dropInvIDAmount = packet.ReadInt16();
                dropInvIDAmount += largeDropAmount * 32768;
                player.DropItem(dropInvID2, dropInvIDAmount);
                break;

            case 0x59:    //move Item
                byte equipFromSlotID = (byte)packet.ReadByte();
                byte equipToSlotID   = (byte)packet.ReadByte();
                player.MoveItem(equipFromSlotID, equipToSlotID);
                break;

            case 0x5A:    //Pickup Item from ground
                int x = packet.ReadInt16();
                int y = packet.ReadInt16();
                player.PickupItem(new Point3D(x, y, socket.Mobile.Z));
                break;

            default:    //Unhandled
                Console.WriteLine("Client: {0}: Unhandled packet 0x{1:X2}", socket, interactionType);
                break;
            }
        }