Decompiled source of AntiCheat v0.8.6
BepInEx/plugins/AntiCheat.dll
Decompiled 3 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; using System.Text.RegularExpressions; using AntiCheat.Core; using AntiCheat.Locale; using AntiCheat.Patch; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Netcode.Transports.Facepunch; using Newtonsoft.Json; 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 { public static class CooldownManager { private struct CooldownData { public Func<bool> IsEnabled; public Func<float> GetCooldown; public List<ulong> CooldownList; } [CompilerGenerated] private sealed class <HandleCooldown>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string groupName; public ulong playerId; private CooldownData <data>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleCooldown>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <data>5__1 = default(CooldownData); <>1__state = -2; } private bool MoveNext() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <data>5__1 = cooldownGroups[groupName]; <data>5__1.CooldownList.Add(playerId); <>2__current = (object)new WaitForSeconds(<data>5__1.GetCooldown()); <>1__state = 1; return true; case 1: <>1__state = -1; <data>5__1.CooldownList.Remove(playerId); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Dictionary<string, CooldownData> cooldownGroups = new Dictionary<string, CooldownData>(); public static void Reset() { cooldownGroups.Clear(); } public static void RegisterCooldownGroup(string groupName, Func<bool> isEnabled, Func<float> getCooldown) { cooldownGroups.Add(groupName, new CooldownData { IsEnabled = isEnabled, GetCooldown = getCooldown, CooldownList = new List<ulong>() }); } [IteratorStateMachine(typeof(<HandleCooldown>d__3))] public static IEnumerator HandleCooldown(string groupName, ulong playerId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleCooldown>d__3(0) { groupName = groupName, playerId = playerId }; } public static bool CheckCooldown(string groupName, PlayerControllerB player) { CooldownData cooldownData = cooldownGroups[groupName]; if (!cooldownData.IsEnabled() || cooldownData.GetCooldown() <= 0f) { return true; } if (cooldownData.CooldownList.Contains(player.playerSteamId)) { return false; } ((MonoBehaviour)player).StartCoroutine(HandleCooldown(groupName, player.playerSteamId)); return true; } } [HarmonyPatch(typeof(GrabbableObject))] [HarmonyWrapSafe] public static class GrabbableObjectPatch { [HarmonyPrefix] [HarmonyPatch("__rpc_handler_4280509730")] public static bool ActivateItemServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (Patches.Check(rpcParams, out var p)) { if (!((Object)(object)target != (Object)null)) { return false; } GrabbableObject val = (GrabbableObject)target; AntiCheat.Core.AntiCheat.LogInfo(p, "(" + val.itemProperties.itemName + ")GrabbableObject.ActivateItemServerRpc"); if ((Object)(object)val != (Object)null && val is RemoteProp) { bool flag = CooldownManager.CheckCooldown("ShipLight", p); if (!flag) { Object.FindFirstObjectByType<ShipLights>().SetShipLightsClientRpc(true); } return flag; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(GiftBoxItem), "ItemActivate")] public static void ItemActivate(GiftBoxItem __instance) { if (((NetworkBehaviour)StartOfRound.Instance).IsHost) { Object.Destroy((Object)(object)((Component)__instance).gameObject); } } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_3484508350")] public static bool SyncBatteryServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0037: Expected O, but got Unknown if (Patches.Check(rpcParams, out var p) && false) { return (Object)(object)p != (Object)null; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); GrabbableObject val = (GrabbableObject)target; AntiCheat.Core.AntiCheat.LogInfo(p, "(" + val.itemProperties.itemName + ")GrabbableObject.SyncBatteryServerRpc", $"num:{num}"); return true; } [HarmonyPrefix] [HarmonyPatch(typeof(LungProp), "EquipItem")] public static bool EquipItem(LungProp __instance) { if (AntiCheat.Core.AntiCheat.OperationLog.Value && __instance.isLungDocked && StartOfRound.Instance.shipHasLanded) { Patches.ShowMessageHostOnly(Patches.locale.OperationLog_GetString("GrabLungProp", new Dictionary<string, string> { { "{player}", StartOfRound.Instance.allPlayerScripts.First((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)__instance).OwnerClientId).playerUsername ?? "" } })); } return true; } } [HarmonyPatch(typeof(HUDManager))] [HarmonyWrapSafe] public static class HUDManagerPatch { public static List<ulong> SyncAllPlayerLevelsServerRpcCalls { get; set; } = new List<ulong>(); [HarmonyPrefix] [HarmonyPatch("__rpc_handler_3153465849")] public static bool GetNewStoryLogServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!Patches.Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); Terminal val = Object.FindObjectOfType<Terminal>(); if (num < val.logEntryFiles.Count && num > 0) { return true; } return false; } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_1043384750")] public static bool SendErrorMessageServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB p; return !Patches.Check(rpcParams, out p); } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_4217433937")] public static bool SyncAllPlayerLevelsServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (!Patches.Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } if (SyncAllPlayerLevelsServerRpcCalls.Contains(p.playerSteamId)) { return false; } 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 != (int)p.playerClientId) { return false; } SyncAllPlayerLevelsServerRpcCalls.Add(p.playerSteamId); return true; } [HarmonyPatch("__rpc_handler_1944155956")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool ScanNewCreatureServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!Patches.Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); Terminal val = Object.FindObjectOfType<Terminal>(); if (num < val.enemyFiles.Count && num > 0) { if (val.scannedEnemyIDs.Contains(num) && val.newlyScannedEnemyIDs.Contains(num)) { return false; } string info = AntiCheat.Core.AntiCheat.localizationManager.Msg_GetString("snc_player", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemy}", val.enemyFiles[num].creatureName } }); Patches.LogInfo(info); return true; } return false; } [HarmonyPatch("__rpc_handler_2436660286")] [HarmonyPrefix] public static bool UseSignalTranslatorServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!Patches.Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } if (AntiCheat.Core.AntiCheat.RemoteTerminal.Value && !Patches.CheckRemoteTerminal(p, "HUDManager.UseSignalTranslatorServerRpc")) { return false; } return true; } } public static class Patches { public class ExplosionData { public List<ulong> CalledClient { get; set; } public Vector3 ExplosionPostion { get; set; } public DateTime CreateDateTime { get; set; } } public class HitData { public int EnemyInstanceId { get; set; } public int force { get; set; } public List<ulong> CalledClient { get; set; } } [CompilerGenerated] private sealed class <CheckAmmo>d__119 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerControllerB p; public ShotgunItem shot; public GrabbableObject ammo; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CheckAmmo>d__119(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.25f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; case 2: <>1__state = -1; if (ReloadGun.ContainsKey(p.playerSteamId) && !ReloadGun[p.playerSteamId] && (Object)(object)ammo != (Object)null && (Object)(object)((NetworkBehaviour)ammo).NetworkObject != (Object)null && ((NetworkBehaviour)ammo).NetworkObject.IsSpawned) { ShowMessage(locale.Msg_GetString("InfiniteAmmo", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.InfiniteAmmo2.Value) { KickPlayer(p); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <CheckRpc>d__53 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerControllerB __instance; public string RPC; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CheckRpc>d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (RPC == "Hit" && !AntiCheat.Core.AntiCheat.RPCReport_Hit.Value) { return false; } if (RPC == "KillPlayer" && !AntiCheat.Core.AntiCheat.RPCReport_KillPlayer.Value) { return false; } <>2__current = (object)new WaitForSeconds((float)(AntiCheat.Core.AntiCheat.RPCReport_Delay.Value / 1000)); <>1__state = 1; return true; case 1: <>1__state = -1; if (__instance.isPlayerDead) { return false; } if (rpcs[RPC].Contains(__instance.playerClientId)) { rpcs[RPC].Remove(__instance.playerClientId); ShowMessage(locale.Msg_GetString("RPCReport", new Dictionary<string, string> { { "{player}", __instance.playerUsername }, { "{RPC}", RPC } })); if (AntiCheat.Core.AntiCheat.RPCReport_Kick.Value) { KickPlayer(__instance); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DestroySelf>d__96 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject self; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DestroySelf>d__96(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; Object.Destroy((Object)(object)self); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List<ulong> jcs = new List<ulong>(); 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 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<ulong, bool> ReloadGun = new Dictionary<ulong, bool>(); public static LocalizationManager locale => AntiCheat.Core.AntiCheat.localizationManager; public static Dictionary<uint, ulong> ConnectionIdtoSteamIdMap { get; set; } = new Dictionary<uint, ulong>(); public static List<long> mjs { 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 Terminal terminal { get { if ((Object)(object)_terminal == (Object)null) { _terminal = Object.FindObjectOfType<Terminal>(); } return _terminal; } } private static Terminal _terminal { get; set; } public static Dictionary<ulong, DateTime> ClingTime { get; set; } = new Dictionary<ulong, DateTime>(); public static List<ExplosionData> explosions { get; set; } = new List<ExplosionData>(); public static PlayerControllerB lastDriver { get; set; } public static bool bypass { get; set; } public static KeyValuePair<DateTime, ulong> lastWhoUseTerminal { get; set; } public static PlayerControllerB whoUseTerminal { get; set; } public static void LogInfo(string info) { AntiCheat.Core.AntiCheat.LogInfo(info); } public static void LogInfo(PlayerControllerB p, string rpc, params object[] param) { AntiCheat.Core.AntiCheat.LogInfo(p, rpc, param); } public static void LogError(string info) { if (AntiCheat.Core.AntiCheat.Log.Value) { AntiCheat.Core.AntiCheat.ManualLog.LogError((object)(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.playerClientId); } 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) { string text = locale.Msg_GetString("behind_player", new Dictionary<string, string> { { "{player}", p.playerUsername } }); LogInfo(text); AddTextMessageClientRpc(text); } } 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_0011: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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, "PlayerControllerB.DamagePlayerFromOtherClientServerRpc", $"damageAmount:{damageAmount}", $"hitDirection:{val}", $"playerWhoHit:{PlayerClientIdConvertName(num)}({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, "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 (AntiCheat.Core.AntiCheat.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(locale.Msg_GetString("Shovel", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() }, { "{item}", isShovel(val) ? locale.Item_GetString("Shovel") : locale.Item_GetString("Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheat.Core.AntiCheat.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(locale.Msg_GetString("Shovel2", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{distance}", num.ToString() }, { "{damageAmount}", damageAmount.ToString() }, { "{item}", isShovel(val) ? locale.Item_GetString("Shovel") : locale.Item_GetString("Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheat.Core.AntiCheat.Shovel2.Value) { KickPlayer(p); } } damageAmount = 0; } else if ((Object)(object)val == (Object)null || (!isGun(val) && !isShovel(val) && !isKnife(val))) { if (ClingTime.ContainsKey(p.playerSteamId) && ClingTime[p.playerSteamId].AddSeconds(5.0) > DateTime.Now) { return true; } for (int i = 0; i < p.ItemSlots.Length; i++) { LogInfo($"p:{p.playerUsername}|i:{i}|itemName:{p.ItemSlots[i]?.itemProperties?.itemName}"); } LogInfo($"currentItemSlot:{p.currentItemSlot}"); LogInfo("currentlyHeldObjectServer:" + p.currentlyHeldObjectServer?.itemProperties?.itemName); LogInfo($"obj:{val}"); if (!jcs.Contains(p.playerSteamId)) { if (AntiCheat.Core.AntiCheat.Shovel3.Value && (damageAmount == 10 || damageAmount == 20 || damageAmount == 30 || damageAmount == 100)) { ShowMessage(locale.Msg_GetString("Shovel3", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() } })); return true; } ShowMessage(locale.Msg_GetString("Shovel3", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", p2.playerUsername }, { "{damageAmount}", damageAmount.ToString() } })); jcs.Add(p.playerSteamId); if (AntiCheat.Core.AntiCheat.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(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 = terminal.groupCredits; } } [HarmonyPatch(typeof(StartOfRound), "EndOfGame")] [HarmonyPostfix] [HarmonyWrapSafe] public static void EndOfGame() { jcs = new List<ulong>(); 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.RemoteTerminal.Value && !CheckRemoteTerminal(p, "StartOfRound.ChangeLevelServerRpc")) { return false; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); ((FastBufferReader)(ref reader)).Seek(0); if (AntiCheat.Core.AntiCheat.FreeBuy.Value) { if (num2 > Money || Money < 0) { ShowMessage(locale.Msg_GetString("FreeBuy_SetMoney", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{Money}", (num2 - Money).ToString() } })); if (AntiCheat.Core.AntiCheat.FreeBuy2.Value) { KickPlayer(p); } return false; } if (num > StartOfRound.Instance.levels.Length) { LogInfo(p, "StartOfRound.ChangeLevelServerRpc", "levelID > StartOfRound.Instance.levels.Length"); return false; } TerminalKeyword val = ((IEnumerable<TerminalKeyword>)terminal.terminalNodes.allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword x) => x.word.ToLower() == "route")); string level = StartOfRound.Instance.levels[num].PlanetName.Split(new char[1] { ' ' })[0]; IEnumerable<CompatibleNoun> source = val.compatibleNouns.Where((CompatibleNoun x) => ((Object)x.result).name == level + "route"); if (source.Any()) { int itemCost = source.First().result.itemCost; level = StartOfRound.Instance.currentLevel.PlanetName.Split(new char[1] { ' ' })[0]; IEnumerable<CompatibleNoun> source2 = val.compatibleNouns.Where((CompatibleNoun x) => ((Object)x.result).name == level + "route"); if (itemCost == 0 && source2.Any() && source2.First().result.itemCost != 0) { ShowMessage(locale.Msg_GetString("ChangeToFreeLevel", new Dictionary<string, string> { { "{player}", p.playerUsername } })); return false; } LogInfo(p, "StartOfRound.ChangeLevelServerRpc", $"levelID:{num}", $"itemCost:{itemCost}"); if (itemCost != 0) { int num3 = Money - itemCost; if (num3 != num2 || Money == 0) { ShowMessage(locale.Msg_GetString("FreeBuy_Level", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.FreeBuy2.Value) { KickPlayer(p); } return false; } } } } if (AntiCheat.Core.AntiCheat.OperationLog.Value && num < StartOfRound.Instance.levels.Length) { ShowMessageHostOnly(locale.OperationLog_GetString("ChangeLevel", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{planet}", StartOfRound.Instance.levels[num].PlanetName } })); } } 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.RemoteTerminal.Value && !CheckRemoteTerminal(p, "StartOfRound.BuyShipUnlockableServerRpc")) { return false; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); ((FastBufferReader)(ref reader)).Seek(0); if (AntiCheat.Core.AntiCheat.FreeBuy.Value) { if (Money == num2 || Money == 0) { ShowMessage(locale.Msg_GetString("FreeBuy_unlockable", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.FreeBuy2.Value) { KickPlayer(p); } return false; } if (num2 > Money || Money < 0) { ShowMessage(locale.Msg_GetString("FreeBuy_SetMoney", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{Money}", (num2 - Money).ToString() } })); if (AntiCheat.Core.AntiCheat.FreeBuy2.Value) { KickPlayer(p); } return false; } } if (AntiCheat.Core.AntiCheat.OperationLog.Value && num < StartOfRound.Instance.unlockablesList.unlockables.Count) { ShowMessageHostOnly(locale.OperationLog_GetString("BuyShipUnlockable", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{unlockable}", StartOfRound.Instance.unlockablesList.unlockables[num].unlockableName } })); } } 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(TimeOfDay), "SyncNewProfitQuotaClientRpc")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SyncNewProfitQuotaClientRpc(int newProfitQuota, int overtimeBonus, int fulfilledQuota) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } Money = Mathf.Clamp(terminal.groupCredits + overtimeBonus, terminal.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; } [IteratorStateMachine(typeof(<CheckRpc>d__53))] public static IEnumerator CheckRpc(PlayerControllerB __instance, string RPC) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CheckRpc>d__53(0) { __instance = __instance, RPC = RPC }; } [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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown if (Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { if (rpcs.ContainsKey("Hit")) { rpcs["Hit"].Remove(p.playerClientId); } 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, "PlayerControllerB.DamagePlayerServerRpc", $"damageNumber:{damageAmount}", $"newHealthAmount:{num}"); PlayerControllerB val = (PlayerControllerB)target; if ((Object)(object)val == (Object)(object)p) { if (AntiCheat.Core.AntiCheat.Health_Recover.Value && damageAmount < 0) { string msg = locale.Msg_GetString("Health_Recover", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{hp}", (damageAmount * -1).ToString() } }); ShowMessage(msg); if (AntiCheat.Core.AntiCheat.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_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)) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); EnemyAI val = (EnemyAI)target; LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.SwitchToBehaviourServerRpc", $"stateIndex:{num}"); if (AntiCheat.Core.AntiCheat.Enemy.Value) { 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, "(" + val.enemyType.enemyName + ")EnemyAI.SwitchToBehaviourServerRpc", $"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, "JesterAI.KillPlayerServerRpc"); } [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, "RedLocustBees.BeeKillPlayerServerRpc"); } [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, "NutcrackerEnemyAI.LegKickPlayerServerRpc"); } [HarmonyPatch(typeof(CentipedeAI), "__rpc_handler_2791977891")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2791977891(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) if (!Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); LogInfo(p, "CentipedeAI.ClingToPlayerServerRpc", $"num:{num}"); if ((int)p.playerClientId == num) { if (ClingTime.ContainsKey(p.playerSteamId)) { ClingTime[p.playerSteamId] = DateTime.Now; } else { ClingTime.Add(p.playerSteamId, DateTime.Now); } } return true; } [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, "RadMechAI.GrabPlayerServerRpc"); } private static bool KillPlayerServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams, string call) { //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, $"{((object)val).GetType()}.KillPlayerServerRpc", $"playerId:{num}"); if (num <= StartOfRound.Instance.allPlayerScripts.Length && (Object)(object)StartOfRound.Instance.allPlayerScripts[num] != (Object)(object)p) { LogInfo(p, $"{((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()) { LogInfo(p, "StartCoroutine:CheckRpc(KillPlayer)", "call:" + call); rpcs["KillPlayer"].Add(p.playerClientId); ((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) if (!Check(rpcParams, out var p) && (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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0148: 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) if (Check(rpcParams, out var p)) { EnemyAI val = (EnemyAI)target; LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.KillEnemyServerRpc", $"EnemyId:{((Object)val).GetInstanceID()}", $"HP:{val.enemyHP}"); if (AntiCheat.Core.AntiCheat.KillEnemy.Value) { foreach (HitData item in bypassKill) { if (item.EnemyInstanceId == ((Object)val).GetInstanceID() && !item.CalledClient.Contains(p.playerClientId)) { LogInfo($"{((Object)val).GetInstanceID()} bypass|playerClientId:{p.playerClientId}"); item.CalledClient.Add(p.playerClientId); return true; } } if (val.enemyHP <= 0) { return true; } if (Vector3.Distance(((Component)p).transform.position, ((Component)val).transform.position) > 50f) { ShowMessage(locale.Msg_GetString("KillEnemy", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{HP}", val.enemyHP.ToString() } })); if (AntiCheat.Core.AntiCheat.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 _) && AntiCheat.Core.AntiCheat.Enemy.Value) { 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0074: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.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(p, "(" + component.enemyType.enemyName + ")EnemyAI.ChangeEnemyOwnerServerRpc", $"Distance:{num2}", $"CallClientId:{p.playerClientId}", $"OwnerClientId:{((NetworkBehaviour)component).OwnerClientId}", $"NewClientId:{num}"); 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 (AntiCheat.Core.AntiCheat.Jetpack.Value) { JetpackItem val = (JetpackItem)target; if ((Object)(object)((GrabbableObject)val).playerHeldBy != (Object)null && ((GrabbableObject)val).playerHeldBy.playerClientId != p.playerClientId) { ShowMessage(locale.Msg_GetString("Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.Jetpack2.Value) { KickPlayer(p); } return false; } if ((Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null) { ShowMessage(locale.Msg_GetString("Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.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 && !bypassKill.Any((HitData x) => x.EnemyInstanceId == ((Object)__instance).GetInstanceID())) { 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(ButlerEnemyAI), "KillEnemy")] [HarmonyPrefix] [HarmonyWrapSafe] public static void ButlerBlowUpAndPop(ButlerEnemyAI __instance) { //IL_001b: 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_002a: 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) if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { LandminePatch.SpawnExplosion(((Component)__instance).transform.position + Vector3.up * 0.15f); } } public static string PlayerClientIdConvertName(int index) { if (index < 0 || index >= StartOfRound.Instance.allPlayerScripts.Length) { return "Unknown"; } return StartOfRound.Instance.allPlayerScripts[index].playerUsername; } [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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) 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); EnemyAI val = (EnemyAI)target; LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.HitEnemyServerRpc", $"EnemyId:{((Object)val).GetInstanceID()}", $"HP:{val.enemyHP}", $"force:{num}", $"playerWhoHit:{PlayerClientIdConvertName(num2)}({num2})"); if (p.isHostPlayerObject) { return true; } if (num2 != -1 && (Object)(object)StartOfRound.Instance.allPlayerScripts[num2] != (Object)(object)p) { LogInfo("return false;"); return false; } VehicleController val2 = Object.FindFirstObjectByType<VehicleController>(); if ((Object)(object)val2 != (Object)null) { PlayerControllerB currentDriver = val2.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; } } foreach (HitData item in bypassHit) { if (item.EnemyInstanceId == ((Object)val).GetInstanceID() && item.force == num && !item.CalledClient.Contains(p.playerClientId)) { LogInfo($"{((Object)val).GetInstanceID()} bypass|playerClientId:{p.playerClientId}"); item.CalledClient.Add(p.playerClientId); return true; } } if (AntiCheat.Core.AntiCheat.Shovel.Value) { GrabbableObject val3 = p.ItemSlots[p.currentItemSlot]; string playerUsername = p.playerUsername; if (num == 6 && num2 == -1) { LogInfo($"force = 6||enemyPostion:{((Component)val).transform.position}"); explosions = explosions.Where((ExplosionData x) => x.CreateDateTime.AddSeconds(10.0) > DateTime.Now).ToList(); for (int num3 = explosions.Count - 1; num3 > 0; num3--) { ExplosionData explosionData = explosions[num3]; if (!explosionData.CalledClient.Contains(p.playerSteamId)) { float num4 = Vector3.Distance(explosionData.ExplosionPostion, ((Component)val).transform.position); LogInfo($"ExplosionPostion:{explosionData.ExplosionPostion}||Distance:{num4}"); if (num4 < 5f) { explosionData.CalledClient.Add(p.playerSteamId); return true; } } } } else if (num != 1 && (Object)(object)val3 != (Object)null && (isShovel(val3) || isKnife(val3))) { if (!jcs.Contains(p.playerSteamId)) { ShowMessage(locale.Msg_GetString("Shovel4", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{damageAmount}", num.ToString() }, { "{item}", isShovel(val3) ? locale.Item_GetString("Shovel") : locale.Item_GetString("Knife") } })); jcs.Add(p.playerSteamId); if (AntiCheat.Core.AntiCheat.Shovel2.Value) { KickPlayer(p); } return false; } } else if (!p.isPlayerDead && (Object)(object)val3 == (Object)null) { if (ClingTime.ContainsKey(p.playerSteamId) && ClingTime[p.playerSteamId].AddSeconds(5.0) > DateTime.Now) { return true; } if (!jcs.Contains(p.playerSteamId)) { for (int i = 0; i < p.ItemSlots.Length; i++) { LogInfo($"p:{p.playerUsername}|i:{i}|itemName:{p.ItemSlots[i]?.itemProperties?.itemName}"); } LogInfo($"currentItemSlot:{p.currentItemSlot}"); LogInfo("currentlyHeldObjectServer:" + p.currentlyHeldObjectServer?.itemProperties?.itemName); LogInfo($"obj:{val3}"); if (!AntiCheat.Core.AntiCheat.Shovel3.Value && (num == 1 || num == 2 || num == 3 || num == 5)) { ShowMessage(locale.Msg_GetString("Shovel6", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{damageAmount}", num.ToString() } })); jcs.Add(p.playerSteamId); if (AntiCheat.Core.AntiCheat.Shovel2.Value) { KickPlayer(p); } } else { ShowMessage(locale.Msg_GetString("Shovel6", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.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; AntiCheat.Core.AntiCheat.MessageType value = AntiCheat.Core.AntiCheat.DetectedMessageType.Value; empty = locale.MessageFormat(new Dictionary<string, string> { { "{Prefix}", locale.Prefix() }, { "{msg}", msg } }); if (!(lastMessage == msg) && (!(lastmsg == lastMessage) || lastmsg == null)) { if (lastmsg != null) { lastMessage = lastmsg; } else { lastMessage = msg; } switch (value) { case AntiCheat.Core.AntiCheat.MessageType.PublicChat: LogInfo("AddTextMessageClientRpc|" + empty); AddTextMessageClientRpc(empty); break; case AntiCheat.Core.AntiCheat.MessageType.HostChat: ShowMessageHostOnly(empty); break; default: LogInfo("ShowGUI|" + empty); break; } } } public static void AddTextMessageClientRpc(string showmsg) { AccessTools.DeclaredMethod(typeof(HUDManager), "AddTextMessageClientRpc", (Type[])null, (Type[])null).Invoke(HUDManager.Instance, new object[1] { showmsg }); } [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_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 (AntiCheat.Core.AntiCheat.Gift.Value) { GiftBoxItem val = (GiftBoxItem)target; if ((bool)AccessTools.DeclaredField(typeof(GiftBoxItem), "hasUsedGift").GetValue(val)) { ShowMessage(locale.Msg_GetString("Gift", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.Gift2.Value) { KickPlayer(p); } return false; } ((MonoBehaviour)StartOfRound.Instance.localPlayerController).StartCoroutine(DestroySelf(((Component)val).gameObject)); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [IteratorStateMachine(typeof(<DestroySelf>d__96))] public static IEnumerator DestroySelf(GameObject self) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DestroySelf>d__96(0) { self = self }; } [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 (AntiCheat.Core.AntiCheat.Mask.Value) { if (mjs.Contains(((Object)target).GetInstanceID())) { ShowMessage(locale.Msg_GetString("Mask", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.Mask2.Value) { KickPlayer(p); } return false; } mjs.Add(((Object)target).GetInstanceID()); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } public 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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)); SteamFriends.RequestUserInformation(SteamId.op_Implicit(76561198830282195uL), true); 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(locale.Msg_GetString("game_start", new Dictionary<string, string> { { "{ver}", "0.8.6" } }), -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 (AntiCheat.Core.AntiCheat.GrabObject.Value && AntiCheat.Core.AntiCheat.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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.GrabObject.Value) { NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable)); ((FastBufferReader)(ref reader)).Seek(0); bool flag = false; NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { bool flag2 = true; bool flag3 = false; GrabbableObject[] itemSlots = p.ItemSlots; foreach (GrabbableObject val3 in itemSlots) { if ((Object)(object)val3 == (Object)null) { flag2 = false; } else if (val3.itemProperties.twoHanded) { flag3 = true; } else if (val3 is JetpackItem) { flag = true; } } GrabbableObject componentInChildren = ((Component)val2).GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren != (Object)null) { LogInfo(p, "PlayerControllerB.GrabObjectServerRpc", "itemName:" + componentInChildren.itemProperties.itemName, $"Distance:{Vector3.Distance(((Component)p).transform.position, ((Component)componentInChildren).transform.position)}"); bool flag4 = false; if (AntiCheat.Core.AntiCheat.GrabObject_TwoHand.Value) { if (componentInChildren.itemProperties.twoHanded && flag3) { flag4 = true; } else if (componentInChildren.itemProperties.twoHanded && flag) { flag4 = true; } else if (flag3 && flag) { flag4 = true; } } if (AntiCheat.Core.AntiCheat.GrabObject_MoreSlot.Value && !flag4) { flag4 = flag2; } if (flag4) { 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; } LocalizationManager localizationManager = locale; 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.Msg_GetString("GrabObject", obj)); componentInChildren = null; val = default(NetworkObjectReference); if (AntiCheat.Core.AntiCheat.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 (AntiCheat.Core.AntiCheat.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(locale.Msg_GetString("Invisibility", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player_position}", ((object)(Vector3)(ref val)).ToString() } })); if (AntiCheat.Core.AntiCheat.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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_0167: 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(locale.Log_GetString("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); } if (AntiCheat.Core.AntiCheat.OperationLog.Value) { LocalizationManager localizationManager = locale; Dictionary<string, string> dictionary = new Dictionary<string, string>(); Friend val = new Friend(SteamId.op_Implicit(ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id])); dictionary.Add("{player}", ((Friend)(ref val)).Name); ShowMessageHostOnly(localizationManager.OperationLog_GetString("JoinLobby", dictionary)); } return true; } [HarmonyPatch(typeof(NetworkConfig), "CompareConfig")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool NetworkConnectionManagerInitialize(ref bool __result) { if ((Object)(object)StartOfRound.Instance != (Object)null && ((NetworkBehaviour)StartOfRound.Instance).IsHost && AntiCheat.Core.AntiCheat.IgnoreClientConfig.Value) { __result = true; return false; } return true; } [HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnDisconnected")] [HarmonyPrefix] [HarmonyWrapSafe] public static void FacepunchTransportOnDisconnected(ref Connection connection, ref ConnectionInfo info) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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; HUDManagerPatch.SyncAllPlayerLevelsServerRpcCalls.Remove(ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); StartOfRoundPatch.SyncShipUnlockablesServerRpcCalls.Remove(ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); StartOfRoundPatch.SyncAlreadyHeldObjectsServerRpcCalls.Remove(ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); ConnectionIdtoSteamIdMap.Remove(((Connection)(ref connection)).Id); } } [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(p, "HUDManager.AddTextMessageServerRpc", "chatMessage:" + text); if (text.Contains("<color") || text.Contains("<size")) { if (AntiCheat.Core.AntiCheat.Map.Value && text.Contains("<size=0>Tyzeron.Minimap")) { ShowMessage(locale.Msg_GetString("Map", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.Map2.Value) { KickPlayer(p); } return false; } 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_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 (AntiCheat.Core.AntiCheat.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, "HUDManager.AddPlayerChatMessageServerRpc", "chatMessage:" + text); if (num == -1) { return false; } if (num <= StartOfRound.Instance.allPlayerScripts.Length) { if (StartOfRound.Instance.allPlayerScripts[num].playerSteamId != p.playerSteamId) { ShowMessage(locale.Msg_GetString("ChatReal", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", StartOfRound.Instance.allPlayerScripts[num].playerUsername } })); if (AntiCheat.Core.AntiCheat.ChatReal2.Value) { KickPlayer(p); } return false; } bool flag2 = CooldownManager.CheckCooldown("Chat", p); if (flag2 && locale.current_language == "zh_CN") { AccessTools.DeclaredMethod(typeof(HUDManager), "AddPlayerChatMessageClientRpc", (Type[])null, (Type[])null).Invoke(HUDManager.Instance, new object[2] { text, num }); return false; } return flag2; } return false; } catch (Exception ex) { LogInfo(ex.ToString()); return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } public static bool CheckRemoteTerminal(PlayerControllerB p, string call) { LogInfo(p, "CheckRemoteTerminal", "Call:" + call); if ((Object)(object)whoUseTerminal == (Object)null && lastWhoUseTerminal.Value == p.playerSteamId) { LogInfo($"whoUseTerminal == null && lastWhoUseTerminal == {p.playerSteamId}||Time:{Math.Round((DateTime.Now - lastWhoUseTerminal.Key).TotalSeconds, 2)}s"); if (lastWhoUseTerminal.Key.AddSeconds(10.0) > DateTime.Now) { return true; } } if ((Object)(object)whoUseTerminal != (Object)(object)p) { if ((Object)(object)whoUseTerminal == (Object)null) { LogInfo("no player use terminal|request player:" + p.playerUsername + "|call:" + call); } else { LogInfo("whoUseTerminal:" + whoUseTerminal.playerUsername + "|p:" + p.playerUsername + "|call:" + call); } ShowMessage(locale.Msg_GetString("RemoteTerminal", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006e: 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) { InteractTrigger val = (InteractTrigger)AccessTools.DeclaredField(typeof(Terminal), "terminalTrigger").GetValue(terminal); if (((Object)val).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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a1: 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; } InteractTrigger val = (InteractTrigger)AccessTools.DeclaredField(typeof(Terminal), "terminalTrigger").GetValue(terminal); if (((Object)val).GetInstanceID() == ((Object)(InteractTrigger)target).GetInstanceID()) { lastWhoUseTerminal = new KeyValuePair<DateTime, ulong>(DateTime.Now, p.playerSteamId); 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 (AntiCheat.Core.AntiCheat.RemoteTerminal.Value && !CheckRemoteTerminal(p, "Terminal.PlayTerminalAudioServerRpc")) { return false; } return CooldownManager.CheckCooldown("TerminalNoise", p); } 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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { bool flag = CooldownManager.CheckCooldown("ShipLight", p); if (!flag) { ((ShipLights)target).SetShipLightsClientRpc(true); } return flag; } 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_3349119596")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_3349119596(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.InfiniteAmmo.Value) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ((FastBufferReader)(ref reader)).Seek(0); ShotgunItem shot = (ShotgunItem)target; LogInfo(p, "ShotgunItem.ReloadGunEffectsServerRpc", $"start:{flag}", $"shellsLoaded:{shot.shellsLoaded}"); if (!ReloadGun.ContainsKey(p.playerSteamId)) { ReloadGun.Add(p.playerSteamId, flag); } else { ReloadGun[p.playerSteamId] = flag; } if (flag) { GrabbableObject val = ((IEnumerable<GrabbableObject>)((GrabbableObject)shot).playerHeldBy.ItemSlots).FirstOrDefault((Func<GrabbableObject, bool>)delegate(GrabbableObject x) { GunAmmo val2 = (GunAmmo)(object)((x is GunAmmo) ? x : null); return val2 != null && val2.ammoType == shot.gunCompatibleAmmoID; }); if ((Object)(object)val != (Object)null) { ((MonoBehaviour)shot).StartCoroutine(CheckAmmo(p, shot, val)); return true; } ShowMessage(locale.Msg_GetString("InfiniteAmmo", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.InfiniteAmmo2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [IteratorStateMachine(typeof(<CheckAmmo>d__119))] public static IEnumerator CheckAmmo(PlayerControllerB p, ShotgunItem shot, GrabbableObject ammo) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CheckAmmo>d__119(0) { p = p, shot = shot, ammo = ammo }; } [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 (AntiCheat.Core.AntiCheat.InfiniteAmmo.Value) { ShotgunItem val = (ShotgunItem)target; if ((bool)typeof(ShotgunItem).GetField("localClientSendingShootGunRPC", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val)) { return true; } LogInfo(p, "ShotgunItem.ShootGunServerRpc", $"shellsLoaded:{val.shellsLoaded}"); if (val.shellsLoaded == 0) { ShowMessage(locale.Msg_GetString("InfiniteAmmo", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (AntiCheat.Core.AntiCheat.InfiniteAmmo2.Value) { KickPlayer(p); } return false; } } if (AntiCheat.Core.AntiCheat.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(locale.Msg_GetString("ItemCooldown", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{item}", locale.Item_GetString("Shotgun") } })); if (AntiCheat.Core.AntiCheat.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_0001: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.ItemCooldown.Value) { ulong playerSteamId = p.playerSteamId; string i = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (!czcd.ContainsKey(playerSteamId)) { czcd.Add(playerSteamId, new List<string>()); } if (czcd[playerSteamId].Count > 200) { czcd[playerSteamId].RemoveRange(0, czcd[playerSteamId].Count - 1); } if (czcd[playerSteamId].Count((string x) => x == i) >= cd) { ShowMessage(locale.Msg_GetString("ItemCooldown", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{item}", locale.Item_GetString("Shovel") } })); if (AntiCheat.Core.AntiCheat.ItemCooldown2.Value) { KickPlayer(p); } return false; } czcd[playerSteamId].Add(i); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(StartOfRound), "__rpc_handler_1089447320")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool StartGameServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) StartMatchLever val = Object.FindObjectOfType<StartMatchLever>(); if (Check(rpcParams, out var p)) { if (AntiCheat.Core.AntiCheat.ShipConfig.Value && !GameNetworkManager.Instance.gameHasStarted) { ShowMessage(locale.Msg_GetString("ShipConfig5", new Dictionary<string, string> { { "{player}", p.playerUsername } })); val.triggerScript.interactable = true; if (AntiCheat.Core.AntiCheat.Ship_Kick.Value) { KickPlayer(p); return false; } return false; } if (StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB x) => x.isPlayerControlled) >= AntiCheat.Core.AntiCheat.ShipConfig2.Value) { return true; } val.triggerScript.interactable = true; ShowMessage(locale.Msg_GetString("ShipConfig2", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{cfg}", AntiCheat.Core.AntiCheat.ShipConfig2.Value.ToString() } })); return false; } if ((Object)(object)p == (Object)null) { val.triggerScript.interactable = true; return false; } return true; } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPostfix] [HarmonyWrapSafe] public static void OnPlayerDC(int playerObjectNumber, ulong clientId) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerObjectNumber].GetComponent<PlayerControllerB>(); component.playerSteamId = 0uL; } public static void KickPlayer(PlayerControllerB kick, bool canJoin = false, string Reason = null) { if (kick.playerClientId == 0) { return; } NetworkManager.Singleton.DisconnectClient(kick.playerClientId, "[" + locale.Prefix() + "] " + locale.Msg_GetString("KickPlayer") + "!"); if (kick.playerSteamId != 0) { StartOfRound instance = StartOfRound.Instance; ulong playerSteamId = kick.playerSteamId; if (!instance.KickedClientIds.Contains(playerSteamId) && !canJoin) { instance.KickedClientIds.Add(playerSteamId); } Terminal val = Object.FindAnyObjectByType<Terminal>(); LogInfo("terminalInUse" + val.placeableObject.inUse); LogInfo("whoUseTerminal:" + whoUseTerminal?.playerUsername); LogInfo("playerUsername:" + kick?.playerUsername); if ((Object)(object)whoUseTerminal == (Object)(object)kick && val.placeableObject.inUse) { LogInfo("SetTerminalInUseServerRpc"); val.SetTerminalInUseClientRpc(false); val.terminalInUse = false; } ShowMessage(locale.Msg_GetString("Kick", new Dictionary<string, string> { { "{player}", kick.playerUsername } })); } } [HarmonyPatch(typeof(StartMatchLever), "__rpc_handler_2406447821")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_2406447821(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: 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_003d: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (Check(rpcParams, out var p)) { if (Object.FindAnyObjectByType<StartMatchLever>().leverHasBeenPulled && !StartOfRound.Instance.shipHasLanded) { return StartGameServerRpc(target, reader, rpcParams); } return EndGameServerRpc(target, reader, rpcParams); } if ((Object)(object)p == (Object)null) { Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } return true; } [HarmonyPatch(typeof(DepositItemsDesk), "SellAndDisplayItemProfits")] [HarmonyPostfix] [HarmonyWrapSafe] public static void SellAndDisplayItemProfits(int profit, int newGroupCredits) { if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { Money = newGroupCredits; LogInfo($"SetMoney:{Money}"); } } [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_1786952262")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_1786952262(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 (AntiCheat.Core.AntiCheat.DespawnItem.Value) { LogInfo(p, "PlayerControllerB.DespawnHeldObjectServerRpc", "itemName:" + p.currentlyHeldObjectServer.itemProperties.itemName); if ((Object)(object)p.currentlyHeldObjectServer != (Object)null && !(p.currentlyHeldObjectServer is GiftBoxItem) && !(p.currentlyHeldObjectServer is KeyItem)) { ShowMessage(locale.Msg_GetString("DespawnItem", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{item}", p.currentlyHeldObjectServer.itemProperties.itemName } })); if (AntiCheat.Core.AntiCheat.DespawnItem2.Value) { KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Update() { if (((NetworkBehaviour)StartOfRound.Instance).IsHost && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !StartOfRound.Instance.shipIsLeaving && StartOfRound.Instance.currentLevel.planetHasTime && AntiCheat.Core.AntiCheat.ShipSetting_OnlyOneVote.Value && !TimeOfDay.Instance.shipLeavingAlertCalled && GameNetworkManager.Instance.localPlayerController.isPlayerDead && !string.IsNullOrEmpty((