Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AntiCheat v0.8.9
BepInEx/plugins/AntiCheat.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using AntiCheat; using AntiCheat.Locale; using AntiCheat.Utils; 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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("chuxiaaaa")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("AntiCheat")] [assembly: AssemblyFileVersion("0.8.8.0")] [assembly: AssemblyInformationalVersion("0.8.8+c295c41ca73c24a6c6c85710bb7bd4f3fa8063b2")] [assembly: AssemblyProduct("AntiCheat")] [assembly: AssemblyTitle("AntiCheat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.8.8.0")] [module: UnverifiableCode] [BepInPlugin("AntiCheat", "AntiCheat", "0.8.8")] public class AntiCheatPlugin : BaseUnityPlugin { internal static ManualLogSource Log = null; internal static LocalizationManager localizationManager = null; private static string _lastMessage = string.Empty; private static readonly MethodInfo AddChatMessageMethod = AccessTools.DeclaredMethod(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null); private static readonly MethodInfo AddTextMessageClientRpcMethod = AccessTools.DeclaredMethod(typeof(HUDManager), "AddTextMessageClientRpc", (Type[])null, (Type[])null); private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; localizationManager = new LocalizationManager(); PluginConfig.Init((BaseUnityPlugin)(object)this); Harmony val = new Harmony("AntiCheat"); val.PatchAll(Assembly.GetExecutingAssembly()); } public static void LogInfo(string info) { if ((!((Object)(object)StartOfRound.Instance != (Object)null) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) && (PluginConfig.Log == null || PluginConfig.Log.Value)) { Log.LogInfo((object)info); File.AppendAllLines("AntiCheat.log", new string[1] { $"[{DateTime.Now:MM-dd HH:mm:ss:ff}] {info}" }); } } public static void LogInfo(PlayerControllerB player, string rpc, params object[] param) { LogInfo(string.Format("{0}({1}) -> {2};{3}", player.playerUsername, player.playerClientId, rpc, string.Join("|", param))); } public static void ShowMessage(string msg, string dedupeKey = null) { string text = localizationManager.MessageFormat().Replace("{Prefix}", localizationManager.Prefix()).Replace("{msg}", msg); string text2 = dedupeKey ?? text; if (_lastMessage == text2) { return; } _lastMessage = text2; if (!((Object)(object)HUDManager.Instance == (Object)null)) { switch (PluginConfig.DetectedMessageType.Value) { case PluginConfig.MessageType.PublicChat: AddTextMessageClientRpc(text); break; case PluginConfig.MessageType.HostChat: ShowMessageHostOnly(text); break; default: LogInfo("ShowGUI|" + text); break; } } } public static void ShowMessageHostOnly(string msg) { if (!((Object)(object)HUDManager.Instance == (Object)null)) { LogInfo("ShowMessageHostOnly -> " + msg); AddChatMessageMethod.Invoke(HUDManager.Instance, new object[4] { msg, "", -1, false }); } } public static void AddTextMessageClientRpc(string showMessage) { if (!((Object)(object)HUDManager.Instance == (Object)null)) { AddTextMessageClientRpcMethod.Invoke(HUDManager.Instance, new object[1] { showMessage }); } } } internal static class LCMPluginInfo { public const string PLUGIN_GUID = "AntiCheat"; public const string PLUGIN_NAME = "AntiCheat"; public const string PLUGIN_VERSION = "0.8.8"; } namespace AntiCheat { internal class FeatureConfig { public ConfigEntry<bool> EnableEntry { get; } public ConfigEntry<bool> KickEntry { get; } public bool Enable => EnableEntry.Value; public bool Value => EnableEntry.Value; public bool Kick => KickEntry?.Value ?? false; public FeatureConfig(ConfigFile config, string section, string enableDesc, bool defaultEnable = true, bool hasKick = true) { EnableEntry = config.Bind<bool>(section, "Enable", defaultEnable, enableDesc); if (hasKick) { KickEntry = config.Bind<bool>(section, "Kick", false, AntiCheatPlugin.localizationManager.Cfg_GetString("Kick")); } else { KickEntry = null; } } } internal static class PluginConfig { public enum MessageType { GUI, HostChat, PublicChat } public static FeatureConfig Shovel; public static FeatureConfig ShipBuild; public static FeatureConfig Landmine; public static FeatureConfig InfiniteAmmo; public static FeatureConfig Mask; public static FeatureConfig Gift; public static FeatureConfig Turret; public static FeatureConfig Invisibility; public static FeatureConfig KillEnemy; public static FeatureConfig SpawnWebTrap; public static FeatureConfig Map; public static FeatureConfig FreeBuy; public static FeatureConfig RemoteTerminal; public static FeatureConfig Nameless; public static FeatureConfig DespawnItem; public static FeatureConfig ChatReal; public static FeatureConfig ShipLight; public static FeatureConfig TerminalNoise; public static FeatureConfig ItemCooldown; public static FeatureConfig Health; public static FeatureConfig RPCReport; public static FeatureConfig Boss; public static FeatureConfig GrabObject; public static FeatureConfig Jetpack; public static FeatureConfig Enemy; public static ConfigEntry<bool> IgnoreClientConfig; public static ConfigEntry<string> Prefix; public static ConfigEntry<string> PlayerJoin; public static ConfigEntry<bool> Log; public static ConfigEntry<bool> OperationLog; 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> ShipSetting_OnlyOneVote; public static ConfigEntry<bool> ShipSetting_ChangToFreeMoon; public static ConfigEntry<int> ShipLight_Cooldown; public static ConfigEntry<int> TerminalNoise_Cooldown; public static ConfigEntry<int> ChatReal_Cooldown; public static ConfigEntry<int> RPCReport_Delay; public static ConfigEntry<bool> RPCReport_Hit; public static ConfigEntry<bool> RPCReport_KillPlayer; public static ConfigEntry<bool> Shovel3; public static ConfigEntry<bool> GrabObject_SendLog; public static ConfigEntry<bool> GrabObject_MoreSlot; public static ConfigEntry<bool> GrabObject_TwoHand; public static ConfigEntry<bool> GrabObject_BeltBag; public static ConfigEntry<MessageType> DetectedMessageType; public static ConfigEntry<bool> Shovel2 => Shovel.KickEntry; public static ConfigEntry<bool> ShipBuild2 => ShipBuild.KickEntry; public static ConfigEntry<bool> ItemCooldown2 => ItemCooldown.KickEntry; public static ConfigEntry<bool> DespawnItem2 => DespawnItem.KickEntry; public static ConfigEntry<bool> ChatReal2 => ChatReal.KickEntry; public static ConfigEntry<bool> Mask2 => Mask.KickEntry; public static ConfigEntry<bool> Gift2 => Gift.KickEntry; public static ConfigEntry<bool> Turret2 => Turret.KickEntry; public static ConfigEntry<bool> InfiniteAmmo2 => InfiniteAmmo.KickEntry; public static ConfigEntry<bool> Invisibility2 => Invisibility.KickEntry; public static ConfigEntry<bool> Boss2 => Boss.KickEntry; public static ConfigEntry<bool> Jetpack2 => Jetpack.KickEntry; public static ConfigEntry<bool> Landmine2 => Landmine.KickEntry; public static ConfigEntry<bool> SpawnWebTrap2 => SpawnWebTrap.KickEntry; public static ConfigEntry<bool> KillEnemy2 => KillEnemy.KickEntry; public static ConfigEntry<bool> Map2 => Map.KickEntry; public static ConfigEntry<bool> FreeBuy2 => FreeBuy.KickEntry; public static ConfigEntry<bool> FreeBuy_Kick => FreeBuy.KickEntry; public static ConfigEntry<bool> RemoteTerminal2 => RemoteTerminal.KickEntry; public static ConfigEntry<bool> Nameless2 => Nameless.KickEntry; public static ConfigEntry<bool> GrabObject_Kick => GrabObject.KickEntry; public static ConfigEntry<bool> Health_Recover => Health.EnableEntry; public static ConfigEntry<bool> Health_Kick => Health.KickEntry; public static ConfigEntry<bool> RPCReport_Kick => RPCReport.KickEntry; internal static void Init(BaseUnityPlugin plugin) { ConfigFile config = plugin.Config; LocalizationManager localizationManager = AntiCheatPlugin.localizationManager; IgnoreClientConfig = config.Bind<bool>("VersionSetting", "NetworkSetting", false, localizationManager.Cfg_GetString("NetworkSetting")); Prefix = config.Bind<string>("ServerNameSetting", "Prefix", "AC", localizationManager.Cfg_GetString("Prefix")); Log = config.Bind<bool>("LogSetting", "Log", true, localizationManager.Cfg_GetString("Log")); OperationLog = config.Bind<bool>("LogSetting", "OperationLog", true, localizationManager.Cfg_GetString("OperationLog")); ShipConfig = config.Bind<bool>("ShipSetting", "StartGameOnlyHost", true, localizationManager.Cfg_GetString("ShipSetting")); Ship_Kick = config.Bind<bool>("ShipSetting", "Kick", false, localizationManager.Cfg_GetString("ShipConfig5")); ShipConfig2 = config.Bind<int>("ShipSetting", "StartGamePlayerCount", 8, localizationManager.Cfg_GetString("ShipConfig2")); ShipConfig3 = config.Bind<string>("ShipSetting", "EndGamePlayerTime", "14:00", localizationManager.Cfg_GetString("ShipConfig3")); ShipConfig4 = config.Bind<int>("ShipSetting", "EndGamePlayerCount", 50, localizationManager.Cfg_GetString("ShipConfig4")); ShipSetting_OnlyOneVote = config.Bind<bool>("ShipSetting", "OnlyOneVote", true, localizationManager.Cfg_GetString("ShipConfig6")); ShipSetting_ChangToFreeMoon = config.Bind<bool>("ShipSetting", "ChangToFreeMoon", false, localizationManager.Cfg_GetString("ChangToFreeMoon")); ShipBuild = new FeatureConfig(config, "ShipBuildSetting", localizationManager.Cfg_GetString("ShipBuild")); ItemCooldown = new FeatureConfig(config, "ItemCooldownSetting", localizationManager.Cfg_GetString("ItemCooldown")); ShipLight = new FeatureConfig(config, "ShipLightSettings", localizationManager.Cfg_GetString("ShipLight"), defaultEnable: true, hasKick: false); TerminalNoise = new FeatureConfig(config, "TerminalNoiseSettings", localizationManager.Cfg_GetString("ShipTerminal"), defaultEnable: true, hasKick: false); DespawnItem = new FeatureConfig(config, "DespawnItemSettings", localizationManager.Cfg_GetString("DespawnItem")); ChatReal = new FeatureConfig(config, "ChatRealSettings", localizationManager.Cfg_GetString("ChatReal")); Mask = new FeatureConfig(config, "MaskSettings", localizationManager.Cfg_GetString("Mask")); Gift = new FeatureConfig(config, "GiftSettings", localizationManager.Cfg_GetString("Gift")); Turret = new FeatureConfig(config, "TurretSettings", localizationManager.Cfg_GetString("Turret")); InfiniteAmmo = new FeatureConfig(config, "InfiniteAmmoSettings", localizationManager.Cfg_GetString("InfiniteAmmo")); Invisibility = new FeatureConfig(config, "InvisibilitySettings", localizationManager.Cfg_GetString("Invisibility")); Boss = new FeatureConfig(config, "BossSetting", localizationManager.Cfg_GetString("Boss")); Jetpack = new FeatureConfig(config, "JetpackSetting", localizationManager.Cfg_GetString("Jetpack")); Landmine = new FeatureConfig(config, "LandmineSetting", localizationManager.Cfg_GetString("Landmine")); SpawnWebTrap = new FeatureConfig(config, "SpawnWebTrapSetting", localizationManager.Cfg_GetString("SpawnWebTrap")); Enemy = new FeatureConfig(config, "EnemySetting", localizationManager.Cfg_GetString("Enemy"), defaultEnable: true, hasKick: false); KillEnemy = new FeatureConfig(config, "KillEnemySetting", localizationManager.Cfg_GetString("KillEnemy")); Map = new FeatureConfig(config, "MapSetting", localizationManager.Cfg_GetString("Map")); FreeBuy = new FeatureConfig(config, "FreeBuySettings", localizationManager.Cfg_GetString("FreeBuy")); RemoteTerminal = new FeatureConfig(config, "RemoteTerminalSettings", localizationManager.Cfg_GetString("RemoteTerminal")); Nameless = new FeatureConfig(config, "NamelessSettings", localizationManager.Cfg_GetString("Nameless")); Health = new FeatureConfig(config, "HealthSetting", localizationManager.Cfg_GetString("Health_Recover")); RPCReport = new FeatureConfig(config, "RPCReportSetting", localizationManager.Cfg_GetString("RPCReport_Hit")); Shovel = new FeatureConfig(config, "ShovelSettings", localizationManager.Cfg_GetString("Shovel")); GrabObject = new FeatureConfig(config, "GrabObjectSetting", localizationManager.Cfg_GetString("GrabObject")); ShipLight_Cooldown = config.Bind<int>("ShipLightSettings", "Cooldown", 2000, localizationManager.Cfg_GetString("Cooldown")); TerminalNoise_Cooldown = config.Bind<int>("TerminalNoiseSettings", "Cooldown", 1000, localizationManager.Cfg_GetString("Cooldown")); ChatReal_Cooldown = config.Bind<int>("ChatRealSettings", "Cooldown", 100, localizationManager.Cfg_GetString("Cooldown")); RPCReport_Delay = config.Bind<int>("RPCReportSetting", "Delay", 1000, localizationManager.Cfg_GetString("RPCReport_Delay")); RPCReport_Hit = config.Bind<bool>("RPCReportSetting", "Hit", true, localizationManager.Cfg_GetString("RPCReport_Hit")); RPCReport_KillPlayer = config.Bind<bool>("RPCReportSetting", "KillPlayer", true, localizationManager.Cfg_GetString("RPCReport_KillPlayer")); DetectedMessageType = config.Bind<MessageType>("DetectedMessageType", "Type", MessageType.PublicChat, localizationManager.Cfg_GetString("DetectedMessageType")); PlayerJoin = config.Bind<string>("MsgSettings", "PlayerJoinShip", localizationManager.Msg_GetString("wlc_player"), localizationManager.Msg_GetString("wlc_player")); Shovel3 = config.Bind<bool>("ShovelSettings", "EmptyHand", false, localizationManager.Cfg_GetString("Shovel2")); GrabObject_SendLog = config.Bind<bool>("GrabObjectSetting", "SendLog", true, localizationManager.Cfg_GetString("GrabObject_SendLog")); GrabObject_MoreSlot = config.Bind<bool>("GrabObjectSetting", "MoreSlot", true, localizationManager.Cfg_GetString("GrabObject_MoreSlot")); GrabObject_TwoHand = config.Bind<bool>("GrabObjectSetting", "TwoHand", true, localizationManager.Cfg_GetString("GrabObject_TwoHand")); GrabObject_BeltBag = config.Bind<bool>("GrabObjectSetting", "BeltBag", true, localizationManager.Cfg_GetString("GrabObject_BeltBag")); CooldownManager.Reset(); RegisterCooldown("TerminalNoise", TerminalNoise.EnableEntry, TerminalNoise_Cooldown); RegisterCooldown("ShipLight", ShipLight.EnableEntry, ShipLight_Cooldown); RegisterCooldown("Chat", ChatReal.EnableEntry, ChatReal_Cooldown); AntiCheatPlugin.LogInfo(localizationManager.Log_GetString("load")); } private static void RegisterCooldown(string name, ConfigEntry<bool> enable, ConfigEntry<int> cooldownMs) { CooldownManager.RegisterCooldownGroup(name, () => enable.Value, () => (float)cooldownMs.Value / 1000f); } } } namespace AntiCheat.Utils { 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>, IEnumerator, IDisposable { 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; } } } namespace AntiCheat.Patches { [HarmonyPatch(typeof(HUDManager))] [HarmonyWrapSafe] public static class HUDManagerChatRealPatch { [HarmonyPatch(typeof(HUDManager), "__rpc_handler_2930587515")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool AddPlayerChatMessageServerRpc(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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.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); PatchHelper.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) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("ChatReal", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player2}", StartOfRound.Instance.allPlayerScripts[num].playerUsername } })); if (PluginConfig.ChatReal2.Value) { PatchHelper.KickPlayer(p); } return false; } bool flag2 = CooldownManager.CheckCooldown("Chat", p); if (flag2 && PatchHelper.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) { PatchHelper.LogInfo(ex.ToString()); return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(HUDManager))] [HarmonyWrapSafe] public static class HUDManagerMapPatch { [HarmonyPatch("__rpc_handler_2787681914")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool AddTextMessageServerRpc(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 (PatchHelper.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); PatchHelper.LogInfo(p, "HUDManager.AddTextMessageServerRpc", "chatMessage:" + text); if (text.Contains("<color") || text.Contains("<size")) { if (PluginConfig.Map.Value && text.Contains("<size=0>Tyzeron.Minimap")) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Map", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (PluginConfig.Map2.Value) { PatchHelper.KickPlayer(p); } } return false; } return text.StartsWith("[morecompanycosmetics]"); } if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(FacepunchTransport))] [HarmonyWrapSafe] public static class FacepunchTransportPatch { [HarmonyPatch("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_00a9: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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.allPlayerScripts.Any((PlayerControllerB x) => x.isPlayerControlled && x.playerSteamId == ((NetIdentity)(ref identity)).SteamId.Value)) { PatchHelper.LogInfo("{steamId} repeatedly joins the game."); return false; } if (PatchHelper.ConnectionIdtoSteamIdMap.ContainsKey(((Connection)(ref connection)).Id)) { PatchHelper.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id] = ((NetIdentity)(ref identity)).SteamId.Value; } else { PatchHelper.ConnectionIdtoSteamIdMap.Add(((Connection)(ref connection)).Id, ((NetIdentity)(ref identity)).SteamId.Value); } if (PluginConfig.OperationLog.Value) { LocalizationManager locale = PatchHelper.locale; Dictionary<string, string> dictionary = new Dictionary<string, string>(); Friend val = new Friend(SteamId.op_Implicit(PatchHelper.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id])); dictionary.Add("{player}", ((Friend)(ref val)).Name); PatchHelper.ShowMessageHostOnly(locale.OperationLog_GetString("JoinLobby", dictionary)); } return true; } [HarmonyPatch("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; HUDManagerRoundSyncPatch.SyncAllPlayerLevelsServerRpcCalls.Remove(PatchHelper.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); StartOfRoundPatch.SyncShipUnlockablesServerRpcCalls.Remove(PatchHelper.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); StartOfRoundPatch.SyncAlreadyHeldObjectsServerRpcCalls.Remove(PatchHelper.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id]); PatchHelper.ConnectionIdtoSteamIdMap.Remove(((Connection)(ref connection)).Id); } } } [HarmonyPatch(typeof(NetworkConfig))] [HarmonyWrapSafe] public static class NetworkConfigPatch { [HarmonyPatch("CompareConfig")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool NetworkConnectionManagerInitialize(ref bool __result) { if ((Object)(object)StartOfRound.Instance != (Object)null && ((NetworkBehaviour)StartOfRound.Instance).IsHost && PluginConfig.IgnoreClientConfig.Value) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(NetworkManager))] [HarmonyWrapSafe] public static class NetworkManagerPatch { [HarmonyPatch("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) { PatchHelper.ConnectionIdtoSteamIdMap[0u] = SteamId.op_Implicit(SteamClient.SteamId); } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerConnectionPatch { [HarmonyPatch("__rpc_handler_2504133785")] [HarmonyPrefix] public static bool SendNewPlayerValuesServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006d: 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_008b: 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) if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost || rpcParams.Server.Receive.SenderClientId == 0) { return true; } ulong num = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); ulong num2 = PatchHelper.ConnectionIdtoSteamIdMap[PatchHelper.ClientIdToTransportId(rpcParams.Server.Receive.SenderClientId)]; Friend val = default(Friend); ((Friend)(ref val))..ctor(SteamId.op_Implicit(num2)); if (num != num2) { NetworkManager.Singleton.DisconnectClient(rpcParams.Server.Receive.SenderClientId); AntiCheatPlugin.LogInfo($"Player {((Friend)(ref val)).Name}({num2}) spoofed SteamID({num}) while joining"); return false; } string showmsg = PluginConfig.PlayerJoin.Value.Replace("{player}", ((Friend)(ref val)).Name); PatchHelper.AddTextMessageClientRpc(showmsg); return true; } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyWrapSafe] public static class StartOfRoundConnectionPatch { [HarmonyPatch("OnPlayerDC")] [HarmonyPostfix] [HarmonyWrapSafe] public static void OnPlayerDC(int playerObjectNumber, ulong clientId) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerObjectNumber].GetComponent<PlayerControllerB>(); component.playerSteamId = 0uL; } } [HarmonyPatch(typeof(EnemyAI))] [HarmonyWrapSafe] public static class EnemyAIControlPatch { [HarmonyPatch("__rpc_handler_2081148948")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SwitchToBehaviourServerRpc(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 (PatchHelper.Check(rpcParams, out var p)) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); EnemyAI val = (EnemyAI)target; PatchHelper.LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.SwitchToBehaviourServerRpc", $"stateIndex:{num}"); if (PluginConfig.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; } PatchHelper.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("__rpc_handler_1277166335")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool UpdateEnemyPositionServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!PatchHelper.Check(rpcParams, out var p) && (Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch("__rpc_handler_3079913705")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool UpdateEnemyRotationServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var _) && PluginConfig.Enemy.Value) { return true; } return true; } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_3587030867")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool ChangeEnemyOwnerServerRpc(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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.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); PatchHelper.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(BeltBagItem))] [HarmonyWrapSafe] public static class BeltBagItemPatch { [HarmonyPatch("__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_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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.GrabObject.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; } if (PluginConfig.GrabObject_SendLog.Value) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("GrabObject_BeltBag", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{itemName}", component.itemProperties.itemName } })); } if (PluginConfig.GrabObject_BeltBag.Value) { ((BeltBagItem)target).CancelAddObjectToBagClientRpc(num); return false; } } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerGrabObjectPatch { [HarmonyPatch("__rpc_handler_412259855")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SwitchItemSlotsServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.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("__rpc_handler_1554282707")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool GrabObjectServerRpc(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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.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; bool flag3 = false; GrabbableObject[] itemSlots = p.ItemSlots; foreach (GrabbableObject val3 in itemSlots) { if ((Object)(object)val3 == (Object)null) { flag = false; } else if (val3.itemProperties.twoHanded) { flag3 = true; } else if (val3 is JetpackItem) { flag2 = true; } } GrabbableObject componentInChildren = ((Component)val2).GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren != (Object)null) { PatchHelper.LogInfo(p, "PlayerControllerB.GrabObjectServerRpc", "itemName:" + componentInChildren.itemProperties.itemName, "heldByPlayerOnServer:" + ((!componentInChildren.heldByPlayerOnServer) ? "false" : componentInChildren.playerHeldBy?.playerUsername), $"Distance:{Vector3.Distance(((Component)p).transform.position, ((Component)componentInChildren).transform.position)}"); bool flag4 = false; GrabbableObject val4 = null; if (p.currentItemSlot >= 0 && p.currentItemSlot < p.ItemSlots.Length) { val4 = p.ItemSlots[p.currentItemSlot]; } bool flag5 = ((Object)(object)p.currentlyHeldObjectServer != (Object)null && p.currentlyHeldObjectServer.itemProperties.twoHanded) || ((Object)(object)val4 != (Object)null && val4.itemProperties.twoHanded); bool flag6 = p.currentlyHeldObjectServer is JetpackItem || val4 is JetpackItem; bool flag7 = flag5 && !componentInChildren.itemProperties.twoHanded; string value = (((Object)(object)p.currentlyHeldObjectServer != (Object)null) ? p.currentlyHeldObjectServer.itemProperties.itemName : (((Object)(object)val4 != (Object)null) ? val4.itemProperties.itemName : "unknown")); bool flag8 = flag6 && componentInChildren.itemProperties.twoHanded && !flag3; if (flag7 || (componentInChildren.itemProperties.twoHanded && flag3) || (componentInChildren.itemProperties.twoHanded && flag2) || (flag3 && flag2)) { if (PluginConfig.GrabObject_SendLog.Value && !flag8) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("GrabObject_TwoHand", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{heldItemName}", value }, { "{itemName}", componentInChildren.itemProperties.itemName }, { "{hasTwoHand}", flag3.ToString() }, { "{jetpack}", flag2.ToString() } })); } if (PluginConfig.GrabObject_TwoHand.Value) { flag4 = true; } } if (flag && !flag4 && PluginConfig.GrabObject_SendLog.Value) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("GrabObject_MoreSlot", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{itemName}", componentInChildren.itemProperties.itemName } })); } if (PluginConfig.GrabObject_MoreSlot.Value && !flag4) { flag4 = flag; } if (flag4) { if (PluginConfig.GrabObject_Kick.Value) { PatchHelper.KickPlayer(p); } ForceCancelGrab(target); return false; } if (Vector3.Distance(((Component)componentInChildren).transform.position, p.serverPlayerPosition) > 100f && !StartOfRound.Instance.shipIsLeaving && StartOfRound.Instance.shipHasLanded) { if (p.teleportedLastFrame) { return true; } if (PluginConfig.GrabObject_SendLog.Value) { LocalizationManager locale = PatchHelper.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()); PatchHelper.ShowMessage(locale.Msg_GetString("GrabObject", obj)); } if (PluginConfig.GrabObject_Kick.Value) { PatchHelper.KickPlayer(p); } ForceCancelGrab(target); return false; } } } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } private static void ForceCancelGrab(NetworkBehaviour target) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005e: Expected O, but got Unknown 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] { (object)default(NetworkObjectReference) }); field.SetValue(target, 0); } } [HarmonyPatch(typeof(GiftBoxItem))] [HarmonyWrapSafe] public static class GiftBoxItemPatch { [HarmonyPatch("__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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.Gift.Value) { GiftBoxItem val = (GiftBoxItem)target; if ((bool)AccessTools.DeclaredField(typeof(GiftBoxItem), "hasUsedGift").GetValue(val)) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Gift", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (PluginConfig.Gift2.Value) { PatchHelper.KickPlayer(p); } return false; } ((MonoBehaviour)StartOfRound.Instance.localPlayerController).StartCoroutine(PatchHelper.DestroySelf(((Component)val).gameObject)); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(GrabbableObject))] [HarmonyWrapSafe] public static class GrabbableObjectItemUsePatch { [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_001f: 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) //IL_0038: Expected O, but got Unknown if (PatchHelper.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; if (val.itemProperties.requiresBattery) { AntiCheatPlugin.LogInfo(p, "(" + val.itemProperties.itemName + ")GrabbableObject.SyncBatteryServerRpc", $"num:{num}"); if (num > 100) { return false; } } return true; } } [HarmonyPatch(typeof(HauntedMaskItem))] [HarmonyWrapSafe] public static class HauntedMaskItemPatch { [HarmonyPatch("__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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.Mask.Value) { if (PatchHelper.mjs.Contains(((Object)target).GetInstanceID())) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Mask", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (PluginConfig.Mask2.Value) { PatchHelper.KickPlayer(p); } return false; } PatchHelper.mjs.Add(((Object)target).GetInstanceID()); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(JetpackItem))] [HarmonyWrapSafe] public static class JetpackItemPatch { [HarmonyPatch("__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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.Jetpack.Value) { JetpackItem val = (JetpackItem)target; if ((Object)(object)((GrabbableObject)val).playerHeldBy != (Object)null && ((GrabbableObject)val).playerHeldBy.playerClientId != p.playerClientId) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (PluginConfig.Jetpack2.Value) { PatchHelper.KickPlayer(p); } return false; } if ((Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Jetpack", new Dictionary<string, string> { { "{player}", p.playerUsername } })); if (PluginConfig.Jetpack2.Value) { PatchHelper.KickPlayer(p); } return false; } return true; } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerItemUsePatch { [HarmonyPatch("__rpc_handler_1786952262")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool DespawnHeldObjectServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.DespawnItem.Value) { PatchHelper.LogInfo(p, "PlayerControllerB.DespawnHeldObjectServerRpc", "itemName:" + p.currentlyHeldObjectServer.itemProperties.itemName); if ((Object)(object)p.currentlyHeldObjectServer != (Object)null && !(p.currentlyHeldObjectServer is GiftBoxItem) && !(p.currentlyHeldObjectServer is KeyItem)) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("DespawnItem", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{item}", p.currentlyHeldObjectServer.itemProperties.itemName } })); if (PluginConfig.DespawnItem2.Value) { PatchHelper.KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(EnemyAI))] [HarmonyWrapSafe] public static class EnemyAIKillEnemyPatch { [HarmonyPatch("__rpc_handler_1810146992")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool KillEnemyServerRpc(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 (PatchHelper.Check(rpcParams, out var p)) { EnemyAI val = (EnemyAI)target; PatchHelper.LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.KillEnemyServerRpc", $"EnemyId:{((Object)val).GetInstanceID()}", $"HP:{val.enemyHP}"); if (PluginConfig.KillEnemy.Value) { foreach (PatchHelper.HitData item in PatchHelper.bypassKill) { if (item.EnemyInstanceId == ((Object)val).GetInstanceID() && !item.CalledClient.Contains(p.playerClientId)) { PatchHelper.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) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("KillEnemy", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{HP}", val.enemyHP.ToString() } })); if (PluginConfig.KillEnemy2.Value) { PatchHelper.KickPlayer(p); return false; } } } } return true; } [HarmonyPatch("KillEnemyOnOwnerClient")] [HarmonyPrefix] [HarmonyWrapSafe] public static void KillEnemyOnOwnerClient(EnemyAI __instance) { if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost && !PatchHelper.bypassKill.Exists((PatchHelper.HitData x) => x.EnemyInstanceId == ((Object)__instance).GetInstanceID())) { PatchHelper.LogInfo($"bypassKill -> {__instance.enemyType.enemyName}({((Object)__instance).GetInstanceID()})"); PatchHelper.bypassKill.Add(new PatchHelper.HitData { EnemyInstanceId = ((Object)__instance).GetInstanceID(), force = 0, CalledClient = new List<ulong>() }); } } [HarmonyPatch("KillEnemy")] [HarmonyPrefix] [HarmonyWrapSafe] public static void KillEnemy(EnemyAI __instance) { //IL_0029: 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_0038: 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) if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost && __instance is ButlerEnemyAI) { LandminePatch.SpawnExplosion(((Component)__instance).transform.position + Vector3.up * 0.15f); } } } [HarmonyPatch(typeof(GameNetworkManager))] [HarmonyWrapSafe] public static class GameNetworkManagerLobbyMetadataPatch { [HarmonyPatch("StartHost")] [HarmonyPrefix] [HarmonyWrapSafe] public static void StartHost() { if (!string.IsNullOrWhiteSpace(PluginConfig.Prefix.Value)) { HostSettings lobbyHostSettings = GameNetworkManager.Instance.lobbyHostSettings; string text = lobbyHostSettings.lobbyName.Replace('【', '[').Replace('】', ']').Replace('[', '[') .Replace(']', ']'); List<string> list = new List<string>(); Match match = Regex.Match(text, "^\\[(.*?)\\]"); if (match.Success) { string value = match.Groups[1].Value; list.AddRange(value.Split('/')); text = text.Remove(0, match.Groups[0].Value.Length).TrimStart(); } if (!list.Any((string x) => x == PluginConfig.Prefix.Value)) { list.Add(PluginConfig.Prefix.Value); } lobbyHostSettings.lobbyName = "[" + string.Join("/", list) + "] " + text; } } } [HarmonyPatch(typeof(DoorLock))] [HarmonyWrapSafe] public static class DoorLockPatch { [HarmonyPatch("__rpc_handler_184554516")] [HarmonyPrefix] public static bool UnlockDoorServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { AntiCheatPlugin.LogInfo(p, "DoorLock.UnlockDoorServerRpc"); } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch("__rpc_handler_2046162111")] [HarmonyPrefix] public static bool OpenDoorAsEnemyServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { AntiCheatPlugin.LogInfo(p, "DoorLock.OpenDoorAsEnemyServerRpc"); } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(GrabbableObject))] [HarmonyWrapSafe] public static class GrabbableObjectOperationLogPatch { [HarmonyPrefix] [HarmonyPatch(typeof(LungProp), "EquipItem")] public static bool EquipItem(LungProp __instance) { if (PluginConfig.OperationLog.Value && __instance.isLungDocked && StartOfRound.Instance.shipHasLanded) { PatchHelper.ShowMessageHostOnly(PatchHelper.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(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerOperationLogPatch { [HarmonyPatch("__rpc_handler_1748753755")] [HarmonyPrefix] public static bool DropAllHeldItemsServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!PatchHelper.Check(rpcParams, out var p)) { return (Object)(object)p != (Object)null; } AntiCheatPlugin.LogInfo(p, "PlayerControllerB.DropAllHeldItemsRpc"); return true; } } [HarmonyPatch(typeof(TerminalAccessibleObject))] [HarmonyWrapSafe] public static class TerminalAccessibleObjectPatch { [HarmonyPatch("__rpc_handler_1181174413")] [HarmonyPrefix] public static bool Prefix(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { AntiCheatPlugin.LogInfo(p, "TerminalAccessibleObject.SetDoorOpenServerRpc"); } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(CentipedeAI))] [HarmonyWrapSafe] public static class CentipedeAIPatch { [HarmonyPatch("__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 (!PatchHelper.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); PatchHelper.LogInfo(p, "CentipedeAI.ClingToPlayerServerRpc", $"num:{num}"); if ((int)p.playerClientId == num) { if (PatchHelper.ClingTime.ContainsKey(p.playerSteamId)) { PatchHelper.ClingTime[p.playerSteamId] = DateTime.Now; } else { PatchHelper.ClingTime.Add(p.playerSteamId, DateTime.Now); } } return true; } } [HarmonyPatch(typeof(EnemyAI))] [HarmonyWrapSafe] public static class EnemyAICombatPatch { [HarmonyPatch("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) { PatchHelper.bypassHit.Add(new PatchHelper.HitData { EnemyInstanceId = ((Object)__instance).GetInstanceID(), force = force, CalledClient = new List<ulong>() }); } } [HarmonyPatch(typeof(EnemyAI), "__rpc_handler_3538577804")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool HitEnemyServerRpc(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_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.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; PatchHelper.LogInfo(p, "(" + val.enemyType.enemyName + ")EnemyAI.HitEnemyServerRpc", $"EnemyId:{((Object)val).GetInstanceID()}", $"HP:{val.enemyHP}", $"force:{num}", $"playerWhoHit:{PatchHelper.PlayerClientIdConvertName(num2)}({num2})"); if (p.isHostPlayerObject) { return true; } if (num2 != -1 && (Object)(object)StartOfRound.Instance.allPlayerScripts[num2] != (Object)(object)p) { PatchHelper.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) { PatchHelper.lastDriver = currentDriver; return true; } if (num == 2 && (Object)(object)currentDriver == (Object)null && PatchHelper.lastDriver.playerClientId == p.playerClientId) { return true; } } foreach (PatchHelper.HitData item in PatchHelper.bypassHit) { if (item.EnemyInstanceId == ((Object)val).GetInstanceID() && item.force == num && !item.CalledClient.Contains(p.playerClientId)) { PatchHelper.LogInfo($"{((Object)val).GetInstanceID()} bypass|playerClientId:{p.playerClientId}"); item.CalledClient.Add(p.playerClientId); return true; } } if (PluginConfig.Shovel.Value) { GrabbableObject val3 = p.ItemSlots[p.currentItemSlot]; if (num == 6 && num2 == -1) { PatchHelper.LogInfo($"force = 6||enemyPostion:{((Component)val).transform.position}"); PatchHelper.explosions = PatchHelper.explosions.Where((PatchHelper.ExplosionData x) => x.CreateDateTime.AddSeconds(10.0) > DateTime.Now).ToList(); for (int num3 = PatchHelper.explosions.Count - 1; num3 > 0; num3--) { PatchHelper.ExplosionData explosionData = PatchHelper.explosions[num3]; if (!explosionData.CalledClient.Contains(p.playerSteamId)) { float num4 = Vector3.Distance(explosionData.ExplosionPostion, ((Component)val).transform.position); PatchHelper.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 && (PatchHelper.isShovel(val3) || PatchHelper.isKnife(val3))) { if (!PatchHelper.jcs.Contains(p.playerSteamId)) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Shovel4", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{damageAmount}", num.ToString() }, { "{item}", PatchHelper.isShovel(val3) ? PatchHelper.locale.Item_GetString("Shovel") : PatchHelper.locale.Item_GetString("Knife") } })); PatchHelper.jcs.Add(p.playerSteamId); if (PluginConfig.Shovel2.Value) { PatchHelper.KickPlayer(p); } return false; } } else if (!p.isPlayerDead && (Object)(object)val3 == (Object)null) { if (PatchHelper.ClingTime.ContainsKey(p.playerSteamId) && PatchHelper.ClingTime[p.playerSteamId].AddSeconds(5.0) > DateTime.Now) { return true; } if (p.ItemSlots.Any((GrabbableObject x) => PatchHelper.isShovel(x)) && num == 1) { return true; } if (!PatchHelper.jcs.Contains(p.playerSteamId)) { for (int i = 0; i < p.ItemSlots.Length; i++) { PatchHelper.LogInfo($"p:{p.playerUsername}|i:{i}|itemName:{p.ItemSlots[i]?.itemProperties?.itemName}"); } PatchHelper.LogInfo($"currentItemSlot:{p.currentItemSlot}"); PatchHelper.LogInfo("currentlyHeldObjectServer:" + p.currentlyHeldObjectServer?.itemProperties?.itemName); PatchHelper.LogInfo($"obj:{val3}"); PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Shovel6", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{enemyName}", val.enemyType.enemyName }, { "{damageAmount}", num.ToString() } })); if (!PluginConfig.Shovel3.Value && (num == 1 || num == 2 || num == 3 || num == 5)) { PatchHelper.jcs.Add(p.playerSteamId); if (PluginConfig.Shovel2.Value) { PatchHelper.KickPlayer(p); } } return false; } } else if (PatchHelper.jcs.Contains(p.playerSteamId)) { return false; } } } return true; } } [HarmonyPatch(typeof(JesterAI))] [HarmonyWrapSafe] public static class JesterAIPatch { [HarmonyPatch("__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 PatchHelper.KillPlayerServerRpc(target, reader, rpcParams, "JesterAI.KillPlayerServerRpc"); } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] [HarmonyWrapSafe] public static class NutcrackerEnemyAIPatch { [HarmonyPatch("__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 PatchHelper.KillPlayerServerRpc(target, reader, rpcParams, "NutcrackerEnemyAI.LegKickPlayerServerRpc"); } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerCombatPatch { [HarmonyPatch("__rpc_handler_1583426973")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool KillPlayerServerRpc(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) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { if (PatchHelper.rpcs.ContainsKey("KillPlayer")) { PatchHelper.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); PatchHelper.LogInfo(p, "PlayerControllerB.KillPlayerServerRpc", $"playerId:{PatchHelper.PlayerClientIdConvertName(num)}({num})", $"spawnBody:{flag}", $"bodyVelocity:{val}", $"num:{(object)(CauseOfDeath)num2}({num2})"); if (num < 0) { PatchHelper.LogInfo($"KillPlayerServerRpc:Invalid PlayerId({num})"); return false; } if ((Object)(object)StartOfRound.Instance.allPlayerScripts[num] != (Object)(object)p) { PatchHelper.LogInfo("KillPlayerServerRpc:Can't kill other player!"); return false; } if (p.isPlayerDead) { PatchHelper.LogInfo("KillPlayerServerRpc:Player death can't kill!"); return false; } if (num2 == 10) { string text = PatchHelper.locale.Msg_GetString("behind_player", new Dictionary<string, string> { { "{player}", p.playerUsername } }); PatchHelper.LogInfo(text); PatchHelper.AddTextMessageClientRpc(text); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch("__rpc_handler_638895557")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool DamagePlayerFromOtherClientServerRpc(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 (PatchHelper.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); PatchHelper.LogInfo(p, "PlayerControllerB.DamagePlayerFromOtherClientServerRpc", $"damageAmount:{damageAmount}", $"hitDirection:{val}", $"playerWhoHit:{PatchHelper.PlayerClientIdConvertName(num)}({num})"); PlayerControllerB p2 = (PlayerControllerB)target; return PatchHelper.CheckDamage(p2, p, ref damageAmount); } if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch("__rpc_handler_2585603452")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool HealServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { PatchHelper.LogInfo(p, "PlayerControllerB.HealServerRpc", $"health:{p.health}", "newHealth:20"); p.health = 20; } else if ((Object)(object)p == (Object)null) { return false; } return true; } [HarmonyPatch("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("__rpc_handler_1084949295")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool DamagePlayerServerRpc(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 (PatchHelper.Check(rpcParams, out var p) || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { if (PatchHelper.rpcs.ContainsKey("Hit")) { PatchHelper.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); PatchHelper.LogInfo(p, "PlayerControllerB.DamagePlayerServerRpc", $"damageNumber:{damageAmount}", $"newHealthAmount:{num}"); PlayerControllerB val = (PlayerControllerB)target; if ((Object)(object)val == (Object)(object)p) { if (PluginConfig.Health_Recover.Value && damageAmount < 0) { string msg = PatchHelper.locale.Msg_GetString("Health_Recover", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{hp}", (damageAmount * -1).ToString() } }); PatchHelper.ShowMessage(msg); if (PluginConfig.Health_Kick.Value) { PatchHelper.KickPlayer(p); } return false; } return true; } return PatchHelper.CheckDamage(val, p, ref damageAmount); } if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(RedLocustBees))] [HarmonyWrapSafe] public static class RedLocustBeesPatch { [HarmonyPatch("__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 PatchHelper.KillPlayerServerRpc(target, reader, rpcParams, "RedLocustBees.BeeKillPlayerServerRpc"); } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerMovementPatch { [HarmonyPatch(typeof(PlayerControllerB), "__rpc_handler_890924887")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool UpdatePlayerPositionServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.Invisibility.Value) { if ((Object)(object)StartOfRound.Instance.currentLevel != (Object)null && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { if (!PatchHelper.recentPlayerPositions.ContainsKey(p.playerSteamId)) { PatchHelper.recentPlayerPositions[p.playerSteamId] = new List<(Vector3, float)>(); } float now = Time.time; PatchHelper.recentPlayerPositions[p.playerSteamId] = PatchHelper.recentPlayerPositions[p.playerSteamId].Where(((Vector3 pos, float time) entry) => now - entry.time <= 5f).ToList(); PatchHelper.recentPlayerPositions[p.playerSteamId].Add((val, now)); } Vector3 serverPlayerPosition = p.serverPlayerPosition; if (p.teleportedLastFrame) { return true; } if (Vector3.Distance(serverPlayerPosition, val) > 100f && Vector3.Distance(val, Vector3.zero) > 10f) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("Invisibility", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player_position}", ((object)(Vector3)(ref val)).ToString() } })); if (PluginConfig.Invisibility2.Value) { PatchHelper.KickPlayer(p); } return false; } } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(HUDManager))] [HarmonyWrapSafe] public static class HUDManagerRoundSyncPatch { public static List<ulong> SyncAllPlayerLevelsServerRpcCalls { get; set; } = new List<ulong>(); [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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!PatchHelper.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(typeof(RoundManager))] [HarmonyWrapSafe] public static class RoundManagerPatch { public static List<ulong> CallFinishedGeneratingLevelServerRpc { get; set; } = new List<ulong>(); [HarmonyPrefix] [HarmonyPatch("__rpc_handler_192551691")] public static bool FinishedGeneratingLevelServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { int num = RoundManager.Instance.playersFinishedGeneratingFloor.Count + 1; AntiCheatPlugin.LogInfo(p, "RoundManager.FinishedGeneratingLevelServerRpc", $"playersFinishedGeneratingFloor:{num}", $"connectedPlayers:{GameNetworkManager.Instance.connectedPlayers}"); CallFinishedGeneratingLevelServerRpc.Add(p.playerSteamId); if (num < GameNetworkManager.Instance.connectedPlayers && num + 5 > GameNetworkManager.Instance.connectedPlayers) { StringBuilder stringBuilder = new StringBuilder(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isHostPlayerObject && !CallFinishedGeneratingLevelServerRpc.Contains(val.playerSteamId)) { stringBuilder.Append(val.playerUsername + "||"); } } if (!string.IsNullOrWhiteSpace(stringBuilder.ToString())) { AntiCheatPlugin.LogInfo("FinishedGeneratingLevelServerRpc Wait For:" + stringBuilder.ToString()); } } if (num == GameNetworkManager.Instance.connectedPlayers) { AntiCheatPlugin.LogInfo("FinishedGeneratingLevelServerRpc All Players Loaded"); CallFinishedGeneratingLevelServerRpc = new List<ulong>(); } } return true; } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyWrapSafe] public static class StartOfRoundPatch { public static List<ulong> SyncShipUnlockablesServerRpcCalls = new List<ulong>(); public static List<ulong> SyncAlreadyHeldObjectsServerRpcCalls = new List<ulong>(); public static List<ulong> CallPlayerHasRevivedServerRpc { get; set; } = new List<ulong>(); public static List<ulong> CallPlayerLoadedServerRpc { get; set; } = new List<ulong>(); [HarmonyPrefix] [HarmonyPatch("__rpc_handler_682230258")] public static bool SyncAlreadyHeldObjectsServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ulong num = PatchHelper.ConnectionIdtoSteamIdMap[PatchHelper.ClientIdToTransportId(rpcParams.Server.Receive.SenderClientId)]; AntiCheatPlugin.LogInfo($"StartOfRound.SyncShipUnlockablesServerRpc:{num}|32"); if (SyncAlreadyHeldObjectsServerRpcCalls.Contains(num)) { AntiCheatPlugin.LogInfo($"StartOfRound.SyncShipUnlockablesServerRpc:{num}|36"); return false; } AntiCheatPlugin.LogInfo($"StartOfRound.SyncShipUnlockablesServerRpc:{num}|39"); SyncAlreadyHeldObjectsServerRpcCalls.Add(num); return true; } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_3083945322")] public static bool PlayerHasRevivedServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { int num = (int)AccessTools.DeclaredField(typeof(StartOfRound), "playersRevived").GetValue(StartOfRound.Instance); AntiCheatPlugin.LogInfo(p, "StartOfRound.PlayerHasRevivedServerRpc", $"playersRevived:{num + 1}", $"connectedPlayers:{GameNetworkManager.Instance.connectedPlayers}"); CallPlayerHasRevivedServerRpc.Add(p.playerSteamId); if (num < GameNetworkManager.Instance.connectedPlayers && num + 5 > GameNetworkManager.Instance.connectedPlayers) { StringBuilder stringBuilder = new StringBuilder(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isHostPlayerObject && !CallPlayerHasRevivedServerRpc.Contains(val.playerSteamId)) { stringBuilder.Append(val.playerUsername + "||"); } } if (!string.IsNullOrWhiteSpace(stringBuilder.ToString())) { AntiCheatPlugin.LogInfo("PlayerHasRevivedServerRpc Wait For:" + stringBuilder.ToString()); } } if (num + 1 == GameNetworkManager.Instance.connectedPlayers) { AntiCheatPlugin.LogInfo("PlayerHasRevivedServerRpc All Players Loaded"); CallPlayerHasRevivedServerRpc = new List<ulong>(); } } return true; } [HarmonyPostfix] [HarmonyPatch("StartGame")] public static void StartGame() { if (File.Exists("AntiCheat.log")) { File.Delete("AntiCheat.log"); } } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_4249638645")] public static bool PlayerLoadedServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { int count = StartOfRound.Instance.fullyLoadedPlayers.Count; AntiCheatPlugin.LogInfo(p, "StartOfRound.PlayerLoadedServerRpc", $"fullyLoadedPlayers:{count + 1}", $"connectedPlayers:{GameNetworkManager.Instance.connectedPlayers}"); CallPlayerLoadedServerRpc.Add(p.playerSteamId); if (count < GameNetworkManager.Instance.connectedPlayers && count + 5 > GameNetworkManager.Instance.connectedPlayers) { StringBuilder stringBuilder = new StringBuilder(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isHostPlayerObject && !CallPlayerLoadedServerRpc.Contains(val.playerSteamId)) { stringBuilder.Append(val.playerUsername + "||"); } } if (!string.IsNullOrWhiteSpace(stringBuilder.ToString())) { AntiCheatPlugin.LogInfo("PlayerLoadedServerRpc Wait For:" + stringBuilder.ToString()); } } if (count + 1 == GameNetworkManager.Instance.connectedPlayers) { CallPlayerLoadedServerRpc = new List<ulong>(); AntiCheatPlugin.LogInfo("PlayerLoadedServerRpc All Players Loaded"); } } return true; } [HarmonyPrefix] [HarmonyPatch("__rpc_handler_744998938")] public static bool __rpc_handler_744998938(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { AntiCheatPlugin.LogInfo(p, "StartOfRound.SyncShipUnlockablesServerRpc", "140"); if (SyncShipUnlockablesServerRpcCalls.Contains(p.playerSteamId)) { AntiCheatPlugin.LogInfo(p, "StartOfRound.SyncShipUnlockablesServerRpc", "144"); return false; } AntiCheatPlugin.LogInfo(p, "StartOfRound.SyncShipUnlockablesServerRpc", "146"); SyncShipUnlockablesServerRpcCalls.Add(p.playerSteamId); return true; } if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyWrapSafe] public static class PlayerControllerSessionPatch { [HarmonyPostfix] [HarmonyPatch("ConnectClientToPlayerObject")] public static void ConnectClientToPlayerObject(PlayerControllerB __instance) { if (__instance.isHostPlayerObject && ((NetworkBehaviour)StartOfRound.Instance).IsHost) { if (File.Exists("AntiCheat.log")) { File.Delete("AntiCheat.log"); } PatchHelper.explosions = new List<PatchHelper.ExplosionData>(); PatchHelper.ConnectionIdtoSteamIdMap = new Dictionary<uint, ulong>(); HUDManagerRoundSyncPatch.SyncAllPlayerLevelsServerRpcCalls = new List<ulong>(); StartOfRoundPatch.SyncShipUnlockablesServerRpcCalls = new List<ulong>(); StartOfRoundPatch.SyncAlreadyHeldObjectsServerRpcCalls = new List<ulong>(); } } } [HarmonyPatch(typeof(RoundManager))] [HarmonyWrapSafe] public static class RoundManagerSessionPatch { [HarmonyPatch("LoadNewLevel")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool LoadNewLevel(SelectableLevel newLevel) { if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost) { return true; } PatchHelper.landMines = new List<int>(); PatchHelper.bypassHit = new List<PatchHelper.HitData>(); PatchHelper.bypassKill = new List<PatchHelper.HitData>(); HUDManager.Instance.AddTextToChatOnServer(PatchHelper.locale.Msg_GetString("game_start", new Dictionary<string, string> { { "{ver}", "0.8.8" } }), -1); return true; } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyWrapSafe] public static class StartOfRoundSessionPatch { [HarmonyPatch("EndOfGame")] [HarmonyPostfix] [HarmonyWrapSafe] public static void EndOfGame() { PatchHelper.jcs = new List<ulong>(); if (PatchHelper.rpcs.ContainsKey("Hit")) { PatchHelper.rpcs["Hit"] = new List<ulong>(); } if (PatchHelper.rpcs.ContainsKey("KillPlayer")) { PatchHelper.rpcs["KillPlayer"] = new List<ulong>(); } } } [HarmonyPatch(typeof(HUDManager))] [HarmonyWrapSafe] public static class HUDManagerShipFlowPatch { [HarmonyPatch("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 && PluginConfig.ShipSetting_OnlyOneVote.Value && !TimeOfDay.Instance.shipLeavingAlertCalled && GameNetworkManager.Instance.localPlayerController.isPlayerDead && !string.IsNullOrEmpty(((TMP_Text)HUDManager.Instance.holdButtonToEndGameEarlyVotesText).text)) { TextMeshProUGUI holdButtonToEndGameEarlyVotesText = HUDManager.Instance.holdButtonToEndGameEarlyVotesText; ((TMP_Text)holdButtonToEndGameEarlyVotesText).text = ((TMP_Text)holdButtonToEndGameEarlyVotesText).text + Environment.NewLine + PatchHelper.locale.Msg_GetString("vote"); } } } [HarmonyPatch(typeof(StartMatchLever))] [HarmonyWrapSafe] public static class StartMatchLeverPatch { [HarmonyPatch("__rpc_handler_2406447821")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool PlayLeverPullEffectsServerRpc(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_003c: 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 (PatchHelper.Check(rpcParams, out var p)) { if (Object.FindAnyObjectByType<StartMatchLever>().leverHasBeenPulled && !StartOfRound.Instance.shipHasLanded) { return StartOfRoundShipFlowPatch.StartGameServerRpc(target, reader, rpcParams); } return StartOfRoundShipFlowPatch.EndGameServerRpc(target, reader, rpcParams); } if ((Object)(object)p == (Object)null) { Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } return true; } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyWrapSafe] public static class StartOfRoundShipFlowPatch { [HarmonyPatch("__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 (PatchHelper.Check(rpcParams, out var p)) { if (PluginConfig.ShipConfig.Value && !GameNetworkManager.Instance.gameHasStarted) { PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("ShipConfig5", new Dictionary<string, string> { { "{player}", p.playerUsername } })); val.triggerScript.interactable = true; if (PluginConfig.Ship_Kick.Value) { PatchHelper.KickPlayer(p); } return false; } if (StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB x) => x.isPlayerControlled) >= PluginConfig.ShipConfig2.Value) { return true; } val.triggerScript.interactable = true; PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("ShipConfig2", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{cfg}", PluginConfig.ShipConfig2.Value.ToString() } })); return false; } if ((Object)(object)p == (Object)null) { val.triggerScript.interactable = true; return false; } return true; } [HarmonyPatch("__rpc_handler_2028434619")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool EndGameServerRpc(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) if (PatchHelper.Check(rpcParams, out var p)) { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); ((FastBufferReader)(ref reader)).Seek(0); PatchHelper.LogInfo(p, "StartOfRound.EndGameServerRpc", $"num:{num}", $"shipHasLanded:{StartOfRound.Instance.shipHasLanded}"); if (num == 0 && p.playerClientId != 0) { Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } if (!StartOfRound.Instance.shipHasLanded) { Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } if (TimeOfDay.Instance.shipLeavingAlertCalled) { return true; } int num2 = int.Parse(PluginConfig.ShipConfig3.Value.Split(':')[0]); int num3 = int.Parse(PluginConfig.ShipConfig3.Value.Split(':')[1]); int num4 = (int)(TimeOfDay.Instance.normalizedTimeOfDay * (60f * (float)TimeOfDay.Instance.numberOfHours)) + 360; int num5 = (int)Mathf.Floor((float)(num4 / 60)); bool flag = false; if (num5 > 12) { flag = true; num5 %= 12; } num4 %= 60; if (flag) { num5 += 12; } IEnumerable<PlayerControllerB> source = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.isPlayerControlled && !x.isPlayerDead); if (source.Count() == 1 && source.First().isInHangarShipRoom) { return true; } decimal num6 = Math.Round((decimal)source.Count() * ((decimal)PluginConfig.ShipConfig4.Value / 100m), 2); decimal num7 = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB x) => x.isPlayerControlled && x.isInHangarShipRoom); if (StartOfRound.Instance.currentLevel.PlanetName.Contains("Gordion")) { num5 = num2; num4 = num3; } if (num2 <= num5 && num3 <= num4 && num7 >= num6) { return true; } PatchHelper.ShowMessage(PatchHelper.locale.Msg_GetString("ShipConfig4", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{player_count}", num6.ToString() }, { "{cfg4}", PluginConfig.ShipConfig4.Value.ToString() }, { "{cfg3}", $"{num2:00}:{num3:00}" }, { "{game_time}", $"{num5:00}:{num4:00}" } })); Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } if ((Object)(object)p == (Object)null) { Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable = true; return false; } return true; } } [HarmonyPatch(typeof(TimeOfDay))] [HarmonyWrapSafe] public static class TimeOfDayShipFlowPatch { [HarmonyPatch("__rpc_handler_543987598")] [HarmonyPostfix] [HarmonyWrapSafe] public static void SetShipLeaveEarlyServerRpcPostfix(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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 (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost && PluginConfig.ShipSetting_OnlyOneVote.Value && rpcParams.Server.Receive.SenderClientId == 0) { TimeOfDay.Instance.SetShipLeaveEarlyClientRpc(TimeOfDay.Instance.normalizedTimeOfDay + 0.1f, StartOfRound.Instance.allPlayerScripts.Length); } } [HarmonyPatch("__rpc_handler_543987598")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool SetShipLeaveEarlyServerRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { int num = StartOfRound.Instance.connectedPlayersAmount + 1 - StartOfRound.Instance.livingPlayers; string msg = PatchHelper.locale.Msg_GetString("vote_player", new Dictionary<string, string> { { "{player}", p.playerUsername }, { "{now}", (TimeOfDay.Instance.votesForShipToLeaveEarly + 1).ToString() }, { "{max}", num.ToString() } }); PatchHelper.ShowMessageHostOnly(msg); if (TimeOfDay.Instance.votesForShipToLeaveEarly + 1 >= num) { PatchHelper.LogInfo("Vote EndGame"); return StartOfRoundShipFlowPatch.EndGameServerRpc(target, reader, rpcParams); } } else if ((Object)(object)p == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(GrabbableObject))] [HarmonyWrapSafe] public static class GrabbableObjectShipSystemsPatch { [HarmonyPrefix] [HarmonyPatch("__rpc_handler_319375719")] public static bool ActivateItemRpc(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (PatchHelper.Check(rpcParams, out var p)) { RemoteProp val = (RemoteProp)(object)((target is RemoteProp) ? target : null); if (val != null) { AntiCheatPlugin.LogInfo(p, "(" + ((GrabbableObject)val).itemProperties.itemName + ")GrabbableObject.ActivateItemRpc"); 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 (Object)(object)target != (Object)null; } } [HarmonyPatch(typeof(ShipBuildModeManager))] [HarmonyWrapSafe] public static class ShipBuildModeManagerPatch { [HarmonyPatch("__rpc_handler_861494715")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool __rpc_handler_861494715(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown re