Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ForceAttackDirection v1.0.0
PogoOnly.dll
Decompiled 5 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GlobalEnums; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using Microsoft.CodeAnalysis; using Silksong.FsmUtil; [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("PogoOnly")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Force Attack Direction")] [assembly: AssemblyTitle("PogoOnly")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 PogoOnly { [BepInPlugin("PogoOnly", "Force Attack Direction", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [Harmony] public class Plugin : BaseUnityPlugin { private enum SprintAttackBlockMode { NoAttack, SprintAttack } private enum ForcedAttackDirection { NotForced, Horizontal, Up, Down } internal static ManualLogSource Logger; private static ConfigEntry<ForcedAttackDirection> forcedAttackDir; private static ConfigEntry<SprintAttackBlockMode> blockSprintAttack; private static FsmEvent pressedEvent; private static FsmEvent cancelEvent; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("PogoOnly"); forcedAttackDir = ((BaseUnityPlugin)this).Config.Bind<ForcedAttackDirection>("General", "Attack Direction", ForcedAttackDirection.Down, (ConfigDescription)null); blockSprintAttack = ((BaseUnityPlugin)this).Config.Bind<SprintAttackBlockMode>("General", "Sprint Attack", SprintAttackBlockMode.NoAttack, (ConfigDescription)null); val.PatchAll(); Logger.LogInfo((object)"Plugin PogoOnly is loaded!"); } private static AttackDirection GetAttackDirection(AttackDirection orig) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) return (AttackDirection)(forcedAttackDir.Value switch { ForcedAttackDirection.Horizontal => 0, ForcedAttackDirection.Up => 1, ForcedAttackDirection.Down => 2, _ => orig, }); } [HarmonyPatch(typeof(HeroController), "Attack")] [HarmonyPrefix] private static void Attack(ref AttackDirection attackDir) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected I4, but got Unknown attackDir = (AttackDirection)(int)GetAttackDirection(attackDir); } [HarmonyPatch(typeof(HeroController), "TryDoTerrainThunk")] [HarmonyPrefix] private static void TryDoTerrainThunk(ref AttackDirection attackDir) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected I4, but got Unknown attackDir = (AttackDirection)(int)GetAttackDirection(attackDir); } [HarmonyPatch(typeof(HeroController), "CanAttackAction")] [HarmonyPostfix] private static void CanAttackAction(HeroController __instance, ref bool __result) { if (forcedAttackDir.Value == ForcedAttackDirection.Down) { __result &= __instance.CanDownAttack(); } } [HarmonyPatch(typeof(HeroController), "CanDownAttack")] [HarmonyPostfix] private static void CanDownAttack(ref bool __result) { if (forcedAttackDir.Value != ForcedAttackDirection.Down && forcedAttackDir.Value != ForcedAttackDirection.NotForced) { __result = true; } } [HarmonyPatch(typeof(HeroController), "NearBench")] [HarmonyPostfix] private static void UpdateSprintFSM(HeroController __instance, bool isNearBench) { if (!isNearBench) { return; } string[] array = new string[3] { "Ground Sprint L", "Ground Sprint R", "Turn Anim" }; int[] array2 = new int[3] { 22, 23, 11 }; FsmEvent val3; for (int i = 0; i < array.Length; i++) { FsmState state = FsmUtil.GetState(__instance.sprintFSM, array[i]); FsmStateAction stateAction = FsmUtil.GetStateAction(state, array2[i]); GetWasButtonPressedQueued val = (GetWasButtonPressedQueued)(object)((stateAction is GetWasButtonPressedQueued) ? stateAction : null); if (val.PressedEvent != null) { pressedEvent = val.PressedEvent; } GetWasButtonPressedQueued val2 = val; SprintAttackBlockMode value = blockSprintAttack.Value; if (1 == 0) { } val3 = (FsmEvent)(value switch { SprintAttackBlockMode.NoAttack => null, SprintAttackBlockMode.SprintAttack => pressedEvent, _ => null, }); if (1 == 0) { } val2.PressedEvent = val3; } FsmState state2 = FsmUtil.GetState(__instance.sprintFSM, "Attack Cancel?"); FsmStateAction stateAction2 = FsmUtil.GetStateAction(state2, 0); ListenForLeft val4 = (ListenForLeft)(object)((stateAction2 is ListenForLeft) ? stateAction2 : null); if (val4.isPressed != null) { cancelEvent = val4.isPressed; } ListenForLeft val5 = val4; SprintAttackBlockMode value2 = blockSprintAttack.Value; if (1 == 0) { } val3 = (FsmEvent)(value2 switch { SprintAttackBlockMode.NoAttack => null, SprintAttackBlockMode.SprintAttack => cancelEvent, _ => null, }); if (1 == 0) { } val5.isPressed = val3; FsmStateAction stateAction3 = FsmUtil.GetStateAction(state2, 1); ListenForRight val6 = (ListenForRight)(object)((stateAction3 is ListenForRight) ? stateAction3 : null); ListenForRight val7 = val6; SprintAttackBlockMode value3 = blockSprintAttack.Value; if (1 == 0) { } val3 = (FsmEvent)(value3 switch { SprintAttackBlockMode.NoAttack => null, SprintAttackBlockMode.SprintAttack => cancelEvent, _ => null, }); if (1 == 0) { } val7.isPressed = val3; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "PogoOnly"; public const string PLUGIN_NAME = "Force Attack Direction"; public const string PLUGIN_VERSION = "1.0.0"; } }