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); }
public static void CreatePlayer(Client client, PacketIn packet) { string name = packet.ReadString(); byte type = packet.ReadByte(); byte strength = packet.ReadByte(); byte health = packet.ReadByte(); byte intelligence = packet.ReadByte(); byte wisdom = packet.ReadByte(); byte agility = packet.ReadByte(); byte face = packet.ReadByte(); byte hair = packet.ReadByte(); if ((strength + health + intelligence + wisdom + agility) != 5) { client.Send(new Packets.CharacterCreationError(Packets.CHARACTER_CREATION_ERROR.SHARING_POINTS_ERROR)); Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails); return; } //check if name is valid if (!Utilities.IsAlnum(name)) { client.Send(new Packets.CharacterError(Packets.CHARACTER_ERROR.INVALID_CHARS)); return; } //check if player name is taken if (Player.GetPlayer(name) != null) { client.Send(new Packets.CharacterCreationError(Packets.CHARACTER_CREATION_ERROR.NAME_TAKEN)); return; } int playerId = client.CreatePlayer(name, type, strength, health, intelligence, wisdom, agility, face, hair); client.SendPlayerList(); }