using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using Silksong.FsmUtil;
using TeamCherry.Localization;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PhantomOfTheOrgan")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PhantomOfTheOrgan")]
[assembly: AssemblyTitle("PhantomOfTheOrgan")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 PhantomOfTheOrgan
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.zhorox.phantomoftheorgan", "PhantomOfTheOrgan", "1.0.0")]
public class PhantomOfTheOrganaPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(Language), "Get")]
[HarmonyPatch(new Type[]
{
typeof(string),
typeof(string)
})]
public static class Language_Get_Patch
{
private static void Postfix(string key, string sheetTitle, ref string __result)
{
if (key == "PHANTOM_MAIN")
{
__result = "Phantom";
}
if (key == "PHANTOM_SUB")
{
__result = "Of The Organ";
}
}
}
[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
private static class PlayMakerFSMPatch
{
private static void Postfix(PlayMakerFSM __instance)
{
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Expected O, but got Unknown
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_051c: Unknown result type (might be due to invalid IL or missing references)
//IL_0526: Expected O, but got Unknown
//IL_052b: Expected O, but got Unknown
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_0538: Unknown result type (might be due to invalid IL or missing references)
//IL_0542: Expected O, but got Unknown
//IL_0542: Unknown result type (might be due to invalid IL or missing references)
//IL_0549: Unknown result type (might be due to invalid IL or missing references)
//IL_0553: Expected O, but got Unknown
//IL_0553: Unknown result type (might be due to invalid IL or missing references)
//IL_055a: Unknown result type (might be due to invalid IL or missing references)
//IL_0564: Expected O, but got Unknown
//IL_0564: Unknown result type (might be due to invalid IL or missing references)
//IL_0570: Expected O, but got Unknown
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05e7: Expected O, but got Unknown
//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
//IL_05fc: Expected O, but got Unknown
//IL_0601: Expected O, but got Unknown
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0692: Unknown result type (might be due to invalid IL or missing references)
//IL_0693: Unknown result type (might be due to invalid IL or missing references)
//IL_069d: Expected O, but got Unknown
//IL_069d: Unknown result type (might be due to invalid IL or missing references)
//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
//IL_06b2: Expected O, but got Unknown
//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
//IL_06be: Expected O, but got Unknown
GameObject val = ((__instance != null) ? ((Component)__instance).gameObject : null);
if (!((Object)(object)val == (Object)null) && ((Object)val).name.StartsWith("phantom", StringComparison.OrdinalIgnoreCase) && string.Equals(__instance.FsmName, "Control", StringComparison.OrdinalIgnoreCase))
{
healthManager = ((Component)__instance).gameObject.GetComponent<HealthManager>();
healthManager.hp = 1200;
FsmState state = __instance.Fsm.GetState("Close Range");
FsmState state2 = __instance.Fsm.GetState("Far Range");
FsmState state3 = __instance.Fsm.GetState("G Pull Wait");
FsmState state4 = __instance.Fsm.GetState("A Pull Wait");
FsmState state5 = __instance.Fsm.GetState("A Thunk");
FsmState state6 = __instance.Fsm.GetState("Dragoon Blast");
FsmState state7 = __instance.Fsm.GetState("Run To");
FsmState state8 = __instance.Fsm.GetState("Run Away");
FsmState state9 = __instance.Fsm.GetState("Parry Stab");
FsmState state10 = __instance.Fsm.GetState("Init");
FsmState state11 = __instance.Fsm.GetState("Stab 1");
FsmState state12 = __instance.Fsm.GetState("Stab 3");
Wait val2 = state3.actions.OfType<Wait>().FirstOrDefault();
val2.time = FsmFloat.op_Implicit(0.01f);
Wait val3 = state4.actions.OfType<Wait>().FirstOrDefault();
val3.time = FsmFloat.op_Implicit(0.01f);
Wait val4 = state5.actions.OfType<Wait>().FirstOrDefault();
val4.time = FsmFloat.op_Implicit(0.01f);
SetVelocityByScale val5 = state11.actions.OfType<SetVelocityByScale>().FirstOrDefault();
val5.speed = FsmFloat.op_Implicit(-100f);
SetVelocityByScale val6 = state12.actions.OfType<SetVelocityByScale>().FirstOrDefault();
val6.speed = FsmFloat.op_Implicit(-100f);
SetVelocityByScale val7 = state7.actions.OfType<SetVelocityByScale>().FirstOrDefault();
val7.speed = FsmFloat.op_Implicit(-24f);
SetVelocityByScale val8 = state8.actions.OfType<SetVelocityByScale>().FirstOrDefault();
val8.speed = FsmFloat.op_Implicit(-18f);
Wait val9 = state6.actions.OfType<Wait>().FirstOrDefault();
val9.time = FsmFloat.op_Implicit(0.1f);
MultiplyIntByFloat val10 = state10.actions.OfType<MultiplyIntByFloat>().FirstOrDefault((Func<MultiplyIntByFloat, bool>)((MultiplyIntByFloat a) => ((NamedVariable)a.storeResult).Name == "Dragoon HP"));
val10.multiplyFloat = FsmFloat.op_Implicit(0.7f);
MultiplyIntByFloat val11 = state10.actions.OfType<MultiplyIntByFloat>().FirstOrDefault((Func<MultiplyIntByFloat, bool>)((MultiplyIntByFloat a) => ((NamedVariable)a.storeResult).Name == "Rage HP"));
val11.multiplyFloat = FsmFloat.op_Implicit(0.715f);
((Component)__instance).GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Jump Antic").fps = 40f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Stab 1").fps = 30f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Stab 2").fps = 30f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Stab 3").fps = 30f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().library.GetClipByName("Air Throw Antic").fps = 20f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().library.GetClipByName("Land").fps = 30f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().library.GetClipByName("Parry End").fps = 30f;
((Component)__instance).GetComponent<tk2dSpriteAnimator>().library.GetClipByName("Parry StabMiss").fps = 30f;
FsmUtil.CopyState(__instance, "Dragoon?", "Throw Rng");
FsmUtil.ChangeTransition(__instance, "Throw Rng", "FINISHED", "Phase Antic");
FsmUtil.ChangeTransition(__instance, "Throw Rng", "DRAGOON", "Parry Swipe");
FsmUtil.RemoveAction(__instance, "Throw Rng", 0);
FsmState state13 = FsmUtil.GetState(__instance, "Throw Rng");
SendRandomEventV4 val12 = state13.actions.OfType<SendRandomEventV4>().FirstOrDefault();
val12.weights = (FsmFloat[])(object)new FsmFloat[2]
{
FsmFloat.op_Implicit(0.7f),
FsmFloat.op_Implicit(0.3f)
};
val12.eventMax = (FsmInt[])(object)new FsmInt[2]
{
FsmInt.op_Implicit(2),
FsmInt.op_Implicit(1)
};
val12.missedMax = (FsmInt[])(object)new FsmInt[2]
{
FsmInt.op_Implicit(1),
FsmInt.op_Implicit(2)
};
FsmUtil.CopyState(__instance, "Stab Antic", "Pin Catch");
FsmUtil.ChangeTransition(__instance, "Catch Stab 1", "FINISHED", "Pin Catch");
FsmUtil.ChangeTransition(__instance, "Pin Catch", "FINISHED", "Throw Rng");
FsmUtil.AddAction(__instance, "Dragoon End", (FsmStateAction)new SetGravity2dScale
{
gameObject = new FsmOwnerDefault(),
gravityScale = new FsmFloat(FsmFloat.op_Implicit(2.5f))
});
FsmUtil.AddAction(__instance, "Dragoon End", (FsmStateAction)new SetInvincible
{
target = new FsmOwnerDefault(),
Invincible = new FsmBool(FsmBool.op_Implicit(false)),
InvincibleFromDirection = new FsmInt(FsmInt.op_Implicit(0)),
resetOnStateExit = false
});
FsmUtil.CopyState(__instance, "Dragoon?", "A Catch Tele");
FsmUtil.ChangeTransition(__instance, "A Catch", "FINISHED", "A Catch Tele");
FsmUtil.ChangeTransition(__instance, "A Catch Tele", "DRAGOON", "A Fall");
FsmUtil.ChangeTransition(__instance, "A Catch Tele", "FINISHED", "Phase Antic");
FsmUtil.RemoveAction(__instance, "A Catch Tele", 0);
FsmUtil.AddAction(__instance, "A Catch", (FsmStateAction)new SetGravity2dScale
{
gameObject = new FsmOwnerDefault(),
gravityScale = new FsmFloat(FsmFloat.op_Implicit(2.5f))
});
FsmState state14 = FsmUtil.GetState(__instance, "A Catch Tele");
SendRandomEventV4 val13 = state14.actions.OfType<SendRandomEventV4>().FirstOrDefault();
val13.weights = (FsmFloat[])(object)new FsmFloat[2]
{
FsmFloat.op_Implicit(0.3f),
FsmFloat.op_Implicit(0.7f)
};
val13.eventMax = (FsmInt[])(object)new FsmInt[2]
{
FsmInt.op_Implicit(2),
FsmInt.op_Implicit(3)
};
val13.missedMax = (FsmInt[])(object)new FsmInt[2]
{
FsmInt.op_Implicit(3),
FsmInt.op_Implicit(2)
};
FsmUtil.AddAction(__instance, "Phase Antic", (FsmStateAction)new DecelerateV2
{
gameObject = new FsmOwnerDefault(),
deceleration = new FsmFloat(FsmFloat.op_Implicit(0.8f)),
brakeOnExit = false
});
}
}
}
public static ManualLogSource Log;
internal static HealthManager healthManager;
public const string Id = "com.zhorox.phantomoftheorgan";
public static string Name => "PhantomOfTheOrgan";
public static string Version => "1.0.0";
private void Start()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(PlayMakerFSMPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(Language_Get_Patch), (string)null);
}
}
}