Decompiled source of AntiCheat v0.7.8
BepInEx/plugins/AntiCheat.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using AntiCheat.Lang; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Netcode.Transports.Facepunch; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AntiCheat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AntiCheat")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4614e6b0-a685-4525-ba01-a3e667af9a8f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace AntiCheat { [BepInPlugin("AntiCheat", "AntiCheat", "0.7.8")] public class AntiCheatPlugin : BaseUnityPlugin { public enum Language { 简体中文, English, Korean } public enum MessageType { GUI, HostChat, PublicChat } public const string Version = "0.7.8"; public static ManualLogSource ManualLog; public static ConfigEntry<Language> LanguageConfig; public static ConfigEntry<bool> Log; public static GameObject ui; public static ConfigEntry<bool> Shovel; public static ConfigEntry<bool> Shovel2; public static ConfigEntry<bool> Shovel3; public static ConfigEntry<string> Prefix; public static ConfigEntry<string> PlayerJoin; public static ConfigEntry<bool> ShipConfig; public static ConfigEntry<int> ShipConfig2; public static ConfigEntry<string> ShipConfig3; public static ConfigEntry<int> ShipConfig4; public static ConfigEntry<bool> Ship_Kick; public static ConfigEntry<bool> ShipConfig6; public static ConfigEntry<bool> ShipBuild; public static ConfigEntry<bool> ShipBuild2; public static ConfigEntry<bool> ShipLight; public static ConfigEntry<bool> ShipTerminal; public static ConfigEntry<bool> ShipTerminal2; public static ConfigEntry<bool> DespawnItem; public static ConfigEntry<bool> DespawnItem2; public static ConfigEntry<bool> ChatReal; public static ConfigEntry<int> ChatReal_Cooldown; public static ConfigEntry<bool> ChatReal2; public static ConfigEntry<bool> Mask; public static ConfigEntry<bool> Mask2; public static ConfigEntry<bool> Gift; public static ConfigEntry<bool> Gift2; public static ConfigEntry<bool> Invisibility; public static ConfigEntry<bool> Invisibility2; public static ConfigEntry<bool> GrabObject; public static ConfigEntry<bool> GrabObject_MoreSlot; public static ConfigEntry<bool> GrabObject_TwoHand; public static ConfigEntry<bool> GrabObject_BeltBag; public static ConfigEntry<bool> GrabObject_Kick; public static ConfigEntry<bool> Boss; public static ConfigEntry<bool> Boss2; public static ConfigEntry<bool> Landmine; public static ConfigEntry<bool> Landmine2; public static ConfigEntry<bool> PlayerCarryWeight; public static ConfigEntry<bool> PlayerCarryWeight2; public static ConfigEntry<bool> PlayerCarryWeight3; public static ConfigEntry<bool> Turret; public static ConfigEntry<bool> Turret2; public static ConfigEntry<bool> Enemy; public static ConfigEntry<bool> KillEnemy; public static ConfigEntry<bool> KillEnemy2; public static ConfigEntry<bool> SpawnWebTrap; public static ConfigEntry<bool> SpawnWebTrap2; public static ConfigEntry<bool> Map; public static ConfigEntry<bool> Map2; public static ConfigEntry<bool> Jetpack; public static ConfigEntry<bool> Jetpack2; public static ConfigEntry<bool> ItemCooldown; public static ConfigEntry<bool> ItemCooldown2; public static ConfigEntry<bool> InfiniteAmmo; public static ConfigEntry<bool> InfiniteAmmo2; public static ConfigEntry<bool> FreeBuy; public static ConfigEntry<bool> FreeBuy2; public static ConfigEntry<bool> RemoteTerminal; public static ConfigEntry<bool> RemoteTerminal2; public static ConfigEntry<bool> Nameless; public static ConfigEntry<bool> Nameless2; public static ConfigEntry<int> RPCReport_Delay; public static ConfigEntry<bool> RPCReport_Hit; public static ConfigEntry<bool> RPCReport_KillPlayer; public static ConfigEntry<bool> RPCReport_Kick; public static ConfigEntry<bool> Health_Recover; public static ConfigEntry<bool> Health_Kick; public static ConfigEntry<MessageType> DetectedMessageType; public static bool Gui; public Dictionary<string, bool> Tabs { get; set; } public static void String(string text, GUIStyle style, float yPos) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) float num = Screen.width; Vector2 val = style.CalcSize(new GUIContent(text)); float num2 = (num - val.x) / 2f; GUI.Label(new Rect(num2, yPos, val.x, val.y), text, style); } [DllImport("User32.dll")] public static extern short GetAsyncKeyState(int key); public void Update() { if ((!((Object)(object)StartOfRound.Instance != (Object)null) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) && UnityInput.Current.GetKeyDown((KeyCode)291)) { Gui = !Gui; } } private void Awake() { ManualLog = ((BaseUnityPlugin)this).Logger; Tabs = new Dictionary<string, bool>(); Tabs.Add("模组配置", value: false); FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(); FileInfo fileInfo = new FileInfo(((BaseUnityPlugin)this).Config.ConfigFilePath); fileSystemWatcher.Path = fileInfo.DirectoryName; fileSystemWatcher.Filter = fileInfo.Name; fileSystemWatcher.Changed += Watcher_Changed; LoadConfig(); fileSystemWatcher.EnableRaisingEvents = true; Harmony.CreateAndPatchAll(typeof(Patch), (string)null); } private void Watcher_Changed(object sender, FileSystemEventArgs e) { ManualLog.LogInfo((object)"Reload Config"); LoadConfig(); } private void LoadConfig() { Language language = Language.简体中文; if (!File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath)) { string text = CultureInfo.CurrentCulture.Name.ToLower(); if (!text.StartsWith("zh-")) { language = Language.English; } } LanguageConfig = ((BaseUnityPlugin)this).Config.Bind<Language>("LanguageSetting", "Language", language, string.Join(",", LocalizationManager.Languages.Select((KeyValuePair<string, Type> x) => x.Key))); LocalizationManager.SetLanguage(LanguageConfig.Value.ToString()); Prefix = ((BaseUnityPlugin)this).Config.Bind<string>("ServerNameSetting", "Prefix", "AC", LocalizationManager.GetString("config_Prefix")); ShipConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipSetting", "StartGameOnlyHost", true, LocalizationManager.GetString("config_ShipSetting")); Log = ((BaseUnityPlugin)this).Config.Bind<bool>("LogSetting", "Log", true, LocalizationManager.GetString("config_Log")); Ship_Kick = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipSetting", "Kick", false, LocalizationManager.GetString("config_ShipConfig5")); ShipConfig2 = ((BaseUnityPlugin)this).Config.Bind<int>("ShipSetting", "StartGamePlayerCount", 8, LocalizationManager.GetString("config_ShipConfig2")); ShipConfig3 = ((BaseUnityPlugin)this).Config.Bind<string>("ShipSetting", "EndGamePlayerTime", "14:00", LocalizationManager.GetString("config_ShipConfig3")); ShipConfig4 = ((BaseUnityPlugin)this).Config.Bind<int>("ShipSetting", "EndGamePlayerCount", 50, LocalizationManager.GetString("config_ShipConfig4")); ShipConfig6 = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipSetting", "OnlyOneVote", true, LocalizationManager.GetString("config_ShipConfig6")); RPCReport_Delay = ((BaseUnityPlugin)this).Config.Bind<int>("RPCReportSetting", "Delay", 1000, LocalizationManager.GetString("config_RPCReport_Delay")); RPCReport_Hit = ((BaseUnityPlugin)this).Config.Bind<bool>("RPCReportSetting", "Hit", true, LocalizationManager.GetString("config_RPCReport_Hit")); RPCReport_KillPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("RPCReportSetting", "KillPlayer", true, LocalizationManager.GetString("config_RPCReport_KillPlayer")); RPCReport_Kick = ((BaseUnityPlugin)this).Config.Bind<bool>("RPCReportSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Health_Recover = ((BaseUnityPlugin)this).Config.Bind<bool>("HealthSetting", "Recover", true, LocalizationManager.GetString("config_Health_Recover")); Health_Kick = ((BaseUnityPlugin)this).Config.Bind<bool>("HealthSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); ShipBuild = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipBuildSetting", "Enable", true, LocalizationManager.GetString("config_ShipBuild")); ShipBuild2 = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipBuildSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); ItemCooldown = ((BaseUnityPlugin)this).Config.Bind<bool>("ItemCooldownSetting", "Enable", true, LocalizationManager.GetString("config_ItemCooldown")); ItemCooldown2 = ((BaseUnityPlugin)this).Config.Bind<bool>("ItemCooldownSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); ShipLight = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipLightSettings", "Enable", true, LocalizationManager.GetString("config_ShipLight")); ShipTerminal = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipTerminalSettings", "Enable", true, LocalizationManager.GetString("config_ShipTerminal")); ShipTerminal2 = ((BaseUnityPlugin)this).Config.Bind<bool>("ShipTerminalSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); DetectedMessageType = ((BaseUnityPlugin)this).Config.Bind<MessageType>("DetectedMessageType", "Type", MessageType.PublicChat, LocalizationManager.GetString("config_DetectedMessageType")); DespawnItem = ((BaseUnityPlugin)this).Config.Bind<bool>("DespawnItemSettings", "Enable", true, LocalizationManager.GetString("config_DespawnItem")); DespawnItem2 = ((BaseUnityPlugin)this).Config.Bind<bool>("DespawnItemSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); ChatReal = ((BaseUnityPlugin)this).Config.Bind<bool>("ChatRealSettings", "Enable", true, LocalizationManager.GetString("config_ChatReal")); ChatReal_Cooldown = ((BaseUnityPlugin)this).Config.Bind<int>("ChatRealSettings", "Cooldown", 200, LocalizationManager.GetString("config_ChatReal_Cooldown")); ChatReal2 = ((BaseUnityPlugin)this).Config.Bind<bool>("ChatRealSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Mask = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskSettings", "Enable", true, LocalizationManager.GetString("config_Mask")); Mask2 = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Gift = ((BaseUnityPlugin)this).Config.Bind<bool>("GiftSettings", "Enable", true, LocalizationManager.GetString("config_Gift")); Gift2 = ((BaseUnityPlugin)this).Config.Bind<bool>("GiftSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Turret = ((BaseUnityPlugin)this).Config.Bind<bool>("TurretSettings", "Enable", true, LocalizationManager.GetString("config_Turret")); Turret2 = ((BaseUnityPlugin)this).Config.Bind<bool>("TurretSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); InfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("InfiniteAmmoSettings", "Enable", true, LocalizationManager.GetString("config_InfiniteAmmo")); InfiniteAmmo2 = ((BaseUnityPlugin)this).Config.Bind<bool>("InfiniteAmmoSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Invisibility = ((BaseUnityPlugin)this).Config.Bind<bool>("InvisibilitySettings", "Enable", true, LocalizationManager.GetString("config_Invisibility")); Invisibility2 = ((BaseUnityPlugin)this).Config.Bind<bool>("InvisibilitySettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Boss = ((BaseUnityPlugin)this).Config.Bind<bool>("BossSetting", "Enable", true, LocalizationManager.GetString("config_Boss")); Boss2 = ((BaseUnityPlugin)this).Config.Bind<bool>("BossSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Jetpack = ((BaseUnityPlugin)this).Config.Bind<bool>("JetpackSetting", "Enable", true, LocalizationManager.GetString("config_Jetpack")); Jetpack2 = ((BaseUnityPlugin)this).Config.Bind<bool>("JetpackSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Landmine = ((BaseUnityPlugin)this).Config.Bind<bool>("LandmineSetting", "Enable", true, LocalizationManager.GetString("config_Landmine")); Landmine2 = ((BaseUnityPlugin)this).Config.Bind<bool>("LandmineSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); SpawnWebTrap = ((BaseUnityPlugin)this).Config.Bind<bool>("SpawnWebTrapSetting", "Enable", true, LocalizationManager.GetString("config_SpawnWebTrap")); SpawnWebTrap2 = ((BaseUnityPlugin)this).Config.Bind<bool>("SpawnWebTrapSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Enemy = ((BaseUnityPlugin)this).Config.Bind<bool>("EnemySetting", "Enable", true, LocalizationManager.GetString("config_Enemy")); KillEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("KillEnemySetting", "Enable", true, LocalizationManager.GetString("config_KillEnemy")); KillEnemy2 = ((BaseUnityPlugin)this).Config.Bind<bool>("KillEnemySetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Map = ((BaseUnityPlugin)this).Config.Bind<bool>("MapSetting", "Enable", true, LocalizationManager.GetString("config_Map")); Map2 = ((BaseUnityPlugin)this).Config.Bind<bool>("MapSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); GrabObject = ((BaseUnityPlugin)this).Config.Bind<bool>("GrabObjectSetting", "Enable", true, LocalizationManager.GetString("config_GrabObject")); GrabObject_MoreSlot = ((BaseUnityPlugin)this).Config.Bind<bool>("GrabObjectSetting", "MoreSlot", true, LocalizationManager.GetString("config_GrabObject_MoreSlot")); GrabObject_TwoHand = ((BaseUnityPlugin)this).Config.Bind<bool>("GrabObjectSetting", "TwoHand", true, LocalizationManager.GetString("config_GrabObject_TwoHand")); GrabObject_BeltBag = ((BaseUnityPlugin)this).Config.Bind<bool>("GrabObjectSetting", "BeltBag", true, LocalizationManager.GetString("config_GrabObject_BeltBag")); GrabObject_Kick = ((BaseUnityPlugin)this).Config.Bind<bool>("GrabObjectSetting", "Kick", false, LocalizationManager.GetString("config_Kick")); Shovel = ((BaseUnityPlugin)this).Config.Bind<bool>("ShovelSettings", "Enable", true, LocalizationManager.GetString("config_Shovel")); Shovel3 = ((BaseUnityPlugin)this).Config.Bind<bool>("ShovelSettings", "EmptyHand", false, LocalizationManager.GetString("config_Shovel2")); Shovel2 = ((BaseUnityPlugin)this).Config.Bind<bool>("ShovelSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); Nameless = ((BaseUnityPlugin)this).Config.Bind<bool>("NamelessSettings", "Enable", true, LocalizationManager.GetString("config_Nameless")); Nameless2 = ((BaseUnityPlugin)this).Config.Bind<bool>("NamelessSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); FreeBuy = ((BaseUnityPlugin)this).Config.Bind<bool>("FreeBuySettings", "Enable", true, LocalizationManager.GetString("config_FreeBuy")); FreeBuy2 = ((BaseUnityPlugin)this).Config.Bind<bool>("FreeBuySettings", "Kick", false, LocalizationManager.GetString("config_Kick")); RemoteTerminal = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoteTerminalSettings", "Enable", true, LocalizationManager.GetString("config_RemoteTerminal")); RemoteTerminal2 = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoteTerminalSettings", "Kick", false, LocalizationManager.GetString("config_Kick")); PlayerJoin = ((BaseUnityPlugin)this).Config.Bind<string>("MsgSettings", "PlayerJoinShip", LocalizationManager.GetString("msg_wlc_player"), LocalizationManager.GetString("msg_wlc_player")); ManualLog.LogInfo((object)(LocalizationManager.GetString("log_load") ?? "")); } } public static class LocalizationManager { private static ResourceManager resourceManager; public static Dictionary<string, Type> Languages = new Dictionary<string, Type> { { "简体中文", typeof(zh_CN) }, { "English", typeof(en_US) }, { "Korean", typeof(ko) } }; public static void SetLanguage(string language) { if (Languages.ContainsKey(language)) { resourceManager = new ResourceManager(Languages[language]); } else { resourceManager = new ResourceManager(typeof(zh_CN)); } } public static string TryGetString(string prefix, string key) { try { string @string = resourceManager.GetString(prefix + key); return (@string == null) ? key : @string.TrimEnd(Array.Empty<char>()); } catch (Exception) { return key; } } public static string GetString(string key, Dictionary<string, string> replaces) { try { string text = resourceManager.GetString(key); foreach (KeyValuePair<string, string> replace in replaces) { text = text.Replace(replace.Key, replace.Value); } return text; } catch (Exception) { return "Missing translation for key: " + key; } } public static string GetString(string key) { try { string @string = resourceManager.GetString(key); return (@string == null) ? string.Empty : @string; } catch (Exception) { return "Missing translation for key: " + key; } } } public static class Patch { public class HitData { public int EnemyInstanceId { get; set; } public int force { get; set; } public List<ulong> CalledClient { get; set; } } public static List<ulong> jcs = new List<ulong>(); public static List<long> zdcd = new List<long>(); public static List<long> dgcd = new List<long>(); public static Dictionary<ulong, List<string>> czcd = new Dictionary<ulong, List<string>>(); public static Dictionary<ulong, List<string>> sdqcd = new Dictionary<ulong, List<string>>(); public static Dictionary<ulong, bool> ChatCooldowns = new Dictionary<ulong, bool>(); public static Dictionary<int, Dictionary<ulong, List<DateTime>>> chcs = new Dictionary<int, Dictionary<ulong, List<DateTime>>>(); public static int Money = -1; public static List<HitData> bypassHit = new List<HitData>(); public static List<HitData> bypassKill = new List<HitData>(); private static string lastMessage = string.Empty; public static Dictionary<uint, ulong> ConnectionIdtoSteamIdMap { get; set; } = new Dictionary<uint, ulong>(); public static List<long> mjs { get; set; } = new List<long>(); public static int count { get; set; } = 0; public static List<long> lhs { get; set; } = new List<long>(); public static List<int> landMines { get; set; } public static Dictionary<string, List<ulong>> rpcs { get; set; } = new Dictionary<string, List<ulong>>(); public static ulong lastClientId { get; set; } public static PlayerControllerB lastDriver { get; set; } public static bool bypass { get; set; } public static PlayerControllerB whoUseTerminal { get; set; } public static void LogInfo(string info) { if (AntiCheatPlugin.Log.Value) { AntiCheatPlugin.ManualLog.LogInfo((object)("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "] " + info)); } } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_4121569671")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_4121569671(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (rpcs.ContainsKey("KillPlayer")) { rpcs["KillPlayer"].Remove(p.actualClientId); } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); ((FastBufferReader)(ref reader)).Seek(0); if (num2 == 10) { bypass = true; string @string = LocalizationManager.GetString("msg_behind_player", new Dictionary<string, string> { { "{player}", p.playerUsername } }); LogInfo(@string); HUDManager.Instance.AddTextToChatOnServer(@string, -1); bypass = false; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_638895557")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_638895557(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if (Check(rpcParams, out var p)) { int damageAmount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damageAmount); Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call PlayerControllerB.DamagePlayerFromOtherClientServerRpc|damageAmount:{damageAmount}|hitDirection:{val}|playerWhoHit:{num}"); PlayerControllerB p2 = (PlayerControllerB)target; return CheckDamage(p2, p, ref damageAmount); } if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_2585603452")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2585603452(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { LogInfo($"{p.playerUsername} call PlayerControllerB.HealServerRpc|health:{p.health}|newHealth:20"); p.health = 20; } else if ((Object)(object)p == (Object)null) { return false; } return true; } private static bool CheckDamage(PlayerControllerB p2, PlayerControllerB p, ref int damageAmount) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (damageAmount == 0) { return true; } LogInfo($"{p.playerUsername} hit {p2.playerUsername} damageAmount:{damageAmount}|p2:{p2.playerUsername}"); try { if (AntiCheatPlugin.Shovel.Value) { float num = Vector3.Distance(((Component)p).transform.position, ((Component)p2).transform.position); GrabbableObject val = p.ItemSlots[p.currentItemSlot]; string playerUsername = p.playerUsername; if (jcs.Contains(p.playerSteamId)) { damageAmount = 0; } else if (damageAmount != 20 && (Object)(object)val != (Object)null && (isShovel(val) || isKnife(val))) { if (!jcs.Contains(p.playerSteamId)) { ShowMessage(LocalizationManager.GetString("msg_Shovel", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() }, { "{item}", isShovel(val) ? LocalizationManager.GetString("Item_Shovel") : LocalizationManager.GetString("Item_Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheatPlugin.Shovel2.Value) { KickPlayer(p); } } damageAmount = 0; } else if (num > 11f && (Object)(object)val != (Object)null && (isShovel(val) || isKnife(val))) { if (p2.isPlayerDead) { return true; } if (!jcs.Contains(p.playerSteamId)) { ShowMessage(LocalizationManager.GetString("msg_Shovel2", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{distance}", num.ToString() }, { "{damageAmount}", damageAmount.ToString() }, { "{item}", isShovel(val) ? LocalizationManager.GetString("Item_Shovel") : LocalizationManager.GetString("Item_Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheatPlugin.Shovel2.Value) { KickPlayer(p); } } damageAmount = 0; } else if ((Object)(object)val == (Object)null || (!isGun(val) && !isShovel(val) && !isKnife(val))) { LogInfo($"currentItemSlot:{p.currentItemSlot}"); LogInfo($"currentlyHeldObjectServer:{p.currentlyHeldObjectServer}"); LogInfo($"obj:{val}"); if (!jcs.Contains(p.playerSteamId)) { if (AntiCheatPlugin.Shovel3.Value && (damageAmount == 10 || damageAmount == 20 || damageAmount == 30 || damageAmount == 100)) { LogInfo(LocalizationManager.GetString("msg_Shovel3", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() } })); return true; } ShowMessage(LocalizationManager.GetString("msg_Shovel3", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() } })); jcs.Add(p.playerSteamId); if (AntiCheatPlugin.Shovel2.Value) { KickPlayer(p); } damageAmount = 0; } } if (damageAmount == 0) { return false; } return true; } } catch (Exception ex) { LogInfo(ex.ToString() ?? ""); } return true; } public static bool isGun(GrabbableObject item) { return item is ShotgunItem; } public static bool isShovel(GrabbableObject item) { return item is Shovel; } public static bool isKnife(GrabbableObject item) { return item is KnifeItem; } public static bool isJetpack(GrabbableObject item) { return item is JetpackItem; } [HarmonyPatch(typeof(StartOfRound), "StartTrackingAllPlayerVoices")] [HarmonyPostfix] [HarmonyWrapSafe] public static void StartTrackingAllPlayerVoices() { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerControlled) { continue; } string playerUsername = val.playerUsername; if (playerUsername == "Player #0") { continue; } if (StartOfRound.Instance.KickedClientIds.Contains(val.playerSteamId)) { KickPlayer(val); return; } LogInfo(playerUsername); if ((Regex.IsMatch(playerUsername, "Nameless\\d*") || Regex.IsMatch(playerUsername, "Unknown\\d*") || Regex.IsMatch(playerUsername, "Player #\\d*")) && AntiCheatPlugin.Nameless.Value) { ShowMessage(LocalizationManager.GetString("msg_Nameless")); if (AntiCheatPlugin.Nameless2.Value) { KickPlayer(val, canJoin: true, "Nameless"); } } } PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts.OrderByDescending((PlayerControllerB x) => x.actualClientId).FirstOrDefault(); if (val2.actualClientId != lastClientId) { if (val2.isPlayerControlled && val2.playerSteamId == 0) { KickPlayer(val2); } else if (val2.isPlayerControlled) { bypass = true; string text = AntiCheatPlugin.PlayerJoin.Value.Replace("{player}", val2.playerUsername); LogInfo(text); HUDManager.Instance.AddTextToChatOnServer(text, -1); lastClientId = val2.actualClientId; bypass = false; } } } [HarmonyPatch(typeof(HUDManager), "__rpc_handler_1944155956")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1944155956(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { string @string = LocalizationManager.GetString("msg_snc_player", new Dictionary<string, string> { { "{player}", p.playerUsername } }); LogInfo(@string); } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyMemberJoined")] [HarmonyPostfix] [HarmonyWrapSafe] public static void SteamMatchmaking_OnLobbyMemberJoined() { if (!((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null) && ((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { LogInfo($"SetMoney:{Money}"); Money = Object.FindObjectOfType<Terminal>().groupCredits; } } [HarmonyPatch(typeof(StartOfRound), "EndOfGame")] [HarmonyPostfix] [HarmonyWrapSafe] public static void EndOfGame() { jcs = new List<ulong>(); chcs = new Dictionary<int, Dictionary<ulong, List<DateTime>>>(); if (rpcs.ContainsKey("Hit")) { rpcs["Hit"] = new List<ulong>(); } if (rpcs.ContainsKey("KillPlayer")) { rpcs["KillPlayer"] = new List<ulong>(); } } [HarmonyPatch(typeof(StartOfRound), "__rpc_handler_1134466287")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1134466287(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { LogInfo(p.playerUsername + "|StartOfRound.ChangeLevelServerRpc"); if (AntiCheatPlugin.RemoteTerminal.Value && !CheckRemoteTerminal(p)) { return false; } if (AntiCheatPlugin.FreeBuy.Value) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); ((FastBufferReader)(ref reader)).Seek(0); if (num2 > Money || Money < 0) { ShowMessage(LocalizationManager.GetString("msg_FreeBuy_SetMoney", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{Money}", (num2 - Money).ToString() } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } if (num > StartOfRound.Instance.levels.Length) { LogInfo(p.playerUsername + "|ChangeLevelServerRpc|levelID > StartOfRound.Instance.levels.Length"); return false; } Terminal val = Object.FindObjectOfType<Terminal>(); TerminalKeyword val2 = val.terminalNodes.allKeywords[26]; int itemCost = val2.compatibleNouns[num].result.itemCost; if (itemCost == 0 && val2.compatibleNouns[StartOfRound.Instance.currentLevelID].result.itemCost != 0) { ShowMessage(LocalizationManager.GetString("msg_FreeBuy_Level", new Dictionary<string, string> { { "{player}", p.playerUsername } })); return false; } LogInfo($"{p.playerUsername}|ChangeLevelServerRpc|levelID:{num}|{itemCost}"); if (itemCost == 0) { return true; } int num3 = Money - itemCost; if (num3 != num2 || Money == 0) { LogInfo($"{p.playerUsername}|ChangeLevelServerRpc|levelID:{num}|ExpectedValue:{num3.ToString()}|newGroupCreditsAmount:{num2}"); ShowMessage(LocalizationManager.GetString("msg_FreeBuy_Level", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(StartOfRound), "__rpc_handler_3953483456")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3953483456(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.RemoteTerminal.Value && !CheckRemoteTerminal(p)) { return false; } if (AntiCheatPlugin.FreeBuy.Value) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"__rpc_handler_3953483456|newGroupCreditsAmount:{num2}"); if (Money == num2 || Money == 0) { LogInfo($"Money:{Money}|newGroupCreditsAmount:{num2}"); ShowMessage(LocalizationManager.GetString("msg_FreeBuy_unlockable", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } if (num2 > Money || Money < 0) { ShowMessage(LocalizationManager.GetString("msg_FreeBuy_SetMoney", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{Money}", (num2 - Money).ToString() } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(StartOfRound), "BuyShipUnlockableClientRpc")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool BuyShipUnlockableClientRpc(int newGroupCreditsAmount, int unlockableID = -1) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } Money = newGroupCreditsAmount; return true; } [HarmonyPatch(typeof(Terminal), "__rpc_handler_4003509079")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_4003509079(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.RemoteTerminal.Value && !CheckRemoteTerminal(p)) { return false; } if (AntiCheatPlugin.FreeBuy.Value) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); int[] values = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref values, default(ForPrimitives)); } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo("__rpc_handler_4003509079|boughtItems:" + string.Join(",", values) + "|newGroupCredits:" + num + "|Money:" + Money); if (Money == num || Money == 0) { ShowMessage(LocalizationManager.GetString("msg_FreeBuy_Item", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } if (num > Money || Money < 0) { ShowMessage(LocalizationManager.GetString("msg_FreeBuy_SetMoney", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{Money}", (num - Money).ToString() } })); if (AntiCheatPlugin.FreeBuy2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(TimeOfDay), "SyncNewProfitQuotaClientRpc")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SyncNewProfitQuotaClientRpc(int newProfitQuota, int overtimeBonus, int fulfilledQuota) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } Terminal val = Object.FindObjectOfType<Terminal>(); Money = Mathf.Clamp(val.groupCredits + overtimeBonus, val.groupCredits, 100000000); return true; } [HarmonyPatch(typeof(Terminal), "SyncGroupCreditsClientRpc")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SyncGroupCreditsClientRpc(int newGroupCredits, int numItemsInShip) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } Money = newGroupCredits; return true; } [HarmonyPatch(typeof(StartOfRound), "ChangeLevelClientRpc")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool ChangeLevelClientRpc(int levelID, int newGroupCreditsAmount) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } Money = newGroupCreditsAmount; return true; } [HarmonyWrapSafe] [HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")] [HarmonyPrefix] public static bool BeginUsingTerminal(Terminal __instance) { if (!((NetworkBehaviour)StartOfRound.Instance).IsHost) { return true; } Money = __instance.groupCredits; LogInfo($"SetMoney:{Money}"); return true; } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool DamagePlayer(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3)) { return true; } [HarmonyPatch(typeof(PlayerControllerB), "IHittable.Hit")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool Hit(PlayerControllerB __instance, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX = false, int hitID = -1) { if (!rpcs.ContainsKey("Hit")) { rpcs.Add("Hit", new List<ulong>()); } if (__instance.AllowPlayerDeath()) { rpcs["Hit"].Add(__instance.actualClientId); LogInfo($"PlayerControllerB.Hit|{__instance.playerUsername}|force:{force}|playerWhoHit:{playerWhoHit.playerUsername}|playHitSFX:{playHitSFX}|hitID:{hitID}"); ((MonoBehaviour)__instance).StartCoroutine(CheckRpc(__instance, "Hit")); } return true; } public static IEnumerator CheckRpc(PlayerControllerB __instance, string RPC) { if ((RPC == "Hit" && !AntiCheatPlugin.RPCReport_Hit.Value) || (RPC == "KillPlayer" && !AntiCheatPlugin.RPCReport_KillPlayer.Value)) { yield break; } yield return (object)new WaitForSeconds((float)AntiCheatPlugin.RPCReport_Delay.Value); if (!__instance.isPlayerDead && rpcs[RPC].Contains(__instance.actualClientId)) { rpcs[RPC].Remove(__instance.actualClientId); ShowMessage(LocalizationManager.GetString("msg_RPCReport", new Dictionary<string, string> { { "{player}", __instance.playerUsername }, { "{RPC}", RPC } })); if (AntiCheatPlugin.RPCReport_Kick.Value) { KickPlayer(__instance); } } } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_1084949295")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1084949295(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { if (rpcs.ContainsKey("Hit")) { rpcs["Hit"].Remove(p.actualClientId); } int damageAmount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damageAmount); int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call PlayerControllerB.DamagePlayerServerRpc|damageNumber:{damageAmount}|newHealthAmount:{num}"); PlayerControllerB val = (PlayerControllerB)target; if ((Object)(object)val == (Object)(object)p) { if (AntiCheatPlugin.Health_Recover.Value && damageAmount < 0) { string @string = LocalizationManager.GetString("msg_Health_Recover", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{hp}", (damageAmount * -1).ToString() } }); ShowMessage(@string); if (AntiCheatPlugin.Health_Kick.Value) { KickPlayer(p); } return false; } return true; } return CheckDamage(val, p, ref damageAmount); } if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_2081148948")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2081148948(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (Check(rpcParams, out var p)) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call EnemyAI.SwitchToBehaviourServerRpc||stateIndex:{num}"); if (AntiCheatPlugin.Enemy.Value) { EnemyAI val = (EnemyAI)target; JesterAI val2 = (JesterAI)(object)((val is JesterAI) ? val : null); if (val2 != null) { if (((EnemyAI)val2).currentBehaviourStateIndex != 0 || num != 1) { if (((EnemyAI)val2).currentBehaviourStateIndex == 1 && num == 2 && val2.popUpTimer <= 0f) { return true; } if (((EnemyAI)val2).currentBehaviourStateIndex == 2 && num == 0) { return true; } LogInfo($"{p.playerUsername} call EnemyAI.SwitchToBehaviourServerRpc||currentBehaviourStateIndex:{((EnemyAI)val2).currentBehaviourStateIndex}|stateIndex:{num}|popUpTimer:{val2.popUpTimer}"); return true; } if ((Object)(object)((EnemyAI)val2).targetPlayer != (Object)null) { return true; } } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(JesterAI), "__rpc_handler_3446243450")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3446243450(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(MouthDogAI), "__rpc_handler_998670557")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_998670557(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(ForestGiantAI), "__rpc_handler_2965927486")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2965927486(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(RedLocustBees), "__rpc_handler_3246315153")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3246315153(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(MaskedPlayerEnemy), "__rpc_handler_3192502457")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3192502457(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(NutcrackerEnemyAI), "__rpc_handler_3881699224")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3881699224(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(BlobAI), "__rpc_handler_3848306567")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3848306567(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(CentipedeAI), "__rpc_handler_2791977891")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2791977891(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(RadMechAI), "__rpc_handler_3707286996")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3707286996(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } [HarmonyPatch(typeof(CaveDwellerAI), "__rpc_handler_3591556954")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3591556954(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return KillPlayerServerRpc(target, reader, rpcParams); } private static bool KillPlayerServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { EnemyAI val = (EnemyAI)target; int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call {((object)val).GetType()}.KillPlayerServerRpc|playerId:{num}"); if (num <= StartOfRound.Instance.allPlayerScripts.Length && (Object)(object)StartOfRound.Instance.allPlayerScripts[num] != (Object)(object)p) { LogInfo($"{p.playerUsername} call {((object)val).GetType()}.KillPlayerServerRpc|playerUsername:{StartOfRound.Instance.allPlayerScripts[num].playerUsername}"); return false; } if (!rpcs.ContainsKey("KillPlayer")) { rpcs.Add("KillPlayer", new List<ulong>()); } if (p.AllowPlayerDeath()) { rpcs["KillPlayer"].Add(p.actualClientId); ((MonoBehaviour)p).StartCoroutine(CheckRpc(p, "KillPlayer")); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_255411420")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_255411420(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call EnemyAI.UpdateEnemyPositionServerRpc|newPos:{val}"); } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_1810146992")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1810146992(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { LogInfo(p.playerUsername + " call EnemyAI.KillEnemyServerRpc"); if (AntiCheatPlugin.KillEnemy.Value) { EnemyAI val = (EnemyAI)target; foreach (HitData item in bypassKill) { if (item.EnemyInstanceId == ((Object)val).GetInstanceID() && !item.CalledClient.Contains(p.actualClientId)) { LogInfo($"{((Object)val).GetInstanceID()} bypass|actualClientId:{p.actualClientId}"); item.CalledClient.Add(p.actualClientId); return true; } } if (val.enemyHP <= 0) { return true; } if (Vector3.Distance(((Component)p).transform.position, ((Component)val).transform.position) > 50f) { ShowMessage(LocalizationManager.GetString("msg_KillEnemy", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{HP}", val.enemyHP.ToString() } })); if (AntiCheatPlugin.KillEnemy2.Value) { KickPlayer(p); return false; } } } } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_3079913705")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3079913705(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p) && AntiCheatPlugin.Enemy.Value) { LogInfo(p.playerUsername + " call EnemyAI.UpdateEnemyRotationServerRpc"); return true; } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_3587030867")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3587030867(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) LogInfo("__rpc_handler_3587030867"); if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.Enemy.Value) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); EnemyAI component = ((Component)target).GetComponent<EnemyAI>(); if (component is MouthDogAI || component is DressGirlAI) { return true; } float num2 = Vector3.Distance(((Component)p).transform.position, ((Component)component).transform.position); LogInfo($"Distance:{num2}"); LogInfo($"{p.playerUsername}|{p.actualClientId} called ChangeOwnershipOfEnemy|enemy:{component.enemyType.enemyName}|clientId:{num}"); LogInfo($"OwnerClientId:{((NetworkBehaviour)component).OwnerClientId}"); int instanceID = ((Object)component).GetInstanceID(); if (!chcs.ContainsKey(instanceID)) { chcs.Add(instanceID, new Dictionary<ulong, List<DateTime>>()); } if (!chcs[instanceID].ContainsKey(p.actualClientId)) { chcs[instanceID].Add(p.actualClientId, new List<DateTime>()); } if (chcs[instanceID][p.actualClientId].Count((DateTime x) => x.AddSeconds(1.0) > DateTime.Now) > 5) { ShowMessage(LocalizationManager.GetString("msg_Enemy_ChangeOwnershipOfEnemy", new Dictionary<string, string> { { "{player}", p.playerUsername } })); return false; } chcs[instanceID][p.actualClientId].Add(DateTime.Now); if (component.isEnemyDead) { return false; } CrawlerAI val = (CrawlerAI)(object)((component is CrawlerAI) ? component : null); if (val != null) { if ((Object)(object)((EnemyAI)val).stunnedByPlayer != (Object)null) { if ((int)((EnemyAI)val).stunnedByPlayer.actualClientId != num) { return false; } } else { PlayerControllerB val2 = component.CheckLineOfSightForPlayer(55f, 60, -1); if ((Object)(object)val2 != (Object)null && (int)val2.actualClientId != num) { return false; } } } else { JesterAI val3 = (JesterAI)(object)((component is JesterAI) ? component : null); if (val3 != null) { if (((EnemyAI)val3).currentBehaviourStateIndex != 2) { LogInfo("client ChangeOwnershipOfEnemy:" + num); return p.isHostPlayerObject; } if (((EnemyAI)val3).TargetClosestPlayer(4f, false, 70f) && (Object)(object)((EnemyAI)val3).targetPlayer != (Object)null && (int)((EnemyAI)val3).targetPlayer.actualClientId == num) { return true; } return false; } FlowermanAI val4 = (FlowermanAI)(object)((component is FlowermanAI) ? component : null); if (val4 != null) { if (((EnemyAI)val4).currentBehaviourStateIndex != 2) { LogInfo("client ChangeOwnershipOfEnemy:" + num); return p.isHostPlayerObject; } if (((EnemyAI)val4).TargetClosestPlayer(1.5f, false, 70f) && (Object)(object)((EnemyAI)val4).targetPlayer != (Object)null && (int)((EnemyAI)val4).targetPlayer.actualClientId == num) { return true; } return false; } RedLocustBees val5 = (RedLocustBees)(object)((component is RedLocustBees) ? component : null); if (val5 != null) { PlayerControllerB val6 = ((EnemyAI)val5).CheckLineOfSightForPlayer(360f, 16, 1); if ((Object)(object)val6 != (Object)null && Vector3.Distance(((Component)val6).transform.position, ((Component)val5.hive).transform.position) < (float)val5.defenseDistance && (int)((EnemyAI)val5).targetPlayer.actualClientId == num) { return true; } return false; } } return true; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(JetpackItem), "__rpc_handler_3663112878")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3663112878(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.Jetpack.Value) { JetpackItem val = (JetpackItem)target; if ((Object)(object)((GrabbableObject)val).playerHeldBy != (Object)null && ((GrabbableObject)val).playerHeldBy.actualClientId != p.actualClientId) { ShowMessage(LocalizationManager.GetString("msg_Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.Jetpack2.Value) { KickPlayer(p); } return false; } if ((Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null) { ShowMessage(LocalizationManager.GetString("msg_Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.Jetpack2.Value) { KickPlayer(p); } return false; } return true; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(EnemyAI), "KillEnemyOnOwnerClient")] [HarmonyPrefix] [HarmonyWrapSafe] public static void KillEnemyOnOwnerClient(EnemyAI __instance) { if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { LogInfo($"bypassKill -> {__instance.enemyType.enemyName}({((Object)__instance).GetInstanceID()})"); bypassKill.Add(new HitData { EnemyInstanceId = ((Object)__instance).GetInstanceID(), force = 0, CalledClient = new List<ulong>() }); } } [HarmonyPatch(typeof(EnemyAI), "HitEnemyOnLocalClient")] [HarmonyPrefix] [HarmonyWrapSafe] public static void HitEnemyOnLocalClient(EnemyAI __instance, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { bypassHit.Add(new HitData { EnemyInstanceId = ((Object)__instance).GetInstanceID(), force = force, CalledClient = new List<ulong>() }); } } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_3538577804")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool HitEnemyServerRpcPatch(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { if ((Object)(object)p == (Object)null) { return false; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ((FastBufferReader)(ref reader)).Seek(0); LogInfo($"{p.playerUsername} call EnemyAI.HitEnemyServerRpc|force:{num}|playerWhoHit:{num2}"); if (p.isHostPlayerObject) { return true; } if (num2 != -1 && (Object)(object)StartOfRound.Instance.allPlayerScripts[num2] != (Object)(object)p) { LogInfo("return false;"); return false; } VehicleController val = Object.FindFirstObjectByType<VehicleController>(); if ((Object)(object)val != (Object)null) { PlayerControllerB currentDriver = val.currentDriver; if (num == 2 && (Object)(object)currentDriver != (Object)null && currentDriver.playerClientId == p.playerClientId) { lastDriver = currentDriver; return true; } if (num == 2 && (Object)(object)currentDriver == (Object)null && lastDriver.playerClientId == p.playerClientId) { return true; } } EnemyAI val2 = (EnemyAI)target; foreach (HitData item in bypassHit) { if (item.EnemyInstanceId == ((Object)val2).GetInstanceID() && item.force == num && !item.CalledClient.Contains(p.actualClientId)) { LogInfo($"{((Object)val2).GetInstanceID()} bypass|actualClientId:{p.actualClientId}"); item.CalledClient.Add(p.actualClientId); return true; } } if (AntiCheatPlugin.Shovel.Value) { GrabbableObject val3 = p.ItemSlots[p.currentItemSlot]; string playerUsername = p.playerUsername; if (num != 1 && (Object)(object)val3 != (Object)null && (isShovel(val3) || isKnife(val3))) { if (!jcs.Contains(p.playerSteamId)) { ShowMessage(LocalizationManager.GetString("msg_Shovel4", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val2.enemyType.enemyName }, { "{damageAmount}", num.ToString() }, { "{item}", isShovel(val3) ? LocalizationManager.GetString("Item_Shovel") : LocalizationManager.GetString("Item_Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheatPlugin.Shovel2.Value) { KickPlayer(p); } return false; } } else if (!p.isPlayerDead && (Object)(object)val3 == (Object)null) { if (!jcs.Contains(p.playerSteamId)) { LogInfo($"currentItemSlot:{p.currentItemSlot}"); LogInfo($"currentlyHeldObjectServer:{p.currentlyHeldObjectServer}"); LogInfo($"obj:{val3}"); if (!AntiCheatPlugin.Shovel3.Value && (num == 1 || num == 2 || num == 3 || num == 5)) { ShowMessage(LocalizationManager.GetString("msg_Shovel6", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val2.enemyType.enemyName }, { "{damageAmount}", num.ToString() } })); jcs.Add(p.playerSteamId); if (AntiCheatPlugin.Shovel2.Value) { KickPlayer(p); } } else { LogInfo(LocalizationManager.GetString("msg_Shovel6", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val2.enemyType.enemyName }, { "{damageAmount}", num.ToString() } })); } return false; } } else if (jcs.Contains(p.playerSteamId)) { return false; } } } return true; } public static void ShowMessage(string msg, string lastmsg = null) { string empty = string.Empty; AntiCheatPlugin.MessageType value = AntiCheatPlugin.DetectedMessageType.Value; empty = LocalizationManager.GetString("MessageFormat", new Dictionary<string, string> { { "{Prefix}", LocalizationManager.GetString("Prefix") }, { "{msg}", msg } }); if (!(lastMessage == msg) && (!(lastmsg == lastMessage) || lastmsg == null)) { if (lastmsg != null) { lastMessage = lastmsg; } else { lastMessage = msg; } switch (value) { case AntiCheatPlugin.MessageType.PublicChat: { bypass = true; HUDManager instance = HUDManager.Instance; FieldInfo field = typeof(HUDManager).GetField("__rpc_exec_stage", BindingFlags.Instance | BindingFlags.NonPublic); object value2 = field.GetValue(instance); field.SetValue(instance, 0); HUDManager.Instance.AddTextToChatOnServer(empty, -1); LogInfo("AddTextToChatOnServer|" + empty); field.SetValue(instance, value2); bypass = false; break; } case AntiCheatPlugin.MessageType.HostChat: LogInfo("AddChatMessage|" + empty); typeof(HUDManager).GetMethod("AddChatMessage", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(HUDManager.Instance, new object[2] { empty, "" }); break; default: LogInfo("ShowGUI|" + empty); break; } } } [HarmonyPatch(typeof(GiftBoxItem), "__rpc_handler_2878544999")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2878544999(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.Gift.Value) { if (lhs.Contains(((Object)target).GetInstanceID())) { ShowMessage(LocalizationManager.GetString("msg_Gift", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.Gift2.Value) { KickPlayer(p); } return false; } lhs.Add(((Object)target).GetInstanceID()); GiftBoxItem val = (GiftBoxItem)target; ((NetworkBehaviour)val).OnNetworkDespawn(); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(HauntedMaskItem), "__rpc_handler_1065539967")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1065539967(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.Mask.Value) { if (mjs.Contains(((Object)target).GetInstanceID())) { ShowMessage(LocalizationManager.GetString("msg_Mask", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.Mask2.Value) { KickPlayer(p); } return false; } mjs.Add(((Object)target).GetInstanceID()); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } private static bool Check(__RpcParams rpcParams, out PlayerControllerB p) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null) { p = null; return false; } if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { p = StartOfRound.Instance.localPlayerController; return false; } PlayerControllerB player = GetPlayer(rpcParams); p = player; if ((Object)(object)p == (Object)null) { NetworkManager.Singleton.DisconnectClient(rpcParams.Server.Receive.SenderClientId); return false; } if (rpcParams.Server.Receive.SenderClientId == GameNetworkManager.Instance.localPlayerController.actualClientId) { p = StartOfRound.Instance.localPlayerController; return false; } if (StartOfRound.Instance.KickedClientIds.Contains(p.playerSteamId)) { NetworkManager.Singleton.DisconnectClient(rpcParams.Server.Receive.SenderClientId); return false; } if (p.playerSteamId == 0) { uint num = ClientIdToTransportId(rpcParams.Server.Receive.SenderClientId); if (num == 0) { return false; } ulong num2 = ConnectionIdtoSteamIdMap[num]; Friend val = default(Friend); ((Friend)(ref val))..ctor(SteamId.op_Implicit(num2)); NetworkManager.Singleton.DisconnectClient(rpcParams.Server.Receive.SenderClientId); StartOfRound.Instance.KickedClientIds.Add(num2); LogInfo($"检测玩家 {((Friend)(ref val)).Name}({num2}) 使用AntiKick功能,已自动踢出!"); return false; } return true; } public static uint ClientIdToTransportId(ulong SenderClientId) { if (SenderClientId == 0) { return 0u; } NetworkConnectionManager value = Traverse.Create((object)NetworkManager.Singleton).Field("ConnectionManager").GetValue<NetworkConnectionManager>(); ulong value2 = Traverse.Create((object)value).Method("ClientIdToTransportId", new object[1] { SenderClientId }).GetValue<ulong>(); return (uint)value2; } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool LoadNewLevel(SelectableLevel newLevel) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } landMines = new List<int>(); bypassHit = new List<HitData>(); bypassKill = new List<HitData>(); HUDManager.Instance.AddTextToChatOnServer(LocalizationManager.GetString("msg_game_start", new Dictionary<string, string> { { "{ver}", "0.7.8" } }), -1); return true; } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_412259855")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_412259855(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if ((Object)(object)p.currentlyHeldObjectServer != (Object)null && p.currentlyHeldObjectServer.itemProperties.twoHanded) { return false; } return true; } if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(BeltBagItem), "__rpc_handler_2988305002")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2988305002(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.GrabObject.Value && AntiCheatPlugin.GrabObject_BeltBag.Value) { NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { GrabbableObject component = ((Component)val2).GetComponent<GrabbableObject>(); if (!component.itemProperties.isScrap && !component.isHeld && !component.isHeldByEnemy && component.itemProperties.itemId != 123984 && component.itemProperties.itemId != 819501) { return true; } ((BeltBagItem)target).CancelAddObjectToBagClientRpc(num); return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_1554282707")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1554282707(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.GrabObject.Value) { NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); ((FastBufferReader)(ref reader)).Seek(0); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { bool flag = true; bool flag2 = false; GrabbableObject[] itemSlots = p.ItemSlots; foreach (GrabbableObject val3 in itemSlots) { if ((Object)(object)val3 == (Object)null) { flag = false; } else if (val3.itemProperties.twoHanded) { flag2 = true; break; } } GrabbableObject componentInChildren = ((Component)val2).GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren != (Object)null) { bool flag3 = false; if (AntiCheatPlugin.GrabObject_TwoHand.Value && componentInChildren.itemProperties.twoHanded && flag2) { flag3 = true; } if (AntiCheatPlugin.GrabObject_MoreSlot.Value) { flag3 = flag; } if (flag3) { FieldInfo field = typeof(NetworkBehaviour).GetField("__rpc_exec_stage", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(target, 1); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke((object?)(PlayerControllerB)target, new object[1]); field.SetValue(target, 0); return false; } if (Vector3.Distance(((Component)componentInChildren).transform.position, p.serverPlayerPosition) > 100f && !StartOfRound.Instance.shipIsLeaving && StartOfRound.Instance.shipHasLanded) { if (p.teleportedLastFrame) { return true; } Dictionary<string, string> obj = new Dictionary<string, string> { { "{player}", p.playerUsername } }; Vector3 position = ((Component)componentInChildren).transform.position; obj.Add("{object_position}", ((object)(Vector3)(ref position)).ToString()); obj.Add("{player_position}", ((object)(Vector3)(ref p.serverPlayerPosition)).ToString()); ShowMessage(LocalizationManager.GetString("msg_GrabObject", obj)); componentInChildren = null; val = default(NetworkObjectReference); if (AntiCheatPlugin.GrabObject_MoreSlot.Value) { KickPlayer(p); } FieldInfo field2 = typeof(NetworkBehaviour).GetField("__rpc_exec_stage", BindingFlags.Instance | BindingFlags.NonPublic); field2.SetValue(target, 1); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke((object?)(PlayerControllerB)target, new object[1]); field2.SetValue(target, 0); return false; } } } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_2013428264")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2013428264(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); ((FastBufferReader)(ref reader)).Seek(0); if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.Invisibility.Value) { Vector3 serverPlayerPosition = p.serverPlayerPosition; if (p.teleportedLastFrame) { return true; } if (Vector3.Distance(serverPlayerPosition, val) > 100f && Vector3.Distance(val, new Vector3(0f, 0f, 0f)) > 10f) { ShowMessage(LocalizationManager.GetString("msg_Invisibility", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player_position}", ((object)(Vector3)(ref val)).ToString() } })); if (AntiCheatPlugin.Invisibility2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(NetworkManager), "Awake")] [HarmonyPrefix] [HarmonyWrapSafe] public static void NetworkManagerAwake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.disableSteam) { ConnectionIdtoSteamIdMap[0u] = SteamId.op_Implicit(SteamClient.SteamId); } } [HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnConnecting")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool FacepunchTransportOnConnecting(ref Connection connection, ref ConnectionInfo info) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetIdentity identity = Traverse.Create((object)info).Field<NetIdentity>("identity").Value; if (StartOfRound.Instance.KickedClientIds.Contains(((NetIdentity)(ref identity)).SteamId.Value)) { LogInfo(LocalizationManager.GetString("log_refuse_connect", new Dictionary<string, string> { { "{steamId}", ((NetIdentity)(ref identity)).SteamId.Value.ToString() } })); return false; } if (StartOfRound.Instance.allPlayerScripts.Any((PlayerControllerB x) => x.isPlayerControlled && x.playerSteamId == ((NetIdentity)(ref identity)).SteamId.Value)) { LogInfo("{steamId} repeatedly joins the game."); return false; } if (ConnectionIdtoSteamIdMap.ContainsKey(((Connection)(ref connection)).Id)) { ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id] = ((NetIdentity)(ref identity)).SteamId.Value; } else { ConnectionIdtoSteamIdMap.Add(((Connection)(ref connection)).Id, ((NetIdentity)(ref identity)).SteamId.Value); } return true; } [HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnDisconnected")] [HarmonyPrefix] [HarmonyWrapSafe] public static void FacepunchTransportOnDisconnected(ref Connection connection, ref ConnectionInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.IsListening) { NetIdentity value = Traverse.Create((object)info).Field<NetIdentity>("identity").Value; ConnectionIdtoSteamIdMap.Remove(((Connection)(ref connection)).Id); } } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_2504133785")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2504133785(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } if (rpcParams.Server.Receive.SenderClientId == 0) { return true; } ulong num = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); ulong num2 = ConnectionIdtoSteamIdMap[ClientIdToTransportId(rpcParams.Server.Receive.SenderClientId)]; if (num != num2) { Friend val = default(Friend); ((Friend)(ref val))..ctor(SteamId.op_Implicit(num2)); NetworkManager.Singleton.DisconnectClient(rpcParams.Server.Receive.SenderClientId); LogInfo($"玩家 {((Friend)(ref val)).Name}({num2}) 伪造SteamID({num})加入游戏"); return false; } return true; } [HarmonyPatch(typeof(HUDManager), "__rpc_handler_2436660286")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2436660286(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.RemoteTerminal.Value && !CheckRemoteTerminal(p)) { return false; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(HUDManager), "__rpc_handler_2787681914")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2787681914(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } ((FastBufferReader)(ref reader)).Seek(0); LogInfo("HUDManager.AddTextMessageServerRpc|" + p.playerUsername + "|" + text); if (text.Contains("<color") || text.Contains("<size")) { LogInfo("playerId = -1"); if (AntiCheatPlugin.Map.Value && text.Contains("<size=0>Tyzeron.Minimap")) { ShowMessage(LocalizationManager.GetString("msg_Map", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.Map2.Value) { KickPlayer(p); } return false; } if (bypass) { LogInfo("bypass"); return true; } return false; } if (text.StartsWith("[morecompanycosmetics]")) { return true; } return false; } if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(HUDManager), "__rpc_handler_168728662")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_168728662(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return __rpc_handler_2930587515(target, reader, rpcParams); } [HarmonyPatch(typeof(HUDManager), "__rpc_handler_2930587515")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2930587515(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.ChatReal.Value) { try { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo(p.playerUsername + " call HUDManager.AddPlayerChatMessageServerRpc|chatMessage:" + text); if (num == -1) { return false; } if (num <= StartOfRound.Instance.allPlayerScripts.Length) { if (StartOfRound.Instance.allPlayerScripts[num].playerSteamId != p.playerSteamId) { ShowMessage(LocalizationManager.GetString("msg_ChatReal", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", StartOfRound.Instance.allPlayerScripts[num].playerUsername } })); if (AntiCheatPlugin.ChatReal2.Value) { KickPlayer(p); } return false; } if (ChatCooldowns[p.playerSteamId]) { LogInfo(p.playerUsername + " in ChatCooldown"); return false; } ((MonoBehaviour)p).StartCoroutine(ChatCoolDown(p)); return true; } return false; } catch (Exception ex) { LogInfo(ex.ToString()); return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } public static IEnumerator ChatCoolDown(PlayerControllerB __instance) { ChatCooldowns[__instance.playerSteamId] = true; yield return (object)new WaitForSeconds((float)AntiCheatPlugin.ChatReal_Cooldown.Value); ChatCooldowns[__instance.playerSteamId] = false; } public static T2 GetField<T, T2>(this T obj, string name) { return (T2)obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).GetValue(obj); } public static void SetField<T>(this T obj, string name, object value) { obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).SetValue(obj, value); } public static bool CheckRemoteTerminal(PlayerControllerB p) { if ((Object)(object)whoUseTerminal != (Object)(object)p) { if ((Object)(object)whoUseTerminal == (Object)null) { LogInfo("no player use terminal|request player:" + p.playerUsername); } else { LogInfo("whoUseTerminal:" + whoUseTerminal.playerUsername + "|p:" + p.playerUsername); } ShowMessage(LocalizationManager.GetString("msg_RemoteTerminal", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.RemoteTerminal2.Value) { KickPlayer(p); } return false; } return true; } [HarmonyPatch(typeof(InteractTrigger), "__rpc_handler_1430497838")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1430497838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); if (num == (int)p.playerClientId) { Terminal obj = Object.FindObjectOfType<Terminal>(); InteractTrigger field = obj.GetField<Terminal, InteractTrigger>("terminalTrigger"); if (((Object)field).GetInstanceID() == ((Object)(InteractTrigger)target).GetInstanceID()) { whoUseTerminal = p; LogInfo("player " + p.playerUsername + " use Terminal"); } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(InteractTrigger), "__rpc_handler_880620475")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_880620475(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); if (num == (int)p.playerClientId) { if (p.isPlayerDead) { LogInfo("player " + p.playerUsername + " death can't use terminal"); return false; } Terminal obj = Object.FindObjectOfType<Terminal>(); InteractTrigger field = obj.GetField<Terminal, InteractTrigger>("terminalTrigger"); if (((Object)field).GetInstanceID() == ((Object)(InteractTrigger)target).GetInstanceID()) { whoUseTerminal = null; LogInfo("player " + p.playerUsername + " stop use Terminal"); } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(Terminal), "__rpc_handler_1713627637")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1713627637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.RemoteTerminal.Value && !CheckRemoteTerminal(p)) { return false; } if (AntiCheatPlugin.ShipTerminal.Value) { long i = DateTime.Now.Ticks / 10000; if (zdcd.Count > 200) { zdcd.RemoveRange(0, zdcd.Count - 1); } if (zdcd.Contains(i)) { return false; } if (zdcd.Any((long x) => x + 200 > i)) { zdcd.Add(i); ShowMessage(LocalizationManager.GetString("msg_ShipTerminal", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.ShipTerminal2.Value) { KickPlayer(p); } return false; } zdcd.Add(i); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(ShipLights), "__rpc_handler_1625678258")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1625678258(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheatPlugin.ShipLight.Value) { long i = DateTime.Now.Ticks / 10000; if (dgcd.Count > 200) { dgcd.RemoveRange(0, dgcd.Count - 1); } if (dgcd.Contains(i)) { ShipLights val = Object.FindAnyObjectByType<ShipLights>(); if (!val.areLightsOn) { val.SetShipLightsClientRpc(true); } return false; } if (dgcd.Count((long x) => x + 1000 > i) > 4) { dgcd.Add(i); ShowMessage(LocalizationManager.GetString("msg_ShipLight", new Dictionary<string, string> { { "{player}", p.playerUsername } }), "msg_ShipLight"); ShipLights val2 = Object.FindAnyObjectByType<ShipLights>(); if (!val2.areLightsOn) { val2.SetShipLightsClientRpc(true); } return false; } dgcd.Add(i); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } private static PlayerControllerB GetPlayer(__RpcParams rpcParams) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == rpcParams.Server.Receive.SenderClientId) { return val; } } return null; } [HarmonyPatch(typeof(ShotgunItem), "__rpc_handler_1329927282")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1329927282(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { if (AntiCheatPlugin.InfiniteAmmo.Value) { ShotgunItem val = (ShotgunItem)target; if ((bool)typeof(ShotgunItem).GetField("localClientSendingShootGunRPC", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val)) { return true; } if (val.shellsLoaded == 0) { ShowMessage(LocalizationManager.GetString("msg_InfiniteAmmo", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheatPlugin.InfiniteAmmo2.Value) { KickPlayer(p); } return false; } LogInfo($"ShotgunItem.ShootGunServerRpc|__rpc_handler_1329927282|{val.shellsLoaded}"); } if (AntiCheatPlugin.ItemCooldown.Value) { ulong playerSteamId = p.playerSteamId; string i = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (!sdqcd.ContainsKey(playerSteamId)) { sdqcd.Add(playerSteamId, new List<string>()); } if (sdqcd[playerSteamId].Count > 200) { sdqcd[playerSteamId].RemoveRange(0, sdqcd[playerSteamId].Count - 1); } if (sdqcd[playerSteamId].Count((string x) => x == i) >= 2) { ShowMessage(LocalizationManager.GetString("msg_ItemCooldown", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{item}", LocalizationManager.GetString("Item_Shotgun") } })); if (AntiCheatPlugin.ItemCooldown2.Value) { KickPlayer(p); } return false; } sdqcd[playerSteamId].Add(i); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(KnifeItem), "__rpc_handler_2696735117")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2696735117(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CheckCoolDownMethod(rpcParams, 10); } [HarmonyPatch(typeof(Shovel), "__rpc_handler_2096026133")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2096026133(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CheckCoolDownMethod(rpcParams, 3); } private static bool CheckCoolDownMethod(__RpcParams rpcParams, int cd) { //IL