Decompiled source of Hide Volume Hide Plane v1.1.1

HideVolumeHidePlane.dll

Decompiled 6 months ago
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Bounce.ManagedCollections;
using HarmonyLib;
using ModdingTales;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HVHP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TaleSpire Modding Community")]
[assembly: AssemblyProduct("HVHP")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.1.1.0")]
namespace HideVolumeHidePlane
{
	[BepInPlugin("org.HF.plugins.HVHP", "Hide Plane for Hide Volumes", "1.1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class HVHPlugin : BaseUnityPlugin
	{
		public const string Guid = "org.HF.plugins.HVHP";

		public const string Version = "1.1.1.0";

		private const string Name = "Hide Plane for Hide Volumes";

		internal static Harmony harmony;

		internal static ManualLogSource _logger;

		public static void DoPatching()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			harmony = new Harmony("org.HF.plugins.HVHP");
			harmony.PatchAll();
			_logger.LogInfo((object)"Hide Plane for Hide Volumes: Patched.");
		}

		public static void UnPatch()
		{
			harmony.UnpatchSelf();
			_logger.LogInfo((object)"Hide Plane for Hide Volumes: UnPatched.");
		}

		private void Awake()
		{
			_logger = ((BaseUnityPlugin)this).Logger;
			DoPatching();
			_logger.LogInfo((object)"Hide Plane for Hide Volumes is Active.");
			ModdingUtils.AddPluginToMenuList((BaseUnityPlugin)(object)this, "HolloFoxes'");
		}
	}
}
namespace HideVolumeHidePlane.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("HideVolumeHidePlane.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace HideVolumeHidePlane.Patches
{
	[HarmonyPatch(typeof(HideVolumeManager), "OnShowHideVolumesChange")]
	internal sealed class HVMPatch
	{
		internal static BList<HideVolumeItem> _hideVolumeItems;

		internal static bool IsActive;

		private static void Postfix(ref bool visibility, ref BList<HideVolumeItem> ____hideVolumeItems)
		{
			_hideVolumeItems = ____hideVolumeItems;
			IsActive = visibility;
			Hider.HideVolumes();
		}
	}
	[HarmonyPatch(typeof(HeightHidePlane), "Update")]
	internal sealed class HeightHidePlanePatch
	{
		internal static float lastHeight;

		private static void Postfix(ref float ____currentHeight)
		{
			if (____currentHeight != lastHeight)
			{
				lastHeight = ____currentHeight;
				Hider.HideVolumes();
			}
		}
	}
	internal static class Hider
	{
		public static void HideVolumes()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002d: 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)
			Enumerator<HideVolumeItem> enumerator = (HVMPatch._hideVolumeItems ?? new BList<HideVolumeItem>(10)).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					HideVolumeItem current = enumerator.Current;
					Bounds bounds = current.HideVolume.Bounds;
					float num = ((Bounds)(ref bounds)).size.y / 2f + ((Bounds)(ref bounds)).center.y;
					current.VisibilityChange(HVMPatch.IsActive && num < HeightHidePlanePatch.lastHeight);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}
	}
}