Beispiel #1
0
        public static void DropItem(Client client, PacketIn packet)
        {
            int        IID   = (int)packet.ReadUInt32();
            PlayerItem pItem = PlayerItem.GetItem(IID);

            int quantity = (int)packet.ReadUInt32();

            //check if the item exists
            if (pItem == null)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            //check if player owns the item
            if (pItem.PID != client.Character.Player.PID)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code);

            handler.Drop(pItem, quantity, client.Character, client);
        }