public static void EncodedCommand(NetState state, CircularBufferReader reader) { var e = World.FindEntity(reader.ReadUInt32()); int packetId = reader.ReadUInt16(); var ph = IncomingPackets.GetEncodedHandler(packetId); if (ph == null) { reader.Trace(state); return; } if (ph.Ingame && state.Mobile == null) { state.WriteConsole( "Sent ingame packet (0xD7x{0:X2}) before having been attached to a mobile", packetId ); state.Dispose(); } else if (ph.Ingame && state.Mobile.Deleted) { state.Dispose(); } else { ph.OnReceive(state, e, new EncodedReader(reader)); } }
public static void EncodedCommand(NetState state, CircularBufferReader reader, ref int packetLength) { var e = World.FindEntity((Serial)reader.ReadUInt32()); int packetId = reader.ReadUInt16(); var ph = IncomingPackets.GetEncodedHandler(packetId); if (ph == null) { reader.Trace(state); return; } if (ph.Ingame && state.Mobile == null) { state.LogInfo( "Sent in-game packet (0xD7x{0:X2}) before being attached to a mobile", packetId ); state.Disconnect($"Sent in-game packet (0xD7x{packetId:X2}) before being attached to a mobile."); } else if (ph.Ingame && state.Mobile.Deleted) { state.Disconnect($"Sent in-game packet(0xD7x{packetId:X2}) but mobile is deleted."); } else { ph.OnReceive(state, e, new EncodedReader(reader)); } }