diff --git a/src/Managers/NetworkManager.cs b/src/Managers/NetworkManager.cs index 86b2b5a..662902f 100644 --- a/src/Managers/NetworkManager.cs +++ b/src/Managers/NetworkManager.cs @@ -276,7 +276,7 @@ internal static class NetworkManager if (innerNetObject is PlayerControl player && player != null) { - if (rpcCall == (byte)RpcCalls.SetNamePlateStr) + if (rpcCall == (byte)RPC.CUSTOM_RPC_CALL) { RPC.HandleCustomRPCPacked(player, reader); } diff --git a/src/Modules/AntiCheat/BetterAntiCheat.cs b/src/Modules/AntiCheat/BetterAntiCheat.cs index af289c3..141f14b 100644 --- a/src/Modules/AntiCheat/BetterAntiCheat.cs +++ b/src/Modules/AntiCheat/BetterAntiCheat.cs @@ -7,7 +7,6 @@ using BetterAmongUs.Managers; using BetterAmongUs.Modules.AntiCheat.RPCHandlers.NetObjectHandlers; using BetterAmongUs.Modules.Support; using BetterAmongUs.Mono.Extended; -using BetterAmongUs.Network; using BetterAmongUs.Patches.Gameplay.UI.Settings; using Hazel; @@ -153,15 +152,6 @@ internal static class BetterAntiCheat return false; } - if (callId == (byte)RpcCalls.SetNamePlateStr) - { - if (RPC.IsPackedCustomRpc(reader)) - { - reader.Recycle(); - return false; - } - } - if (!player.IsHost()) { if (callId is (byte)RpcCalls.SetTasks diff --git a/src/Network/RPC.cs b/src/Network/RPC.cs index 6d6ab5a..737c359 100644 --- a/src/Network/RPC.cs +++ b/src/Network/RPC.cs @@ -1,5 +1,4 @@ -using AmongUs.Data; -using BetterAmongUs.Enums; +using BetterAmongUs.Enums; using BetterAmongUs.Helpers; using BetterAmongUs.Modules; using BetterAmongUs.Mono.Extended; @@ -9,11 +8,14 @@ namespace BetterAmongUs.Network; /// /// Handles custom RPC (Remote Procedure Call) messages for BetterAmongUs. -/// This class provides methods for sending and receiving custom RPC messages -/// packed within vanilla RPC calls to maintain compatibility with vanilla servers. /// internal static class RPC { + /// + /// The base rpc call used for custom RPC messages. + /// + internal const RpcCalls CUSTOM_RPC_CALL = RpcCalls.CancelPet; + /// /// The flag string used to identify custom RPC messages packed within vanilla RPC calls. /// @@ -29,11 +31,8 @@ internal static class RPC /// The specific client ID to target, or -1 to broadcast to all clients. internal static void SendCustomRpcPacked(CustomRPC customRPC, Action action, int targetClientId = -1) { - AmongUsClient.Instance.SendRpcImmediately(PlayerControl.LocalPlayer.NetId, RpcCalls.SetNamePlateStr, SendOption.Reliable, writer => + AmongUsClient.Instance.SendRpcImmediately(PlayerControl.LocalPlayer.NetId, CUSTOM_RPC_CALL, SendOption.Reliable, writer => { - writer.Write(DataManager.Player.Customization.NamePlate); - writer.Write(PlayerControl.LocalPlayer.GetNextRpcSequenceId(RpcCalls.SetNamePlateStr)); - writer.Write(CUSTOM_RPC_FLAG); // Flag to check if its a rpc packed into SetNamePlateStr writer.Write((byte)customRPC); action(writer); @@ -53,9 +52,6 @@ internal static class RPC MessageReader reader = MessageReader.Get(oldReader); - _ = reader.ReadString(); - _ = reader.ReadByte(); - if (IsPackedCustomRpc(reader)) { CustomRPC customRPC = (CustomRPC)reader.ReadByte();