Decompiled source of AwakenedGrandMotherSilk v1.0.4
Awakened Grand Mother Silk.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Awakened_Grand_Mother_Silk.Source.Behaviours; using Awakened_Grand_Mother_Silk.Source.Patches; using BepInEx; using BepInEx.Logging; using GlobalEnums; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using TeamCherry.Localization; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Awakened Grand Mother Silk")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Awakened Grand Mother Silk")] [assembly: AssemblyTitle("Awakened Grand Mother Silk")] [assembly: AssemblyVersion("1.0.0.0")] [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 Awakened_Grand_Mother_Silk { public static class MyPluginInfo { public const string PLUGIN_GUID = "AwakenedGrandMotherSilk"; public const string PLUGIN_NAME = "AwakenedGrandMotherSilk"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Awakened_Grand_Mother_Silk.Source { public static class ArrayExtensions { public static T[] RemoveFirst<T>(this T[] array, Func<T, bool> predicate) { Func<T, bool> predicate2 = predicate; List<T> list = array.ToList(); int num = list.FindIndex((T x) => predicate2(x)); if (num >= 0) { list.RemoveAt(num); } return list.ToArray(); } public static T[] Insert<T>(this T[] array, int index, T item) { List<T> list = array.ToList(); list.Insert(index, item); return list.ToArray(); } } internal static class AssetManager { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public string assetPath; internal bool <Initialize>b__0(string objName) { return assetPath.Contains(objName); } } [CompilerGenerated] private sealed class <>c__DisplayClass9_0 { public string bundleName; internal bool <ManuallyLoadBundles>b__0(AssetBundle bundle) { return ((Object)bundle).name == bundleName; } } [CompilerGenerated] private sealed class <>c__DisplayClass9_1 { public AssetBundleRequest assetLoadRequest; internal void <ManuallyLoadBundles>b__1(AsyncOperation _) { Object asset = assetLoadRequest.asset; GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null); if (val != null && asset.name == "Lost Lace Ground Tendril") { ConstrainPosition component = val.GetComponent<ConstrainPosition>(); component.xMax = 100f; component.yMin = 0f; component.yMax = 100f; FsmState[] fsmStates = FSMUtility.LocateMyFSM(val, "Control").FsmStates; foreach (FsmState val2 in fsmStates) { if (val2.Name == "Antic") { FsmStateAction[] actions = val2.Actions; FsmStateAction[] array = actions; foreach (FsmStateAction val3 in array) { SetFloatValue val4 = (SetFloatValue)(object)((val3 is SetFloatValue) ? val3 : null); if (val4 == null) { EaseFloat val5 = (EaseFloat)(object)((val3 is EaseFloat) ? val3 : null); if (val5 != null) { val5.fromValue.Value = 11f; val5.toValue.Value = 13f; } } else { val4.floatValue.Value = 11f; } } val2.Actions = actions; } else { if (!(val2.Name == "Recycle")) { continue; } FsmStateAction[] actions2 = val2.Actions; FsmStateAction[] array = actions2; foreach (FsmStateAction obj in array) { SetPosition2D val6 = (SetPosition2D)(object)((obj is SetPosition2D) ? obj : null); if (val6 != null) { val6.Y.Value = 11f; } } val2.Actions = actions2; } } } AssetManager.TryAdd<Object>(asset); } } [CompilerGenerated] private sealed class <Initialize>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private IEnumerator<AssetBundle> <>7__wrap1; private AssetBundle <bundle>5__3; private string[] <>7__wrap3; private int <>7__wrap4; private AssetBundleRequest <assetLoadHandle>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Initialize>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <bundle>5__3 = null; <>7__wrap3 = null; <assetLoadHandle>5__6 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; Object asset = <assetLoadHandle>5__6.asset; if (asset != (Object)null) { AssetManager.TryAdd<Object>(asset); } <assetLoadHandle>5__6 = null; goto IL_010a; } <>1__state = -1; if (_initialized) { return false; } _initialized = true; <>7__wrap1 = AssetBundle.GetAllLoadedAssetBundles().GetEnumerator(); <>1__state = -3; goto IL_0139; IL_0139: if (<>7__wrap1.MoveNext()) { <bundle>5__3 = <>7__wrap1.Current; <>7__wrap3 = <bundle>5__3.GetAllAssetNames(); <>7__wrap4 = 0; goto IL_0118; } <>m__Finally1(); <>7__wrap1 = null; return false; IL_010a: <>7__wrap4++; goto IL_0118; IL_0118: if (<>7__wrap4 < <>7__wrap3.Length) { <>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0 { assetPath = <>7__wrap3[<>7__wrap4] }; if (_assetNames.Any((string objName) => CS$<>8__locals0.assetPath.Contains(objName))) { <assetLoadHandle>5__6 = <bundle>5__3.LoadAssetAsync(CS$<>8__locals0.assetPath); <>2__current = <assetLoadHandle>5__6; <>1__state = 1; return true; } goto IL_010a; } <>7__wrap3 = null; <bundle>5__3 = null; goto IL_0139; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ManuallyLoadBundles>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string[] <>7__wrap1; private int <>7__wrap2; private AssetBundleCreateRequest <bundleLoadRequest>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ManuallyLoadBundles>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <bundleLoadRequest>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; AssetBundle assetBundle = <bundleLoadRequest>5__4.assetBundle; _manuallyLoadedBundles.Add(assetBundle); string[] allAssetNames = assetBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { string[] assetNames = _assetNames; foreach (string value in assetNames) { if (!text.Contains(value)) { continue; } <>c__DisplayClass9_1 CS$<>8__locals1 = new <>c__DisplayClass9_1 { assetLoadRequest = assetBundle.LoadAssetAsync(text) }; ((AsyncOperation)CS$<>8__locals1.assetLoadRequest).completed += delegate { Object asset = CS$<>8__locals1.assetLoadRequest.asset; GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null); if (val != null && asset.name == "Lost Lace Ground Tendril") { ConstrainPosition component = val.GetComponent<ConstrainPosition>(); component.xMax = 100f; component.yMin = 0f; component.yMax = 100f; FsmState[] fsmStates = FSMUtility.LocateMyFSM(val, "Control").FsmStates; foreach (FsmState val2 in fsmStates) { if (val2.Name == "Antic") { FsmStateAction[] actions = val2.Actions; FsmStateAction[] array = actions; foreach (FsmStateAction val3 in array) { SetFloatValue val4 = (SetFloatValue)(object)((val3 is SetFloatValue) ? val3 : null); if (val4 == null) { EaseFloat val5 = (EaseFloat)(object)((val3 is EaseFloat) ? val3 : null); if (val5 != null) { val5.fromValue.Value = 11f; val5.toValue.Value = 13f; } } else { val4.floatValue.Value = 11f; } } val2.Actions = actions; } else if (val2.Name == "Recycle") { FsmStateAction[] actions2 = val2.Actions; FsmStateAction[] array = actions2; foreach (FsmStateAction obj in array) { SetPosition2D val6 = (SetPosition2D)(object)((obj is SetPosition2D) ? obj : null); if (val6 != null) { val6.Y.Value = 11f; } } val2.Actions = actions2; } } } AssetManager.TryAdd<Object>(asset); }; } } <bundleLoadRequest>5__4 = null; goto IL_0186; } <>1__state = -1; <>7__wrap1 = _bundleNames; <>7__wrap2 = 0; goto IL_0194; IL_0186: <>7__wrap2++; goto IL_0194; IL_0194: if (<>7__wrap2 < <>7__wrap1.Length) { <>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0 { bundleName = <>7__wrap1[<>7__wrap2] }; if (!AssetBundle.GetAllLoadedAssetBundles().Any((AssetBundle bundle) => ((Object)bundle).name == CS$<>8__locals0.bundleName)) { RuntimePlatform platform = Application.platform; string text2 = (((int)platform == 1) ? "StandaloneOSX" : (((int)platform == 2) ? "StandaloneWindows64" : (((int)platform != 13) ? "" : "StandaloneLinux64"))); string path = text2; string text3 = Path.Combine(Addressables.RuntimePath, path, CS$<>8__locals0.bundleName + ".bundle"); <bundleLoadRequest>5__4 = AssetBundle.LoadFromFileAsync(text3); <>2__current = <bundleLoadRequest>5__4; <>1__state = 1; return true; } goto IL_0186; } <>7__wrap1 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static string[] _bundleNames = new string[1] { "localpoolprefabs_assets_laceboss" }; private static List<AssetBundle> _manuallyLoadedBundles = new List<AssetBundle>(); private static string[] _assetNames = new string[1] { "Audio Player Actor Simple" }; private static readonly Dictionary<Type, Dictionary<string, Object>> Assets = new Dictionary<Type, Dictionary<string, Object>>(); private static bool _initialized; [IteratorStateMachine(typeof(<Initialize>d__5))] internal static IEnumerator Initialize() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Initialize>d__5(0); } private static void TryAdd<T>(T asset) where T : Object { string name = ((Object)asset).name; if (Has(name)) { Log.Warn("Asset \"" + ((Object)asset).name + "\" has already been loaded!"); return; } Type type = ((object)asset).GetType(); if (Assets.ContainsKey(type)) { Dictionary<string, Object> dictionary = Assets[type]; if (dictionary != null) { if (dictionary.ContainsKey(name)) { if (dictionary[name] != (Object)null) { Log.Warn($"There is already an asset \"{name}\" of type \"{type}\"!"); return; } Log.Info($"Key \"{name}\" for sub-dictionary of type \"{type}\" exists, but its value is null; Replacing with new asset..."); Assets[type][name] = (Object)(object)asset; } else { Log.Debug($"Adding asset \"{name}\" of type \"{type}\"."); Assets[type].Add(name, (Object)(object)asset); } } else { Log.Error($"Failed to get sub-dictionary of type \"{type}\"!"); Assets.Add(type, new Dictionary<string, Object>()); } } else { Assets.Add(type, new Dictionary<string, Object> { [name] = (Object)(object)asset }); Log.Debug($"Added new sub-dictionary of type \"{type}\" with initial asset \"{name}\"."); } } internal static void LoadTextures() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00a5: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { string text2 = text.ToLower(); if (!text2.EndsWith(".png") && !text2.EndsWith(".jpg") && !text2.EndsWith(".jpeg")) { continue; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); string text4 = (((Object)val).name = text.Split('.')[^2]); ImageConversion.LoadImage(val, array); TryAdd<Texture2D>(val); Log.Debug("Loaded texture: " + text4); } } } internal static void LoadAudioClips() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); int num = 0; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); string[] array = manifestResourceNames; foreach (string text in array) { Log.Debug(" Resource: " + text); } array = manifestResourceNames; foreach (string text2 in array) { if (!text2.ToLower().EndsWith(".wav")) { continue; } using Stream stream = executingAssembly.GetManifestResourceStream(text2); if (stream == null) { Log.Warn("LoadAudioClips: Could not open stream for " + text2); continue; } byte[] array2 = new byte[stream.Length]; stream.Read(array2, 0, array2.Length); string text3 = text2.Split('.')[^2]; try { AudioClip val = WavUtility.ToAudioClip(array2, text3); if ((Object)(object)val != (Object)null) { TryAdd<AudioClip>(val); num++; } } catch (Exception ex) { Log.Error("Failed to load audio clip '" + text3 + "': " + ex.Message); } } Log.Info($"LoadAudioClips: Loaded {num} audio clips total"); } [IteratorStateMachine(typeof(<ManuallyLoadBundles>d__9))] internal static IEnumerator ManuallyLoadBundles() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ManuallyLoadBundles>d__9(0); } internal static void UnloadAll() { foreach (Dictionary<string, Object> value in Assets.Values) { foreach (Object value2 in value.Values) { Object.DestroyImmediate(value2); } } Assets.Clear(); GC.Collect(); } internal static void UnloadManualBundles() { foreach (AssetBundle manuallyLoadedBundle in _manuallyLoadedBundles) { string bundleName = ((Object)manuallyLoadedBundle).name; ((AsyncOperation)manuallyLoadedBundle.UnloadAsync(true)).completed += delegate { Log.Info("Successfully unloaded bundle \"" + bundleName + "\""); }; } _manuallyLoadedBundles.Clear(); if (!Assets.ContainsKey(typeof(GameObject))) { return; } foreach (KeyValuePair<string, Object> item in Assets[typeof(GameObject)]) { item.Deconstruct(out var _, out var value); GameObject val = (GameObject)(object)((value is GameObject) ? value : null); if (val != null && val.activeSelf) { Log.Info("Recycling all instances of prefab \"" + ((Object)val).name + "\""); ObjectPoolExtensions.RecycleAll(val); } } } private static bool Has(string assetName) { foreach (KeyValuePair<Type, Dictionary<string, Object>> asset in Assets) { asset.Deconstruct(out var _, out var value); foreach (var (text2, val2) in value) { if (assetName == text2 && Object.op_Implicit(val2)) { return true; } } } return false; } internal static T? Get<T>(string assetName) where T : Object { Type typeFromHandle = typeof(T); if (Assets.ContainsKey(typeFromHandle)) { Dictionary<string, Object> dictionary = Assets[typeFromHandle]; if (dictionary != null) { if (dictionary.ContainsKey(assetName)) { Object val = dictionary[assetName]; if (val != (Object)null) { return (T)(object)((val is T) ? val : null); } Log.Error("Failed to get asset \"" + assetName + "\"; asset is null"); return default(T); } Log.Error($"Sub-dictionary for type \"{typeFromHandle}\" does not contain key \"{assetName}\""); return default(T); } Log.Error($"Failed to get asset \"{assetName}\"; sub-dictionary of key \"{typeFromHandle}\" is null"); return default(T); } Log.Error($"Could not find a sub-dictionary of type \"{typeFromHandle}\""); return default(T); } } internal static class WavUtility { public static AudioClip? ToAudioClip(byte[] wavData, string clipName) { if (wavData.Length < 44) { Log.Error("WAV data too short for '" + clipName + "'"); return null; } if (wavData[0] != 82 || wavData[1] != 73 || wavData[2] != 70 || wavData[3] != 70) { Log.Error("Invalid WAV header for '" + clipName + "' - not a RIFF file"); return null; } if (wavData[8] != 87 || wavData[9] != 65 || wavData[10] != 86 || wavData[11] != 69) { Log.Error("Invalid WAV header for '" + clipName + "' - not a WAVE file"); return null; } int num = BitConverter.ToInt16(wavData, 22); int num2 = BitConverter.ToInt32(wavData, 24); int num3 = BitConverter.ToInt16(wavData, 34); Log.Debug($"WAV '{clipName}': {num} channels, {num2} Hz, {num3}-bit"); int num4 = -1; int num5 = 0; for (int i = 36; i < wavData.Length - 8; i++) { if (wavData[i] == 100 && wavData[i + 1] == 97 && wavData[i + 2] == 116 && wavData[i + 3] == 97) { num5 = BitConverter.ToInt32(wavData, i + 4); num4 = i + 8; break; } } if (num4 < 0) { Log.Error("Could not find data chunk in WAV '" + clipName + "'"); return null; } int num6 = num3 / 8; int num7 = num5 / num6 / num; if (num7 <= 0) { Log.Error("Invalid sample count for WAV '" + clipName + "'"); return null; } AudioClip val = AudioClip.Create(clipName, num7, num, num2, false); float[] array = new float[num7 * num]; switch (num3) { case 16: { for (int k = 0; k < array.Length; k++) { int num9 = num4 + k * 2; if (num9 + 1 < wavData.Length) { short num10 = BitConverter.ToInt16(wavData, num9); array[k] = (float)num10 / 32768f; } } break; } case 8: { for (int j = 0; j < array.Length; j++) { int num8 = num4 + j; if (num8 < wavData.Length) { array[j] = (float)(wavData[num8] - 128) / 128f; } } break; } default: Log.Error($"Unsupported bits per sample ({num3}) for WAV '{clipName}'"); return null; } val.SetData(array, 0); Log.Debug($"Created AudioClip '{clipName}': {num7} samples, {val.length:F2}s duration"); return val; } } [PublicAPI] public static class FsmUtil { public static void RemoveAction(this FsmState state, int index) { state.Actions = state.Actions.Where((FsmStateAction _, int ind) => ind != index).ToArray(); } public static void RemoveAction<T>(this FsmState state) where T : FsmStateAction { state.Actions = state.Actions.RemoveFirst((FsmStateAction x) => x is T).ToArray(); } public static void RemoveAllOfType<T>(this FsmState state) where T : FsmStateAction { state.Actions = state.Actions.Where((FsmStateAction x) => !(x is T)).ToArray(); } public static void RemoveAnim(this PlayMakerFSM fsm, string stateName, int index) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown Tk2dPlayAnimationWithEvents action = fsm.GetAction<Tk2dPlayAnimationWithEvents>(stateName, index); FsmEvent sendEvent = new FsmEvent(action.animationCompleteEvent ?? action.animationTriggerEvent); FsmState state = fsm.GetState(stateName); state.RemoveAction(index); state.InsertAction(index, (FsmStateAction)new NextFrameEvent { sendEvent = sendEvent, Active = true, Enabled = true }); } public static FsmState GetState(this PlayMakerFSM fsm, string stateName) { string stateName2 = stateName; return fsm.FsmStates.First((FsmState t) => t.Name == stateName2); } public static bool TryGetState(this PlayMakerFSM fsm, string stateName, [MaybeNullWhen(false)] out FsmState state) { string stateName2 = stateName; state = ((IEnumerable<FsmState>)fsm.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState t) => t.Name == stateName2)); return state != null; } public static FsmState CopyState(this PlayMakerFSM fsm, string stateName, string newState) { //IL_0009: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown FsmState state = fsm.GetState(stateName); FsmState val = new FsmState(state) { Name = newState, Transitions = ((IEnumerable<FsmTransition>)state.Transitions).Select((Func<FsmTransition, FsmTransition>)((FsmTransition x) => new FsmTransition(x) { ToFsmState = x.ToFsmState })).ToArray() }; fsm.Fsm.States = fsm.FsmStates.Append(val).ToArray(); return val; } public static T GetAction<T>(this FsmState state, int index) where T : FsmStateAction { return (T)(object)state.Actions[index]; } public static T GetAction<T>(this PlayMakerFSM fsm, string stateName, int index) where T : FsmStateAction { return (T)(object)fsm.GetState(stateName).Actions[index]; } public static T GetAction<T>(this FsmState state) where T : FsmStateAction { return state.Actions.OfType<T>().First(); } public static T GetAction<T>(this PlayMakerFSM fsm, string stateName) where T : FsmStateAction { return fsm.GetState(stateName).GetAction<T>(); } public static void AddAction(this FsmState state, FsmStateAction action) { state.Actions = state.Actions.Append(action).ToArray(); action.Init(state); } public static void InsertAction(this FsmState state, int index, FsmStateAction action) { state.Actions = state.Actions.Insert(index, action).ToArray(); action.Init(state); } public static void ChangeTransition(this PlayMakerFSM self, string state, string eventName, string toState) { self.GetState(state).ChangeTransition(eventName, toState); } public static void ChangeTransition(this FsmState state, string eventName, string toState) { string eventName2 = eventName; state.Transitions.First((FsmTransition tr) => tr.EventName == eventName2).ToFsmState = state.Fsm.FsmComponent.GetState(toState); } public static void AddTransition(this FsmState state, FsmEvent @event, string toState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown state.Transitions = state.Transitions.Append(new FsmTransition { FsmEvent = @event, ToFsmState = state.Fsm.GetState(toState) }).ToArray(); } [PublicAPI] public static void AddTransition(this FsmState state, string eventName, string toState) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) state.AddTransition((FsmEvent)(((object)FsmEvent.GetFsmEvent(eventName)) ?? ((object)new FsmEvent(eventName))), toState); } [PublicAPI] public static void RemoveTransition(this FsmState state, string transition) { string transition2 = transition; state.Transitions = state.Transitions.Where((FsmTransition trans) => transition2 != trans.ToFsmState.Name).ToArray(); } [PublicAPI] public static void AddCoroutine(this FsmState state, Func<IEnumerator> method) { state.InsertCoroutine(state.Actions.Length, method); } [PublicAPI] public static void AddMethod(this FsmState state, Action method) { state.InsertMethod(state.Actions.Length, method); } [PublicAPI] public static void InsertMethod(this FsmState state, int index, Action method) { state.InsertAction(index, (FsmStateAction)(object)new InvokeMethod(method)); } [PublicAPI] public static void InsertCoroutine(this FsmState state, int index, Func<IEnumerator> coro, bool wait = true) { state.InsertAction(index, (FsmStateAction)(object)new InvokeCoroutine(coro, wait)); } [PublicAPI] public static FsmInt GetOrCreateInt(this PlayMakerFSM fsm, string intName) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown string intName2 = intName; FsmInt val = ((IEnumerable<FsmInt>)fsm.FsmVariables.IntVariables).FirstOrDefault((Func<FsmInt, bool>)((FsmInt x) => ((NamedVariable)x).Name == intName2)); if (val != null) { return val; } FsmInt val2 = new FsmInt(intName2); fsm.FsmVariables.IntVariables = fsm.FsmVariables.IntVariables.Append(val2).ToArray(); return val2; } [PublicAPI] public static FsmBool CreateBool(this PlayMakerFSM fsm, string boolName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown FsmBool val = new FsmBool(boolName); fsm.FsmVariables.BoolVariables = fsm.FsmVariables.BoolVariables.Append(val).ToArray(); return val; } [PublicAPI] public static void AddToSendRandomEventV3(this SendRandomEventV3 sre, string toState, float weight, int eventMaxAmount, int missedMaxAmount, string? eventName = null, bool createInt = true) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown string eventName2 = eventName; PlayMakerFSM fsm = (PlayMakerFSM)((FsmStateAction)sre).Fsm.Owner; string name = ((FsmStateAction)sre).State.Name; if (eventName2 == null) { eventName2 = toState.Split(' ').First(); } fsm.GetState(name).AddTransition(eventName2, toState); sre.events = sre.events.Append(fsm.GetState(name).Transitions.Single((FsmTransition x) => x.FsmEvent.Name == eventName2).FsmEvent).ToArray(); sre.weights = sre.weights.Append(FsmFloat.op_Implicit(weight)).ToArray(); sre.trackingInts = sre.trackingInts.Append(fsm.GetOrCreateInt("Ms " + eventName2)).ToArray(); sre.eventMax = sre.eventMax.Append(FsmInt.op_Implicit(eventMaxAmount)).ToArray(); sre.trackingIntsMissed = sre.trackingIntsMissed.Append(fsm.GetOrCreateInt("Ct " + eventName2)).ToArray(); sre.missedMax = sre.missedMax.Append(FsmInt.op_Implicit(missedMaxAmount)).ToArray(); } [PublicAPI] public static FsmState CreateState(this PlayMakerFSM fsm, string stateName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown FsmState val = new FsmState(fsm.Fsm) { Name = stateName }; fsm.Fsm.States = fsm.FsmStates.Append(val).ToArray(); return val; } } public class InvokeCoroutine : FsmStateAction { [CompilerGenerated] private sealed class <Coroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public InvokeCoroutine <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Coroutine>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; InvokeCoroutine invokeCoroutine = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = invokeCoroutine._coroutine(); <>1__state = 1; return true; case 1: <>1__state = -1; ((FsmStateAction)invokeCoroutine).Finish(); 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 readonly Func<IEnumerator> _coroutine; private readonly bool _wait; public InvokeCoroutine(Func<IEnumerator> coroutine, bool wait) { _coroutine = coroutine; _wait = wait; } [IteratorStateMachine(typeof(<Coroutine>d__3))] private IEnumerator Coroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Coroutine>d__3(0) { <>4__this = this }; } public override void OnEnter() { ((FsmStateAction)this).Fsm.Owner.StartCoroutine(_wait ? Coroutine() : _coroutine()); if (!_wait) { ((FsmStateAction)this).Finish(); } } } public class InvokeMethod : FsmStateAction { private readonly Action _action; public InvokeMethod(Action action) { _action = action; } public override void OnEnter() { _action(); ((FsmStateAction)this).Finish(); } } internal static class Log { private static ManualLogSource? _logSource; private static string LogPrefix => $"[{Assembly.GetExecutingAssembly().GetName().Version}] "; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object debug) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogDebug((object)(LogPrefix + debug)); } } internal static void Error(object error) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogError((object)(LogPrefix + error)); } } internal static void Fatal(object fatal) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogFatal((object)(LogPrefix + fatal)); } } internal static void Info(object info) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogInfo((object)(LogPrefix + info)); } } internal static void Message(object message) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogMessage((object)(LogPrefix + message)); } } internal static void Warn(object warning) { ManualLogSource? logSource = _logSource; if (logSource != null) { logSource.LogWarning((object)(LogPrefix + warning)); } } } [BepInPlugin("AwakenedGrandMotherSilk", "AwakenedGrandMotherSilk", "1.0.4")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <DeferredLanguagePatch>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Type silkbossType; public Plugin <>4__this; private bool <initialized>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DeferredLanguagePatch>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <initialized>5__2 = false; break; case 1: <>1__state = -1; break; } if (!<initialized>5__2) { try { Language.CurrentLanguage(); <initialized>5__2 = true; } catch { } <>2__current = null; <>1__state = 1; return true; } MethodInfo method = silkbossType.GetMethod("PatchBossTitle", BindingFlags.Static | BindingFlags.NonPublic); if (method != null) { MethodInfo method2 = typeof(Language).GetMethod("Get", new Type[2] { typeof(string), typeof(string) }); if (method2 != null) { plugin._harmony.Patch((MethodBase)method2, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("PatchBossTitle applied to Language.Get (deferred)"); } IEnumerable<MethodBase> patchedMethods = plugin._harmony.GetPatchedMethods(); int num2 = 0; foreach (MethodBase item in patchedMethods) { Log.Info("Patched: " + item.DeclaringType?.Name + "." + item.Name); num2++; } Log.Info($"Total patches applied: {num2}"); } 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 const string PLUGIN_GUID = "AwakenedGrandMotherSilk"; public const string PLUGIN_NAME = "AwakenedGrandMotherSilk"; public const string PLUGIN_VERSION = "1.0.4"; private Harmony _harmony; private const string BUILD_ID = "BUILD_2025_01_25_A"; private void Awake() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Log.Info("Awakened GMS mod loading... [BUILD_2025_01_25_A]"); Log.Info(">>> Step 1: Loading textures..."); try { AssetManager.LoadTextures(); Log.Info(">>> Step 1: Textures loaded successfully"); } catch (Exception arg) { Log.Error($">>> Step 1 FAILED: {arg}"); } Log.Info(">>> Step 2: Loading audio clips..."); try { AssetManager.LoadAudioClips(); Log.Info(">>> Step 2: Audio clips loaded successfully"); } catch (Exception arg2) { Log.Error($">>> Step 2 FAILED: {arg2}"); } _harmony = new Harmony("AwakenedGrandMotherSilk"); Log.Info(">>> Step 3: Attempting to manually patch..."); try { Type type = Assembly.GetExecutingAssembly().GetType("Awakened_Grand_Mother_Silk.Source.Patches.SilkbossPatches"); if (type != null) { Log.Info("Found SilkbossPatches, manually patching methods..."); MethodInfo method = type.GetMethod("ModifySilkboss", BindingFlags.Static | BindingFlags.NonPublic); if (method != null) { _harmony.Patch((MethodBase)typeof(PlayMakerFSM).GetMethod("Start", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.Info("ModifySilkboss applied"); } new Harmony("AwakenedGrandMotherSilk").PatchAll(typeof(SilkbossPatches).Assembly); } } catch (Exception arg3) { Log.Error($"Manual patching failed: {arg3}"); } } private void Start() { Log.Info("Plugin Start() called, beginning deferred language patch..."); try { Type type = Assembly.GetExecutingAssembly().GetType("Awakened_Grand_Mother_Silk.Source.Patches.SilkbossPatches"); if (type != null) { ((MonoBehaviour)this).StartCoroutine(DeferredLanguagePatch(type)); } } catch (Exception arg) { Log.Error($"Failed to start deferred language patch: {arg}"); } } [IteratorStateMachine(typeof(<DeferredLanguagePatch>d__7))] private IEnumerator DeferredLanguagePatch(Type silkbossType) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DeferredLanguagePatch>d__7(0) { <>4__this = this, silkbossType = silkbossType }; } private void OnDestroy() { _harmony.UnpatchSelf(); AssetManager.UnloadAll(); } } } namespace Awakened_Grand_Mother_Silk.Source.Patches { internal static class DebugPatches { [HarmonyPrefix] [HarmonyPatch(typeof(HeroController), "Awake")] private static void ForceInvincible() { CheatManager.Invincibility = (InvincibilityStates)3; } } internal static class MainPatches { [CompilerGenerated] private sealed class <UnpatchSilkboss>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator result; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UnpatchSilkboss>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (result.MoveNext()) { <>2__current = result.Current; <>1__state = 1; return true; } _harmony.UnpatchSelf(); 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 static Harmony _harmony; internal static void Initialize() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _harmony = new Harmony("MainPatches"); } [IteratorStateMachine(typeof(<UnpatchSilkboss>d__2))] private static IEnumerator UnpatchSilkboss(IEnumerator result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UnpatchSilkboss>d__2(0) { result = result }; } } internal static class SilkbossPatches { public static class StateWatcher { private class WatchData { public PlayMakerFSM? Fsm; public string? LastState; public Action? Callback; } private class WatcherUpdater : MonoBehaviour { private void Update() { for (int i = 0; i < watchers.Count; i++) { WatchData watchData = watchers[i]; if ((Object)(object)watchData.Fsm == (Object)null) { watchers.RemoveAt(i); i--; continue; } string activeStateName = watchData.Fsm.ActiveStateName; if (activeStateName != watchData.LastState) { watchData.LastState = activeStateName; watchData.Callback?.Invoke(); } } } } private static readonly List<WatchData> watchers = new List<WatchData>(); private static bool hooked = false; public static void Watch(PlayMakerFSM fsm, Action callback) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) PlayMakerFSM fsm2 = fsm; if (!watchers.Exists((WatchData w) => (Object)(object)w.Fsm == (Object)(object)fsm2)) { watchers.Add(new WatchData { Fsm = fsm2, LastState = fsm2.ActiveStateName, Callback = callback }); if (!hooked) { hooked = true; new GameObject("FSMStateWatcher").AddComponent<WatcherUpdater>(); } } } } private static readonly HashSet<string> loggedKeys = new HashSet<string>(); [HarmonyPrefix] [HarmonyPatch(typeof(PlayMakerFSM), "Start")] private static void ModifySilkboss(PlayMakerFSM __instance) { if (((Object)__instance).name == "Silk Boss" && __instance.FsmName == "Control" && ((Component)__instance).gameObject.layer == LayerMask.NameToLayer("Enemies") && (Object)(object)((Component)__instance).gameObject.GetComponent<SilkBoss>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<SilkBoss>(); } else if (__instance.FsmName == "Hand Control" && (Object)(object)((Component)__instance).gameObject.GetComponent<ExtraPins>() == (Object)null) { Log.Info("SilkbossPatches: Found Hand Control FSM on " + ((Object)((Component)__instance).gameObject).name); ((Component)__instance).gameObject.AddComponent<ExtraPins>(); } } private static void PatchBossTitle(string key, string sheetTitle, ref string __result) { if (key == "SILK_SUPER" || key == "SILK_MAIN") { __result = " "; Log.Info("[PatchBossTitle] Modified result for key=" + key); } } } } namespace Awakened_Grand_Mother_Silk.Source.Behaviours { internal static class BossAnimation { private struct FrameDefinition { public int X; public int Y; public int Width; public int Height; public int AnchorX; public int AnchorY; public FrameDefinition(int x, int y, int width, int height, int anchorX, int anchorY) { X = x; Y = y; Width = width; Height = height; AnchorX = anchorX; AnchorY = anchorY; } } internal const string NUKE_SUMMON_CLIP = "Nuke Summon"; private static tk2dSpriteAnimator? _bossAnimator; private static tk2dSpriteCollectionData? _spriteCollection; private static bool _initialized = false; private static int _nukeSummonStartId = -1; private static int _nukeSummonFrameCount = 20; private const int ATLAS3_WIDTH = 4096; private const int ATLAS3_HEIGHT = 4096; private const int ATLAS3_MATERIAL_ID = 3; private static readonly FrameDefinition[] NukeSummonFrames = new FrameDefinition[15] { new FrameDefinition(369, 0, 369, 958, 211, 479), new FrameDefinition(0, 0, 369, 958, 213, 479), new FrameDefinition(1510, 0, 369, 958, 208, 479), new FrameDefinition(0, 963, 491, 958, 323, 479), new FrameDefinition(490, 963, 491, 958, 314, 479), new FrameDefinition(968, 963, 491, 958, 314, 483), new FrameDefinition(1450, 963, 491, 958, 314, 482), new FrameDefinition(1930, 963, 491, 958, 322, 482), new FrameDefinition(2420, 963, 491, 958, 321, 482), new FrameDefinition(2908, 963, 491, 958, 324, 483), new FrameDefinition(0, 963, 491, 958, 323, 479), new FrameDefinition(490, 963, 491, 958, 314, 479), new FrameDefinition(1107, 0, 369, 958, 210, 483), new FrameDefinition(1915, 0, 373, 958, 206, 484), new FrameDefinition(738, 0, 369, 958, 208, 483) }; internal static void Reset() { _bossAnimator = null; _spriteCollection = null; _initialized = false; _nukeSummonStartId = -1; } internal static void Initialize(tk2dSpriteAnimator bossAnimator) { _bossAnimator = bossAnimator; tk2dSprite component = ((Component)bossAnimator).GetComponent<tk2dSprite>(); if ((Object)(object)component != (Object)null) { _spriteCollection = ((tk2dBaseSprite)component).Collection; for (int i = 0; i < _spriteCollection.materials.Length; i++) { _ = _spriteCollection.materials[i]; } int num = FindExistingNukeSummonSprite(); if (num >= 0) { _nukeSummonStartId = num; } else { AddNukeSummonSpriteDefinitions(); } _initialized = true; EnsureNukeSummonClipInAnimator(); } else { Log.Error("CustomAnimations: Could not get tk2dSprite component from animator"); } } private static int FindExistingNukeSummonSprite() { if ((Object)(object)_spriteCollection == (Object)null) { return -1; } for (int i = 0; i < _spriteCollection.spriteDefinitions.Length; i++) { tk2dSpriteDefinition val = _spriteCollection.spriteDefinitions[i]; if (val != null && val.name == "nuke_summon_00") { return i; } } return -1; } private static void EnsureNukeSummonClipInAnimator() { if ((Object)(object)_bossAnimator == (Object)null) { Log.Error("CustomAnimations: Cannot ensure clip - animator is null"); return; } if ((Object)(object)_bossAnimator.Library == (Object)null) { Log.Error("CustomAnimations: Cannot ensure clip - animator Library is null"); return; } if (_nukeSummonStartId < 0) { Log.Error("CustomAnimations: Cannot ensure clip - sprite definitions not added yet"); return; } tk2dSpriteAnimationClip val = FindClipByName("Nuke Summon"); if (val != null && val.frames != null && val.frames.Length != 0) { tk2dSpriteAnimationFrame val2 = val.frames[0]; if ((Object)(object)val2.spriteCollection == (Object)(object)_spriteCollection && val2.spriteId == _nukeSummonStartId) { return; } RemoveClipFromLibrary("Nuke Summon"); } AddNukeSummonClip(); } private static void RemoveClipFromLibrary(string clipName) { string clipName2 = clipName; tk2dSpriteAnimator? bossAnimator = _bossAnimator; if (!((Object)(object)((bossAnimator != null) ? bossAnimator.Library : null) == (Object)null)) { tk2dSpriteAnimationClip[] clips = _bossAnimator.Library.clips.Where((tk2dSpriteAnimationClip c) => c == null || c.name != clipName2).ToArray(); _bossAnimator.Library.clips = clips; Log.Info("CustomAnimations: Removed clip '" + clipName2 + "' from Library"); } } private static void AddNukeSummonSpriteDefinitions() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown if ((Object)(object)_spriteCollection == (Object)null) { Log.Error("CustomAnimations: Cannot add sprite definitions - collection is null"); return; } tk2dSpriteDefinition[] spriteDefinitions = _spriteCollection.spriteDefinitions; int num = spriteDefinitions.Length; int num2 = 3; Material val = null; if (num2 < _spriteCollection.materials.Length) { val = _spriteCollection.materials[num2]; } else { Texture2D val2 = AssetManager.Get<Texture2D>("atlas3"); if ((Object)(object)val2 == (Object)null) { Log.Error("CustomAnimations: atlas3 texture not found!"); return; } Material val3 = ((IEnumerable<Material>)_spriteCollection.materials).FirstOrDefault((Func<Material, bool>)((Material m) => (Object)(object)m != (Object)null)); if ((Object)(object)val3 != (Object)null) { val = new Material(val3.shader); val.CopyPropertiesFromMaterial(val3); } else { val = new Material(Shader.Find("Sprites/Default")); } val.mainTexture = (Texture)(object)val2; ((Object)val).name = "atlas3"; Material[] array = (Material[])(object)new Material[num2 + 1]; for (int i = 0; i < _spriteCollection.materials.Length; i++) { array[i] = _spriteCollection.materials[i]; } array[num2] = val; _spriteCollection.materials = array; if (_spriteCollection.materialInsts != null) { Material[] array2 = (Material[])(object)new Material[num2 + 1]; for (int j = 0; j < _spriteCollection.materialInsts.Length; j++) { array2[j] = _spriteCollection.materialInsts[j]; } array2[num2] = val; _spriteCollection.materialInsts = array2; } } int? obj; if (val == null) { obj = null; } else { Texture mainTexture = val.mainTexture; obj = ((mainTexture != null) ? new int?(mainTexture.width) : null); } int? num3 = obj; float num4 = num3.GetValueOrDefault(4096); int? obj2; if (val == null) { obj2 = null; } else { Texture mainTexture2 = val.mainTexture; obj2 = ((mainTexture2 != null) ? new int?(mainTexture2.height) : null); } num3 = obj2; float num5 = num3.GetValueOrDefault(4096); if (num4 != 4096f || num5 != 4096f) { Log.Error($"CustomAnimations: Texture size ({num4}x{num5}) differs from constants ({4096}x{4096})!"); } _nukeSummonStartId = num; _nukeSummonFrameCount = NukeSummonFrames.Length; tk2dSpriteDefinition[] array3 = (tk2dSpriteDefinition[])(object)new tk2dSpriteDefinition[num + _nukeSummonFrameCount]; for (int k = 0; k < num; k++) { array3[k] = spriteDefinitions[k]; } for (int l = 0; l < _nukeSummonFrameCount; l++) { FrameDefinition frameDefinition = NukeSummonFrames[l]; int num6 = _nukeSummonStartId + l; float uvX = (float)frameDefinition.X / num4; float uvY = (float)frameDefinition.Y / num5; float uvW = (float)frameDefinition.Width / num4; float uvH = (float)frameDefinition.Height / num5; array3[num6] = CreateSpriteDefinition($"nuke_summon_{l:D2}", num2, uvX, uvY, uvW, uvH, frameDefinition.Width, frameDefinition.Height, frameDefinition.AnchorX, frameDefinition.AnchorY); array3[num6].material = val; array3[num6].materialInst = val; } _spriteCollection.spriteDefinitions = array3; } private static tk2dSpriteDefinition CreateSpriteDefinition(string name, int materialId, float uvX, float uvY, float uvW, float uvH, float pixelWidth, float pixelHeight, float anchorX, float anchorY) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) //IL_0239: 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) float num = 0.0157f; float num2 = (0f - anchorX) * num; float num3 = (pixelWidth - anchorX) * num; float num4 = (0f - anchorY) * num; float num5 = (pixelHeight - anchorY) * num; tk2dSpriteDefinition val = new tk2dSpriteDefinition(); val.name = name; val.materialId = materialId; val.positions = (Vector3[])(object)new Vector3[4] { new Vector3(num2, num4, 0f), new Vector3(num3, num4, 0f), new Vector3(num2, num5, 0f), new Vector3(num3, num5, 0f) }; val.uvs = (Vector2[])(object)new Vector2[4] { new Vector2(uvX, uvY), new Vector2(uvX + uvW, uvY), new Vector2(uvX, uvY + uvH), new Vector2(uvX + uvW, uvY + uvH) }; val.indices = new int[6] { 0, 2, 1, 2, 3, 1 }; val.boundsData = (Vector3[])(object)new Vector3[2] { new Vector3(0f, 0f, 0f), new Vector3(num3 - num2, num5 - num4, 0f) }; val.untrimmedBoundsData = (Vector3[])(object)new Vector3[2] { new Vector3(0f, 0f, 0f), new Vector3(num3 - num2, num5 - num4, 0f) }; val.normals = (Vector3[])(object)new Vector3[4] { Vector3.back, Vector3.back, Vector3.back, Vector3.back }; val.tangents = (Vector4[])(object)new Vector4[4] { new Vector4(1f, 0f, 0f, 1f), new Vector4(1f, 0f, 0f, 1f), new Vector4(1f, 0f, 0f, 1f), new Vector4(1f, 0f, 0f, 1f) }; return val; } private static void AddNukeSummonClip() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if ((Object)(object)_bossAnimator == (Object)null) { Log.Error("CustomAnimations: Cannot add Nuke Summon clip - animator is null"); return; } if ((Object)(object)_bossAnimator.Library == (Object)null) { Log.Error("CustomAnimations: Cannot add Nuke Summon clip - animator Library is null"); return; } if (_nukeSummonStartId < 0) { Log.Error("CustomAnimations: Cannot add Nuke Summon clip - sprite IDs not set"); return; } tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = "Nuke Summon", fps = 13f, wrapMode = (WrapMode)2, frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[_nukeSummonFrameCount] }; for (int i = 0; i < _nukeSummonFrameCount; i++) { val.frames[i] = new tk2dSpriteAnimationFrame { spriteId = _nukeSummonStartId + i, spriteCollection = _spriteCollection }; } tk2dSpriteAnimationClip[] clips = _bossAnimator.Library.clips; _bossAnimator.Library.clips = clips.Append(val).ToArray(); } private static tk2dSpriteAnimationClip? FindClipByName(string clipName) { tk2dSpriteAnimator? bossAnimator = _bossAnimator; if (((bossAnimator == null) ? null : bossAnimator.Library?.clips) == null) { return null; } tk2dSpriteAnimationClip[] clips = _bossAnimator.Library.clips; foreach (tk2dSpriteAnimationClip val in clips) { if (val != null && !string.IsNullOrEmpty(val.name) && val.name == clipName) { return val; } } return null; } internal static void PlayNukeSummon() { if ((Object)(object)_bossAnimator == (Object)null) { Log.Error("CustomAnimations: Cannot play animation - _bossAnimator is null"); return; } if ((Object)(object)((Component)_bossAnimator).gameObject == (Object)null) { Log.Error("CustomAnimations: Cannot play animation - animator's gameObject is null (object was destroyed?)"); _bossAnimator = null; return; } if ((Object)(object)_bossAnimator.Library == (Object)null) { Log.Error("CustomAnimations: Cannot play animation - animator Library is null"); return; } tk2dSpriteAnimationClip val = FindClipByName("Nuke Summon"); if (val == null) { Log.Error("CustomAnimations: Clip 'Nuke Summon' not found in Library!"); tk2dSpriteAnimationClip[] clips = _bossAnimator.Library.clips; Log.Error($" Library has {((clips != null) ? clips.Length : 0)} clips:"); if (_bossAnimator.Library.clips != null) { for (int i = 0; i < _bossAnimator.Library.clips.Length; i++) { tk2dSpriteAnimationClip val2 = _bossAnimator.Library.clips[i]; Log.Error(string.Format(" [{0}] - '{1}'", i, val2?.name ?? "NULL")); } } } else { _bossAnimator.Play(val); } } internal static float GetNukeSummonDuration() { tk2dSpriteAnimator? bossAnimator = _bossAnimator; if ((Object)(object)((bossAnimator != null) ? bossAnimator.Library : null) == (Object)null) { return 1f; } tk2dSpriteAnimationClip val = FindClipByName("Nuke Summon"); if (val == null || val.frames == null || val.frames.Length == 0) { return 1f; } return (float)val.frames.Length / val.fps; } internal static bool IsPlayingNukeSummon() { if ((Object)(object)_bossAnimator == (Object)null) { return false; } tk2dSpriteAnimationClip currentClip = _bossAnimator.CurrentClip; if (currentClip != null) { return currentClip.name == "Nuke Summon"; } return false; } internal static bool IsReady() { if ((Object)(object)_bossAnimator == (Object)null) { return false; } if ((Object)(object)((Component)_bossAnimator).gameObject == (Object)null) { return false; } if ((Object)(object)_bossAnimator.Library == (Object)null) { return false; } if (_nukeSummonStartId < 0) { return false; } return _initialized; } } internal class BossShieldAnimation : MonoBehaviour { [CompilerGenerated] private sealed class <AnimationSequence>d__38 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BossShieldAnimation <>4__this; private float <frameStartDelay>5__2; private int <frameIndex>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimationSequence>d__38(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown int num = <>1__state; BossShieldAnimation bossShieldAnimation = <>4__this; float num2; switch (num) { default: return false; case 0: <>1__state = -1; bossShieldAnimation._isAnimating = true; <>2__current = (object)new WaitForSeconds(0.9f); <>1__state = 1; return true; case 1: <>1__state = -1; <frameStartDelay>5__2 = 0.3f; <frameIndex>5__3 = 0; goto IL_00f0; case 2: <>1__state = -1; goto IL_00de; case 3: { <>1__state = -1; bossShieldAnimation._isAnimating = false; bossShieldAnimation._frameCoroutines.Clear(); Log.Info("BossShieldAnimation: Animation sequence complete"); return false; } IL_00f0: if (<frameIndex>5__3 < 6) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } SpriteRenderer[]? shieldRenderers = bossShieldAnimation._shieldRenderers; SpriteRenderer val = ((shieldRenderers != null) ? shieldRenderers[<frameIndex>5__3] : null); if (!((Object)(object)val == (Object)null)) { Coroutine item = ((MonoBehaviour)bossShieldAnimation).StartCoroutine(bossShieldAnimation.FrameSequence(val, <frameIndex>5__3)); bossShieldAnimation._frameCoroutines.Add(item); <>2__current = (object)new WaitForSeconds(<frameStartDelay>5__2); <>1__state = 2; return true; } goto IL_00de; } num2 = 2.9999998f; <>2__current = (object)new WaitForSeconds(num2); <>1__state = 3; return true; IL_00de: <frameIndex>5__3++; goto IL_00f0; } } 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 <CancelFadeOut>d__37 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BossShieldAnimation <>4__this; private float <elapsed>5__2; private float[] <startAlphas>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CancelFadeOut>d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <startAlphas>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; BossShieldAnimation bossShieldAnimation = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; Log.Info("BossShieldAnimation: Starting cancel fade out"); <elapsed>5__2 = 0f; <startAlphas>5__3 = new float[6]; if (bossShieldAnimation._shieldRenderers == null) { break; } for (int i = 0; i < bossShieldAnimation._shieldRenderers.Length; i++) { if ((Object)(object)bossShieldAnimation._shieldRenderers[i] != (Object)null) { <startAlphas>5__3[i] = bossShieldAnimation._shieldRenderers[i].color.a; } } break; } case 1: <>1__state = -1; break; } if (<elapsed>5__2 < 0.2f) { <elapsed>5__2 += Time.deltaTime; float num2 = Mathf.Clamp01(<elapsed>5__2 / 0.2f); if (bossShieldAnimation._shieldRenderers != null) { for (int j = 0; j < bossShieldAnimation._shieldRenderers.Length; j++) { if ((Object)(object)bossShieldAnimation._shieldRenderers[j] != (Object)null) { float num3 = Mathf.Lerp(<startAlphas>5__3[j], 0f, num2); bossShieldAnimation._shieldRenderers[j].color = new Color(1f, 1f, 1f, num3); } } } <>2__current = null; <>1__state = 1; return true; } if (bossShieldAnimation._shieldRenderers != null) { SpriteRenderer[] shieldRenderers = bossShieldAnimation._shieldRenderers; foreach (SpriteRenderer val in shieldRenderers) { if ((Object)(object)val != (Object)null) { val.color = new Color(1f, 1f, 1f, 0f); } } } bossShieldAnimation._isAnimating = false; bossShieldAnimation._isCancelling = false; Log.Info("BossShieldAnimation: Cancel fade out complete"); 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 <FrameSequence>d__39 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BossShieldAnimation <>4__this; public SpriteRenderer renderer; private float <elapsed>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FrameSequence>d__39(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_04da: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; BossShieldAnimation bossShieldAnimation = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <elapsed>5__2 = 0f; goto IL_00d2; case 1: <>1__state = -1; goto IL_00d2; case 2: <>1__state = -1; goto IL_018f; case 3: <>1__state = -1; goto IL_020b; case 4: <>1__state = -1; goto IL_0294; case 5: <>1__state = -1; goto IL_030d; case 6: <>1__state = -1; goto IL_039c; case 7: <>1__state = -1; goto IL_0418; case 8: <>1__state = -1; goto IL_04b0; case 9: <>1__state = -1; goto IL_052d; case 10: { <>1__state = -1; break; } IL_00d2: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num2 = Mathf.Lerp(0f, 0.7f, Mathf.Clamp01(<elapsed>5__2 / 0.3f)); renderer.color = new Color(1f, 1f, 1f, num2); <>2__current = null; <>1__state = 1; return true; } renderer.color = new Color(1f, 1f, 1f, 0.7f); <elapsed>5__2 = 0f; goto IL_018f; IL_039c: if (<elapsed>5__2 < 0.4f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num3 = 1f - Mathf.Clamp01(<elapsed>5__2 / 0.4f); renderer.color = new Color(1f, 1f, 1f, num3); <>2__current = null; <>1__state = 6; return true; } renderer.color = new Color(1f, 1f, 1f, 0f); <elapsed>5__2 = 0f; goto IL_0418; IL_018f: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num4 = Mathf.Lerp(0.7f, 0f, Mathf.Clamp01(<elapsed>5__2 / 0.3f)); renderer.color = new Color(1f, 1f, 1f, num4); <>2__current = null; <>1__state = 2; return true; } renderer.color = new Color(1f, 1f, 1f, 0f); <elapsed>5__2 = 0f; goto IL_020b; IL_052d: if (<elapsed>5__2 < 0.25f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 9; return true; } <elapsed>5__2 = 0f; break; IL_020b: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 3; return true; } <elapsed>5__2 = 0f; goto IL_0294; IL_0294: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num5 = Mathf.Clamp01(<elapsed>5__2 / 0.3f); renderer.color = new Color(1f, 1f, 1f, num5); <>2__current = null; <>1__state = 4; return true; } renderer.color = new Color(1f, 1f, 1f, 1f); <elapsed>5__2 = 0f; goto IL_030d; IL_04b0: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num6 = Mathf.Lerp(0f, 0.7f, Mathf.Clamp01(<elapsed>5__2 / 0.3f)); renderer.color = new Color(1f, 1f, 1f, num6); <>2__current = null; <>1__state = 8; return true; } renderer.color = new Color(1f, 1f, 1f, 0.7f); <elapsed>5__2 = 0f; goto IL_052d; IL_030d: if (<elapsed>5__2 < 0.3f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 5; return true; } <elapsed>5__2 = 0f; goto IL_039c; IL_0418: if (<elapsed>5__2 < 0.5f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 7; return true; } <elapsed>5__2 = 0f; goto IL_04b0; } if (<elapsed>5__2 < 0.35f) { if (!bossShieldAnimation._isAnimating || bossShieldAnimation._isCancelling) { return false; } <elapsed>5__2 += Time.deltaTime; float num7 = Mathf.Lerp(0.7f, 0f, Mathf.Clamp01(<elapsed>5__2 / 0.35f)); renderer.color = new Color(1f, 1f, 1f, num7); <>2__current = null; <>1__state = 10; return true; } renderer.color = new Color(1f, 1f, 1f, 0f); 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 const float CAST_ANIMATION_DELAY = 0.9f; private const float SHIELD_SCALE = 1f; private const float PRE_FLASH_FADE_IN_DURATION = 0.3f; private const float PRE_FLASH_ALPHA = 0.7f; private const float PRE_FLASH_FADE_OUT_DURATION = 0.3f; private const float PRE_TO_MAIN_HOLD_DURATION = 0.3f; private const float MAIN_FADE_IN_DURATION = 0.3f; private const float MAIN_HOLD_DURATION = 0.3f; private const float MAIN_FADE_OUT_DURATION = 0.4f; private const float POST_FLASH_WAIT = 0.5f; private const float POST_FLASH_FADE_IN_DURATION = 0.3f; private const float POST_FLASH_ALPHA = 0.7f; private const float POST_FLASH_HOLD_DURATION = 0.25f; private const float POST_FLASH_FADE_OUT_DURATION = 0.35f; private const float CANCEL_FADE_OUT_DURATION = 0.2f; private const float OFFSET_X = 1.9f; private const float OFFSET_Y = -1f; private const int SHIELD_FRAME_COUNT = 6; private static Sprite[]? _shieldSprites; private static bool _spritesLoaded; private Transform? _bossTransform; private SpriteRenderer[]? _shieldRenderers; private Coroutine? _animationCoroutine; private List<Coroutine> _frameCoroutines = new List<Coroutine>(); private bool _isAnimating; private bool _isCancelling; private static BossShieldAnimation? _instance; internal static BossShieldAnimation? Instance => _instance; internal bool IsAnimating => _isAnimating; internal static void Initialize(GameObject bossObject) { if ((Object)(object)bossObject == (Object)null) { Log.Error("BossShieldAnimation: Cannot initialize - boss object is null"); return; } if (!_spritesLoaded) { LoadShieldSprites(); } _instance = bossObject.GetComponent<BossShieldAnimation>(); if ((Object)(object)_instance == (Object)null) { _instance = bossObject.AddComponent<BossShieldAnimation>(); } _instance._bossTransform = bossObject.transform; _instance.CreateShieldRenderers(); Log.Info("BossShieldAnimation: Initialized successfully"); } internal static void Reset() { if ((Object)(object)_instance != (Object)null) { _instance.StopAnimationImmediate(); _instance.DestroyShieldRenderers(); } _instance = null; Log.Info("BossShieldAnimation: Reset complete"); } private static void LoadShieldSprites() { //IL_004d: 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) _shieldSprites = (Sprite[]?)(object)new Sprite[6]; for (int i = 0; i < 6; i++) { Texture2D val = AssetManager.Get<Texture2D>($"silk_boss_shield{i}"); if ((Object)(object)val != (Object)null) { _shieldSprites[i] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 64f); } } _spritesLoaded = true; Log.Info($"BossShieldAnimation: Loaded {6} shield sprites"); } private void CreateShieldRenderers() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown DestroyShieldRenderers(); if (_shieldSprites == null) { Log.Error("BossShieldAnimation: Cannot create renderers - sprites not loaded"); return; } _shieldRenderers = (SpriteRenderer[]?)(object)new SpriteRenderer[6]; for (int i = 0; i < 6; i++) { GameObject val = new GameObject($"ShieldLayer_{i}"); val.transform.SetParent(((Component)this).transform); val.transform.localPosition = new Vector3(1.9f, -1f, 0f); val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one * 1f; SpriteRenderer val2 = val.AddComponent<SpriteRenderer>(); val2.sprite = _shieldSprites[i]; ((Renderer)val2).sortingLayerName = "Default"; ((Renderer)val2).sortingOrder = 100 + i; val2.color = new Color(1f, 1f, 1f, 0f); ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); ((Renderer)val2).material.SetInt("_SrcBlend", 5); ((Renderer)val2).material.SetInt("_DstBlend", 1); _shieldRenderers[i] = val2; } Log.Info($"BossShieldAnimation: Created {6} shield renderers"); } private void DestroyShieldRenderers() { if (_shieldRenderers == null) { return; } SpriteRenderer[] shieldRenderers = _shieldRenderers; foreach (SpriteRenderer val in shieldRenderers) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } _shieldRenderers = null; } internal void PlayAnimation() { if (_isAnimating) { Log.Info("BossShieldAnimation: Animation already playing, restarting"); StopAnimationImmediate(); } if (_shieldRenderers == null || _shieldSprites == null) { Log.Error("BossShieldAnimation: Cannot play renderers or sprites not initialized"); return; } _isCancelling = false; _animationCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimationSequence()); Log.Info("BossShieldAnimation: Started animation sequence"); } internal void StopAnimation() { if (_isCancelling) { return; } if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); _animationCoroutine = null; } foreach (Coroutine frameCoroutine in _frameCoroutines) { if (frameCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(frameCoroutine); } } _frameCoroutines.Clear(); if (_isAnimating && _shieldRenderers != null) { _isCancelling = true; ((MonoBehaviour)this).StartCoroutine(CancelFadeOut()); } else { _isAnimating = false; } Log.Info("BossShieldAnimation: Stopping animation with fade out"); } private void StopAnimationImmediate() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); _animationCoroutine = null; } foreach (Coroutine frameCoroutine in _frameCoroutines) { if (frameCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(frameCoroutine); } } _frameCoroutines.Clear(); _isAnimating = false; _isCancelling = false; if (_shieldRenderers != null) { SpriteRenderer[] shieldRenderers = _shieldRenderers; foreach (SpriteRenderer val in shieldRenderers) { if ((Object)(object)val != (Object)null) { val.color = new Color(1f, 1f, 1f, 0f); } } } Log.Info("BossShieldAnimation: Stopped animation immediately"); } [IteratorStateMachine(typeof(<CancelFadeOut>d__37))] private IEnumerator CancelFadeOut() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CancelFadeOut>d__37(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<AnimationSequence>d__38))] private IEnumerator AnimationSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimationSequence>d__38(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<FrameSequence>d__39))] private IEnumerator FrameSequence(SpriteRenderer renderer, int frameIndex) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FrameSequence>d__39(0) { <>4__this = this, renderer = renderer }; } internal static void TriggerShieldAnimation() { if ((Object)(object)_instance != (Object)null) { _instance.PlayAnimation(); } else { Log.Warn("BossShieldAnimation: Cannot trigger instance is null"); } } internal static void StopShieldAnimation() { if ((Object)(object)_instance != (Object)null) { _instance.StopAnimation(); } } private void OnDestroy() { StopAnimationImmediate(); DestroyShieldRenderers(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } internal class ExtraPins : MonoBehaviour { private const bool LogStateChanges = true; private const float BasicStompPinLXOffset = -1.3f; private const float BasicStompPinRXOffset = 1.3f; private const float BasicStompPinMXOffset = -1f; private const float BasicStompCloneXOffset = 3f; private const float BasicStompAfterSwipeRGroupOffset = 0f; private const float BasicStompAfterSwipeLGroupOffset = 0f; private const float StompAimLGroupXOffset = 1.8f; private const float StompAimRGroupXOffset = -1.8f; private const float DualStompPinLXOffset = 0f; private const float DualStompPinRXOffset = 0f; private const float DualStompPinMXOffset = -2f; private const float DualStompCloneXOffset = 3f; private const float StompDashLGroupXOffset = 1.8f; private const float StompDashRGroupXOffset = -1.8f; private const float DashStompPinLXOffset = 0f; private const float DashStompPinRXOffset = 0f; private const float DashStompPinMXOffset = -2f; private const float DashStompCloneXOffset = 3f; private const float SwipePinLYOffset = 0f; private const float SwipePinRYOffset = 3f; private const float SwipePinMYOffset = 0.5f; private const float SwipeCloneYOffset = -10.5f; private const float SwipeHighPinLYOffset = 0f; private const float SwipeHighPinRYOffset = 0f; private const float SwipeHighPinMYOffset = 0f; private const float SwipeHighCloneYOffset = -2f; private PlayMakerFSM _control; private GameObject Silk; private GameObject FingerBladeL; private GameObject FingerBladeR; private GameObject FingerBladeM; private GameObject FingerBladeClone; private bool _isSwipeHighActive; private GameObject[] ClonedBlades; private GameObject[] AllBlades; private string _handName = ""; private static string _lastMainAttack = ""; private static Dictionary<string, string> _swipeDirectionByHand = new Dictionary<string, string>(); private void Awake() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) Log.Info("ExtraPins.Awake() on " + ((Object)((Component)this).gameObject).name); _handName = ((Object)((Component)this).gameObject).name; _control = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Hand Control"); if ((Object)(object)_control == (Object)null) { Log.Error("ExtraPins: Could not find Hand Control FSM!"); return; } Silk = ((Component)((Component)this).gameObject.transform.parent).gameObject; Transform val = ((Component)this).gameObject.transform.Find("Finger Blade L"); Transform val2 = ((Component)this).gameObject.transform.Find("Finger Blade R"); Transform val3 = ((Component)this).gameObject.transform.Find("Finger Blade M"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { Log.Error("ExtraPins: Could not find pins"); return; } FingerBladeL = ((Component)val).gameObject; FingerBladeR = ((Component)val2).gameObject; FingerBladeM = ((Component)val3).gameObject; FingerBladeClone = Object.Instantiate<GameObject>(FingerBladeM, ((Component)this).gameObject.transform); ((Object)FingerBladeClone).name = "Finger Blade M (Clone)"; FingerBladeClone.transform.localPosition = FingerBladeM.transform.localPosition + new Vector3(3f, 0f, 0f); ClonedBlades = (GameObject[])(object)new GameObject[1] { FingerBladeClone }; AllBlades = (GameObject[])(object)new GameObject[4] { FingerBladeL, FingerBladeR, FingerBladeM, FingerBladeClone }; SetupClonedPins(); GameObject[] allBlades = AllBlades; foreach (GameObject val4 in allBlades) { if ((Object)(object)val4.GetComponent<FingerBlades>() == (Object)null) { val4.AddComponent<FingerBlades>(); } } InjectStateLogging(); InjectAttackTracking(); ModifyStompAttacks(); ModifySwipeAttacks(); ModifySwipeHighAttacks(); ModifySwipeRandomFloat(); SyncSwipeDirection(); Log.Info("ExtraPins: Setup complete for " + _handName); } private void SetupClonedPins() { GameObject[] clonedBlades = ClonedBlades; for (int i = 0; i < clonedBlades.Length; i++) { PlayMakerFSM val = FSMUtility.LocateMyFSM(clonedBlades[i], "Control"); if ((Object)(object)val == (Object)null) { continue; } FsmState state = val.GetState("Init"); if (state != null && state.Actions.Length > 1) { state.RemoveAction(1); } FsmGameObject fsmGameObject = val.Fsm.GetFsmGameObject("Silk Boss"); if (fsmGameObject != null) { fsmGameObject.Value = Silk; } FsmState state2 = val.GetState("Pause"); if (state2 != null) { state2.AddTransition("STOMP", "Set Stomp"); state2.AddTransition("SWIPE L", "Set Swipe L"); state2.AddTransition("SWIPE R", "Set Swipe R"); state2.AddTransition("SWIPE L QUICK", "Set Swipe L Q"); state2.AddTransition("SWIPE R QUICK", "Set Swipe R Q"); state2.AddTransition("STOMP QUICK", "Set Stomp Q"); } FsmState state3 = val.GetState("Return End"); if (state3 != null && state2 != null) { FsmTransition[] transitions = state3.Transitions; foreach (FsmTransition val2 in transitions) { if (val2.EventName == "FINISHED") { val2.ToFsmState = state2; val2.ToState = "Pause"; } } } val.SetState("Pause"); } } private void InjectStateLogging() { string[] obj = new string[16] { "Stomp", "Stomp Basic", "Stomp Aim", "Stomp Aim L", "Stomp Aim R", "Stomp Dash L", "Stomp Dash R", "Swipe L", "Swipe R", "Swipe Dir", "Swipe High L", "Swipe High R", "Attacking", "Attack Ready Frame", "Idle", "Prepare" }; _ = _handName; string[] array = obj; foreach (string stateName in array) { if (_control.TryGetState(stateName, out FsmState state)) { state?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { })); } } } private void InjectAttackTracking() { if (_control.TryGetState("Swipe L", out FsmState state)) { state?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { _lastMainAttack = "Swipe L"; })); } if (_control.TryGetState("Swipe R", out FsmState state2)) { state2?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { _lastMainAttack = "Swipe R"; })); } if (_control.TryGetState("Swipe High L", out FsmState state3)) { state3?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { _lastMainAttack = "Swipe High L"; })); } if (_control.TryGetState("Swipe High R", out FsmState state4)) { state4?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { _lastMainAttack = "Swipe High R"; })); } if (_control.TryGetState("Idle", out FsmState state5)) { state5?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { _ = _lastMainAttack != ""; _lastMainAttack = ""; FingerBlades.ClearAnglePattern(); })); } if (_control.TryGetState("Stomp Aim", out FsmState state6)) { state6?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { FingerBlades.CheckAndSetAnglePattern(); })); } } private void ModifyStompAttacks() { FsmFloat attackX = _control.Fsm.GetFsmFloat("Attack X"); if (attackX == null) { return; } FsmState state = _control.GetState("Stomp"); if (state != null) { FsmState val = _control.CopyState("Stomp", "Stomp Basic"); if (_control.TryGetState("Stomp Aim", out FsmState state2) && state2 != null) { FsmTransition[] transitions = state2.Transitions; foreach (FsmTransition val2 in transitions) { if (val2.ToState == "Stomp") { val2.ToState = "Stomp Basic"; val2.ToFsmState = val; } } state2.AddAction((FsmStateAction)(object)new InvokeMethod(delegate { float num = 0f; if (_lastMainAttack == "Swipe R") { num = 0f; } else if (_lastMainAttack == "Swipe L") { num = 0f; } if (num != 0f) { FsmFloat obj5 = attackX; obj5.Value += num; } })); } ModifyStompState(val, attackX, -1.3f, 1.3f, -1f, 3f, "Basic"); } if (_control.TryGetState("Stomp Aim L", out FsmState state3) && state3 != null) { for (int j = 0; j < state3.Actions.Length; j++) { FsmStateAction obj = state3.Actions[j]; FloatAdd val3 = (FloatAdd)(object)((obj is FloatAdd) ? obj : null); if (val3 != null) { float value = val3.add.Value; val3.add.Value = value + 1.8f; break; } } } if (_control.TryGetState("Stomp Aim R", out FsmState state4) && state4 != null) { for (int k = 0; k < state4.Actions.Length; k++) { FsmStateAction obj2 = state4.Actions[k]; FloatAdd val4 = (FloatAdd)(object)((obj2 is FloatAdd) ? obj2 : null); if (val4 != null) { float value2 = val4.add.Value; val4.add.Value = value2 + -1.8f; break; } } } if (_control.TryGetState("Stomp Dash L", out FsmState state5) && state5 != null) { for (int l = 0; l < state5.Actions.Length; l++) { FsmStateAction obj3 = state5.Actions[l]; FloatAdd val5 = (FloatAdd)(object)((obj3 is FloatAdd) ? obj3 : null); if (val5 != null) { float value3 = val5.add.Value; val5.add.Value = value3 + 1.8f; break; } } } if (_control.TryGetState("Stomp Dash R", out FsmState state6) && state6 != null) { for (int m = 0; m < state6.Actions.Length; m++) { FsmStateAction obj4 = state6.Actions[m]; FloatAdd val6 = (FloatAdd)(object)((obj4 is FloatAdd) ? obj4 : null); if (val6 != null) { float value4 = val6.add.Value; val6.add.Value = value4 + -1.8f; break; } } } if (state != null) { ModifyStompState(state, attackX, 0f, 0f, -2f, 3f, "Dual/Dash"); } } private void ModifyStompState(FsmState stompState, FsmFloat attackX, float pinLOffset, float pinROffset, float pinMOffset, float cloneOffset, string stompType) { int num = -1; int num2 = -1; int num3 = -1; int num4 = 0; for (int i = 0; i < stompState.Actions.Length; i++) { if (stompState.Actions[i] is SetFsmFloat) { switch (num4) { case 0: num = i; break; case 1: num2 = i; break; case 2: num3 = i; break; } num4++; } } if (num3 >= 0 && pinMOffset != 0f) { stompState.InsertAction(num3, (FsmStateAction)(object)FloatAdder(attackX, pinMOffset)); } if (num2 >= 0 && pinROffset != 0f) { stompState.InsertAction(num2, (FsmStateAction)(object)FloatAdder(attackX, pinROffset)); } if (num >= 0 && pinLOffset != 0f) { stompState.InsertAction(num, (FsmStateAction)(object)FloatAdder(attackX, pinLOffset)); } stompState.AddAction((FsmStateAction)(object)FloatAdder(attackX, cloneOffset)); stompState.AddAction((FsmStateAction)(object)FloatSender(FingerBladeClone, "Attack X", attackX)); stompState.AddAction((FsmStateAction)(object)EventSender(FingerBladeClone, "STOMP")); } private void ModifySwipeAttacks() { FsmFloat fsmFloat = _control.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat2 = _control.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat == null || fsmFloat2 == null) { return; } PlayMakerFSM val = FSMUtility.LocateMyFSM(FingerBladeM, "Control"); PlayMakerFSM val2 = FSMUtility.LocateMyFSM(FingerBladeClone, "Control"); if (_control.TryGetState("Swipe L", out FsmState state) && state != null) { int[] array = FindSetFsmFloatIndices(state, "Attack Y"); if (array.Length >= 3) { state.InsertAction(array[2], (FsmStateAction)(object)FloatAdder(fsmFloat2, 0.5f)); state.InsertAction(array[1], (FsmStateAction)(object)FloatAdder(fsmFloat2, 3f)); } } if (_control.TryGetState("Swipe R", out FsmState state2) && state2 != null) { int[] array2 = FindSetFsmFloatIndices(state2, "Attack Y"); if (array2.Length >= 3) { state2.InsertAction(array2[2], (FsmStateAction)(object)FloatAdder(fsmFloat2, 0.5f)); state2.InsertAction(array2[1], (FsmStateAction)(object)FloatAdder(fsmFloat2, 3f)); } } if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { SyncCloneWithPinM(val, val2, fsmFloat, fsmFloat2); } } private void SyncCloneWithPinM(PlayMakerFSM pinMControl, PlayMakerFSM cloneControl, FsmFloat attackX, FsmFloat attackY) { PlayMakerFSM pinMControl2 = pinMControl; PlayMakerFSM cloneControl2 = cloneControl; pinMControl2.Fsm.GetState("Set Swipe L")?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { FsmFloat fsmFloat13 = pinMControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat14 = pinMControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat13 != null && fsmFloat14 != null) { FsmFloat fsmFloat15 = cloneControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat16 = cloneControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat15 != null && fsmFloat16 != null) { fsmFloat15.Value = fsmFloat13.Value; float num4 = (_isSwipeHighActive ? (-2f) : (-10.5f)); fsmFloat16.Value = fsmFloat14.Value + num4; cloneControl2.SendEvent("SWIPE L"); } } })); pinMControl2.Fsm.GetState("Set Swipe R")?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { FsmFloat fsmFloat9 = pinMControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat10 = pinMControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat9 != null && fsmFloat10 != null) { FsmFloat fsmFloat11 = cloneControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat12 = cloneControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat11 != null && fsmFloat12 != null) { fsmFloat11.Value = fsmFloat9.Value; float num3 = (_isSwipeHighActive ? (-2f) : (-10.5f)); fsmFloat12.Value = fsmFloat10.Value + num3; cloneControl2.SendEvent("SWIPE R"); } } })); pinMControl2.Fsm.GetState("Set Swipe L Q")?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { FsmFloat fsmFloat5 = pinMControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat6 = pinMControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat5 != null && fsmFloat6 != null) { FsmFloat fsmFloat7 = cloneControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat8 = cloneControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat7 != null && fsmFloat8 != null) { fsmFloat7.Value = fsmFloat5.Value; float num2 = (_isSwipeHighActive ? (-2f) : (-10.5f)); fsmFloat8.Value = fsmFloat6.Value + num2; cloneControl2.SendEvent("SWIPE L QUICK"); } } })); pinMControl2.Fsm.GetState("Set Swipe R Q")?.InsertAction(0, (FsmStateAction)(object)new InvokeMethod(delegate { FsmFloat fsmFloat = pinMControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat2 = pinMControl2.Fsm.GetFsmFloat("Attack Y"); if (fsmFloat != null && fsmFloat2 != null) { FsmFloat fsmFloat3 = cloneControl2.Fsm.GetFsmFloat("Attack X"); FsmFloat fsmFloat4 = cloneControl2.Fsm.GetFsmFloat("Attack Y"); i