Decompiled source of No Light Pollution v1.0.0

NoLightPollution.dll

Decompiled 6 hours ago
using System;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BigWalkMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BigWalkMod")]
[assembly: AssemblyTitle("BigWalkMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 nolightpollution
{
	[BepInPlugin("bayturtleking.bigwalk.nolightpollution", "No Light Pollution", "1.0.0")]
	public class nopollution : BasePlugin
	{
		internal static ManualLogSource logsource;

		internal static readonly string[] namesforthem = new string[5] { "buoy", "torch", "flashlight", "nubbin", "lamp" };

		public override void Load()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			logsource = ((BasePlugin)this).Log;
			new Harmony("bayturtleking.bigwalk.nolightpollution").PatchAll();
			((BasePlugin)this).Log.LogInfo((object)"it go dark (no light pollution loaded)");
		}
	}
	[HarmonyPatch(typeof(Prop), "Awake")]
	public static class savedastarss
	{
		[HarmonyPostfix]
		private static void postfix(Prop __instance)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			Il2CppArrayBase<Light> componentsInChildren = ((Component)__instance).GetComponentsInChildren<Light>(true);
			if (componentsInChildren == null || componentsInChildren.Length == 0)
			{
				return;
			}
			string nameforitemthing = ((Object)((Component)__instance).gameObject).name;
			ManualLogSource logsource = nopollution.logsource;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("no light pollution: '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(nameforitemthing);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' has ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(componentsInChildren.Length);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" light pollution!!!");
			}
			logsource.LogInfo(val);
			if (!nopollution.namesforthem.Any((string filter) => nameforitemthing.ToLowerInvariant().Contains(filter.ToLowerInvariant())))
			{
				return;
			}
			foreach (Light item in componentsInChildren)
			{
				((Behaviour)item).enabled = false;
				item.intensity = 0f;
			}
			ManualLogSource logsource2 = nopollution.logsource;
			val = new BepInExInfoLogInterpolatedStringHandler(63, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("we stopped '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(nameforitemthing);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' from polluting the stars hoorayyy. SAVE THE STARS");
			}
			logsource2.LogInfo(val);
		}
	}
}