Decompiled source of Void Crest v0.4.4

VoidCrest.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalEnums;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using Needleforge;
using Needleforge.Attacks;
using Needleforge.Data;
using Newtonsoft.Json.Linq;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("VoidCrest")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.4.4.0")]
[assembly: AssemblyInformationalVersion("0.4.4")]
[assembly: AssemblyProduct("VoidCrest")]
[assembly: AssemblyTitle("VoidCrest")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace VoidCrest
{
	public sealed class VoidCrestSprites : MonoBehaviour
	{
		public static Sprite crestSprite;

		public static Sprite crestSilhouette;

		private static string assetsPath;

		public static void StartFromMain()
		{
			assetsPath = Path.Combine(Path.GetDirectoryName(typeof(VoidCrestPlugin).Assembly.Location) ?? "", "Assets");
			LoadSprites();
		}

		private static void LoadSprites()
		{
			try
			{
				crestSprite = TryLoadSprite("crestSprite.png");
				crestSilhouette = TryLoadSprite("crestSilhouette.png", Sil: true);
			}
			catch (Exception ex)
			{
				VoidCrestPlugin.LogSrc.LogError((object)("LoadSprites() threw: " + ex));
			}
		}

		public static Sprite TryLoadSprite(string fileName, bool Sil = false)
		{
			try
			{
				return LoadSprite(fileName, Sil);
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"LoadSpriteSafe: exception while loading {fileName}: {arg}");
				return null;
			}
		}

		private static Texture2D ResizeTexture(Texture2D source, int newWidth, int newHeight)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			RenderTexture temporary = RenderTexture.GetTemporary(newWidth, newHeight);
			Graphics.Blit((Texture)(object)source, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(newWidth, newHeight, (TextureFormat)4, false);
			val.ReadPixels(new Rect(0f, 0f, (float)newWidth, (float)newHeight), 0, 0);
			val.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			((Texture)val).filterMode = ((Texture)source).filterMode;
			((Texture)val).wrapMode = ((Texture)source).wrapMode;
			return val;
		}

		public static Sprite MatchSpriteSize(Sprite source)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0027: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Texture2D texture = source.texture;
			Rect rect = source.rect;
			Vector2 pivot = source.pivot;
			Rect rect2 = source.rect;
			float width = ((Rect)(ref rect2)).width;
			rect2 = source.rect;
			return Sprite.Create(texture, rect, pivot / new Vector2(width, ((Rect)(ref rect2)).height), 150f, 0u, (SpriteMeshType)0, source.border);
		}

		private static Sprite LoadSprite(string resourceName, bool Sil = false)
		{
			string resourceName2 = resourceName;
			Assembly assembly = typeof(VoidCrestPlugin).Assembly;
			string name = "VoidCrest.Assets." + resourceName2;
			Stream manifestResourceStream = assembly.GetManifestResourceStream(name);
			if (manifestResourceStream == null)
			{
				string[] manifestResourceNames = assembly.GetManifestResourceNames();
				string text = manifestResourceNames.FirstOrDefault((string n) => n.EndsWith(resourceName2, StringComparison.InvariantCultureIgnoreCase));
				if (string.IsNullOrEmpty(text))
				{
					VoidCrestPlugin.LogSrc.LogError((object)$"LoadSprite: resource not found: '{resourceName2}'. Available count: {manifestResourceNames.Length}");
					return null;
				}
				manifestResourceStream = assembly.GetManifestResourceStream(text);
			}
			if (manifestResourceStream == null)
			{
				VoidCrestPlugin.LogSrc.LogError((object)("LoadSprite: still null stream after fallback for '" + resourceName2 + "'"));
				return null;
			}
			using (manifestResourceStream)
			{
				byte[] array;
				try
				{
					array = new byte[manifestResourceStream.Length];
					if (manifestResourceStream.Read(array, 0, array.Length) == 0)
					{
						VoidCrestPlugin.LogSrc.LogError((object)("LoadSprite: zero bytes read for '" + resourceName2 + "'"));
						return null;
					}
				}
				catch (Exception arg)
				{
					VoidCrestPlugin.LogSrc.LogError((object)$"LoadSprite: error reading resource stream for '{resourceName2}': {arg}");
					return null;
				}
				try
				{
					return LoadSpriteFromBytes(array, Sil);
				}
				catch (Exception arg2)
				{
					VoidCrestPlugin.LogSrc.LogError((object)$"LoadSprite: LoadImage/Sprite.Create failed for '{resourceName2}': {arg2}");
					return null;
				}
			}
		}

		public static Sprite LoadSpriteFromBytes(byte[] data, bool Sil = false)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (data == null || data.Length == 0)
			{
				throw new ArgumentException("data");
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, data))
			{
				throw new Exception("Texture2D.LoadImage failed to decode image bytes");
			}
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			if (IsLikelyFlippedVertically(val))
			{
				Texture2D val2 = FlipTextureVertically(val);
				Object.Destroy((Object)(object)val);
				val = val2;
			}
			int newWidth = (Sil ? 398 : 696);
			int newHeight = (Sil ? 419 : 735);
			Texture2D val3 = ResizeTexture(val, newWidth, newHeight);
			Object.Destroy((Object)(object)val);
			return Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f);
		}

		private static bool IsLikelyFlippedVertically(Texture2D t)
		{
			//IL_0015: 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)
			try
			{
				int num = ((Texture)t).width / 2;
				float a = t.GetPixel(num, ((Texture)t).height - 1).a;
				float a2 = t.GetPixel(num, 0).a;
				return a < a2 * 0.5f;
			}
			catch
			{
				return false;
			}
		}

		private static Texture2D FlipTextureVertically(Texture2D original)
		{
			//IL_0012: 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_001e: Expected O, but got Unknown
			//IL_0058: 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)
			int width = ((Texture)original).width;
			int height = ((Texture)original).height;
			Texture2D val = new Texture2D(width, height, original.format, false);
			for (int i = 0; i < height; i++)
			{
				Color[] pixels = original.GetPixels(0, i, width, 1);
				val.SetPixels(0, height - 1 - i, width, 1, pixels);
			}
			val.Apply();
			((Texture)val).filterMode = ((Texture)original).filterMode;
			((Texture)val).wrapMode = ((Texture)original).wrapMode;
			return val;
		}
	}
	public class Localization
	{
		public class LocalizationData
		{
			public class Sheet
			{
				public string name;

				public Dictionary<string, string> entries = new Dictionary<string, string>();

				public Sheet(string name)
				{
					this.name = name;
				}
			}

			public class Language
			{
				public string name;

				public Dictionary<string, Sheet> sheets = new Dictionary<string, Sheet>();

				public Language(string name)
				{
					this.name = name;
				}

				public Sheet AddSheet(Sheet sheet)
				{
					if (sheets.ContainsKey(sheet.name))
					{
						foreach (KeyValuePair<string, string> entry in sheet.entries)
						{
							if (!sheet.entries.TryAdd(entry.Key, entry.Value))
							{
								sheet.entries[entry.Key] = entry.Value;
							}
						}
					}
					else
					{
						sheets.Add(sheet.name, sheet);
					}
					return sheet;
				}

				public Dictionary<string, Dictionary<string, string>> Build()
				{
					Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>();
					foreach (KeyValuePair<string, Sheet> sheet in sheets)
					{
						Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
						Extensions.AddRange<string, string>(dictionary2, sheet.Value.entries);
						dictionary.Add(sheet.Key, dictionary2);
					}
					return dictionary;
				}

				public void BuildInto(ref Dictionary<string, Dictionary<string, string>> other)
				{
					Dictionary<string, Dictionary<string, string>> dictionary = Build();
					foreach (KeyValuePair<string, Dictionary<string, string>> item in dictionary)
					{
						if (other.ContainsKey(item.Key))
						{
							foreach (KeyValuePair<string, string> item2 in item.Value)
							{
								if (!other[item.Key].TryAdd(item2.Key, item2.Value))
								{
									other[item.Key][item2.Key] = item2.Value;
								}
							}
						}
						else
						{
							other.Add(item.Key, item.Value);
						}
					}
				}
			}

			public Dictionary<string, Language> languages = new Dictionary<string, Language>();

			public Language AddLanguage(Language language)
			{
				Language language2 = language;
				if (languages.ContainsKey(language.name))
				{
					language2 = languages[language.name];
					foreach (KeyValuePair<string, Sheet> sheet in language.sheets)
					{
						if (!language2.sheets.TryAdd(sheet.Key, sheet.Value))
						{
							language2.sheets[sheet.Key] = sheet.Value;
						}
					}
				}
				else
				{
					languages.Add(language.name, language);
				}
				return language2;
			}
		}

		public static LocalizationData data;

		static Localization()
		{
			data = new LocalizationData();
			SceneManager.sceneLoaded += OnLoadScene;
		}

		private static void OnLoadScene(Scene scene, LoadSceneMode mode)
		{
			LocalizationPatches.Patch(VoidCrestPlugin.harmony);
		}

		public static void LoadJsonFromEmbedded(string language, string name)
		{
			LoadJsonFromAssemblyEmbedded(language, name, Assembly.GetCallingAssembly());
		}

		public static void LoadJsonFromAssemblyEmbedded(string language, string name, Assembly assembly)
		{
			if (!assembly.GetManifestResourceNames().Contains(name))
			{
				throw new Exception("No json with the name of \"" + name + "\" in assembly \"" + assembly.GetName().Name + "\"");
			}
			using Stream stream = assembly.GetManifestResourceStream(name);
			LoadJsonFromStream(language, stream);
		}

		public static void LoadJsonFromStream(string language, Stream stream)
		{
			using StreamReader streamReader = new StreamReader(stream);
			string json = streamReader.ReadToEnd();
			LoadJson(language, json);
		}

		public static void LoadJsonFile(string language, string path)
		{
			LoadJson(language, File.ReadAllText(path));
		}

		public static void LoadJson(string language, string json)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			LocalizationData.Language language2 = data.AddLanguage(new LocalizationData.Language(language));
			JObject val = JObject.Parse(json);
			foreach (KeyValuePair<string, JToken> item in val)
			{
				string key = item.Key;
				JToken value = item.Value;
				if (value == null || (int)value.Type != 1)
				{
					continue;
				}
				LocalizationData.Sheet sheet = new LocalizationData.Sheet(key);
				JObject val2 = (JObject)value;
				foreach (KeyValuePair<string, JToken> item2 in val2)
				{
					string key2 = item2.Key;
					if (item2.Value != null && (int)item2.Value.Type == 8)
					{
						string value2 = ((object)item2.Value).ToString();
						sheet.entries.Add(key2, value2);
					}
				}
				if (sheet.entries.Count > 0)
				{
					language2.AddSheet(sheet);
				}
			}
		}
	}
	public class LocalizationPatches
	{
		public static void LoadForLanguage(LanguageCode code)
		{
			Dictionary<string, Dictionary<string, string>> other = Language._currentEntrySheets;
			string defaultLangCode = Language.Settings.defaultLangCode;
			if (Localization.data.languages.ContainsKey(defaultLangCode))
			{
				Localization.LocalizationData.Language language = Localization.data.languages[defaultLangCode];
				language.BuildInto(ref other);
			}
			string key = ((object)(LanguageCode)(ref code)).ToString();
			if (Localization.data.languages.ContainsKey(key))
			{
				Localization.LocalizationData.Language language2 = Localization.data.languages[key];
				language2.BuildInto(ref other);
			}
			Language._currentEntrySheets = other;
		}

		public static void Patch(Harmony harmony)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			harmony.Patch((MethodBase)typeof(Language).GetMethod("SwitchLanguage", new Type[1] { typeof(LanguageCode) }), (HarmonyMethod)null, new HarmonyMethod(typeof(LocalizationPatches).GetMethod("LoadForLanguage")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("io.dervoce.voidcrest", "VoidCrest", "0.4.4")]
	public class VoidCrestPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <<Awake>g__ThisIsStupid|40_1>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private ToolCrest <voidCrest>5__1;

			private ToolCrest <basecrest>5__2;

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

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

			[DebuggerHidden]
			public <<Awake>g__ThisIsStupid|40_1>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<voidCrest>5__1 = null;
				<basecrest>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e6: 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_00f7: 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_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Expected O, but got Unknown
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					LogSrc.LogInfo((object)"ThisIsStupid Ran");
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)voidCrestData.ToolCrest != (Object)null));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)ManagerSingleton<ToolItemManager>.Instance != (Object)null));
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					LogSrc.LogInfo((object)"ThisIsStupid Began");
					<voidCrest>5__1 = voidCrestData.ToolCrest;
					<voidCrest>5__1.hasCustomAction = true;
					<voidCrest>5__1.customButtonCombo = new Display
					{
						ActionButton = (HeroActionButton)4,
						DirectionModifier = (AttackToolBinding)1,
						PromptText = new LocalisedString("VOID", "VOIDBINDUP"),
						ShowHold = true
					};
					<basecrest>5__2 = ToolItemManager.GetCrestByName(BaseCrest.Value);
					if ((Object)(object)<basecrest>5__2 == (Object)null)
					{
						<basecrest>5__2 = ToolItemManager.GetCrestByName("Witch");
						LogSrc.LogWarning((object)"WARNING!!!! The base crest name you chose for void crest was incorrect, defaulting to witch crest as base.");
					}
					voidCrestData.Moveset.HeroConfig = HeroConfigNeedleforge.Copy(<basecrest>5__2.heroConfig);
					<voidCrest>5__1.heroConfig = <basecrest>5__2.heroConfig;
					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 <<Awake>g__Waitforsphere|40_3>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action action;

			private GameObject <special>5__1;

			private GameObject <ball>5__2;

			private Vector3 <oldscale>5__3;

			private IEnumerator <>s__4;

			private Transform <c>5__5;

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

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

			[DebuggerHidden]
			public <<Awake>g__Waitforsphere|40_3>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<special>5__1 = null;
				<ball>5__2 = null;
				<>s__4 = null;
				<c>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0205: 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_00aa: Expected O, but got Unknown
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: 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_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					HeroController.instance.TakeSilk(9);
					<special>5__1 = ((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject;
					((Component)<special>5__1.transform.Find("Sphere Flash")).gameObject.SetActive(true);
					Balancey.doVoidSilk = true;
					<>s__4 = <special>5__1.transform.GetEnumerator();
					try
					{
						while (<>s__4.MoveNext())
						{
							<c>5__5 = (Transform)<>s__4.Current;
							VoidCrestColorUtil.MakeItBlack(((Component)<c>5__5).gameObject);
							<c>5__5 = null;
						}
					}
					finally
					{
						if (<>s__4 is IDisposable disposable)
						{
							disposable.Dispose();
						}
					}
					<>s__4 = null;
					<ball>5__2 = ((Component)<special>5__1.transform.Find("Sphere Ball")).gameObject;
					<oldscale>5__3 = <ball>5__2.transform.localScale;
					Transform transform = <ball>5__2.transform;
					transform.localScale *= SpecialAttackBaseSize.Value * (1f + (float)voidspool.voidMass * SpecialAttackSizeIncreasePerVoidMass.Value);
					<ball>5__2.SetActive(true);
					HeroController.instance.cState.SetState("isBinding", true);
					doingSpecialAttack = true;
					if (!SpecialAttackUnfixFly.Value)
					{
						HeroController.instance.ResetVelocity();
					}
					<>2__current = (object)new WaitForSeconds(SpecialAttackBaseTime.Value * 1f + (float)voidspool.voidMass * SpecialAttackTimeIncreasePerVoidMass.Value);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					doingSpecialAttack = false;
					<ball>5__2.SetActive(false);
					<ball>5__2.transform.localScale = <oldscale>5__3;
					HeroController.instance.cState.SetState("isBinding", false);
					Balancey.doVoidSilk = false;
					((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject.UnvoidifyRoot();
					HeroController.instance.AddHealth((int)((float)voidspool.voidMass * SpecialAttackHealIncreasePerVoidMass.Value));
					voidspool.voidMass = 0;
					action();
					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 <<Awake>g__youcanthitmelol|40_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HeroController __instance;

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

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

			[DebuggerHidden]
			public <<Awake>g__youcanthitmelol|40_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					__instance.MakeHeroFucked();
					<>2__current = (object)new WaitForSeconds(bindTimeValue.Value + 0.25f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					__instance.RestoreHero();
					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();
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BindEventHandler <>9__40_5;

			public static Func<bool> <>9__40_6;

			public static Func<bool> <>9__40_7;

			public static BindEventHandler <>9__40_8;

			public static EventHandler <>9__40_4;

			internal void <Awake>b__40_5(FsmInt FsmInt, FsmInt FsmInt2, FsmFloat FsmFloat, PlayMakerFSM PlayMakerFSM)
			{
				((MonoBehaviour)HeroController.instance).StartCoroutine(<Awake>g__youcanthitmelol|40_0(HeroController.instance));
			}

			internal bool <Awake>b__40_6()
			{
				return (Object)(object)voidCrestData.ToolCrest != (Object)null;
			}

			internal bool <Awake>b__40_7()
			{
				return (Object)(object)ManagerSingleton<ToolItemManager>.Instance != (Object)null;
			}

			internal void <Awake>b__40_8(FsmInt healValue, FsmInt healAmount, FsmFloat healTime, PlayMakerFSM Fsm)
			{
				healValue.Value = bindHealValue.Value;
				healAmount.Value = 1;
				healTime.Value = bindTimeValue.Value;
			}

			internal void <Awake>b__40_4(object _, EventArgs __)
			{
				if (!((Object)(object)HeroController.instance == (Object)null) && voidCrestData.IsEquipped)
				{
					Transform val = ((Component)HeroController.instance).gameObject.transform.Find("HeroLight");
					if (enableOrangeAura.Value)
					{
						((Component)val).gameObject.Voidify();
					}
					else
					{
						((Component)val).gameObject.UnvoidifyRoot();
					}
				}
			}
		}

		public static ManualLogSource? LogSrc;

		public static Harmony? harmony;

		public static CrestData? voidCrestData;

		public static VoidCrestPlugin? Instance;

		public static DamageEnemies? DashDamager;

		public static GameObject? DashDamagerObject;

		public static PolygonCollider2D? DashDamagerCollider;

		public static ColorData? voidColor;

		public static bool doingSpecialAttack;

		public static ConfigEntry<bool> enableOrangeAura;

		public static ConfigEntry<bool> enableOrangeHornet;

		public static ConfigEntry<int> bindHealValue;

		public static ConfigEntry<float> bindTimeValue;

		public static ConfigEntry<float> SpecialAttackSizeIncreasePerVoidMass;

		public static ConfigEntry<float> SpecialAttackBaseSize;

		public static ConfigEntry<float> SpecialAttackBaseTime;

		public static ConfigEntry<float> SpecialAttackTimeIncreasePerVoidMass;

		public static ConfigEntry<float> SpecialAttackHealIncreasePerVoidMass;

		public static ConfigEntry<string> BaseCrest;

		public static ConfigEntry<bool> DoPlasmiumMass;

		public static ConfigEntry<int> PlasmiumMassAmount;

		public static ConfigEntry<bool> DoVoidSilk;

		public static ConfigEntry<float> VoidSilkMult;

		public static ConfigEntry<int> VoidSilkCost;

		public static ConfigEntry<int> VoidMassPerHit;

		public static ConfigEntry<int> InjectorVoidMassBonus;

		public static ConfigEntry<int> MultibinderVoidMassBonus;

		public static ConfigEntry<int> WardingVoidMassBonus;

		public static ConfigEntry<bool> InjectorSilkHit;

		public static ConfigEntry<bool> MultibinderSilkHit;

		public static ConfigEntry<bool> WardingSilkHit;

		public static ConfigEntry<float> BindHitMult;

		public static ConfigEntry<float> DashHitMult;

		public static ConfigEntry<float> WardingHitMultBonus;

		public static ConfigEntry<float> InjectorHitMultBonus;

		public static ConfigEntry<float> MultibinderHitMultBonus;

		public static ConfigEntry<float> AnkletDashHitMultBonus;

		public static ConfigEntry<float> BeltDashHitMultBonus;

		public static ConfigEntry<float> SpecialAttackDamageMult;

		public static ConfigEntry<bool> SpecialAttackUnfixFly;

		public const string Id = "io.dervoce.voidcrest";

		public static string Name => "VoidCrest";

		public static string Version => "0.4.4";

		private void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Expected O, but got Unknown
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Expected O, but got Unknown
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Expected O, but got Unknown
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0759: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0780: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Expected O, but got Unknown
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0809: Expected O, but got Unknown
			//IL_081c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0826: Expected O, but got Unknown
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Expected O, but got Unknown
			Instance = this;
			LogSrc = ((BaseUnityPlugin)this).Logger;
			LogSrc.LogInfo((object)("Plugin " + Name + " (io.dervoce.voidcrest) has loaded!"));
			harmony = new Harmony("io.dervoce.voidcrest");
			harmony.PatchAll();
			enableOrangeAura = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Orange Aura Shader", true, "Enable or disable the orange shader");
			SpecialAttackUnfixFly = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Unfix special attack bug", false, "Setting this to true re-enables a patched bug where your momentum was kept when you did a special attack and you just kept flying in that direction until you either hit a wall or the attack stops and gravity becomes existent again");
			enableOrangeHornet = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Orange Hornet Model Shader", true, "Enable or disable the orange shader");
			BaseCrest = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Base Crest", "Witch", "Which Crest to use as a base for regular attacks (Must use the crest's id name)");
			bindHealValue = ((BaseUnityPlugin)this).Config.Bind<int>("Bind", "Bind Heal Value", 0, "How much the regular bind heals (should probably stay 0 for the sake of the concept)");
			bindTimeValue = ((BaseUnityPlugin)this).Config.Bind<float>("Bind", "Bind Time Value", 1.5f, "How long the bind lasts");
			VoidMassPerHit = ((BaseUnityPlugin)this).Config.Bind<int>("Bind", "Void Mass Per Hit", 1, "How much void mass you recieve when hit while binding");
			BindHitMult = ((BaseUnityPlugin)this).Config.Bind<float>("Bind", "Bind Hit Mult", 2f, "How much of needle damage does a base bind retaliation hit do");
			DashHitMult = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "Dash Hit Mult", 0.5f, "How much of needle damage does a base sharp shadow dash hit do");
			SpecialAttackSizeIncreasePerVoidMass = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Size Increase Per Voidmass", 0.1f, "How much the special attack's size scales with every voidmass (0.1 means it grows by 10% every voidmass)");
			SpecialAttackBaseSize = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Base Size", 1f, "the regular size of the attack before being multiplied by 1 + (voidmass * SpecialAttackSizeIncreasePerVoidMass)");
			SpecialAttackBaseTime = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Base Time", 0f, "the regular duration of the attack before being multiplied by 1 + (voidmass * SpecialAttackTimeIncreasePerVoidMass)");
			SpecialAttackTimeIncreasePerVoidMass = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Time Increase Per Voidmass", 1f, "How much the special attack's duration scales with every voidmass (1 means it grows by 1 second every voidmass)");
			SpecialAttackHealIncreasePerVoidMass = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Heal Increase Per Voidmass", 0.5f, "How much the special attack's heal scales with every voidmass (0.5 means it grows by 1 second every 2 voidmass, rounding down)");
			SpecialAttackDamageMult = ((BaseUnityPlugin)this).Config.Bind<float>("Special Attack", "Special Attack Damage Mult", 2f, "Fun fact, the special attack literally is just thread sphere with a custom duration and size except it does double damage (by default), this stat lets you change how much of a regular thread sphere's damage it does");
			DoPlasmiumMass = ((BaseUnityPlugin)this).Config.Bind<bool>("Tool Modifications", "Do Plasmium Mass?", true, "Determines whether or not to replace blue masks given from plasmium phial with voidmass");
			PlasmiumMassAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Tool Modifications", "Plasmium Mass Amount", 1, "How much voidmass does each use of plasmium phial give");
			InjectorVoidMassBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Tool Modifications", "Injector Bands Void Mass Bonus", 1, "How much extra voidmass per hit while binding you recieve when Injector Bands is equipped");
			WardingVoidMassBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Tool Modifications", "Warding Bell Void Mass Bonus", 0, "How much extra voidmass per hit while binding you recieve when Warding Bell is equipped");
			MultibinderVoidMassBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Tool Modifications", "Multibinder Void Mass Bonus", 0, "How much extra voidmass per hit while binding you recieve when Multibinder is equipped");
			MultibinderSilkHit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tool Modifications", "Multibinder Silk Hit", true, "If having Multibinder equipped allows you to generate silk on hit with sharpshadow and bind damage");
			InjectorSilkHit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tool Modifications", "Injector Bands Silk Hit", false, "If having Injector Bands equipped allows you to generate silk on hit with sharpshadow and bind damage");
			WardingSilkHit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tool Modifications", "Warding Bell Silk Hit", false, "If having this Warding Bell equipped allows you to generate silk on hit with sharpshadow and bind damage");
			MultibinderHitMultBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Tool Modifications", "Multibinder Hit Mult Bonus", 0.5f, "How much more bonus damage you deal with bind retaliation hits with Multibinder equipped (0.5 means 50% more)");
			InjectorHitMultBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Tool Modifications", "Injector Bands Hit Mult Bonus", 0.5f, "How much more bonus damage you deal with bind retaliation hits with Injector Bands equipped (0.5 means 50% more)");
			WardingHitMultBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Tool Modifications", "Warding Bell Hit Mult Bonus", 1f, "How much more bonus damage you deal with bind retaliation hits with Warding Bell equipped (1 means 100% more)");
			AnkletDashHitMultBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Tool Modifications", "Anklet Dash Hit Mult Bonus", 0.5f, "How much more bonus damage you deal with sharpshadow dash hits with Anklet equipped (0.5 means 50% more)");
			BeltDashHitMultBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Tool Modifications", "Weighted Belt Dash Hit Mult Bonus", 0.75f, "How much more bonus damage you deal with sharpshadow dash hits with Weighted Belt equipped (0.75 means 75% more)");
			DoVoidSilk = ((BaseUnityPlugin)this).Config.Bind<bool>("Silk Skills", "Do Void Silk?", true, "Determines whether or not consume voidmass to trigger void silk skills");
			VoidSilkMult = ((BaseUnityPlugin)this).Config.Bind<float>("Silk Skills", "Void Silk Mult", 2f, "The damage multiplier on voided silk skills");
			VoidSilkCost = ((BaseUnityPlugin)this).Config.Bind<int>("Silk Skills", "Void Silk Cost", 1, "The cost in voidmass to void a silk skill");
			Localization.LoadJsonFromEmbedded("EN", "VoidCrest.Locale.EN.json");
			VoidCrestSprites.StartFromMain();
			LocalisedString val = default(LocalisedString);
			val.Sheet = "VOID";
			val.Key = "VOIDCRESTDESC";
			LocalisedString val2 = val;
			val = default(LocalisedString);
			val.Sheet = "VOID";
			val.Key = "VOIDCRESTNAME";
			LocalisedString val3 = val;
			Sprite crestSprite = VoidCrestSprites.crestSprite;
			Sprite crestSilhouette = VoidCrestSprites.crestSilhouette;
			Sprite val4 = VoidCrestSprites.MatchSpriteSize(crestSilhouette);
			voidCrestData = NeedleforgePlugin.AddCrest("Void", val3, val2, crestSprite, crestSilhouette, val4);
			voidColor = NeedleforgePlugin.AddToolColor("voidcolor", new Color(0.35f, 0.35f, 0.35f, 1f), true);
			voidColor.allColorsValid = true;
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)0, new Vector2(0.025f, -0.1f) * 1.2f, false);
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)0, new Vector2(-1.185f, 0.95f) * 1.2f, false);
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)2, new Vector2(0.15f, -1.55f) * 1.2f, false);
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)0, new Vector2(-1.5f, -0.6f) * 1.2f, false);
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)1, new Vector2(0.85f, 1.65f) * 1.2f, false);
			voidCrestData.AddToolSlot(voidColor.Type, (AttackToolBinding)0, new Vector2(1.8f, -0.6f) * 1.2f, false);
			voidCrestData.ApplyAutoSlotNavigation(true, 60f, (Vector2?)null);
			voidCrestData.HudFrame.Preset = (VanillaCrest)6;
			CrestData? obj = voidCrestData;
			BindEventHandler bindEvent = obj.BindEvent;
			object obj2 = <>c.<>9__40_5;
			if (obj2 == null)
			{
				BindEventHandler val5 = delegate
				{
					((MonoBehaviour)HeroController.instance).StartCoroutine(youcanthitmelol(HeroController.instance));
				};
				<>c.<>9__40_5 = val5;
				obj2 = (object)val5;
			}
			obj.BindEvent = (BindEventHandler)Delegate.Combine((Delegate?)(object)bindEvent, (Delegate?)obj2);
			((MonoBehaviour)this).StartCoroutine(ThisIsStupid());
			MovesetData moveset = voidCrestData.Moveset;
			DashAttack val6 = new DashAttack();
			((GameObjectProxy)val6).Name = "VoidWitchSlashDash";
			Step[] array = new Step[1];
			Step val7 = new Step();
			((AttackBase)val7).Hitbox = (Vector2[])(object)new Vector2[7]
			{
				new Vector2(-1.8526f, 1.3656f),
				new Vector2(-3.7877f, 0.4383f),
				new Vector2(-4.3551f, -0.3097f),
				new Vector2(-3.9318f, -1.3109f),
				new Vector2(-2.6655f, -1.6735f),
				new Vector2(0.1618f, -1.3393f),
				new Vector2(0.0949f, 1.6069f)
			};
			((AttackBase)val7).AnimName = "DashStabEffect 1";
			((AttackBase)val7).Color = new Color(0.1f, 0.1f, 0.1f, 1f);
			array[0] = val7;
			((MultiStepAttack<Step>)(object)val6).Steps = (Step[])(object)array;
			moveset.DashSlash = val6;
			try
			{
				CrestData? obj3 = voidCrestData;
				BindEventHandler bindEvent2 = obj3.BindEvent;
				object obj4 = <>c.<>9__40_8;
				if (obj4 == null)
				{
					BindEventHandler val8 = delegate(FsmInt healValue, FsmInt healAmount, FsmFloat healTime, PlayMakerFSM Fsm)
					{
						healValue.Value = bindHealValue.Value;
						healAmount.Value = 1;
						healTime.Value = bindTimeValue.Value;
					};
					<>c.<>9__40_8 = val8;
					obj4 = (object)val8;
				}
				obj3.BindEvent = (BindEventHandler)Delegate.Combine((Delegate?)(object)bindEvent2, (Delegate?)obj4);
				voidCrestData.uniqueBindEvent = new UniqueBindEvent((UniqueBindDirection)0, (Action<Action>)delegate(Action finish)
				{
					((MonoBehaviour)this).StartCoroutine(Waitforsphere(finish));
				});
			}
			catch (Exception arg)
			{
				LogSrc.LogError((object)$"Failed updating Bind FSM: {arg}");
			}
			enableOrangeAura.SettingChanged += delegate
			{
				if (!((Object)(object)HeroController.instance == (Object)null) && voidCrestData.IsEquipped)
				{
					Transform val9 = ((Component)HeroController.instance).gameObject.transform.Find("HeroLight");
					if (enableOrangeAura.Value)
					{
						((Component)val9).gameObject.Voidify();
					}
					else
					{
						((Component)val9).gameObject.UnvoidifyRoot();
					}
				}
			};
			[IteratorStateMachine(typeof(<<Awake>g__ThisIsStupid|40_1>d))]
			static IEnumerator ThisIsStupid()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<Awake>g__ThisIsStupid|40_1>d(0);
			}
			[IteratorStateMachine(typeof(<<Awake>g__Waitforsphere|40_3>d))]
			static IEnumerator Waitforsphere(Action action)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<Awake>g__Waitforsphere|40_3>d(0)
				{
					action = action
				};
			}
			[IteratorStateMachine(typeof(<<Awake>g__youcanthitmelol|40_0>d))]
			static IEnumerator youcanthitmelol(HeroController __instance)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<Awake>g__youcanthitmelol|40_0>d(0)
				{
					__instance = __instance
				};
			}
		}

		[IteratorStateMachine(typeof(<<Awake>g__youcanthitmelol|40_0>d))]
		[CompilerGenerated]
		internal static IEnumerator <Awake>g__youcanthitmelol|40_0(HeroController __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <<Awake>g__youcanthitmelol|40_0>d(0)
			{
				__instance = __instance
			};
		}
	}
	public static class TransformUtils
	{
		public static Transform FindDeepChild(this Transform parent, string name)
		{
			if ((Object)(object)parent == (Object)null)
			{
				return null;
			}
			if (((Object)parent).name == name)
			{
				return parent;
			}
			for (int i = 0; i < parent.childCount; i++)
			{
				Transform child = parent.GetChild(i);
				if (((Object)child).name == name)
				{
					return child;
				}
				Transform val = child.FindDeepChild(name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}
	}
	public static class VoidCrestColorUtil
	{
		private class VoidifyRunner : MonoBehaviour
		{
			[CompilerGenerated]
			private sealed class <MonitorLoop>d__7 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public VoidifyRunner <>4__this;

				private Exception <ex>5__1;

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

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

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

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

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						break;
					case 2:
						<>1__state = -1;
						break;
					}
					if (<>4__this.running)
					{
						try
						{
							<>4__this.tickAction?.Invoke();
						}
						catch (Exception ex)
						{
							<ex>5__1 = ex;
							Debug.LogError((object)$"Monitor exception: {<ex>5__1}");
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					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();
				}
			}

			private bool running;

			private float interval = 0.08f;

			private Action tickAction;

			private Coroutine loop;

			public void Init(Action tick, float pollInterval)
			{
				tickAction = tick;
				interval = pollInterval;
			}

			public void StartMonitoring()
			{
				if (!running)
				{
					running = true;
					loop = ((MonoBehaviour)this).StartCoroutine(MonitorLoop());
				}
			}

			public void StopMonitoring()
			{
				if (running)
				{
					running = false;
					if (loop != null)
					{
						((MonoBehaviour)this).StopCoroutine(loop);
					}
					loop = null;
					Object.Destroy((Object)(object)((Component)this).gameObject);
					runner = null;
				}
			}

			[IteratorStateMachine(typeof(<MonitorLoop>d__7))]
			private IEnumerator MonitorLoop()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <MonitorLoop>d__7(0)
				{
					<>4__this = this
				};
			}
		}

		private static readonly Dictionary<Object, Color> originalColors = new Dictionary<Object, Color>();

		public static GameObject[] ExemptObjects = (GameObject[])(object)new GameObject[1] { ((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject };

		public static GameObject[] ExemptSprites = (GameObject[])(object)new GameObject[1] { ((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject };

		private static readonly HashSet<GameObject> monitoredRoots = new HashSet<GameObject>();

		private static readonly HashSet<Object> forcedBlackComponents = new HashSet<Object>();

		private static VoidifyRunner runner;

		private const float PollInterval = 0.08f;

		public static void Voidify(this GameObject root)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!((Object)(object)root == (Object)null))
			{
				if ((Object)(object)runner == (Object)null)
				{
					GameObject val = new GameObject("VoidCrestColorRunner");
					Object.DontDestroyOnLoad((Object)(object)val);
					runner = val.AddComponent<VoidifyRunner>();
					runner.Init(OnMonitorTick, 0.08f);
				}
				if (monitoredRoots.Add(root))
				{
					MakeItBlack(root);
				}
				runner.StartMonitoring();
			}
		}

		public static void Unvoidify()
		{
			//IL_0039: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<Object, Color> item in originalColors.ToList())
			{
				try
				{
					Object key = item.Key;
					SpriteRenderer val = (SpriteRenderer)(object)((key is SpriteRenderer) ? key : null);
					if (val != null)
					{
						val.color = item.Value;
						continue;
					}
					Object key2 = item.Key;
					tk2dSprite val2 = (tk2dSprite)(object)((key2 is tk2dSprite) ? key2 : null);
					if (val2 != null)
					{
						((tk2dBaseSprite)val2).color = item.Value;
						continue;
					}
					Object key3 = item.Key;
					tk2dBaseSprite val3 = (tk2dBaseSprite)(object)((key3 is tk2dBaseSprite) ? key3 : null);
					if (val3 != null)
					{
						val3.color = item.Value;
					}
				}
				catch
				{
				}
			}
			originalColors.Clear();
			forcedBlackComponents.Clear();
			monitoredRoots.Clear();
			if ((Object)(object)runner != (Object)null)
			{
				runner.StopMonitoring();
			}
		}

		public static void UnvoidifyRoot(this GameObject root)
		{
			//IL_008a: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject root2 = root;
			if ((Object)(object)root2 == (Object)null)
			{
				return;
			}
			monitoredRoots.Remove(root2);
			List<Object> list = originalColors.Keys.Where((Object k) => ComponentUnderRoot(k, root2)).ToList();
			foreach (Object item in list)
			{
				try
				{
					SpriteRenderer val = (SpriteRenderer)(object)((item is SpriteRenderer) ? item : null);
					if (val != null)
					{
						val.color = originalColors[item];
					}
					else
					{
						tk2dSprite val2 = (tk2dSprite)(object)((item is tk2dSprite) ? item : null);
						if (val2 != null)
						{
							((tk2dBaseSprite)val2).color = originalColors[item];
						}
						else
						{
							tk2dBaseSprite val3 = (tk2dBaseSprite)(object)((item is tk2dBaseSprite) ? item : null);
							if (val3 != null)
							{
								val3.color = originalColors[item];
							}
						}
					}
				}
				catch
				{
				}
				originalColors.Remove(item);
				forcedBlackComponents.Remove(item);
			}
			if (monitoredRoots.Count == 0 && (Object)(object)runner != (Object)null)
			{
				runner.StopMonitoring();
			}
		}

		private static void OnMonitorTick()
		{
			foreach (GameObject item in monitoredRoots.ToList())
			{
				if (!((Object)(object)item == (Object)null))
				{
					ScanRootForSprites(item);
				}
			}
			ReapplyBlackToForcedComponents();
		}

		public static void MakeItBlack(GameObject obj)
		{
			//IL_00be: 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)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)obj == (Object)null || ExemptObjects.Contains(obj) || (!VoidCrestPlugin.enableOrangeAura.Value && ((Object)obj).name == "HeroLight"))
			{
				return;
			}
			if (!ExemptSprites.Contains(obj) && (VoidCrestPlugin.enableOrangeAura.Value || !(((Object)obj).name == "HeroLight")) && (VoidCrestPlugin.enableOrangeHornet.Value || !(((Object)obj).name == "Hero_Hornet(Clone)")))
			{
				tk2dSprite component = obj.GetComponent<tk2dSprite>();
				if ((Object)(object)component != (Object)null)
				{
					SaveOriginal((Object)(object)component, ((tk2dBaseSprite)component).color);
					ForceBlack((Object)(object)component);
				}
				else
				{
					tk2dBaseSprite component2 = obj.GetComponent<tk2dBaseSprite>();
					if ((Object)(object)component2 != (Object)null)
					{
						SaveOriginal((Object)(object)component2, component2.color);
						ForceBlack((Object)(object)component2);
					}
					SpriteRenderer component3 = obj.GetComponent<SpriteRenderer>();
					if ((Object)(object)component3 != (Object)null)
					{
						SaveOriginal((Object)(object)component3, component3.color);
						ForceBlack((Object)(object)component3);
					}
				}
			}
			foreach (Transform item in obj.transform)
			{
				Transform val = item;
				MakeItBlack(((Component)val).gameObject);
			}
		}

		private static void ScanRootForSprites(GameObject root)
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			Stack<Transform> stack = new Stack<Transform>();
			stack.Push(root.transform);
			while (stack.Count > 0)
			{
				Transform val = stack.Pop();
				GameObject gameObject = ((Component)val).gameObject;
				if (ExemptObjects.Contains(gameObject) || (!VoidCrestPlugin.enableOrangeAura.Value && ((Object)gameObject).name == "HeroLight"))
				{
					continue;
				}
				if (!ExemptSprites.Contains(gameObject) && (VoidCrestPlugin.enableOrangeAura.Value || !(((Object)gameObject).name == "HeroLight")) && (VoidCrestPlugin.enableOrangeHornet.Value || !(((Object)gameObject).name == "Hero_Hornet(Clone)")))
				{
					tk2dSprite component = gameObject.GetComponent<tk2dSprite>();
					if ((Object)(object)component != (Object)null)
					{
						SaveOriginal((Object)(object)component, ((tk2dBaseSprite)component).color);
						ForceBlack((Object)(object)component);
					}
					else
					{
						tk2dBaseSprite component2 = gameObject.GetComponent<tk2dBaseSprite>();
						if ((Object)(object)component2 != (Object)null)
						{
							SaveOriginal((Object)(object)component2, component2.color);
							ForceBlack((Object)(object)component2);
						}
						else
						{
							SpriteRenderer component3 = gameObject.GetComponent<SpriteRenderer>();
							if ((Object)(object)component3 != (Object)null)
							{
								SaveOriginal((Object)(object)component3, component3.color);
								ForceBlack((Object)(object)component3);
							}
						}
					}
				}
				for (int i = 0; i < val.childCount; i++)
				{
					stack.Push(val.GetChild(i));
				}
			}
		}

		private static void SaveOriginal(Object comp, Color color)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (!originalColors.ContainsKey(comp))
			{
				originalColors[comp] = color;
			}
		}

		private static void ForceBlack(Object comp)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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)
			if (comp == (Object)null || !forcedBlackComponents.Add(comp))
			{
				return;
			}
			try
			{
				Color color = default(Color);
				((Color)(ref color))..ctor(0.1f, 0.1f, 0.1f, 1f);
				tk2dSprite val = (tk2dSprite)(object)((comp is tk2dSprite) ? comp : null);
				if (val == null)
				{
					tk2dBaseSprite val2 = (tk2dBaseSprite)(object)((comp is tk2dBaseSprite) ? comp : null);
					if (val2 == null)
					{
						SpriteRenderer val3 = (SpriteRenderer)(object)((comp is SpriteRenderer) ? comp : null);
						if (val3 != null)
						{
							val3.color = color;
						}
					}
					else
					{
						val2.color = color;
					}
				}
				else
				{
					((tk2dBaseSprite)val).color = color;
				}
			}
			catch
			{
			}
		}

		private static void ReapplyBlackToForcedComponents()
		{
			//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)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			List<Object> list = new List<Object>();
			Color val = default(Color);
			((Color)(ref val))..ctor(0.1f, 0.1f, 0.1f, 1f);
			foreach (Object forcedBlackComponent in forcedBlackComponents)
			{
				if (forcedBlackComponent == (Object)null)
				{
					list.Add(forcedBlackComponent);
					continue;
				}
				try
				{
					Object val2 = forcedBlackComponent;
					Object val3 = val2;
					tk2dSprite val4 = (tk2dSprite)(object)((val3 is tk2dSprite) ? val3 : null);
					if (val4 == null)
					{
						tk2dBaseSprite val5 = (tk2dBaseSprite)(object)((val3 is tk2dBaseSprite) ? val3 : null);
						if (val5 == null)
						{
							SpriteRenderer val6 = (SpriteRenderer)(object)((val3 is SpriteRenderer) ? val3 : null);
							if (val6 != null && val6.color != val)
							{
								val6.color = val;
							}
						}
						else if (val5.color != val)
						{
							val5.color = val;
						}
					}
					else if (((tk2dBaseSprite)val4).color != val)
					{
						((tk2dBaseSprite)val4).color = val;
					}
				}
				catch
				{
					list.Add(forcedBlackComponent);
				}
			}
			foreach (Object item in list)
			{
				forcedBlackComponents.Remove(item);
				originalColors.Remove(item);
			}
		}

		private static bool ComponentUnderRoot(Object comp, GameObject root)
		{
			Component val = (Component)(object)((comp is Component) ? comp : null);
			if (val != null)
			{
				return (Object)(object)val.transform != (Object)null && ((Object)(object)val.transform == (Object)(object)root.transform || val.transform.IsChildOf(root.transform));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(SilkSpool), "Start")]
	internal class voidspool
	{
		public static GameObject spoolClone;

		public static int _voidMass;

		public static int voidMass
		{
			get
			{
				return _voidMass;
			}
			set
			{
				_voidMass = value;
				spoolClone.GetComponent<SilkSpool>().ChangeSilk(_voidMass, 0, (SilkAddSource)0, (SilkTakeSource)0);
			}
		}

		[HarmonyPostfix]
		private static void DoVoidSpool(SilkSpool __instance)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("_GameCameras/HudCamera/In-game/Anchor TL/Hud Canvas Offset/Hud Canvas/Thread/Spool/");
			if (!Object.op_Implicit((Object)(object)val.gameObject.transform.parent.Find("Spool_VoidVersion")))
			{
				spoolClone = CreateSpoolClone(val);
				spoolClone.transform.SetParent(val.transform.parent, false);
				spoolClone.transform.localPosition = new Vector3(-4.04f, -2.37f, -3f);
				spoolClone.transform.Find("Thread Spool").localPosition = new Vector3(0f, 0f, 0f);
				spoolClone.transform.Find("Bind Orb").localPosition = new Vector3(1.17f, 2.29f, 1.0437f);
				((Component)spoolClone.transform.Find("Bind Orb")).gameObject.SetActive(false);
				spoolClone.transform.localRotation = val.transform.localRotation;
				spoolClone.transform.localScale = val.transform.localScale;
				bool flag = InitSpool(spoolClone, val);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Active")).gameObject.SetActive(false);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Extender Tool")).gameObject.SetActive(false);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Tool Flea Egg HUD")).gameObject.SetActive(false);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Bind Notch")).gameObject.SetActive(false);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Broken")).gameObject.SetActive(true);
				((Component)spoolClone.transform.Find("Thread Spool").Find("Parent").Find("Cursed")).gameObject.SetActive(true);
				spoolClone.SetActive(true);
				spoolClone.Voidify();
				spoolClone.SetActive(VoidCrestPlugin.voidCrestData.IsEquipped);
				if (VoidCrestPlugin.voidCrestData.IsEquipped)
				{
					((Component)spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.Voidify();
				}
				else
				{
					((Component)spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.UnvoidifyRoot();
				}
				((MonoBehaviour)VoidCrestPlugin.Instance).StartCoroutine(HornetSilkFSM_Start_Patch.waity(VoidCrestPlugin.voidCrestData.IsEquipped ? "Void" : ""));
			}
		}

		public static bool InitSpool(GameObject spoolClone, GameObject originalSpool = null)
		{
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)spoolClone == (Object)null)
			{
				return false;
			}
			SilkSpool component = spoolClone.GetComponent<SilkSpool>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			Type type = ((object)component).GetType();
			try
			{
				component.Awake();
			}
			catch
			{
			}
			try
			{
				component.Start();
			}
			catch
			{
			}
			bool flag = false;
			try
			{
				component.DrawSpool();
				flag = true;
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"SilkSpool.DrawSpool() threw: {arg}");
			}
			FieldInfo field = type.GetField("hasDrawnSpool", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo field2 = type.GetField("silkChunks", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo field3 = type.GetField("chunkParent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo field4 = type.GetField("silkChunkPrefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo field5 = type.GetField("firstChunk_x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo field6 = type.GetField("chunkDistance_x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			ICollection collection = field2?.GetValue(component) as ICollection;
			bool flag2 = field != null && (bool)field.GetValue(component);
			if (flag)
			{
				collection = field2?.GetValue(component) as ICollection;
				flag2 = field != null && (bool)field.GetValue(component);
				if (flag2 || (collection != null && collection.Count > 0))
				{
					TryCallChangeSilk(component);
					return true;
				}
			}
			if (!flag2 && (collection == null || collection.Count == 0))
			{
				object? obj3 = field3?.GetValue(component);
				Transform val = (Transform)((obj3 is Transform) ? obj3 : null);
				object? obj4 = field4?.GetValue(component);
				GameObject val2 = (GameObject)((obj4 is GameObject) ? obj4 : null);
				float num = ((field5 != null) ? ((float)field5.GetValue(component)) : 0f);
				float num2 = ((field6 != null) ? ((float)field6.GetValue(component)) : 0.18f);
				if ((Object)(object)val == (Object)null)
				{
					val = spoolClone.transform.FindDeepChild("Thread Spool/Parent") ?? spoolClone.transform.FindDeepChild("Thread Spool") ?? spoolClone.transform;
				}
				if ((Object)(object)val2 == (Object)null && (Object)(object)originalSpool != (Object)null)
				{
					SilkSpool component2 = originalSpool.GetComponent<SilkSpool>();
					if ((Object)(object)component2 != (Object)null)
					{
						object? obj5 = field4?.GetValue(component2);
						val2 = (GameObject)((obj5 is GameObject) ? obj5 : null);
					}
				}
				if ((Object)(object)val2 == (Object)null)
				{
					Transform val3 = spoolClone.transform.FindDeepChild("Silk Chunk");
					if ((Object)(object)val3 != (Object)null)
					{
						val2 = ((Component)val3).gameObject;
					}
				}
				if ((Object)(object)val2 == (Object)null)
				{
					TryCallChangeSilk(component);
					return false;
				}
				int num3 = 12;
				object obj6 = field2?.GetValue(component);
				MethodInfo methodInfo = obj6?.GetType().GetMethod("Add");
				for (int i = 0; i < num3; i++)
				{
					GameObject val4 = Object.Instantiate<GameObject>(val2, val);
					((Object)val4).name = $"SilkChunk_Manual_{i}";
					val4.transform.localPosition = new Vector3(num + (float)i * num2, 0f, 0f);
					val4.transform.localRotation = Quaternion.identity;
					val4.transform.localScale = Vector3.one;
					Component component3 = val4.GetComponent("SilkChunk");
					if ((Object)(object)component3 != (Object)null)
					{
						Type type2 = ((object)component3).GetType();
						MethodInfo method = type2.GetMethod("Start", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						try
						{
							method?.Invoke(component3, null);
						}
						catch
						{
						}
					}
					try
					{
						Component component4 = val4.GetComponent("SilkChunk");
						methodInfo?.Invoke(obj6, new object[1] { ((object)component4) ?? ((object)val4.transform) });
					}
					catch
					{
					}
				}
				try
				{
					field?.SetValue(component, true);
				}
				catch
				{
				}
			}
			TryCallChangeSilk(component);
			return true;
		}

		private static void TryCallChangeSilk(SilkSpool sp)
		{
			if ((Object)(object)sp == (Object)null)
			{
				return;
			}
			try
			{
				Type type = ((object)sp).GetType();
				MethodInfo method = type.GetMethod("ChangeSilk", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method != null)
				{
					ParameterInfo[] parameters = method.GetParameters();
					if (parameters.Length == 4)
					{
						object obj = 0;
						try
						{
							obj = 0;
						}
						catch
						{
						}
						Type parameterType = parameters[2].ParameterType;
						Type parameterType2 = parameters[3].ParameterType;
						object obj3 = null;
						object obj4 = null;
						try
						{
							obj3 = Enum.Parse(parameterType, "Normal");
							obj4 = Enum.Parse(parameterType2, "Normal");
						}
						catch
						{
							obj3 = Activator.CreateInstance(parameterType);
							obj4 = Activator.CreateInstance(parameterType2);
						}
						method.Invoke(sp, new object[4] { 0, 0, obj3, obj4 });
						return;
					}
				}
				sp.ChangeSilk(0, 0, (SilkAddSource)0, (SilkTakeSource)0);
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"TryCallChangeSilk failed: {arg}");
			}
		}

		private static GameObject CreateSpoolClone(GameObject original)
		{
			//IL_0043: 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)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)original == (Object)null)
			{
				return null;
			}
			Transform parent = original.transform.parent;
			GameObject val = Object.Instantiate<GameObject>(original, parent, false);
			((Object)val).name = "Spool_VoidVersion";
			val.transform.localPosition = original.transform.localPosition;
			val.transform.localRotation = original.transform.localRotation;
			val.transform.localScale = original.transform.localScale;
			val.layer = original.layer;
			string[] array = new string[7] { "PlayMakerFSM", "EventRegister", "DeactivateAfter2dtkAnimation", "DeactivateAfterDelay", "DeactivateAfter2dtkAnimation", "BindOrbHudFrame", "NestedFadeGroup" };
			Component[] componentsInChildren = val.GetComponentsInChildren<Component>(true);
			Component[] array2 = componentsInChildren;
			foreach (Component val2 in array2)
			{
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				Type type = ((object)val2).GetType();
				string name = type.Name;
				if (name.IndexOf("SilkSpool", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					continue;
				}
				string[] array3 = array;
				foreach (string value in array3)
				{
					if (name.IndexOf(value, StringComparison.OrdinalIgnoreCase) < 0)
					{
						continue;
					}
					Behaviour val3 = (Behaviour)(object)((val2 is Behaviour) ? val2 : null);
					if (val3 != null)
					{
						try
						{
							val3.enabled = false;
						}
						catch
						{
						}
					}
					else
					{
						try
						{
							Object.Destroy((Object)(object)val2);
						}
						catch
						{
						}
					}
					break;
				}
			}
			try
			{
				Type fsmType = Type.GetType("HutongGames.PlayMaker.PlayMakerFSM, HutongGames.PlayMaker");
				if (fsmType != null)
				{
					foreach (Component item in from c in val.GetComponentsInChildren<Component>(true)
						where ((object)c).GetType() == fsmType
						select c)
					{
						try
						{
							((Behaviour)((item is Behaviour) ? item : null)).enabled = false;
						}
						catch
						{
							try
							{
								Object.Destroy((Object)(object)item);
							}
							catch
							{
							}
						}
					}
				}
			}
			catch
			{
			}
			MeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val4 in componentsInChildren2)
			{
				((Renderer)val4).enabled = false;
				((Renderer)val4).enabled = true;
			}
			SpriteRenderer[] componentsInChildren3 = val.GetComponentsInChildren<SpriteRenderer>(true);
			foreach (SpriteRenderer val5 in componentsInChildren3)
			{
				((Renderer)val5).enabled = false;
				((Renderer)val5).enabled = true;
			}
			Canvas.ForceUpdateCanvases();
			return val;
		}
	}
	[HarmonyPatch(typeof(GameObject), "SetActive")]
	internal class fuckthesethreeinparticular
	{
		private static void Prefix(GameObject __instance, ref bool value)
		{
			Transform transform = __instance.transform;
			object obj;
			if (transform == null)
			{
				obj = null;
			}
			else
			{
				Transform parent = transform.parent;
				if (parent == null)
				{
					obj = null;
				}
				else
				{
					Transform parent2 = parent.parent;
					if (parent2 == null)
					{
						obj = null;
					}
					else
					{
						Transform parent3 = parent2.parent;
						obj = ((parent3 != null) ? ((Object)parent3).name : null);
					}
				}
			}
			if ((string?)obj == "Spool_VoidVersion" && (((Object)__instance).name == "Extender Tool" || ((Object)__instance).name == "Tool Flea Egg HUD" || ((Object)__instance).name == "Bind Notch" || ((Object)__instance).name == "Active"))
			{
				value = false;
			}
			Transform transform2 = __instance.transform;
			object obj2;
			if (transform2 == null)
			{
				obj2 = null;
			}
			else
			{
				Transform parent4 = transform2.parent;
				if (parent4 == null)
				{
					obj2 = null;
				}
				else
				{
					Transform parent5 = parent4.parent;
					if (parent5 == null)
					{
						obj2 = null;
					}
					else
					{
						Transform parent6 = parent5.parent;
						obj2 = ((parent6 != null) ? ((Object)parent6).name : null);
					}
				}
			}
			if ((string?)obj2 == "Spool_VoidVersion" && (((Object)__instance).name == "Broken" || ((Object)__instance).name == "Cursed"))
			{
				value = true;
			}
		}
	}
	[HarmonyPatch(typeof(SilkChunk), "Add")]
	internal class voidifychunks
	{
		[HarmonyPostfix]
		private static void voidthesechunks(SilkChunk __instance)
		{
			if (((Object)((Component)__instance).transform.parent.parent.parent).name == "Spool_VoidVersion")
			{
				((Component)__instance).gameObject.Voidify();
			}
			else
			{
				((Component)__instance).gameObject.UnvoidifyRoot();
			}
		}
	}
	[HarmonyPatch(typeof(SilkSpool), "ChangeSilk")]
	internal class voidifychunks23
	{
		[HarmonyPrefix]
		private static void voidthesechunks(SilkSpool __instance, ref int silk, ref int silkParts, ref SilkAddSource addSource, ref SilkTakeSource takeSource)
		{
			if (!(((Object)((Component)__instance).gameObject).name != "Spool_VoidVersion"))
			{
				silk = voidspool.voidMass;
				silkParts = 0;
				addSource = (SilkAddSource)0;
				takeSource = (SilkTakeSource)0;
			}
		}
	}
	[HarmonyPatch(typeof(HeroController), "Start")]
	internal class AddVoid
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static FsmEdit <0>__DoNothing;
		}

		public static bool VoidFocusEnabled()
		{
			HeroController instance = HeroController.instance;
			if (PlayerData.instance == null || (Object)(object)instance == (Object)null)
			{
				return false;
			}
			return PlayerData.instance.CurrentCrestID == "Void" && (instance.cState.isBinding || instance.cState.dashing || instance.cState.shadowDashing);
		}

		[HarmonyPostfix]
		private static void AddCrests(HeroController __instance)
		{
			try
			{
				if (VoidCrestPlugin.voidCrestData.IsEquipped)
				{
					((Component)__instance).gameObject.Voidify();
				}
				else
				{
					VoidCrestColorUtil.Unvoidify();
				}
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"Failed updating Silk FSM color: {arg}");
			}
		}

		private static tk2dSpriteAnimationFrame[] CloneFrames(tk2dSpriteAnimationFrame[] frames, int? count = null)
		{
			int valueOrDefault = count.GetValueOrDefault();
			if (!count.HasValue)
			{
				valueOrDefault = frames.Length;
				count = valueOrDefault;
			}
			return ((IEnumerable<tk2dSpriteAnimationFrame>)frames).Select((Func<tk2dSpriteAnimationFrame, tk2dSpriteAnimationFrame>)((tk2dSpriteAnimationFrame f) => new tk2dSpriteAnimationFrame
			{
				spriteCollection = f.spriteCollection,
				spriteId = f.spriteId,
				triggerEvent = false
			})).Take(count.Value).ToArray();
		}

		[HarmonyPrefix]
		[HarmonyPriority(600)]
		private static void FsmEditting(HeroController __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			HeroConfigNeedleforge heroConfig = VoidCrestPlugin.voidCrestData.Moveset.HeroConfig;
			object obj = <>O.<0>__DoNothing;
			if (obj == null)
			{
				FsmEdit val = DoNothing;
				<>O.<0>__DoNothing = val;
				obj = (object)val;
			}
			heroConfig.DashSlashFsmEdit = (FsmEdit)obj;
		}

		private static void DoNothing(PlayMakerFSM _, FsmState startState, out FsmState[] endStates)
		{
			endStates = (FsmState[])(object)new FsmState[1] { startState };
		}

		private Sprite CopySpriteWithNewTexture(Sprite original, Texture2D newTexture)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0058: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)original == (Object)null || (Object)(object)newTexture == (Object)null)
			{
				return null;
			}
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)newTexture).width, (float)((Texture)newTexture).height);
			Rect val2 = val;
			float x = original.pivot.x;
			Rect rect = original.rect;
			float num = x / ((Rect)(ref rect)).width;
			float y = original.pivot.y;
			rect = original.rect;
			return Sprite.Create(newTexture, val2, new Vector2(num, y / ((Rect)(ref rect)).height), original.pixelsPerUnit, 0u, (SpriteMeshType)0, original.border);
		}
	}
	public static class HeroInvincibilityManager
	{
		private struct HeroOriginalState
		{
			public DamageMode damageMode;

			public bool cState_Invulnerable;

			public float parryInvulnTimer;

			public bool playerData_isInvincible;

			public InvincibilityStates cheatInvincibility;
		}

		private static HeroOriginalState? _savedState;

		public static void MakeHeroFucked(this HeroController hero)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			if (!_savedState.HasValue)
			{
				HeroOriginalState value = default(HeroOriginalState);
				value.damageMode = hero.damageMode;
				value.cState_Invulnerable = hero.cState.Invulnerable;
				value.parryInvulnTimer = hero.parryInvulnTimer;
				value.playerData_isInvincible = hero.playerData.isInvincible;
				value.cheatInvincibility = CheatManager.Invincibility;
				_savedState = value;
				hero.damageMode = (DamageMode)2;
				hero.SetCState("Invulnerable", true);
				hero.parryInvulnTimer = 9999f;
				hero.playerData.isInvincible = true;
				CheatManager.Invincibility = (InvincibilityStates)2;
			}
		}

		public static void RestoreHero(this HeroController hero)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (_savedState.HasValue)
			{
				HeroOriginalState value = _savedState.Value;
				hero.damageMode = value.damageMode;
				hero.SetCState("Invulnerable", value.cState_Invulnerable);
				hero.parryInvulnTimer = value.parryInvulnTimer;
				hero.playerData.isInvincible = value.playerData_isInvincible;
				CheatManager.Invincibility = value.cheatInvincibility;
				_savedState = null;
			}
		}
	}
	[HarmonyPatch(typeof(HeroController), "TakeDamage")]
	public static class HeroController_TakeDamage_Patch23
	{
		private static float _lastVoidCrestDashHitTime;

		private static float _lastVoidCrestBindHitTime;

		public static void Prefix(HeroController __instance, ref GameObject go, CollisionSide damageSide, int damageAmount, HazardType hazardType, DamagePropertyFlags damagePropertyFlags = 0)
		{
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			if (!AddVoid.VoidFocusEnabled() || (HeroController.instance.cState.isBinding && Time.time < _lastVoidCrestBindHitTime + 0.5f) || ((HeroController.instance.cState.dashing || HeroController.instance.cState.shadowDashing) && Time.time < _lastVoidCrestDashHitTime + 0.29f))
			{
				return;
			}
			if (HeroController.instance.cState.isBinding)
			{
				_lastVoidCrestBindHitTime = Time.time;
			}
			else
			{
				_lastVoidCrestDashHitTime = Time.time;
			}
			__instance.audioCtrl.PlaySound((HeroSounds)11, true);
			__instance.DoMossToolHit();
			HeroController instance = HeroController.instance;
			if (HeroController.instance.cState.isBinding)
			{
				voidspool.voidMass = Math.Min(voidspool.voidMass + VoidCrestPlugin.VoidMassPerHit.Value + (ToolItemManager.IsToolEquipped("Quickbind") ? VoidCrestPlugin.InjectorVoidMassBonus.Value : 0) + (ToolItemManager.IsToolEquipped("Multibind") ? VoidCrestPlugin.MultibinderVoidMassBonus.Value : 0) + (ToolItemManager.IsToolEquipped("Bell Bind") ? VoidCrestPlugin.WardingVoidMassBonus.Value : 0), 10);
			}
			HitInstance val = default(HitInstance);
			val.DamageDealt = PlayerData.instance.nailDamage;
			val.Source = ((Component)instance).gameObject;
			val.Multiplier = (HeroController.instance.cState.isBinding ? VoidCrestPlugin.BindHitMult.Value : VoidCrestPlugin.DashHitMult.Value) + (HeroController.instance.cState.isBinding ? ((ToolItemManager.IsToolEquipped("Bell Bind") ? VoidCrestPlugin.WardingHitMultBonus.Value : 0f) + (ToolItemManager.IsToolEquipped("Quickbind") ? VoidCrestPlugin.InjectorHitMultBonus.Value : 0f) + (ToolItemManager.IsToolEquipped("Multibind") ? VoidCrestPlugin.MultibinderHitMultBonus.Value : 0f)) : ((ToolItemManager.IsToolEquipped("Sprintmaster") ? VoidCrestPlugin.AnkletDashHitMultBonus.Value : 0f) + (ToolItemManager.IsToolEquipped("Weighted Anklet") ? VoidCrestPlugin.BeltDashHitMultBonus.Value : 0f)));
			val.AttackType = (AttackTypes)0;
			val.SilkGeneration = (HitSilkGeneration)(((!ToolItemManager.IsToolEquipped("Multibind") || !VoidCrestPlugin.MultibinderSilkHit.Value) && (!ToolItemManager.IsToolEquipped("Quickbind") || !VoidCrestPlugin.InjectorSilkHit.Value) && (!ToolItemManager.IsToolEquipped("Bell Bind") || !VoidCrestPlugin.WardingSilkHit.Value)) ? 2 : 0);
			val.HitEffectsType = (EffectsTypes)1;
			val.CriticalHit = false;
			val.IsFirstHit = false;
			val.IsNailTag = true;
			val.Direction = 0f;
			val.MagnitudeMultiplier = 1f;
			HitInstance val2 = val;
			try
			{
				HealthManager val3 = FindHealthManager(go);
				if ((Object)(object)val3 != (Object)null)
				{
					val3.TakeDamage(val2);
				}
				else
				{
					VoidCrestPlugin.LogSrc.LogWarning((object)"No HealthManager found on target.");
				}
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"HealthManager.TakeDamage threw: {arg}");
			}
			static HealthManager FindHealthManager(GameObject go)
			{
				Transform val4 = go.transform;
				for (int i = 0; i < 4; i++)
				{
					if (!((Object)(object)val4 != (Object)null))
					{
						break;
					}
					HealthManager component = ((Component)val4).GetComponent<HealthManager>();
					if ((Object)(object)component != (Object)null)
					{
						return component;
					}
					val4 = val4.parent;
				}
				return null;
			}
		}
	}
	[HarmonyPatch(typeof(HeroController), "HeroDamaged")]
	[HarmonyPatch(typeof(HeroController), "CancelAttack", new Type[] { })]
	[HarmonyPatch(typeof(HeroController), "RegainControl", new Type[] { })]
	[HarmonyPatch(typeof(HeroController), "StartAnimationControl", new Type[] { })]
	internal static class HeroController_MultiPrefixPatch
	{
		[HarmonyPrefix]
		private static bool Prefix(HeroController __instance, MethodBase __originalMethod)
		{
			return !AddVoid.VoidFocusEnabled();
		}
	}
	[HarmonyPatch(typeof(HeroController), "WillDoBellBindHit", new Type[] { typeof(bool) })]
	internal static class HeroController_WillDoBellBindHitPostfix
	{
		[HarmonyPostfix]
		private static void Postfix(HeroController __instance, ref bool __result)
		{
			if (AddVoid.VoidFocusEnabled())
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(HeroController))]
	[HarmonyPatch("MaxHealth")]
	public static class HeroController_TakeDamage_Patch98
	{
		public static void Postfix()
		{
			voidspool.voidMass = 0;
		}
	}
	[HarmonyPatch(typeof(DamageEnemies))]
	[HarmonyPatch("DoDamage", new Type[]
	{
		typeof(GameObject),
		typeof(bool)
	})]
	public static class VoidSilkBuff
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private List<CodeInstruction> <codes>5__1;

			private MethodInfo <zapToolField>5__2;

			private MethodInfo <addMultiplierMethod>5__3;

			private int <i>5__4;

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

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

			[DebuggerHidden]
			public <Transpiler>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<codes>5__1 = null;
				<zapToolField>5__2 = null;
				<addMultiplierMethod>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Expected O, but got Unknown
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<codes>5__1 = new List<CodeInstruction>(instructions);
					<zapToolField>5__2 = AccessTools.PropertyGetter(typeof(Gameplay), "ZapImbuementTool");
					<addMultiplierMethod>5__3 = AccessTools.Method(typeof(DamageStack), "AddMultiplier", (Type[])null, (Type[])null);
					<i>5__4 = 0;
					break;
				case 1:
					<>1__state = -1;
					if (CodeInstructionExtensions.Calls(<codes>5__1[<i>5__4], <addMultiplierMethod>5__3))
					{
						<>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
						<>1__state = 2;
						return true;
					}
					goto IL_012e;
				case 2:
					<>1__state = -1;
					<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(VoidSilkBuff), "AddVoidSilkBuff", (Type[])null, (Type[])null));
					<>1__state = 3;
					return true;
				case 3:
					{
						<>1__state = -1;
						goto IL_012e;
					}
					IL_012e:
					<i>5__4++;
					break;
				}
				if (<i>5__4 < <codes>5__1.Count)
				{
					<>2__current = <codes>5__1[<i>5__4];
					<>1__state = 1;
					return true;
				}
				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();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__0 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__0(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<Transpiler>d__0))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__0(-2)
			{
				<>3__instructions = instructions
			};
		}

		public static void AddVoidSilkBuff(DamageEnemies __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			try
			{
				if (Object.op_Implicit((Object)(object)__instance.representingTool) && (int)__instance.representingTool.Type == 3 && VoidCrestPlugin.voidCrestData.IsEquipped && Balancey.doVoidSilk)
				{
					if (VoidCrestPlugin.doingSpecialAttack)
					{
						__instance.tempDamageStack.AddMultiplier(VoidCrestPlugin.SpecialAttackDamageMult.Value);
					}
					else
					{
						__instance.tempDamageStack.AddMultiplier(VoidCrestPlugin.VoidSilkMult.Value);
					}
				}
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"Failed injecting voidmass buff: {arg}");
			}
		}
	}
	[HarmonyPatch(typeof(ToolItemManager), "SetEquippedCrest")]
	public static class HornetSilkFSM_Start_Patch
	{
		[CompilerGenerated]
		private sealed class <waity>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string crestId;

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

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

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

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

			private bool MoveNext()
			{
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (crestId == "Void")
					{
						((Component)HeroController.instance).gameObject.Voidify();
						voidspool.spoolClone.SetActive(true);
						Transform obj3 = voidspool.spoolClone.transform.Find("Thread Spool");
						if (obj3 != null)
						{
							((Component)obj3).gameObject.SetActive(true);
						}
						((Component)voidspool.spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.Voidify();
						voidspool.spoolClone.Voidify();
					}
					else
					{
						VoidCrestColorUtil.Unvoidify();
						Transform obj4 = voidspool.spoolClone.transform.Find("Thread Spool");
						if (obj4 != null)
						{
							((Component)obj4).gameObject.SetActive(false);
						}
						voidspool.spoolClone.SetActive(false);
						((Component)voidspool.spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.UnvoidifyRoot();
						voidspool.spoolClone.UnvoidifyRoot();
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (crestId == "Void")
					{
						((Component)HeroController.instance).gameObject.Voidify();
						voidspool.spoolClone.SetActive(true);
						Transform obj = voidspool.spoolClone.transform.Find("Thread Spool");
						if (obj != null)
						{
							((Component)obj).gameObject.SetActive(true);
						}
						((Component)voidspool.spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.Voidify();
						voidspool.spoolClone.Voidify();
					}
					else
					{
						VoidCrestColorUtil.Unvoidify();
						Transform obj2 = voidspool.spoolClone.transform.Find("Thread Spool");
						if (obj2 != null)
						{
							((Component)obj2).gameObject.SetActive(false);
						}
						voidspool.spoolClone.SetActive(false);
						((Component)voidspool.spoolClone.transform.parent.Find("Spool").Find("Bind Orb")).gameObject.UnvoidifyRoot();
						voidspool.spoolClone.UnvoidifyRoot();
					}
					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 void Postfix(ToolItemManager __instance, string crestId)
		{
			try
			{
				((MonoBehaviour)HeroController.instance).StartCoroutine(waity(crestId));
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"Failed updating color: {arg}");
			}
		}

		[IteratorStateMachine(typeof(<waity>d__1))]
		public static IEnumerator waity(string crestId)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <waity>d__1(0)
			{
				crestId = crestId
			};
		}
	}
	[HarmonyPatch(typeof(HeroController), "HeroDash")]
	public static class HornetSilkFSM_Start_Patch98
	{
		[CompilerGenerated]
		private sealed class <sDash>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HeroController __instance;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: 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_004d: Expected O, but got Unknown
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					__instance.damageMode = (DamageMode)1;
					__instance.cState.shadowDashing = true;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					__instance.damageMode = (DamageMode)0;
					__instance.cState.shadowDashing = false;
					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 void Prefix(HeroController __instance)
		{
			try
			{
				if (PlayerData.instance.CurrentCrestID == "Void")
				{
					((MonoBehaviour)__instance).StartCoroutine(sDash(__instance));
				}
			}
			catch (Exception arg)
			{
				VoidCrestPlugin.LogSrc.LogError((object)$"Failed shadow dashr: {arg}");
			}
		}

		[IteratorStateMachine(typeof(<sDash>d__1))]
		private static IEnumerator sDash(HeroController __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <sDash>d__1(0)
			{
				__instance = __instance
			};
		}
	}
	[HarmonyPatch(typeof(EventRegister), "SendEvent", new Type[]
	{
		typeof(string),
		typeof(GameObject)
	})]
	public static class HornetSilkFSM_Start_Patch982
	{
		public static bool Prefix(string eventName)
		{
			if (!VoidCrestPlugin.DoPlasmiumMass.Value)
			{
				return true;
			}
			if (PlayerData.instance.CurrentCrestID == "Void" && (eventName == "AddBlueHealth" || eventName == "AddQueuedBlueHealth"))
			{
				voidspool.voidMass += VoidCrestPlugin.PlasmiumMassAmount.Value;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(EventRegister), "SendEvent", new Type[]
	{
		typeof(int),
		typeof(GameObject)
	})]
	public static class HornetSilkFSM_Start_Patch9822
	{
		public static bool Prefix(int eventNameHash)
		{
			if (!VoidCrestPlugin.DoPlasmiumMass.Value)
			{
				return true;
			}
			if (PlayerData.instance.CurrentCrestID == "Void" && (eventNameHash == EventRegisterEvents.AddBlueHealth || eventNameHash == EventRegisterEvents.AddQueuedBlueHealth))
			{
				voidspool.voidMass += VoidCrestPlugin.PlasmiumMassAmount.Value;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HeroController), "ThrowTool")]
	public static class Balancey
	{
		public static bool doVoidSilk;

		public static void Postfix(HeroController __instance)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			if (!VoidCrestPlugin.voidCrestData.IsEquipped || !VoidCrestPlugin.DoVoidSilk.Value || doVoidSilk || (int)__instance.willThrowTool.Type != 3)
			{
				return;
			}
			if (voidspool.voidMass >= VoidCrestPlugin.VoidSilkCost.Value)
			{
				voidspool.voidMass -= VoidCrestPlugin.VoidSilkCost.Value;
				doVoidSilk = true;
				{
					foreach (Transform item in ((Component)__instance).gameObject.transform.Find("Special Attacks"))
					{
						Transform val = item;
						VoidCrestColorUtil.MakeItBlack(((Component)val).gameObject);
					}
					return;
				}
			}
			doVoidSilk = false;
			((Component)((Component)__instance).gameObject.transform.Find("Special Attacks")).gameObject.UnvoidifyRoot();
		}
	}
	[HarmonyPatch(typeof(HeroController), "ThrowToolEnd")]
	public static class Balancey2
	{
		public static void Postfix(HeroController __instance)
		{
			Balancey.doVoidSilk = false;
			((Component)((Component)__instance).gameObject.transform.Find("Special Attacks")).gameObject.UnvoidifyRoot();
		}
	}
}