Decompiled source of DimNeon v1.0.0

DimNeon.dll

Decompiled 10 months 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.Configuration;
using HarmonyLib;
using Landfall.TABS;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("DimNeon")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DimNeon")]
[assembly: AssemblyTitle("DimNeon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace DimNeon
{
	[BepInPlugin("org.bepinex.plugins.dimneon", "DIMNEON", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public static List<Color> neoncolors = new List<Color>();

		public static ConfigEntry<float> generaldim;

		public static ConfigEntry<float> halloweendim;

		public static ConfigEntry<float> farmerdim;

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("DimNeon");
			val.PatchAll();
			LoadConfig();
			Debug.Log((object)"Loaded DimNeon Successfully");
			PatchGlow(generaldim.Value);
		}

		public void LoadConfig()
		{
			generaldim = ((BaseUnityPlugin)this).Config.Bind<float>("SETTINGS", "generaldim", 1.3f, "Dim applied overall, set to 1 to disable.");
			halloweendim = ((BaseUnityPlugin)this).Config.Bind<float>("SETTINGS", "halloweendim", 5f, "Amount of dim applied to halloween maps, default is 5 times");
			farmerdim = ((BaseUnityPlugin)this).Config.Bind<float>("SETTINGS", "farmerdim", 1.3f, "Amount of dim applied to farmer snow, default is 1.3 times");
		}

		public static void PatchGlow(float divider)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			UnitEditorColorPalette val = Resources.FindObjectsOfTypeAll<UnitEditorColorPalette>()[0];
			for (int i = 77; i < 83; i++)
			{
				ParentCatagories[] colorPalleteParentCatagories = val.m_ColorPalleteParentCatagories;
				foreach (ParentCatagories val2 in colorPalleteParentCatagories)
				{
					ColorPaletteCatagory[] colorPaletteCatagories = val2.colorPaletteCatagories;
					foreach (ColorPaletteCatagory val3 in colorPaletteCatagories)
					{
						ColorPaletteData[] colors = val3.Colors;
						foreach (ColorPaletteData val4 in colors)
						{
							if (val4.ColorIndex == i)
							{
								Color color = val4.m_material.GetColor("_EmissionColor");
								if (neoncolors.Count < 6)
								{
									neoncolors.Add(color);
								}
								Color val5 = neoncolors[i - 77] / divider;
								val4.m_material.SetColor("_EmissionColor", val5);
							}
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(TABSSceneManager), "LoadMap")]
	public class SpookyPatch
	{
		public static void Postfix(ref MapAsset map)
		{
			Debug.LogError((object)(map.MapName + ":SCENE NAME DIMNEON!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"));
			if (map.MapName == "00_Lvl2_Halloween_VC" || map.MapName == "00_Lvl1_Halloween_VC")
			{
				Main.PatchGlow(Main.halloweendim.Value);
			}
			else if (map.MapName == "02_Lvl3_Farmer_Snow_VC")
			{
				Main.PatchGlow(Main.farmerdim.Value);
			}
			else
			{
				Main.PatchGlow(Main.generaldim.Value);
			}
		}
	}
}