Decompiled source of We Need To Go Deeper v1.0.0

plugins/WeNeedToGoDeeper.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using WeNeedToGoDeeper.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WeNeedToGoDeeper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeNeedToGoDeeper")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1ef81f2f-53f0-4c30-b4e6-40f441c3f147")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WeNeedToGoDeeper
{
	[BepInPlugin("Sirus.WeNeedToGoDeeper", "We Need To Go Deeper", "1.0.0.0")]
	public class WeNeedToGoDeeperBase : BaseUnityPlugin
	{
		private const string modGUID = "Sirus.WeNeedToGoDeeper";

		private const string modName = "We Need To Go Deeper";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Sirus.WeNeedToGoDeeper");

		private static WeNeedToGoDeeperBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Sirus.WeNeedToGoDeeper");
			mls.LogInfo((object)"Ice Bucket Challenge: Mod has been loaded");
			harmony.PatchAll(typeof(WeNeedToGoDeeperBase));
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
		}
	}
}
namespace WeNeedToGoDeeper.Patches
{
	[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")
		{
			Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").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)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)"IS");
			}
			else if (___entranceId != 0 && ___isEntranceToBuilding)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)"FE");
				HUDManager.Instance.DisplayTip("???", "Read the sign, it says exit not entrance.", false, false, "LC_Tip1");
				return false;
			}
			if (___entranceId == 0 && !___isEntranceToBuilding)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)"ME");
				HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
				return false;
			}
			return true;
		}

		[HarmonyPatch("FindExitPoint")]
		[HarmonyPostfix]
		public static void FindExitPointPostfix(bool ___isEntranceToBuilding, int ___entranceId, bool ___gotExitPoint, ref bool __result)
		{
			Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)$"Entrance ID: {___entranceId}");
			Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)$"Is Entrance?: {___isEntranceToBuilding}");
			if (!___gotExitPoint)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)"Initial Sweep");
			}
			else if (___entranceId != 0 && ___isEntranceToBuilding)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").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)
			{
				Logger.CreateLogSource("Sirus.WeNeedToGoDeeper").LogInfo((object)"Main Entrance Denied");
				HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
				__result = false;
			}
		}
	}
}