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.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("VoidCrest")]
[assembly: AssemblyTitle("repos")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: 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;
}
ToolCrest crestByName = ToolItemManager.GetCrestByName("Witch");
Sprite val3 = (Sil ? crestByName.CrestSilhouette : crestByName.crestSprite);
Rect rect;
float num;
if (Sil)
{
rect = val3.rect;
num = ((Rect)(ref rect)).width * 1.35f;
}
else
{
rect = val3.rect;
num = ((Rect)(ref rect)).width * 1.2f;
}
int newWidth = (int)num;
float num2;
if (Sil)
{
rect = val3.rect;
num2 = ((Rect)(ref rect)).height * 1.35f;
}
else
{
rect = val3.rect;
num2 = ((Rect)(ref rect)).height * 1.2f;
}
int newHeight = (int)num2;
Texture2D val4 = ResizeTexture(val, newWidth, newHeight);
Object.Destroy((Object)(object)val);
return Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f), val3.pixelsPerUnit);
}
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", "repos", "0.1.0")]
public class VoidCrestPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <<Awake>g__Waitforsphere|9_1>d : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float time;
public Action action;
public GameObject ball;
object? IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object? IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <<Awake>g__Waitforsphere|9_1>d(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_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(time);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
ball.SetActive(false);
HeroController.instance.cState.SetState("isBinding", false);
HeroController.instance.AddHealth(voidspool.voidMass / 2);
Balancey.doVoidSilk = false;
((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject.UnvoidifyRoot();
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();
}
}
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 ConfigEntry<bool> enableOrange;
public const string Id = "io.dervoce.voidcrest";
public static string Name => "repos";
public static string Version => "0.1.0";
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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
LogSrc = ((BaseUnityPlugin)this).Logger;
LogSrc.LogInfo((object)("Plugin " + Name + " (io.dervoce.voidcrest) has loaded!"));
harmony = new Harmony("io.dervoce.voidcrest");
Localization.LoadJsonFromEmbedded("EN", "VoidCrest.Locale.EN.json");
voidCrestData = NeedleforgePlugin.AddCrest("Void");
harmony.PatchAll();
try
{
Dictionary<string, Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM>> bindEvents = NeedleforgePlugin.bindEvents;
bindEvents["Void"] = (Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM>)Delegate.Combine(bindEvents["Void"], (Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM>)delegate(FsmInt healValue, FsmInt healAmount, FsmFloat healTime, PlayMakerFSM Fsm)
{
healValue.Value = 0;
healAmount.Value = 1;
healTime.Value = 1.5f;
});
NeedleforgePlugin.uniqueBind["Void"] = new UniqueBindEvent((UniqueBindDirection)0, (Action<Action>)delegate(Action finish)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
HeroController.instance.TakeSilk(9);
GameObject gameObject = ((Component)((Component)HeroController.instance).gameObject.transform.Find("Special Attacks")).gameObject;
((Component)gameObject.transform.Find("Sphere Flash")).gameObject.SetActive(true);
Balancey.doVoidSilk = true;
foreach (Transform item in gameObject.transform)
{
Transform val2 = item;
VoidCrestColorUtil.TraverseAndVoidify(((Component)val2).gameObject);
}
GameObject gameObject2 = ((Component)gameObject.transform.Find("Sphere Ball")).gameObject;
Transform transform = gameObject2.transform;
transform.localScale *= 1f + (float)voidspool.voidMass * 0.1f;
gameObject2.SetActive(true);
HeroController.instance.cState.SetState("isBinding", true);
((MonoBehaviour)this).StartCoroutine(Waitforsphere(voidspool.voidMass, finish, gameObject2));
});
voidColor = NeedleforgePlugin.AddToolColor("voidcolor", new Color(0.35f, 0.35f, 0.35f, 1f), true);
voidColor.allColorsValid = true;
}
catch (Exception arg)
{
LogSrc.LogError((object)$"Failed updating Bind FSM: {arg}");
}
enableOrange = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Orange Aura Shader", true, "Enable or disable the orange shader");
enableOrange.SettingChanged += delegate
{
if (!((Object)(object)HeroController.instance == (Object)null) && voidCrestData.IsEquipped)
{
Transform val = ((Component)HeroController.instance).gameObject.transform.Find("HeroLight");
if (enableOrange.Value)
{
((Component)val).gameObject.Voidify();
}
else
{
((Component)val).gameObject.UnvoidifyRoot();
}
}
};
[IteratorStateMachine(typeof(<<Awake>g__Waitforsphere|9_1>d))]
static IEnumerator Waitforsphere(float time, Action action, GameObject? ball)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <<Awake>g__Waitforsphere|9_1>d(0)
{
time = time,
action = action,
ball = ball
};
}
}
}
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))
{
TraverseAndVoidify(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 TraverseAndVoidify(GameObject obj)
{
//IL_00a0: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Expected O, but got Unknown
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)obj == (Object)null || ExemptObjects.Contains(obj) || (!VoidCrestPlugin.enableOrange.Value && ((Object)obj).name == "HeroLight"))
{
return;
}
if (!ExemptSprites.Contains(obj) && (VoidCrestPlugin.enableOrange.Value || !(((Object)obj).name == "HeroLight")))
{
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;
TraverseAndVoidify(((Component)val).gameObject);
}
}
private static void ScanRootForSprites(GameObject root)
{
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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.enableOrange.Value && ((Object)gameObject).name == "HeroLight"))
{
continue;
}
if (!ExemptSprites.Contains(gameObject) && (VoidCrestPlugin.enableOrange.Value || !(((Object)gameObject).name == "HeroLight")))
{
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();
}
}
}
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 sealed class <<AddCrests>g__youcanthitmelol|1_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 <<AddCrests>g__youcanthitmelol|1_0>d(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
__instance.MakeHeroFucked();
<>2__current = (object)new WaitForSeconds(1.75f);
<>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();
}
}
[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);
}
[HarmonyPostfix]
private static void AddCrests(HeroController __instance)
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Expected O, but got Unknown
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
VoidCrestSprites.StartFromMain();
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}");
}
CrestData voidCrestData = VoidCrestPlugin.voidCrestData;
ToolCrest toolCrest = VoidCrestPlugin.voidCrestData.ToolCrest;
ToolCrest crestByName = ToolItemManager.GetCrestByName("Witch");
voidCrestData.HudFrame.Preset = (VanillaCrest)6;
Sprite crestSprite = VoidCrestSprites.crestSprite;
Sprite crestSilhouette = VoidCrestSprites.crestSilhouette;
Sprite crestGlow = VoidCrestSprites.MatchSpriteSize(crestSilhouette);
toolCrest.crestSprite = crestSprite;
toolCrest.crestSilhouette = crestSilhouette;
toolCrest.crestGlow = crestGlow;
toolCrest.description = new LocalisedString
{
Sheet = "VOID",
Key = "VOIDCRESTDESC"
};
toolCrest.displayName = new LocalisedString
{
Sheet = "VOID",
Key = "VOIDCRESTNAME"
};
CrestData? voidCrestData2 = VoidCrestPlugin.voidCrestData;
voidCrestData2.BindEvent = (Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM>)Delegate.Combine(voidCrestData2.BindEvent, (Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM>)delegate
{
((MonoBehaviour)HeroController.instance).StartCoroutine(youcanthitmelol(HeroController.instance));
});
List<SlotInfo> source = crestByName.slots.ToList();
source = source.Select(delegate(SlotInfo slot)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_0023: 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)
slot.Type = VoidCrestPlugin.voidColor.Type;
slot.AttackBinding = (AttackToolBinding)0;
slot.IsLocked = false;
return slot;
}).ToList();
SlotInfo value = source[0];
value.Position = new Vector2(0.025f, -0.1f) * 1.2f;
source[0] = value;
SlotInfo value2 = source[1];
value2.Position = new Vector2(-1.185f, 0.95f) * 1.2f;
source[1] = value2;
SlotInfo value3 = source[2];
value3.Position = new Vector2(0.15f, -1.55f) * 1.2f;
value3.AttackBinding = (AttackToolBinding)2;
source[2] = value3;
SlotInfo value4 = source[3];
value4.Position = new Vector2(-1.5f, -0.6f) * 1.2f;
source[3] = value4;
SlotInfo value5 = source[4];
value5.Position = new Vector2(0.85f, 1.65f) * 1.2f;
value5.AttackBinding = (AttackToolBinding)1;
source[4] = value5;
SlotInfo value6 = source[5];
value6.Position = new Vector2(1.8f, -0.6f) * 1.2f;
source[5] = value6;
toolCrest.slots = source.ToArray();
voidCrestData.ApplyAutoSlotNavigation(true, 60f, (Vector2?)null);
voidCrestData.Moveset.HeroConfig = HeroConfigNeedleforge.Copy(crestByName.heroConfig);
toolCrest.heroConfig = crestByName.heroConfig;
MovesetData moveset = voidCrestData.Moveset;
DashAttack val = new DashAttack();
((GameObjectProxy)val).Name = "VoidWitchSlashDash";
Step[] array = new Step[1];
Step val2 = new Step();
((AttackBase)val2).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)val2).AnimName = "DashStabEffect 1";
((AttackBase)val2).Color = new Color(0.1f, 0.1f, 0.1f, 1f);
array[0] = val2;
((MultiStepAttack<Step>)(object)val).Steps = (Step[])(object)array;
moveset.DashSlash = val;
toolCrest.hasCustomAction = true;
toolCrest.customButtonCombo = new Display
{
ActionButton = (HeroActionButton)4,
DirectionModifier = (AttackToolBinding)1,
PromptText = new LocalisedString("VOID", "VOIDBINDUP"),
ShowHold = true
};
[IteratorStateMachine(typeof(<<AddCrests>g__youcanthitmelol|1_0>d))]
static IEnumerator youcanthitmelol(HeroController __instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <<AddCrests>g__youcanthitmelol|1_0>d(0)
{
__instance = __instance
};
}
}
[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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: 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 && Time.time < _lastVoidCrestBindHitTime + 0.29f))
{
return;
}
_lastVoidCrestBindHitTime = Time.time;
_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 + ((!ToolItemManager.IsToolEquipped("Quickbind")) ? 1 : 2), 10);
}
HitInstance val = default(HitInstance);
val.DamageDealt = PlayerData.instance.nailDamage;
val.Source = ((Component)instance).gameObject;
val.Multiplier = (HeroController.instance.cState.isBinding ? 2f : 0.5f) + (HeroController.instance.cState.isBinding ? ((ToolItemManager.IsToolEquipped("Bell Bind") ? 1f : 0f) + (ToolItemManager.IsToolEquipped("Quickbind") ? 0.5f : 0f) + (ToolItemManager.IsToolEquipped("Multibind") ? 0.5f : 0f)) : ((ToolItemManager.IsToolEquipped("Sprintmaster") ? 0.5f : 0f) + (ToolItemManager.IsToolEquipped("Weighted Anklet") ? 0.75f : 0f)));
val.AttackType = (AttackTypes)0;
val.SilkGeneration = (HitSilkGeneration)((!ToolItemManager.IsToolEquipped("Multibind")) ? 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)
{
__instance.tempDamageStack.AddMultiplier(2f);
}
}
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))]
private 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.29f);
<>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 (PlayerData.instance.CurrentCrestID == "Void" && (eventName == "AddBlueHealth" || eventName == "AddQueuedBlueHealth"))
{
voidspool.voidMass += 2;
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 (PlayerData.instance.CurrentCrestID == "Void" && (eventNameHash == EventRegisterEvents.AddBlueHealth || eventNameHash == EventRegisterEvents.AddQueuedBlueHealth))
{
voidspool.voidMass += 2;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(HeroController), "ThrowTool")]
public static class Balancey
{
public static bool doVoidSilk;
public static void Postfix(HeroController __instance)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
if (!VoidCrestPlugin.voidCrestData.IsEquipped || (int)__instance.willThrowTool.Type != 3)
{
return;
}
if (voidspool.voidMass > 0)
{
voidspool.voidMass--;
doVoidSilk = true;
{
foreach (Transform item in ((Component)__instance).gameObject.transform.Find("Special Attacks"))
{
Transform val = item;
VoidCrestColorUtil.TraverseAndVoidify(((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();
}
}
}