Decompiled source of HarvestMoonsTweaks v1.0.0

dev.peelz.harvestmoonstweaks.dll

Decompiled 2 weeks ago
using 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 LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("BepInEx")]
[assembly: AssemblyCompany("dev.peelz.harvestmoonstweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+29f4b17b54deed170598e3b4d01bc809cb499c64")]
[assembly: AssemblyProduct("HarvestMoonsTweaks")]
[assembly: AssemblyTitle("dev.peelz.harvestmoonstweaks")]
[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.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;
		}
	}
}
public class Config
{
	public ConfigEntry<bool> FrayDisableInsideFog { get; }

	public ConfigEntry<bool> SierraDisableInsideFog { get; }

	public Config(ConfigFile cfg)
	{
		cfg.SaveOnConfigSet = false;
		FrayDisableInsideFog = cfg.Bind<bool>("Fray", "DisableInsideFog", false, "Hides the fog that appears inside the facility.");
		SierraDisableInsideFog = cfg.Bind<bool>("Sierra", "DisableInsideFog", false, "Hides the fog that appears inside the facility.");
		cfg.OrphanedEntries.Clear();
		cfg.Save();
		cfg.SaveOnConfigSet = true;
	}
}
namespace HarvestMoonsTweaks
{
	internal static class GameObjectExtensions
	{
		public static IEnumerable<GameObject> Children(this GameObject o)
		{
			for (int i = 0; i < o.transform.childCount; i++)
			{
				Transform child = o.transform.GetChild(i);
				yield return ((Component)child).gameObject;
			}
		}
	}
	[BepInPlugin("dev.peelz.harvestmoonstweaks", "HarvestMoonsTweaks", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
	public class HarvestMoonsTweaks : BaseUnityPlugin
	{
		public static Config Config { get; private set; }

		private void Awake()
		{
			Config = new Config(((BaseUnityPlugin)this).Config);
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//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)
			string name = ((Scene)(ref scene)).name;
			if (!(name == "SierraScene"))
			{
				if (name == "FrayScene" && Config.FrayDisableInsideFog.Value)
				{
					DisableInsideFog();
				}
			}
			else if (Config.SierraDisableInsideFog.Value)
			{
				DisableInsideFog();
			}
			void DisableInsideFog()
			{
				GameObject val = ((IEnumerable<GameObject>)((Scene)(ref scene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Environment"));
				if ((Object)(object)val == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("GameObject 'Environment' doesn't exist in scene '" + ((Scene)(ref scene)).name + "'"));
				}
				else
				{
					GameObject val2 = val.Children().FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Lighting"));
					if ((Object)(object)val2 == (Object)null)
					{
						((BaseUnityPlugin)this).Logger.LogWarning((object)("GameObject 'Environment/Lighting' doesn't exist in scene '" + ((Scene)(ref scene)).name + "'"));
					}
					else
					{
						int num = 0;
						IEnumerable<GameObject> enumerable = from x in val2.Children()
							where ((Object)x).name.StartsWith("Inside Fog")
							select x;
						foreach (GameObject item in enumerable)
						{
							((BaseUnityPlugin)this).Logger.LogInfo((object)("Disabling GameObject 'Environment/Lighting/" + ((Object)item).name + "' in scene '" + ((Scene)(ref scene)).name + "'"));
							item.SetActive(false);
							num++;
						}
						if (num == 0)
						{
							((BaseUnityPlugin)this).Logger.LogWarning((object)("No 'Inside Fog' GameObjects found in scene '" + ((Scene)(ref scene)).name + "'"));
						}
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "dev.peelz.harvestmoonstweaks";

		public const string PLUGIN_NAME = "HarvestMoonsTweaks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}