Decompiled source of ButterscotchandRosesBaseMod v0.2.1

butterscotchnroses.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AllyNames;
using BNR;
using BNR.items;
using BNR.patches;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CoolerEclipse;
using DebuggingPlains;
using EntityStates;
using EntityStates.JunkCube;
using GoldenCoastPlusRevived.Modules;
using HG;
using HG.Reflection;
using HarmonyLib;
using Inferno.Stat_AI;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.JunkCube;
using On.RoR2;
using On.RoR2.Hologram;
using On.RoR2.UI;
using On.RoR2.UI.SkinControllers;
using PhotoMode;
using R2API;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ConVar;
using RoR2.Hologram;
using RoR2.Items;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using SS2;
using ShaderSwapper;
using Skillsmas.Skills.Merc;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using butterscotchnroses;

[assembly: AssemblyTitle("butterscotchnroses")]
[assembly: AssemblyProduct("butterscotchnroses")]
[assembly: AssemblyInformationalVersion("1.0.0+f6676ca7adceafe8f8bc541ea4598e8487290979")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCompany("butterscotchnroses")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: OptIn]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ProdzModpackUtils
{
	public class ProdzUtils
	{
		public static Color TRANSPARENT = new Color(0f, 0f, 0f, 0f);

		public static Sprite GetComposite(Texture2D bg, Texture2D fg)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor((float)Mathf.Max(((Texture)bg).width, ((Texture)fg).width), (float)Mathf.Max(((Texture)bg).height, ((Texture)fg).height));
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(Mathf.Floor(((float)((Texture)bg).width - val.x) / 2f), Mathf.Floor(((float)((Texture)bg).width - val.y) / 2f));
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(Mathf.Floor(((float)((Texture)fg).width - val.x) / 2f), Mathf.Floor(((float)((Texture)fg).width - val.y) / 2f));
			Texture2D val4 = new Texture2D((int)val.x, (int)val.y);
			for (int i = 0; (float)i < val.x; i++)
			{
				for (int j = 0; (float)j < val.y; j++)
				{
					val4.SetPixel(i, j, Over(Pixel(bg, (float)i + val2.x, (float)j + val2.y), Pixel(fg, (float)i + val3.x, (float)j + val3.y)));
				}
			}
			return Sprite.Create(val4, new Rect(0f, 0f, val.x, val.y), new Vector2(0.5f, 0.5f), 3f);
		}

		public static Color Pixel(Texture2D img, float x, float y)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (0f > x || x >= (float)((Texture)img).width || 0f > y || y >= (float)((Texture)img).height)
			{
				return TRANSPARENT;
			}
			return img.GetPixel((int)x, (int)y);
		}

		public static Color Over(Color bg, Color fg)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			float num = bg.a * (1f - fg.a) + fg.a;
			return Color.op_Implicit((Color.op_Implicit(fg) * fg.a + Color.op_Implicit(bg) * bg.a * (1f - fg.a)) / num);
		}

		public static Sprite Load(params string[] path)
		{
			//IL_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			Size dimensions = ImageHelper.GetDimensions(Path.Combine(path));
			byte[] array = File.ReadAllBytes(Path.Combine(path));
			Texture2D val = new Texture2D(dimensions.Width, dimensions.Height, (TextureFormat)3, false)
			{
				filterMode = (FilterMode)2
			};
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)dimensions.Width, (float)dimensions.Height), new Vector2(0.5f, 0.5f), 3f);
		}
	}
	public static class ImageHelper
	{
		private const string errorMessage = "Could not recognize image format.";

		private static Dictionary<byte[], Func<BinaryReader, Size>> imageFormatDecoders = new Dictionary<byte[], Func<BinaryReader, Size>>
		{
			{
				new byte[2] { 66, 77 },
				DecodeBitmap
			},
			{
				new byte[6] { 71, 73, 70, 56, 55, 97 },
				DecodeGif
			},
			{
				new byte[6] { 71, 73, 70, 56, 57, 97 },
				DecodeGif
			},
			{
				new byte[8] { 137, 80, 78, 71, 13, 10, 26, 10 },
				DecodePng
			},
			{
				new byte[2] { 255, 216 },
				DecodeJfif
			}
		};

		public static Size GetDimensions(string path)
		{
			using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path));
			try
			{
				return GetDimensions(binaryReader);
			}
			catch (ArgumentException ex)
			{
				if (ex.Message.StartsWith("Could not recognize image format."))
				{
					throw new ArgumentException("Could not recognize image format.", "path", ex);
				}
				throw ex;
			}
		}

		public static Size GetDimensions(BinaryReader binaryReader)
		{
			int num = imageFormatDecoders.Keys.OrderByDescending((byte[] x) => x.Length).First().Length;
			byte[] array = new byte[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = binaryReader.ReadByte();
				foreach (KeyValuePair<byte[], Func<BinaryReader, Size>> imageFormatDecoder in imageFormatDecoders)
				{
					if (array.StartsWith(imageFormatDecoder.Key))
					{
						return imageFormatDecoder.Value(binaryReader);
					}
				}
			}
			throw new ArgumentException("Could not recognize image format.", "binaryReader");
		}

		private static bool StartsWith(this byte[] thisBytes, byte[] thatBytes)
		{
			for (int i = 0; i < thatBytes.Length; i++)
			{
				if (thisBytes[i] != thatBytes[i])
				{
					return false;
				}
			}
			return true;
		}

		private static short ReadLittleEndianInt16(this BinaryReader binaryReader)
		{
			byte[] array = new byte[2];
			for (int i = 0; i < 2; i++)
			{
				array[1 - i] = binaryReader.ReadByte();
			}
			return BitConverter.ToInt16(array, 0);
		}

		private static int ReadLittleEndianInt32(this BinaryReader binaryReader)
		{
			byte[] array = new byte[4];
			for (int i = 0; i < 4; i++)
			{
				array[3 - i] = binaryReader.ReadByte();
			}
			return BitConverter.ToInt32(array, 0);
		}

		private static Size DecodeBitmap(BinaryReader binaryReader)
		{
			binaryReader.ReadBytes(16);
			int width = binaryReader.ReadInt32();
			int height = binaryReader.ReadInt32();
			return new Size(width, height);
		}

		private static Size DecodeGif(BinaryReader binaryReader)
		{
			short width = binaryReader.ReadInt16();
			int height = binaryReader.ReadInt16();
			return new Size(width, height);
		}

		private static Size DecodePng(BinaryReader binaryReader)
		{
			binaryReader.ReadBytes(8);
			int width = binaryReader.ReadLittleEndianInt32();
			int height = binaryReader.ReadLittleEndianInt32();
			return new Size(width, height);
		}

		private static Size DecodeJfif(BinaryReader binaryReader)
		{
			while (binaryReader.ReadByte() == byte.MaxValue)
			{
				byte num = binaryReader.ReadByte();
				short num2 = binaryReader.ReadLittleEndianInt16();
				if (num == 192)
				{
					binaryReader.ReadByte();
					int height = binaryReader.ReadLittleEndianInt16();
					return new Size(binaryReader.ReadLittleEndianInt16(), height);
				}
				binaryReader.ReadBytes(num2 - 2);
			}
			throw new ArgumentException("Could not recognize image format.");
		}
	}
}
namespace butterscotchnroses
{
	public class oldconfigs
	{
		private static ConfigEntry<bool> replaceOldConfigs;

