Please disclose if any significant portion of your mod was created 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 LetsGoDeeper v1.1.1
LetsGoDeeper.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TestAccount666.LetsGoDeeper")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Giving doors consciousness since 1989.")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+dbfe10da75762b7ee6d115b52ee4f462c45a8284")] [assembly: AssemblyProduct("LetsGoDeeper")] [assembly: AssemblyTitle("TestAccount666.LetsGoDeeper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LetsGoDeeper { public class ConfigManager { internal ConfigEntry<bool> allowExitIfLastOneAlive = null; internal ConfigEntry<bool> needsToFindAllBodiesFirst = null; internal ConfigEntry<bool> allowFireExitEnter = null; internal ConfigEntry<bool> allowMainEntranceExit = null; internal void Setup(ConfigFile configFile) { allowExitIfLastOneAlive = configFile.Bind<bool>("General", "1. Allow exit if last one alive", false, "If true, will allow using any way to exit is possible, if you're the last one alive."); needsToFindAllBodiesFirst = configFile.Bind<bool>("General", "2. Only if all bodies found", false, "If true, will only allow the above option, if all bodies have been discovered. (If a player died without a body, it will count as seen)"); allowFireExitEnter = configFile.Bind<bool>("General", "3. Allow Fire Exit Enter", false, "If true, will allow you to enter through fire exits"); allowMainEntranceExit = configFile.Bind<bool>("General", "4. Allow Main Entrance Exit", false, "If true, will allow you to leave through the main entrance"); } } public static class ExitChecker { internal static readonly List<ulong> FoundBodiesList = new List<ulong>(); internal static int foundBodies = 0; internal static int requiredBodies = 0; public static bool CanExit() { int num = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB playerScript) => !playerScript.isPlayerDead && playerScript.isPlayerControlled); if (num > 1) { return false; } return foundBodies >= requiredBodies; } } public class FakeBody : MonoBehaviour { } [BepInPlugin("TestAccount666.LetsGoDeeper", "LetsGoDeeper", "1.1.1")] public class LetsGoDeeper : BaseUnityPlugin { internal static ConfigManager configManager; public static LetsGoDeeper Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; configManager = new ConfigManager(); configManager.Setup(((BaseUnityPlugin)this).Config); Patch(); Logger.LogInfo((object)"TestAccount666.LetsGoDeeper v1.1.1 has loaded!"); } internal static void Patch() { //IL_000d: 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 if (Harmony == null) { Harmony = new Harmony("TestAccount666.LetsGoDeeper"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TestAccount666.LetsGoDeeper"; public const string PLUGIN_NAME = "LetsGoDeeper"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace LetsGoDeeper.Patches { [HarmonyPatch(typeof(DeadBodyInfo))] public static class DeadBodyInfoPatch { [HarmonyPatch("DetectIfSeenByLocalPlayer")] [HarmonyPrefix] public static void BeforeDetectIfSeenByLocalPlayer(DeadBodyInfo __instance, out bool __state) { __state = false; if (!__instance.seenByLocalPlayer && __instance.playerScript != null && !((Object)(object)((Component)__instance.grabBodyObject).GetComponent<FakeBody>() != (Object)null) && !ExitChecker.FoundBodiesList.Contains(__instance.playerScript.playerClientId)) { __state = true; } } [HarmonyPatch("DetectIfSeenByLocalPlayer")] [HarmonyPostfix] public static void BeforeDetectIfSeenByLocalPlayer(DeadBodyInfo __instance, bool __state) { if (__state && __instance.seenByLocalPlayer && __instance.playerScript != null && !((Object)(object)((Component)__instance.grabBodyObject).GetComponent<FakeBody>() != (Object)null) && !ExitChecker.FoundBodiesList.Contains(__instance.playerScript.playerClientId)) { ExitChecker.FoundBodiesList.Add(__instance.playerScript.playerClientId); ExitChecker.foundBodies++; } } } [HarmonyPatch(typeof(HUDManager))] public class HUDManagerPatch { [HarmonyPatch("HoldInteractionFill")] [HarmonyPostfix] private static void DestroyEntranceExitAbility(ref bool __result) { if (!__result) { return; } PlayerControllerB localPlayerController = HUDManager.Instance.playersManager.localPlayerController; InteractTrigger hoveringOverTrigger = localPlayerController.hoveringOverTrigger; if ((Object)(object)hoveringOverTrigger == (Object)null) { return; } EntranceTeleport component = ((Component)hoveringOverTrigger).gameObject.GetComponent<EntranceTeleport>(); if ((Object)(object)component == (Object)null) { return; } if (component.entranceId == 0) { if (!component.isEntranceToBuilding && !LetsGoDeeper.configManager.allowMainEntranceExit.Value && (!ExitChecker.CanExit() || !LetsGoDeeper.configManager.allowExitIfLastOneAlive.Value)) { __result = false; hoveringOverTrigger.currentCooldownValue = 1f; HUDManager.Instance.DisplayTip("Entrance Door", "I'm an entrance, you fool!", false, false, "LC_Tip1"); } } else if (component.isEntranceToBuilding && !LetsGoDeeper.configManager.allowFireExitEnter.Value) { __result = false; hoveringOverTrigger.currentCooldownValue = 1f; HUDManager.Instance.DisplayTip("Fire Exit Door", "Fire? Where? Oh wait, you're trying to enter through an exit...", false, false, "LC_Tip1"); } } [HarmonyPatch("DisplayNewScrapFound")] [HarmonyPostfix] public static void AfterDisplayNewScrapFound() { if (HUDManager.Instance.itemsToBeDisplayed.Count <= 0) { return; } foreach (GrabbableObject item in HUDManager.Instance.itemsToBeDisplayed) { RagdollGrabbableObject val = (RagdollGrabbableObject)(object)((item is RagdollGrabbableObject) ? item : null); if (val == null || (Object)(object)((Component)val).GetComponent<FakeBody>() != (Object)null) { continue; } PlayerControllerB playerScript = val.ragdoll.playerScript; if (playerScript != null) { ulong playerClientId = playerScript.playerClientId; if (!ExitChecker.FoundBodiesList.Contains(playerClientId)) { ExitChecker.FoundBodiesList.Add(playerClientId); ExitChecker.foundBodies++; } } } } } [HarmonyPatch(typeof(RagdollGrabbableObject))] public static class RagdollPatch { [HarmonyPatch("Update")] [HarmonyPostfix] public static void AfterUpdate(RagdollGrabbableObject __instance) { if (((Component)__instance).gameObject.GetComponent<FakeBody>() != null) { return; } Transform val = ((Component)__instance).transform.Find("ScanNode"); if (val != null && ((Component)val).gameObject.activeSelf) { return; } Transform val2 = ((Component)__instance).transform.Find("MapDot"); if (val2 == null || !((Component)val2).gameObject.activeSelf) { BoxCollider component = ((Component)__instance).GetComponent<BoxCollider>(); if (component == null || !((Collider)component).enabled) { ((Component)__instance).gameObject.AddComponent<FakeBody>(); } } } } [HarmonyPatch(typeof(RoundManager))] public static class RoundManagerPatch { [HarmonyPatch("GenerateNewLevelClientRpc")] [HarmonyPostfix] public static void AfterGenerateNewLevelClientRpc() { ExitChecker.FoundBodiesList.Clear(); ExitChecker.foundBodies = 0; ExitChecker.requiredBodies = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB playerControllerB) => (Object)(object)playerControllerB != (Object)null && playerControllerB.isPlayerControlled) - 1; if (!LetsGoDeeper.configManager.needsToFindAllBodiesFirst.Value) { ExitChecker.requiredBodies = 0; } } } }