Decompiled source of WeNeedToGoDeeper Q10L v1.0.0

WeNeedToGoDeeper_Q10L.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using WeNeedToGoDeeper_Q10L.Patches;

[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("WeNeedToGoDeeper_Q10L")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WeNeedToGoDeeper_Q10L")]
[assembly: AssemblyTitle("WeNeedToGoDeeper_Q10L")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WeNeedToGoDeeper_Q10L
{
	[BepInPlugin("WeNeedToGoDeeper_Q10L", "WeNeedToGoDeeper_Q10L", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony harmony = new Harmony("WeNeedToGoDeeper_Q10L");

		public static ManualLogSource Logger;

		private void Awake()
		{
			Logger = Logger.CreateLogSource("WeNeedToGoDeeper_Q10L");
			Logger.LogInfo((object)"Plugin WeNeedToGoDeeper_Q10L is loading.");
			Logger.LogInfo((object)"Loaded WeNeedToGoDeeper_Q10L. Patching.");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(LevelLoadPatch));
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WeNeedToGoDeeper_Q10L";

		public const string PLUGIN_NAME = "WeNeedToGoDeeper_Q10L";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace WeNeedToGoDeeper_Q10L.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class LevelLoadPatch : HarmonyPatch
	{
		public static List<int> UnlockedDoorsID = new List<int>();

		public static bool ExitedFire { get; set; } = false;


		[HarmonyPatch("LoadNewLevel")]
		[HarmonyPostfix]
		public static void OnLevelLoaded()
		{
			ExitedFire = false;
			UnlockedDoorsID.Clear();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch : HarmonyPatch
	{
		[HarmonyPatch("DisplayTip")]
		[HarmonyPostfix]
		public static void DisplayTipPostfix(string headerText, string bodyText, bool isWarning = false, bool useSave = false, string prefsKey = "LC_Tip1")
		{
			Plugin.Logger.LogInfo((object)(bodyText ?? ""));
		}
	}
	[HarmonyPatch(typeof(EntranceTeleport))]
	internal class EntranceTeleportPatch : HarmonyPatch
	{
		[HarmonyPatch("TeleportPlayer")]
		[HarmonyPrefix]
		public static bool TeleportPlayerPrefix(bool ___isEntranceToBuilding, int ___entranceId, bool ___gotExitPoint)
		{
			if (!___gotExitPoint)
			{
				Plugin.Logger.LogInfo((object)"IS");
			}
			else if (___entranceId != 0 && ___isEntranceToBuilding && !LevelLoadPatch.UnlockedDoorsID.Contains(___entranceId))
			{
				Plugin.Logger.LogInfo((object)"FE");
				HUDManager.Instance.DisplayTip("???", "Read the sign, it says exit not entrance.", false, false, "LC_Tip1");
				return false;
			}
			if (___entranceId == 0 && !___isEntranceToBuilding)
			{
				Plugin.Logger.LogInfo((object)"ME");
				HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
				return false;
			}
			if (___entranceId != 0 && !___isEntranceToBuilding)
			{
				Plugin.Logger.LogInfo((object)"Fire exit used.");
				if (!LevelLoadPatch.UnlockedDoorsID.Contains(___entranceId))
				{
					LevelLoadPatch.UnlockedDoorsID.Add(___entranceId);
					HUDManager.Instance.DisplayTip("???", "The fire exit was unlocked.", false, false, "LC_Tip1");
				}
			}
			return true;
		}

		[HarmonyPatch("FindExitPoint")]
		[HarmonyPostfix]
		public static void FindExitPointPostfix(bool ___isEntranceToBuilding, int ___entranceId, bool ___gotExitPoint, ref bool __result)
		{
			Plugin.Logger.LogInfo((object)$"Entrance ID: {___entranceId}");
			Plugin.Logger.LogInfo((object)$"Is Entrance?: {___isEntranceToBuilding}");
			if (!___gotExitPoint)
			{
				Plugin.Logger.LogInfo((object)"Initial Sweep");
			}
			else if (___entranceId != 0 && ___isEntranceToBuilding && !LevelLoadPatch.UnlockedDoorsID.Contains(___entranceId))
			{
				Plugin.Logger.LogInfo((object)"Fire Exit Denied");
				HUDManager.Instance.DisplayTip("???", "Read the sign, it says exit not entrance.", false, false, "LC_Tip1");
				__result = false;
			}
			if (___entranceId == 0 && !___isEntranceToBuilding)
			{
				Plugin.Logger.LogInfo((object)"Main Entrance Denied");
				HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
				__result = false;
			}
		}
	}
}