		public static void fixOldConfigs()
		{
			replaceOldConfigs = ((BaseUnityPlugin)BNR.butterscotchnroses.instance).Config.Bind<bool>("!!!Config Replacement!!!", "whether or not to replace/fix old default configs ,..,", true, "basically uhh replace default configs if enabled.,,.");
			if (replaceOldConfigs.Value)
			{
				string text = "golemplains,golemplains2";
				if (coolereclipse.whitelistStages.Value == text)
				{
					coolereclipse.whitelistStages.Value = (string)((ConfigEntryBase)coolereclipse.whitelistStages).DefaultValue;
				}
				string text2 = "goldshores,bazaar,solutionalhaunt,ss2_voidshop,goldshores";
				if (coolereclipse.blacklistStages.Value == text2)
				{
					coolereclipse.blacklistStages.Value = (string)((ConfigEntryBase)coolereclipse.blacklistStages).DefaultValue;
				}
				string text3 = "BombardmentDrone,Bombardment Drone,Default;Drones,Tsar Bomba;Fat Man;Little Boy|JunkDrone,Junk Drone,Default;Drones|RechargeDrone,Barrier Drone,Default;Drones|JailerDrone,Jailer Drone,Default;Drones|CleanupDrone,Cleanup Drone,Default;Drones,Roomba|CopycatDrone,Freeze Drone,Default;Drones,Frozone|HaulerDrone,Transport Drone,Default;Drones|DTGunnerDroneBody,CROSSHAIRS,Default;Drones,Ruxin|DTHealingDroneBody,DOC,Default;Drones,Bunny|DTHaulerDroneBody,CHIRP,Default;Drones,Moose|FriendUnitBody,Best Buddy,Default,Friend Inside Me;Stupid Baby;Son|DroneBomber,Lt. Droneboy,Default,Lt. Beep Boop";
				if (allynames.bodyNames.Value == text3)
				{
					allynames.bodyNames.Value = (string)((ConfigEntryBase)allynames.bodyNames).DefaultValue;
				}
			}
		}
	}
}
namespace BNR
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("zzzicebro.BNR", "BNR", "0.2.1")]
	public class butterscotchnroses : BaseUnityPlugin
	{
		private const string PluginGUID = "zzzicebro.BNR";

		private const string PluginAuthor = "icebro";

		private const string PluginName = "BNR";

		private const string PluginVersion = "0.2.1";

		public static AssetBundle carvingKitBundle;

		public static butterscotchnroses instance;

		public static List<PatchBase> patchBases = new List<PatchBase>();

		public static Harmony harmony;

		public void Awake()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			((BaseUnityPlugin)this).Logger.LogDebug((object)"loading mod !!");
			carvingKitBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "carvingkit_assets"));
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(carvingKitBundle));
			harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(PatchBase))
				select type)
			{
				try
				{
					PatchBase patchBase = (PatchBase)Activator.CreateInstance(item);
					patchBase.Config(((BaseUnityPlugin)this).Config);
					patchBase.PreInit();
					patchBases.Add(patchBase);
				}
				catch (Exception data)
				{
					Log.Warning("failed to patch something ! probably fine if you dont have whatever mod that was attempted to be patched enabled ,..,,.");
					Log.Warning(data);
				}
			}
			foreach (Type item2 in from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(BuffBase))
				select type)
			{
				((BuffBase)Activator.CreateInstance(item2)).AddBuff();
			}
			foreach (Type item3 in from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
				select type)
			{
				((ItemBase)Activator.CreateInstance(item3)).Init(((BaseUnityPlugin)this).Config);
			}
			CheatsConVar.instance.boolValue = true;
			oldconfigs.fixOldConfigs();
		}

		private void Update()
		{
		}

		private void FixedUpdate()
		{
			foreach (PatchBase patchBasis in patchBases)
			{
				patchBasis.FixedUpdate();
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public class buttonrecolors : PatchBase<buttonrecolors>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__ButtonSkinControllerOnAwake;

			public static hook_Awake <1>__PanelSkinControllerOnAwake;
		}

		private ConfigEntry<bool> enabled;

		private static ConfigEntry<bool> colorButtons;

		private static ConfigEntry<Color> buttonNorm;

		private static ConfigEntry<Color> buttonHigh;

		private static ConfigEntry<Color> buttonPress;

		private static ConfigEntry<Color> buttonSelect;

		public override void Init()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			if (enabled.Value)
			{
				object obj = <>O.<0>__ButtonSkinControllerOnAwake;
				if (obj == null)
				{
					hook_Awake val = ButtonSkinControllerOnAwake;
					<>O.<0>__ButtonSkinControllerOnAwake = val;
					obj = (object)val;
				}
				ButtonSkinController.Awake += (hook_Awake)obj;
				object obj2 = <>O.<1>__PanelSkinControllerOnAwake;
				if (obj2 == null)
				{
					hook_Awake val2 = PanelSkinControllerOnAwake;
					<>O.<1>__PanelSkinControllerOnAwake = val2;
					obj2 = (object)val2;
				}
				PanelSkinController.Awake += (hook_Awake)obj2;
			}
		}

		private static void PanelSkinControllerOnAwake(orig_Awake orig, PanelSkinController self)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (colorButtons.Value && !((Object)((Component)self).gameObject).name.Contains("ObjectivePanel") && !((Object)((Component)self).gameObject).name.Contains("NakedButton (Quit)"))
			{
				Image component = ((Component)self).gameObject.GetComponent<Image>();
				if (!((Object)((Component)component).gameObject).name.Contains("RuleBook"))
				{
					((Graphic)component).color = Utils.Color255(buttonNorm.Value.r, buttonNorm.Value.g, buttonNorm.Value.b, ((Graphic)component).color.a);
				}
			}
		}

		private static void ButtonSkinControllerOnAwake(orig_Awake orig, ButtonSkinController self)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!colorButtons.Value)
			{
				return;
			}
			HGButton component = ((Component)self).gameObject.GetComponent<HGButton>();
			if (Object.op_Implicit((Object)(object)component) && !((Object)component).name.Contains("SurvivorIcon") && !((Object)((Component)component).gameObject).name.Contains("Choice") && !((Object)((Component)component).gameObject).name.Contains("Loadout") && !((Object)((Component)component).gameObject).name.Contains("ObjectivePanel") && !((Object)((Component)component).gameObject).name.Contains("NakedButton (Quit)"))
			{
				if (((Object)((Component)component).gameObject).name.Contains("Music&More"))
				{
					((Component)component).gameObject.SetActive(false);
				}
				ColorBlock colors = ((Selectable)component).colors;
				((ColorBlock)(ref colors)).normalColor = buttonNorm.Value;
				((ColorBlock)(ref colors)).highlightedColor = buttonHigh.Value;
				((ColorBlock)(ref colors)).pressedColor = buttonPress.Value;
				((ColorBlock)(ref colors)).selectedColor = buttonSelect.Value;
				((Selectable)component).colors = colors;
			}
		}

		public override void Config(ConfigFile config)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			enabled = config.Bind<bool>("BNR - UI", "enable patches for button recolors", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				if (enabled.Value)
				{
					object obj = <>O.<0>__ButtonSkinControllerOnAwake;
					if (obj == null)
					{
						hook_Awake val = ButtonSkinControllerOnAwake;
						<>O.<0>__ButtonSkinControllerOnAwake = val;
						obj = (object)val;
					}
					ButtonSkinController.Awake += (hook_Awake)obj;
					object obj2 = <>O.<1>__PanelSkinControllerOnAwake;
					if (obj2 == null)
					{
						hook_Awake val2 = PanelSkinControllerOnAwake;
						<>O.<1>__PanelSkinControllerOnAwake = val2;
						obj2 = (object)val2;
					}
					PanelSkinController.Awake += (hook_Awake)obj2;
				}
				else
				{
					object obj3 = <>O.<0>__ButtonSkinControllerOnAwake;
					if (obj3 == null)
					{
						hook_Awake val3 = ButtonSkinControllerOnAwake;
						<>O.<0>__ButtonSkinControllerOnAwake = val3;
						obj3 = (object)val3;
					}
					ButtonSkinController.Awake -= (hook_Awake)obj3;
					object obj4 = <>O.<1>__PanelSkinControllerOnAwake;
					if (obj4 == null)
					{
						hook_Awake val4 = PanelSkinControllerOnAwake;
						<>O.<1>__PanelSkinControllerOnAwake = val4;
						obj4 = (object)val4;
					}
					PanelSkinController.Awake -= (hook_Awake)obj4;
				}
			};
			colorButtons = config.Bind<bool>("BNR - UI", "change buttons colors", false, "whether or not to use custom menu button colors,..,");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(colorButtons));
			buttonNorm = config.Bind<Color>("BNR - UI", "normal button color", Utils.Color255(110, 83, 120), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(buttonNorm));
			buttonHigh = config.Bind<Color>("BNR - UI", "highlighted button coor", Utils.Color255(255, 177, 245), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(buttonHigh));
			buttonPress = config.Bind<Color>("BNR - UI", "pressed button color", Utils.Color255(192, 113, 182), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(buttonPress));
			buttonSelect = config.Bind<Color>("BNR - UI", "selected button color", Utils.Color255(255, 177, 238), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(buttonSelect));
		}
	}
	public class drifter : PatchBase<drifter>
	{
		private ConfigEntry<bool> enabled;

		private ConfigEntry<bool> neverKillCubes;

		private ConfigEntry<int> cubeCount;

		public override void Init()
		{
			if (enabled.Value)
			{
				applyHooks();
			}
		}

		public void applyHooks()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (enabled.Value)
			{
				CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMasterOnGetDeployableSameSlotLimit);
				Idle.OnEnter += new hook_OnEnter(IdleOnOnEnter);
			}
			else
			{
				CharacterMaster.GetDeployableSameSlotLimit -= new hook_GetDeployableSameSlotLimit(CharacterMasterOnGetDeployableSameSlotLimit);
				Idle.OnEnter -= new hook_OnEnter(IdleOnOnEnter);
			}
		}

		private void IdleOnOnEnter(orig_OnEnter orig, Idle self)
		{
			orig.Invoke(self);
			if (neverKillCubes.Value)
			{
				((EntityState)self).fixedAge = float.NegativeInfinity;
			}
		}

		private int CharacterMasterOnGetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if ((int)slot != 22)
			{
				return orig.Invoke(self, slot);
			}
			return cubeCount.Value;
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("BNR - drifter", "enable patches for drifter", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				applyHooks();
			};
			cubeCount = config.Bind<int>("BNR - drifter", "junk cube count", 20, "limit of junk cubes !!");
			Utils.SliderConfig(4, 300, cubeCount);
			neverKillCubes = config.Bind<bool>("BNR - drifter", "never kill cubes !!!", true, "byeah ,,.");
			Utils.CheckboxConfig(neverKillCubes);
		}
	}
	public class dronevisibility : PatchBase<dronevisibility>
	{
		private ConfigEntry<bool> enabled;

		private ConfigEntry<bool> useSillyMaterials;

		private ConfigEntry<Color> sillyMaterialColor;

		private ConfigEntry<Color> operatorIndicatorColor;

		private ConfigEntry<float> visibilityDistance;

		private Material operatorMat;

		public override void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			operatorMat = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC3/Drone Tech/matDroneTechCarryRings.mat").WaitForCompletion());
			operatorMat.SetColor("_TintColor", operatorIndicatorColor.Value);
			Hook();
		}

		private void Hook()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (enabled.Value)
			{
				HologramProjector.BuildHologram += new hook_BuildHologram(HologramProjectorOnBuildHologram);
				SummonMasterBehavior.OnEnable += new hook_OnEnable(SummonMasterBehaviorOnOnEnable);
			}
			else
			{
				HologramProjector.BuildHologram -= new hook_BuildHologram(HologramProjectorOnBuildHologram);
				SummonMasterBehavior.OnEnable -= new hook_OnEnable(SummonMasterBehaviorOnOnEnable);
			}
		}

		private void SummonMasterBehaviorOnOnEnable(orig_OnEnable orig, SummonMasterBehavior self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<DroneAvailability>()))
			{
				HologramProjector component = ((Component)self).GetComponent<HologramProjector>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.displayDistance = visibilityDistance.Value;
				}
				else
				{
					Log.Warning("failed to find projector on drone !!");
				}
			}
		}

		private void HologramProjectorOnBuildHologram(orig_BuildHologram orig, HologramProjector self)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponent<DroneAvailability>()) || ((Object)((Component)self).gameObject).name.Contains("Turret"))
			{
				return;
			}
			Texture portraitIcon = ((Component)self).gameObject.GetComponent<SummonMasterBehavior>().masterPrefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().portraitIcon;
			Transform val = ((Component)self).gameObject.transform.Find("HologramPivot");
			GameObject val2 = new GameObject("HologramSprite");
			val2.transform.SetParent(((Component)val).transform);
			val2.AddComponent<HologramHelper>();
			SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>();
			val3.sprite = Sprite.Create((Texture2D)(object)((portraitIcon is Texture2D) ? portraitIcon : null), new Rect(0f, 0f, (float)portraitIcon.width, (float)portraitIcon.height), new Vector2(0.5f, 0.5f));
			val2.transform.localScale = new Vector3(2f, 2f, 1f);
			if (useSillyMaterials.Value)
			{
				((Renderer)val3).sharedMaterial = Addressables.LoadAssetAsync<Material>((object)RoR2_DLC2.matHalcyoniteShrineCrystalGlow_mat).WaitForCompletion();
				((Renderer)val3).sharedMaterial.SetTexture("_Cloud2Tex", Addressables.LoadAssetAsync<Texture>((object)RoR2_Base_Common.texCloudOrganic2_png).WaitForCompletion());
				((Renderer)val3).sharedMaterial.SetTexture("_Cloud1Tex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Child.texChildPrimaryStarCloud_png).WaitForCompletion());
				((Renderer)val3).sharedMaterial.SetColor("_TintColor", sillyMaterialColor.Value);
				((Renderer)val3).sharedMaterial.SetInt("_AlphaBias", 0);
			}
			GameObject val4 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drone Tech/CommandCarryTransportVFX.prefab").WaitForCompletion(), val2.transform, true);
			for (int i = 0; i < val4.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)val4.transform.GetChild(i)).gameObject;
				if (((Object)gameObject).name != "MainRings")
				{
					Object.Destroy((Object)(object)gameObject);
					continue;
				}
				gameObject.GetComponent<ParticleSystem>().startSpeed = -10f;
				((Renderer)gameObject.GetComponent<ParticleSystemRenderer>()).sharedMaterial = operatorMat;
			}
			val4.transform.position = val4.transform.localPosition;
			val4.transform.localPosition = new Vector3(0f, 0f, 0f);
			val4.transform.position = new Vector3(val4.transform.position.x, val4.transform.position.y - 3.2f, val4.transform.position.z);
		}

		public override void Config(ConfigFile config)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			enabled = config.Bind<bool>("BNR - Drone Visibility", "enable patches for drone visibility", false, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				Hook();
			};
			useSillyMaterials = config.Bind<bool>("BNR - Drone Visibility", "use silly materials for indicator !!", true, "");
			Utils.CheckboxConfig(useSillyMaterials);
			sillyMaterialColor = config.Bind<Color>("BNR - Drone Visibility", "colors for silly sprite hologram thing material !!", Utils.Color255(191, 126, 211), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(sillyMaterialColor));
			operatorIndicatorColor = config.Bind<Color>("BNR - Drone Visibility", "colors for operator vfx thing !!", Utils.Color255(252, 142, 249), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(operatorIndicatorColor));
			visibilityDistance = config.Bind<float>("BNR - Drone Visibility", "set distance which hologram becomes visible (set like 99999 for always !!", 99999f, "");
			Utils.SliderConfig(15f, 999f, visibilityDistance);
		}
	}
	public class HologramHelper : MonoBehaviour
	{
		private Transform hologram;

		public Vector3 pos;

		public void OnEnable()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			hologram = ((Component)this).transform.parent.GetChild(0);
			((Component)this).transform.position = ((Component)this).transform.localPosition;
			((Component)this).transform.localPosition = new Vector3(0f, 0f, 0f);
			((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, ((Component)this).transform.position.y + 2f, ((Component)this).transform.position.z);
		}

		public void FixedUpdate()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)hologram))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Vector3 val = default(Vector3);
			val.x = 0f;
			val.y = hologram.eulerAngles.y;
			val.z = hologram.eulerAngles.z;
			((Component)this).transform.rotation = Quaternion.Euler(val);
		}
	}
	public class malachite : PatchBase<malachite>
	{
		private ConfigEntry<bool> enabled;

		public static ConfigEntry<float> timeBetweenSpawns;

		public override void Init()
		{
			applyHooks();
		}

		private void applyHooks()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (enabled.Value)
			{
				CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBodyOnOnBuffFirstStackGained);
			}
			else
			{
				CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBodyOnOnBuffFirstStackGained);
			}
		}

		private void CharacterBodyOnOnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if (!((Object)(object)buffDef != (Object)(object)Buffs.AffixPoison))
			{
				((Component)self).gameObject.AddComponent<EvilUrchinSpawner>()._characterBody = self;
			}
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("BNR - malachite", "enable patches for malachite (have them naturally spawn urchins ,.,.", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				applyHooks();
			};
			timeBetweenSpawns = config.Bind<float>("BNR - malachite", "time between urchin spawns .,,.", 12f, "byeah.,,");
			Utils.SliderConfig(1f, 30f, timeBetweenSpawns);
		}
	}
	public class EvilUrchinSpawner : MonoBehaviour
	{
		public CharacterBody _characterBody;

		private float urchinSpawnTimer;

		private void OnEnable()
		{
			Log.Debug("added urchin spawner !!");
		}

		private void FixedUpdate()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			urchinSpawnTimer += Time.fixedDeltaTime;
			if (!(urchinSpawnTimer > malachite.timeBetweenSpawns.Value))
			{
				return;
			}
			urchinSpawnTimer = 0f;
			Log.Debug("spawning urgin !!");
			if (!Object.op_Implicit((Object)(object)_characterBody) || !_characterBody.HasBuff(Buffs.AffixPoison))
			{
				Log.Debug("uh oh,,");
				Object.Destroy((Object)(object)this);
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			Ray val = (Ray)(Object.op_Implicit((Object)(object)_characterBody.inputBank) ? _characterBody.inputBank.GetAimRay() : new Ray(((Component)this).transform.position, ((Component)this).transform.rotation * Vector3.forward));
			Quaternion val2 = Quaternion.LookRotation(((Ray)(ref val)).direction);
			GameObject val3 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/UrchinTurretMaster"), position, val2);
			CharacterMaster component = val3.GetComponent<CharacterMaster>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.teamIndex = _characterBody.teamComponent.teamIndex;
				NetworkServer.Spawn(val3);
				component.SpawnBodyHere();
			}
		}
	}
	public class pingrecolor : PatchBase<pingrecolor>
	{
		private ConfigEntry<Color> pingIndicatorDefault;

		private ConfigEntry<Color> pingIndicatorEnemy;

		private ConfigEntry<Color> pingIndicatorInteractable;

		private ConfigEntry<Color> pingIndicatorCount;

		private ConfigEntry<bool> enabled;

		public override void Init()
		{
			applyHooks();
		}

		private void applyHooks()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			if (enabled.Value)
			{
				PingIndicator.OnEnable += new hook_OnEnable(PingIndicatorOnOnEnable);
				PingIndicator.RebuildPing += new hook_RebuildPing(PingIndicatorOnRebuildPing);
				PingIndicator.Start += new hook_Start(PingIndicatorOnStart);
				PingIndicator.OnPreRenderOutlineHighlight += new hook_OnPreRenderOutlineHighlight(PingIndicatorOnOnPreRenderOutlineHighlight);
				ChargeIndicatorController.TriggerPing += new hook_TriggerPing(ChargeIndicatorControllerOnTriggerPing);
			}
			else
			{
				PingIndicator.OnEnable -= new hook_OnEnable(PingIndicatorOnOnEnable);
				PingIndicator.RebuildPing -= new hook_RebuildPing(PingIndicatorOnRebuildPing);
				PingIndicator.Start -= new hook_Start(PingIndicatorOnStart);
				PingIndicator.OnPreRenderOutlineHighlight -= new hook_OnPreRenderOutlineHighlight(PingIndicatorOnOnPreRenderOutlineHighlight);
				ChargeIndicatorController.TriggerPing -= new hook_TriggerPing(ChargeIndicatorControllerOnTriggerPing);
			}
		}

		private void ChargeIndicatorControllerOnTriggerPing(orig_TriggerPing orig, ChargeIndicatorController self, string pingownername, bool triggeranimation)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			self.playerPingColor = pingIndicatorInteractable.Value;
			orig.Invoke(self, pingownername, triggeranimation);
		}

		private void PingIndicatorOnOnPreRenderOutlineHighlight(orig_OnPreRenderOutlineHighlight orig, PingIndicator self, OutlineHighlight outlinehighlight)
		{
			recolorPingIndicator(self);
			orig.Invoke(self, outlinehighlight);
		}

		private void PingIndicatorOnStart(orig_Start orig, PingIndicator self)
		{
			recolorPingIndicator(self);
			orig.Invoke(self);
		}

		private void PingIndicatorOnOnEnable(orig_OnEnable orig, PingIndicator self)
		{
			recolorPingIndicator(self);
			orig.Invoke(self);
		}

		private void PingIndicatorOnRebuildPing(orig_RebuildPing orig, PingIndicator self)
		{
			recolorPingIndicator(self);
			orig.Invoke(self);
		}

		private void recolorPingIndicator(PingIndicator pingIndicator)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected I4, but got Unknown
			//IL_005a: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			pingIndicator.defaultPingColor = pingIndicatorDefault.Value;
			pingIndicator.enemyPingColor = pingIndicatorEnemy.Value;
			pingIndicator.interactablePingColor = pingIndicatorInteractable.Value;
			PingType pingType = pingIndicator.pingType;
			pingIndicator.pingColor = (Color)((int)pingType switch
			{
				0 => pingIndicatorDefault.Value, 
				1 => pingIndicatorEnemy.Value, 
				2 => pingIndicatorInteractable.Value, 
				3 => pingIndicatorCount.Value, 
				_ => pingIndicator.pingColor, 
			});
			pingIndicator.activeColor = pingIndicator.pingColor;
			((Component)((Component)pingIndicator).transform.GetChild(0)).GetComponent<ParticleSystem>().startColor = pingIndicatorDefault.Value;
			((Component)((Component)pingIndicator).transform.GetChild(1)).GetComponent<ParticleSystem>().startColor = pingIndicatorInteractable.Value;
			((Component)((Component)pingIndicator).transform.GetChild(2)).GetComponent<ParticleSystem>().startColor = pingIndicatorEnemy.Value;
			((Component)pingIndicator.positionIndicator.alwaysVisibleObject.transform.GetChild(0)).GetComponent<SpriteRenderer>().color = pingIndicatorDefault.Value;
			((Component)pingIndicator.positionIndicator.alwaysVisibleObject.transform.GetChild(1)).GetComponent<SpriteRenderer>().color = pingIndicatorEnemy.Value;
			((Component)pingIndicator.positionIndicator.alwaysVisibleObject.transform.GetChild(2)).GetComponent<SpriteRenderer>().color = pingIndicatorInteractable.Value;
		}

		public override void Config(ConfigFile config)
		{
			//IL_005e: 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_0082: Expected O, but got Unknown
			//IL_00a2: 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_00c6: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			enabled = config.Bind<bool>("BNR - pingrecolor", "enable patches for pingrecolor", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				applyHooks();
			};
			pingIndicatorDefault = config.Bind<Color>("BNR - pingrecolor", "ping recolor for default ping !!", Utils.Color255(252, 142, 249), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(pingIndicatorDefault));
			pingIndicatorEnemy = config.Bind<Color>("BNR - pingrecolor", "ping recolor for enemy ping !!", Utils.Color255(252, 142, 249), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(pingIndicatorEnemy));
			pingIndicatorInteractable = config.Bind<Color>("BNR - pingrecolor", "ping recolor for interactable ping !!", Utils.Color255(252, 142, 249), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(pingIndicatorInteractable));
			pingIndicatorCount = config.Bind<Color>("BNR - pingrecolor", "ping recolor for count ping (unsure what this one actually is !! !!", Utils.Color255(252, 142, 249), "");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(pingIndicatorCount));
		}
	}
	public class quickerhalcshrine : PatchBase<quickerhalcshrine>
	{
		private HalcyoniteShrineInteractable halcshrineinteractable;

		private GameObject bluePortalRef;

		private float startingTickRate;

		private ConfigEntry<bool> enabled;

		private ConfigEntry<float> multiplier;

		private ConfigEntry<int> playerCount;

		private ConfigEntry<bool> scaleTime;

		private ConfigEntry<bool> greenToBlue;

		public override void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			if (enabled.Value)
			{
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2.ShrineHalcyonite_prefab).WaitForCompletion();
				bluePortalRef = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_PortalShop.PortalShop_prefab).WaitForCompletion();
				halcshrineinteractable = val.GetComponent<HalcyoniteShrineInteractable>();
				startingTickRate = halcshrineinteractable.tickRate;
				halcshrineinteractable.tickRate = startingTickRate * multiplier.Value;
				multiplier.SettingChanged += delegate
				{
					halcshrineinteractable.tickRate = startingTickRate * multiplier.Value;
				};
				HalcyoniteShrineInteractable.Start += new hook_Start(HalcyoniteShrineInteractableOnStart);
				GoldSiphonNearbyBodyController.DrainGold += new hook_DrainGold(GoldSiphonNearbyBodyControllerOnDrainGold);
				BossGroup.OnDefeatedServer += new hook_OnDefeatedServer(BossGroupOnOnDefeatedServer);
			}
		}

		private void BossGroupOnOnDefeatedServer(orig_OnDefeatedServer orig, BossGroup self)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (greenToBlue.Value)
			{
				GameObject val = GameObject.Find("PortalColossus(Clone)");
				if (Object.op_Implicit((Object)(object)val))
				{
					GameObject obj = Object.Instantiate<GameObject>(bluePortalRef);
					obj.transform.position = val.transform.position;
					NetworkServer.Spawn(obj);
					Object.Destroy((Object)(object)val);
				}
			}
		}

		private void GoldSiphonNearbyBodyControllerOnDrainGold(orig_DrainGold orig, GoldSiphonNearbyBodyController self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && self.isTetheredToAtLeastOneObject && scaleTime.Value && Run.instance.participatingPlayerCount <= playerCount.Value)
			{
				Run.instance.SetRunStopwatch((Run.instance.GetRunStopwatch() + 1f / self.tickRate) * (multiplier.Value - 1f));
			}
		}

		private void HalcyoniteShrineInteractableOnStart(orig_Start orig, HalcyoniteShrineInteractable self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && Run.instance.participatingPlayerCount <= playerCount.Value)
			{
				self.tickRate = startingTickRate * multiplier.Value;
			}
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("BNR - Halyc Shrines", "enable patches for halyc shrines", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				if (enabled.Value)
				{
					HalcyoniteShrineInteractable.Start += new hook_Start(HalcyoniteShrineInteractableOnStart);
					GoldSiphonNearbyBodyController.DrainGold += new hook_DrainGold(GoldSiphonNearbyBodyControllerOnDrainGold);
				}
				else
				{
					HalcyoniteShrineInteractable.Start -= new hook_Start(HalcyoniteShrineInteractableOnStart);
					GoldSiphonNearbyBodyController.DrainGold -= new hook_DrainGold(GoldSiphonNearbyBodyControllerOnDrainGold);
				}
			};
			multiplier = config.Bind<float>("BNR - Halyc Shrines", "speed up halcyon shrine mutlipler", 2f, "");
			Utils.SliderConfig(1f, 3f, multiplier);
			playerCount = config.Bind<int>("BNR - Halyc Shrines", "only apply multiplier under or equal to x amount of players", 1, "eg. 1 = only singleplayer 2 = only 2 people multiplayer");
			Utils.SliderConfig(1, 4, playerCount);
			scaleTime = config.Bind<bool>("BNR - Halyc Shrines", "speed up time scale as well", true, "make time scale with halcyon shrine speed as well");
			Utils.CheckboxConfig(scaleTime);
			greenToBlue = config.Bind<bool>("BNR - Halyc Shrines", "turn green portal to blue", true, "makes green portals become blue after the boss has been defeated !!!");
			Utils.CheckboxConfig(greenToBlue);
		}
	}
	public class skinrecolors : PatchBase<skinrecolors>
	{
		public class monobehaviorskinloader : MonoBehaviour
		{
			public void OnEnable()
			{
				Log.Debug("starting custom skin loadings coroutine  !");
				((MonoBehaviour)this).StartCoroutine(LoadTextures());
			}
		}

		[CompilerGenerated]
		private sealed class <LoadTextures>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private string[] <>7__wrap1;

			private int <>7__wrap2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadTextures>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string[] files = Directory.GetFiles(textureDirs, "*.*", SearchOption.AllDirectories);
					<>7__wrap1 = files;
					<>7__wrap2 = 0;
					break;
				}
				case 1:
					<>1__state = -1;
					<>7__wrap2++;
					break;
				}
				if (<>7__wrap2 < <>7__wrap1.Length)
				{
					string text = <>7__wrap1[<>7__wrap2];
					Stopwatch stopwatch = new Stopwatch();
					stopwatch.Start();
					byte[] array = File.ReadAllBytes(text);
					Texture2D val = new Texture2D(2, 2);
					ImageConversion.LoadImage(val, array);
					Log.Debug(string.Format("loaded {0} in {1}ms !! adding to recoloredTextures ,.,.", text.Split("\\")[^1], stopwatch.ElapsedMilliseconds));
					recoloredTextures.Add(text.Split("\\")[^1], val);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<>7__wrap1 = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SkinCatalogOnInit>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public orig_Init orig;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SkinCatalogOnInit>d__14(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					Stopwatch stopwatch = Stopwatch.StartNew();
					stopwatch.Start();
					RecolorSkins();
					Log.Debug(string.Format("recolored {0} skins in {1}ms !!!", skinRecolors.Value.Split(";;").Length, stopwatch.ElapsedMilliseconds));
					<>2__current = orig.Invoke();
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <StageOnStart>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public orig_Start orig;

			public Stage self;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <StageOnStart>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					commands.bodyNameToPrev.Clear();
					<>2__current = orig.Invoke(self);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static SkinDef baseSkinName;

		public static string newSkinName;

		public static CharacterBody currentBody;

		public static float[] hsv = new float[3];

		public static string textureDirs;

		public static SkinDef baseSkin;

		public static Dictionary<string, Texture2D> recoloredTextures = new Dictionary<string, Texture2D>();

		public static ConfigEntry<string> skinRecolors;

		private static ConfigEntry<bool> enabled;

		public override void Init()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			textureDirs = Path.Combine(Path.GetDirectoryName(Paths.BepInExConfigPath), "skintextures");
			if (!Directory.Exists(textureDirs))
			{
				Directory.CreateDirectory(textureDirs);
			}
			baseSkin = Addressables.LoadAssetAsync<SkinDef>((object)RoR2_Base_Commando.skinCommandoDefault_asset).WaitForCompletion();
			applyHooks();
			GameObject obj = PrefabAPI.CreateEmptyPrefab("skinloadercoroutines");
			obj.AddComponent<monobehaviorskinloader>();
			Object.Instantiate<GameObject>(obj);
		}

		[IteratorStateMachine(typeof(<LoadTextures>d__9))]
		private static IEnumerator LoadTextures()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadTextures>d__9(0);
		}

		private void applyHooks()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			if (enabled.Value)
			{
				SkinCatalog.Init += new hook_Init(SkinCatalogOnInit);
				Run.onRunStartGlobal += RunOnonRunStartGlobal;
				Stage.Start += new hook_Start(StageOnStart);
			}
			else
			{
				SkinCatalog.Init -= new hook_Init(SkinCatalogOnInit);
				Run.onRunStartGlobal -= RunOnonRunStartGlobal;
				Stage.Start -= new hook_Start(StageOnStart);
			}
		}

		[IteratorStateMachine(typeof(<StageOnStart>d__11))]
		private IEnumerator StageOnStart(orig_Start orig, Stage self)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <StageOnStart>d__11(0)
			{
				orig = orig,
				self = self
			};
		}

		private void RunOnBeginStage(orig_BeginStage orig, Run self)
		{
			orig.Invoke(self);
			commands.bodyNameToPrev.Clear();
		}

		private static void RunOnonRunStartGlobal(Run obj)
		{
			commands.bodyNameToPrev.Clear();
		}

		[IteratorStateMachine(typeof(<SkinCatalogOnInit>d__14))]
		private IEnumerator SkinCatalogOnInit(orig_Init orig)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SkinCatalogOnInit>d__14(0)
			{
				orig = orig
			};
		}

		private static void RecolorSkins()
		{
			if (skinRecolors.Value.Length == 0)
			{
				return;
			}
			string[] array = skinRecolors.Value.Split(";;");
			foreach (string text in array)
			{
				try
				{
					string[] array2 = text.Split(",");
					skinRecolor(array2[0], array2[1], float.Parse(array2[2]), float.Parse(array2[3]), float.Parse(array2[4]), array2[5], (array2.Length == 7) ? array2[6] : "");
				}
				catch (Exception data)
				{
					Log.Warning("error while parsing config !!");
					Log.Warning(data);
				}
			}
		}

		public static SkinDef skinRecolor(string baseSkinDefName, string bodyName, float hue, float saturation, float value, string skinName, string prefix = "", bool dontAdd = false)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			SkinDef result = baseSkin;
			try
			{
				ModelSkinController modelLocator = Utils.GetModelLocator(BodyCatalog.FindBodyPrefab(bodyName));
				if ((Object)(object)modelLocator == (Object)null)
				{
					return result;
				}
				SkinDef val = null;
				SkinDef[] skins = modelLocator.skins;
				foreach (SkinDef val2 in skins)
				{
					if (!(((Object)val2).name != baseSkinDefName))
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					return result;
				}
				SkinDef val3 = Object.Instantiate<SkinDef>(val);
				Texture2D obj = Utils.hsvModifyTexture(val3.icon.texture, hue, saturation / 100f, value / 100f, dontAdd);
				Rect textureRect = val3.icon.textureRect;
				int num = Mathf.FloorToInt(((Rect)(ref textureRect)).width);
				textureRect = val3.icon.textureRect;
				Texture2D val4 = new Texture2D(num, Mathf.FloorToInt(((Rect)(ref textureRect)).height));
				textureRect = val3.icon.textureRect;
				int num2 = Mathf.FloorToInt(((Rect)(ref textureRect)).x);
				textureRect = val3.icon.textureRect;
				int num3 = Mathf.FloorToInt(((Rect)(ref textureRect)).y);
				textureRect = val3.icon.textureRect;
				int num4 = Mathf.FloorToInt(((Rect)(ref textureRect)).width);
				textureRect = val3.icon.textureRect;
				Color[] pixels = obj.GetPixels(num2, num3, num4, Mathf.FloorToInt(((Rect)(ref textureRect)).height));
				val4.SetPixels(pixels);
				val4.Apply();
				Sprite icon = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2((float)(((Texture)val4).width / 2), (float)(((Texture)val4).height / 2)));
				val3.icon = icon;
				if ((Object)(object)val3.skinDefParams == (Object)null && val3.skinDefParamsAddress == null)
				{
					RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[val3.rendererInfos.Length];
					for (int j = 0; j < val3.rendererInfos.Length; j++)
					{
						RendererInfo val5 = val3.rendererInfos[j];
						Material mat = Object.Instantiate<Material>(val5.defaultMaterial);
						val5.defaultMaterial = Utils.RecolorMaterial(mat, hue, saturation, value, dontAdd);
						val5.defaultMaterialAddress = new AssetReferenceT<Material>("");
						array[j] = val5;
					}
					val3.rendererInfos = array;
				}
				else
				{
					SkinDefParams val6 = Object.Instantiate<SkinDefParams>((val3.skinDefParamsAddress != null && ((object)val3.skinDefParamsAddress).ToString() != "[]") ? val3.skinDefParamsAddress.LoadAssetAsync().WaitForCompletion() : (((Object)(object)val3.skinDefParams == (Object)null) ? SkinDefParams.FromSkinDef(val) : val3.skinDefParams));
					for (int k = 0; k < val6.rendererInfos.Length; k++)
					{
						Material mat2 = Object.Instantiate<Material>(((Object)(object)val6.rendererInfos[k].defaultMaterial == (Object)null) ? val6.rendererInfos[k].defaultMaterialAddress.LoadAssetAsync().WaitForCompletion() : val6.rendererInfos[k].defaultMaterial);
						val6.rendererInfos[k].defaultMaterial = Utils.RecolorMaterial(mat2, hue, saturation, value, dontAdd);
						val6.rendererInfos[k].defaultMaterialAddress = new AssetReferenceT<Material>("");
					}
					val3.optimizedSkinDefParams = val6;
					val3.skinDefParams = val6;
					val3.skinDefParamsAddress = new AssetReferenceT<SkinDefParams>("");
				}
				string text = skinName.Replace(" ", "");
				((Object)val3).name = ((Object)val3).name.Replace("(Clone)", "");
				((Object)val3).name = ((Object)val3).name + "Recolored" + text;
				((Object)val3).name = prefix + ((Object)val3).name;
				val3.nameToken = val3.nameToken + "_BNR_" + text.ToUpper();
				LanguageAPI.Add(val3.nameToken, skinName);
				if (!dontAdd)
				{
					Array.Resize(ref modelLocator.skins, modelLocator.skins.Length + 1);
					modelLocator.skins[^1] = val3;
				}
				Log.Debug("added " + skinName + " to " + bodyName + " !!!!");
				result = val3;
			}
			catch (Exception data)
			{
				Log.Warning("faileds to add " + skinName + " skin to " + bodyName + " ,.,.,.");
				Log.Error(data);
			}
			return result;
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("BNR - skinrecolors", "enable patches for skinrecolors", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				applyHooks();
			};
			skinRecolors = config.Bind<string>("BNR - skinrecolors", "skin recolors", "skinCommandoAlt,CommandoBody,100,0,0,Test Skin;;skinCommandoAlt,CommandoBody,200,0,0,Test Skin 2;;skinCommandoDefault,CommandoBody,290,-40,-10,Awesome Skin !!!!", "follows \"string baseSkinDefName, string bodyName, float hue, float saturation, float value, string skinName, string prefix\" where prefix is optional (used for like ,., Red on wolfo qol merc.,., use list_skins to get internal names or prodz debugging mod ,., split with ;; ..,,. you can temporarily try out recolors with recolor_skin hue saturation value ,.,,.");
		}
	}
	public class smallermoneyandlunars : PatchBase<smallermoneyandlunars>
	{
		private ConfigEntry<bool> enabled;

		public override void Init()
		{
			if (enabled.Value)
			{
				HUD.onHudTargetChangedGlobal += HUDOnonHudTargetChangedGlobal;
			}
		}

		private static void HUDOnonHudTargetChangedGlobal(HUD obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("UpperLeftCluster");
			if (Object.op_Implicit((Object)(object)val))
			{
				val.GetComponent<RectTransform>().offsetMin = new Vector2(0f, -64f);
				((HorizontalOrVerticalLayoutGroup)val.GetComponent<VerticalLayoutGroup>()).spacing = 0f;
				GameObject val2 = GameObject.Find("DollarSign");
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.transform.localPosition = new Vector3(4f, val2.transform.localPosition.y, val2.transform.localPosition.z);
				}
				GameObject val3 = GameObject.Find("SteamBuildLabel");
				if (Object.op_Implicit((Object)(object)val3))
				{
					val3.gameObject.SetActive(false);
				}
			}
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("BNR - UI", "make currency thing smaller", true, "make the thing that has coins and lunar coins in the top left smaller like pre sotv (i miss you ,.,.");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				if (enabled.Value)
				{
					HUD.onHudTargetChangedGlobal += HUDOnonHudTargetChangedGlobal;
				}
				else
				{
					HUD.onHudTargetChangedGlobal -= HUDOnonHudTargetChangedGlobal;
				}
			};
		}
	}
	public class testsceneskybox : PatchBase<testsceneskybox>
	{
		private static Material skyboxMaterial;

		private static ConfigEntry<Color> skyboxColor;

		private ConfigEntry<bool> enabled;

		public override void Init()
		{
			applyHooks();
		}

		private void applyHooks()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (enabled.Value)
			{
				Stage.Start += new hook_Start(StageOnStart);
			}
			else
			{
				Stage.Start += new hook_Start(StageOnStart);
			}
		}

		private IEnumerator StageOnStart(orig_Start orig, Stage self)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "testscene")
			{
				if ((Object)(object)skyboxMaterial == (Object)null)
				{
					skyboxMaterial = Object.Instantiate<Material>(RenderSettings.skybox);
					skyboxMaterial.SetColor("_Tint", skyboxColor.Value);
				}
				RenderSettings.skybox = skyboxMaterial;
			}
			return orig.Invoke(self);
		}

		private void SceneDirectorOnStart(orig_Start orig, SceneDirector self)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "testscene")
			{
				Material skybox = RenderSettings.skybox;
				activeScene = SceneManager.GetActiveScene();
				Log.Debug($"new scene !! {skybox} {((Scene)(ref activeScene)).name}");
				if ((Object)(object)skyboxMaterial == (Object)null)
				{
					skyboxMaterial = Object.Instantiate<Material>(RenderSettings.skybox);
					skyboxMaterial.SetColor("_Tint", skyboxColor.Value);
				}
				RenderSettings.skybox = skyboxMaterial;
			}
		}

		public override void Config(ConfigFile config)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			enabled = config.Bind<bool>("BNR - testscene", "enable patches for testscene", true, "");
			Utils.CheckboxConfig(enabled);
			enabled.SettingChanged += delegate
			{
				applyHooks();
			};
			skyboxColor = config.Bind<Color>("BNR - testscene", "skyboxColor", Utils.Color255(152, 122, 144), "tint of skybox in testscene !!!");
			ModSettingsManager.AddOption((BaseOption)new ColorOption(skyboxColor));
		}
	}
	public class allynames : PatchBase<allynames>
	{
		[HarmonyPatch]
		public class AllyNamesChanges
		{
			[HarmonyPatch(typeof(NamesList), "InitConfig")]
			[HarmonyPostfix]
			public static void OnEnterPostFix(NamesList __instance)
			{
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				string[] array = bodyNames.Value.Split('|');
				foreach (string text in array)
				{
					if (string.IsNullOrEmpty(text))
					{
						continue;
					}
					string[] array2 = text.Split(',');
					for (int j = 0; j < array2.Length; j++)
					{
						array2[j] = array2[j].Trim();
						if (array2[j].EndsWith("Body"))
						{
							array2[j] = array2[j].Substring(0, array2[j].Length - 4);
						}
					}
					string text2 = "";
					if (array2.Length >= 4)
					{
						text2 = array2[3].Trim().TrimStart('[').TrimEnd(']')
							.Replace(";", ",");
					}
					ConfigBodyIndex val = new ConfigBodyIndex(array2[0].Trim(), array2[1].Trim(), array2[2].Trim().TrimStart('[').TrimEnd(']')
						.Replace(";", ","), text2);
					ArrayUtils.ArrayAppend<ConfigBodyIndex>(ref NamesList.configBodyIndexes, ref val);
				}
				ConfigBodyIndex[] configBodyIndexes = NamesList.configBodyIndexes;
				for (int i = 0; i < configBodyIndexes.Length; i++)
				{
					_ = ref configBodyIndexes[i];
				}
			}
		}

		public static ConfigEntry<string> bodyNames;

		private ConfigEntry<bool> enabled;

		public override string chainLoaderKey => "SwagWizards.AllyNames";

		public override void Init()
		{
			if (enabled.Value)
			{
				Log.Debug("applying allynames patches !!");
				butterscotchnroses.harmony.CreateClassProcessor(typeof(AllyNamesChanges)).Patch();
				NamesList.InitConfig();
				NamesList.BuildNamesByBodyName();
				AllyNames.instance.AddTokens();
			}
		}

		public override void Config(ConfigFile config)
		{
			enabled = config.Bind<bool>("Mods - allynames", "enable patches for allynames", true, "");
			Utils.CheckboxConfig(enabled);
			bodyNames = config.Bind<string>("Mods - allynames", "ally name replace !!", "BombardmentDrone,Bombardment Drone,Default;Drones,Tsar Bomba;Fat Man;Little Boy|JunkDrone,Junk Drone,Default;Drones|RechargeDrone,Barrier Drone,Default;Drones|JailerDrone,Jailer Drone,Default;Drones|CleanupDrone,Cleanup Drone,Default;Drones,Roomba|CopycatDrone,Freeze Drone,Default;Drones,Frozone|HaulerDrone,Transport Drone,Default;Drones|DTGunnerDrone,CROSSHAIRS,Default;Drones,Ruxin|DTHealingDrone,DOC,Default;Drones,Bunny|DTHaulerDrone,CHIRP,Default;Drones,Moose|FriendUnit,Best Buddy,Default,Friend Inside Me;Stupid Baby;Son|DroneBomber,Lt. Droneboy,Default,Lt. Beep Boop|_Turretling,turretling,Default,Chudling", "add custom !! use bodynamewithoutBody,realname,category1;category2,customname1;customname2|seconditem format to add custom names !!");
			Utils.StringConfig(bodyNames);
		}
	}
	public class coolereclipse : PatchBase<coolereclipse>
	{
		[HarmonyPatch]
		public class CoolerEclipseChanges
		{
			[HarmonyPatch(typeof(CoolerEclipse), "AddSkybox")]
			[HarmonyPrefix]
			public static bool CoolerEclipseAddSkyboxPreFix(orig_Start orig, SceneDirector self)
			{
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				CoolerEclipse.shouldBeChance.Value = false;
				GameObject obj = GameObject.Find("eclipse handler(Clone)");
				EclipseNetworkBehavior eclipseNetworkBehavior = default(EclipseNetworkBehavior);
				if (obj != null && obj.TryGetComponent<EclipseNetworkBehavior>(ref eclipseNetworkBehavior))
				{
					int num = ((SyncList<int>)(object)eclipseNetworkBehavior.eclipseRNGs)[Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.stageClearCount : 0];
					bool flag = ((SyncList<bool>)(object)eclipseNetworkBehavior.pinkEclipses)[Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.stageClearCount : 0];
					Log.Debug($"rng {num} pink {flag} run null {(Object)(object)Run.instance == (Object)null}");
					Scene activeScene = SceneManager.GetActiveScene();
					string name = ((Scene)(ref activeScene)).name;
					if (!Utility.IsNullOrWhiteSpace(whitelistStages.Value))
					{
						string[] array = whitelistStages.Value.Split(",");
						foreach (string text in array)
						{
							if (name.Contains(text))
							{
								Log.Debug(text + " is in whitelist !! forcing !!");
								return true;
							}
						}
					}
					if (!Utility.IsNullOrWhiteSpace(blacklistStages.Value))
					{
						string[] array = blacklistStages.Value.Split(",");
						foreach (string text2 in array)
						{
							if (name.Contains(text2))
							{
								Log.Debug("name " + text2 + " is in config !! skipping !!");
								orig.Invoke(self);
								return false;
							}
						}
					}
					Log.Debug($"test eclipse !! rng {num} < {eclipseChance.Value} ,,,.. applying ? {(float)num > eclipseChance.Value}");
					if ((float)num > eclipseChance.Value)
					{
						orig.Invoke(self);
						return false;
					}
					return true;
				}
				Log.Debug("unable to find eclipse handler !! ");
				orig.Invoke(self);
				return false;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(CoolerEclipse), "AddSkybox")]
			public static void CoolerEclipseAddSkyboxPostFix(orig_Start orig, SceneDirector self)
			{
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_0247: Unknown result type (might be due to invalid IL or missing references)
				//IL_024c: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				//IL_0269: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0283: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_0466: Unknown result type (might be due to invalid IL or missing references)
				//IL_046b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0493: Unknown result type (might be due to invalid IL or missing references)
				//IL_0498: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)GameObject.Find("Eclipse")))
				{
					return;
				}
				GameObject obj = GameObject.Find("eclipse handler(Clone)");
				EclipseNetworkBehavior eclipseNetworkBehavior = default(EclipseNetworkBehavior);
				if (obj != null && obj.TryGetComponent<EclipseNetworkBehavior>(ref eclipseNetworkBehavior))
				{
					int num = ((SyncList<int>)(object)eclipseNetworkBehavior.eclipseRNGs)[Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.stageClearCount : 0];
					bool flag = ((SyncList<bool>)(object)eclipseNetworkBehavior.pinkEclipses)[Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.stageClearCount : 0];
					Log.Debug($"rng {num} pink {flag} run null {(Object)(object)Run.instance == (Object)null}");
					GameObject val = GameObject.Find("PP + Amb");
					PostProcessVolume val2 = default(PostProcessVolume);
					if (val.TryGetComponent<PostProcessVolume>(ref val2))
					{
						RampFog setting = val2.sharedProfile.GetSetting<RampFog>();
						((ParameterOverride<Color>)(object)setting.fogColorStart).value = Color32.op_Implicit(new Color32((byte)55, (byte)87, (byte)82, (byte)15));
						((ParameterOverride<Color>)(object)setting.fogColorMid).value = Color32.op_Implicit(new Color32((byte)54, (byte)74, (byte)89, (byte)100));
						((ParameterOverride<Color>)(object)setting.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)47, (byte)63, (byte)82, (byte)200));
						if (!Object.op_Implicit((Object)(object)colorGrading))
						{
							colorGrading = val2.sharedProfile.GetSetting<ColorGrading>();
						}
						if (!val2.sharedProfile.HasSettings<ColorGrading>())
						{
							val2.sharedProfile.AddSettings<ColorGrading>();
							val2.sharedProfile.settings[val2.sharedProfile.settings.FindIndex((PostProcessEffectSettings settings) => settings is ColorGrading)] = (PostProcessEffectSettings)(object)colorGrading;
						}
					}
					if (!flag)
					{
						return;
					}
					SetAmbientLight val3 = default(SetAmbientLight);
					if (val.TryGetComponent<SetAmbientLight>(ref val3))
					{
						val3.ambientSkyColor = Utils.Color255(207, 97, 182);
						val3.ambientEquatorColor = Utils.Color255(207, 97, 165);
						val3.ambientGroundColor = Utils.Color255(146, 32, 93);
						val3.ApplyLighting();
					}
					PostProcessVolume val4 = default(PostProcessVolume);
					if (val.TryGetComponent<PostProcessVolume>(ref val4))
					{
						RampFog setting2 = val4.sharedProfile.GetSetting<RampFog>();
						((ParameterOverride<Color>)(object)setting2.fogColorStart).value = Color32.op_Implicit(new Color32((byte)190, (byte)154, (byte)150, (byte)15));
						((ParameterOverride<Color>)(object)setting2.fogColorMid).value = Color32.op_Implicit(new Color32((byte)110, (byte)73, (byte)69, (byte)100));
						((ParameterOverride<Color>)(object)setting2.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)90, (byte)47, (byte)44, (byte)200));
						if (!Object.op_Implicit((Object)(object)colorGrading))
						{
							colorGrading = val2.sharedProfile.GetSetting<ColorGrading>();
						}
						val4.sharedProfile.RemoveSettings<ColorGrading>();
					}
					GameObject val5 = GameObject.Find("Weather (Locked Position/Rotation)");
					ParticleSystemRenderer val6 = default(ParticleSystemRenderer);
					if (Object.op_Implicit((Object)(object)val5) && Object.op_Implicit((Object)(object)val5.transform.Find("Embers")) && ((Component)val5.transform.Find("Embers")).gameObject.TryGetComponent<ParticleSystemRenderer>(ref val6))
					{
						if ((Object)(object)particleSystemMat == (Object)null)
						{
							particleSystemMat = Object.Instantiate<Material>(((Renderer)val6).sharedMaterial);
							particleSystemMat.SetTexture(RemapTex, (Texture)(object)particleSystemRamp);
						}
						((Renderer)val6).sharedMaterial = particleSystemMat;
					}
					MeshRenderer val7 = default(MeshRenderer);
					if (GameObject.Find("Sphere, Stars").TryGetComponent<MeshRenderer>(ref val7) && Object.op_Implicit((Object)(object)val7))
					{
						if ((Object)(object)starsMat == (Object)null)
						{
							starsMat = Object.Instantiate<Material>(((Renderer)val7).sharedMaterial);
							starsMat.SetTexture(RemapTex, (Texture)(object)starRamp);
						}
						((Renderer)val7).sharedMaterial = starsMat;
					}
					MeshRenderer val8 = default(MeshRenderer);
					if (GameObject.Find("Sphere, Stars 2").TryGetComponent<MeshRenderer>(ref val8) && Object.op_Implicit((Object)(object)val8))
					{
						if ((Object)(object)starsMat2 == (Object)null)
						{
							starsMat2 = Object.Instantiate<Material>(((Renderer)val8).sharedMaterial);
							starsMat2.SetTexture(RemapTex, (Texture)(object)starRamp);
						}
						((Renderer)val8).sharedMaterial = starsMat2;
					}
					MeshRenderer val9 = default(MeshRenderer);
					if (GameObject.Find("Sphere, Moon").TryGetComponent<MeshRenderer>(ref val9) && Object.op_Implicit((Object)(object)val9))
					{
						if ((Object)(object)moonMat == (Object)null)
						{
							moonMat = Object.Instantiate<Material>(((Renderer)val9).sharedMaterial);
							moonMat.SetTexture(RemapTex, (Texture)(object)moonRamp);
							moonMat.SetColor(TintColor, Color.op_Implicit(new Vector4(0.58431375f, 0.2784314f, 0.29411766f, 1f)));
							moonMat.SetColor(SpecColor, Color.op_Implicit(new Vector4(1f, 0f, 0f, 1f)));
						}
						((Renderer)val9).sharedMaterial = moonMat;
					}
					MeshRenderer val10 = default(MeshRenderer);
					if (GameObject.Find("Eclipse").TryGetComponent<MeshRenderer>(ref val10) && Object.op_Implicit((Object)(object)val10))
					{
						if ((Object)(object)eclipseMat == (Object)null)
						{
							eclipseMat = Object.Instantiate<Material>(((Renderer)val10).sharedMaterial);
							eclipseMat.SetTexture(RemapTex, (Texture)(object)moonRamp);
						}
						((Renderer)val10).sharedMaterial = eclipseMat;
					}
				}
				else
				{
					Log.Debug("unable to find eclipse handler !! ");
				}
			}
		}

		private static int eclipseRNG;

		private static bool pinkEclipse;

		private static Texture2D particleSystemRamp;

		private static Texture2D starRamp;

		private static Texture2D moonRamp;

		private static Material particleSystemMat;

		private static Material starsMat;

		private static Material starsMat2;

		private static Material eclipseMat;

		private static Material moonMat;

		private static ColorGrading colorGrading;

		public static GameObject eclipseHandler;

		private static ConfigEntry<bool> applyCE;

		private static ConfigEntry<float> eclipseChance;

		public static ConfigEntry<float> pinkEclipseChance;

		public static ConfigEntry<string> blacklistStages;

		public static ConfigEntry<string> whitelistStages;

		private static readonly int RemapTex = Shader.PropertyToID("_RemapTex");

		private static readonly int TintColor = Shader.PropertyToID("_TintColor");

		private static readonly int SpecColor = Shader.PropertyToID("_SpecColor");

		public override string chainLoaderKey => "com.Nuxlar.CoolerEclipse";

		public override void Init()
		{
			//IL_0062: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			if (applyCE.Value)
			{
				butterscotchnroses.harmony.CreateClassProcessor(typeof(CoolerEclipseChanges)).Patch();
				Run.onRunStartGlobal += RunOnonRunStartGlobal;
				Log.Debug("ptached cooler eclipse !!");
				eclipseHandler = PrefabAPI.CreateEmptyPrefab("eclipse handler", true);
				eclipseHandler.AddComponent<EclipseNetworkBehavior>();
				AsyncOperationHandle<Texture2D> val = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampGolem_png);
				val.Completed += delegate(AsyncOperationHandle<Texture2D> handle)
				{
					starRamp = handle.Result;
				};
				val = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampArchWisp_png);
				val.Completed += delegate(AsyncOperationHandle<Texture2D> handle)
				{
					moonRamp = handle.Result;
				};
				val = Addressables.LoadAssetAsync<Texture2D>((object)RoR2_Base_Common_ColorRamps.texRampDiamondLaser_png);
				val.Completed += delegate(AsyncOperationHandle<Texture2D> handle)
				{
					particleSystemRamp = handle.Result;
				};
			}
		}

		private void RunOnonRunStartGlobal(Run obj)
		{
			GameObject val = GameObject.Find("eclipse handler(Clone)");
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)val);
			}
			if (NetworkServer.active)
			{
				val = Object.Instantiate<GameObject>(eclipseHandler);
				NetworkServer.Spawn(val);
			}
		}

		public override void Config(ConfigFile config)
		{
			applyCE = config.Bind<bool>("Mods - CoolerEclipse", "apply cooler eclipse patches !!", true, "");
			Utils.CheckboxConfig(applyCE);
			eclipseChance = config.Bind<float>("Mods - CoolerEclipse", "chance for eclipse", 15f, "bwaa,  (0-100 !!!");
			Utils.SliderConfig(0f, 100f, eclipseChance);
			pinkEclipseChance = config.Bind<float>("Mods - CoolerEclipse", "chance for pink eclipse if enabled !", 50f, "bwaa,  (0-100 !!! if regular eclipse is rolled rolls this percent chance on top .,,. set to 0 to disable !!");
			Utils.SliderConfig(0f, 100f, pinkEclipseChance);
			blacklistStages = config.Bind<string>("Mods - CoolerEclipse", "stage blacklist", "goldshores,bazaar,solutionalhaunt,ss2_voidshop,testscene,voidraid,arena", "eclipse stage blacklist (seperate by , !! (eg golemplains,blackbeach!!");
			Utils.StringConfig(blacklistStages);
			whitelistStages = config.Bind<string>("Mods - CoolerEclipse", "stage whitelist", "", "what stages to force eclipses on (seperate by , !! (eg golemplains,blackbeach!! will not work with moon2, ,..");
			Utils.StringConfig(whitelistStages);
		}
	}
	internal class EclipseNetworkBehavior : NetworkBehaviour
	{
		public SyncListInt eclipseRNGs = new SyncListInt();

		public SyncListBool pinkEclipses = new SyncListBool();

		private bool ranFixedUpdate;

		private static int kListeclipseRNGs;

		private static int kListpinkEclipses;

		private void Awake()
		{
			Object.DontDestroyOnLoad((Object)(object)this);
			((SyncList<int>)(object)eclipseRNGs).InitializeBehaviour((NetworkBehaviour)(object)this, kListeclipseRNGs);
			((SyncList<bool>)(object)pinkEclipses).InitializeBehaviour((NetworkBehaviour)(object)this, kListpinkEclipses);
		}

		private void Start()
		{
		}

		private void OnServerInitialized()
		{
		}

		public override void OnStartClient()
		{
			((NetworkBehaviour)this).OnStartClient();
			if (NetworkServer.active)
			{
				for (int i = 0; i < 10; i++)
				{
					((SyncList<int>)(object)eclipseRNGs).Add(Random.RandomRangeInt(0, 100));
					((SyncList<bool>)(object)pinkEclipses).Add((float)Random.RandomRangeInt(0, 100) > coolereclipse.pinkEclipseChance.Value);
				}
			}
		}

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Stage.Start += new hook_Start(StageOnStart);
		}

		private void FixedUpdate()
		{
			if (!ranFixedUpdate)
			{
				ranFixedUpdate = true;
			}
		}

		private void start()
		{
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Stage.Start -= new hook_Start(StageOnStart);
		}

		private IEnumerator StageOnStart(orig_Start orig, Stage self)
		{
			if (NetworkServer.active)
			{
				int num = Run.instance.runRNG.RangeInt(0, 100);
				Log.Debug($"eclipse rng {num}");
				int num2 = Run.instance.runRNG.RangeInt(0, 100);
				Log.Debug($"pink rng {(float)num2 > coolereclipse.pinkEclipseChance.Value}");
				((SyncList<int>)(object)eclipseRNGs).Add(num);
				((SyncList<bool>)(object)pinkEclipses).Add((float)num2 > coolereclipse.pinkEclipseChance.Value);
			}
			return orig.Invoke(self);
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeSyncListeclipseRNGs(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"SyncList eclipseRNGs called on server.");
			}
			else
			{
				((SyncList<int>)(object)((EclipseNetworkBehavior)(object)obj).eclipseRNGs).HandleMsg(reader);
			}
		}

		protected static void InvokeSyncListpinkEclipses(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"SyncList pinkEclipses called on server.");
			}
			else
			{
				((SyncList<bool>)(object)((EclipseNetworkBehavior)(object)obj).pinkEclipses).HandleMsg(reader);
			}
		}

		static EclipseNetworkBehavior()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			kListeclipseRNGs = -1395580364;
			NetworkBehaviour.RegisterSyncListDelegate(typeof(EclipseNetworkBehavior), kListeclipseRNGs, new CmdDelegate(InvokeSyncListeclipseRNGs));
			kListpinkEclipses = 477959197;
			NetworkBehaviour.RegisterSyncListDelegate(typeof(EclipseNetworkBehavior), kListpinkEclipses, new CmdDelegate(InvokeSyncListpinkEclipses));
			NetworkCRC.RegisterBehaviour("EclipseNetworkBehavior", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				SyncListInt.WriteInstance(writer, eclipseRNGs);
				SyncListBool.WriteInstance(writer, pinkEclipses);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				SyncListInt.WriteInstance(writer, eclipseRNGs);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				SyncListBool.WriteInstance(writer, pinkEclipses);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			if (initialState)
			{
				SyncListInt.ReadReference(reader, eclipseRNGs);
				SyncListBool.ReadReference(reader, pinkEclipses);
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				SyncListInt.ReadReference(reader, eclipseRNGs);
			}
			if (((uint)num & 2u) != 0)
			{
				SyncListBool.ReadReference(reader, pinkEclipses);
			}
		}
	}
	public class debugplains : PatchBase<debugplains>
	{
		[HarmonyPatch]
		public class DebuggingPlainsChanges
		{
			private static bool autoVote;

			private static bool autoMenu;

			private static bool autoPlains;

			private static bool autoCharacter;

			[HarmonyPrefix]
			[HarmonyPatch(typeof(DebuggingPlains), "PreGameRuleVoteController_ServerHandleClientVoteUpdate")]
			public static bool PreGameRuleVoteController_ServerHandleClientVoteUpdate(DebuggingPlains __instance)
			{
				if (!preventRepeatEnters.Value)
				{
					return true;
				}
				if (autoVote)
				{
					return false;
				}
				autoVote = true;
				return true;
			}

			[HarmonyPatch(typeof(DebuggingPlains), "Stage_RespawnCharacter")]
			[HarmonyPrefix]
			public static bool Stage_RespawnCharacter(DebuggingPlains __instance)
			{
				if (!preventRepeatEnters.Value)
				{
					return true;
				}
				if (autoCharacter)
				{
					return false;
				}
				autoCharacter = true;
				return true;
			}

			[HarmonyPatch(typeof(DebuggingPlains), "MainMenuController_UpdateMenuTransition")]
			[HarmonyPrefix]
			public static bool MainMenuController_UpdateMenuTransition(DebuggingPlains __instance)
			{
				if (!preventRepeatEnters.Value)
				{
					return true;
				}
				if (autoMenu)
				{
					return false;
				}
				autoMenu = true;
				return true;
			}

			[HarmonyPatch(typeof(Debuggin