using 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 HarmonyLib;
using InControl;
using Microsoft.CodeAnalysis;
[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("MakeFloatGreatAgain")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+35046a866c7708a4efb9ded891c45f932a61ffd4")]
[assembly: AssemblyProduct("MakeFloatGreatAgain")]
[assembly: AssemblyTitle("Make_Float_Great_Again")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/DemoJameson/Silksong.MakeFloatGreatAgain")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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 Silksong.MakeFloatGreatAgain
{
[HarmonyPatch]
[BepInPlugin("com.demojameson.makefloatgreatagain", "Make Float Great Again", "1.3.0")]
public class MakeFloatGreatAgainPlugin : BaseUnityPlugin
{
private static ManualLogSource logger;
private static ConfigEntry<bool> enabled;
private static ConfigEntry<bool> allowHorizontalInput;
private static ConfigEntry<bool> downInput;
private static ConfigEntry<bool> upInput;
private static ConfigEntry<bool> needolinInput;
private static ConfigEntry<bool> quickMapInput;
private static ConfigEntry<bool> invertCondition;
private Harmony harmony;
public const string Id = "com.demojameson.makefloatgreatagain";
public static string Name => "Make Float Great Again";
public static string Version => "1.3.0";
private void Awake()
{
logger = ((BaseUnityPlugin)this).Logger;
enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Float Override", true, "Whether to enable float override functionality");
allowHorizontalInput = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Allow Horizontal Input", false, "Whether to allow horizontal input to trigger floating");
invertCondition = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Invert General.Inputs checks", false, "Whether to invert the result of General.Inputs checks");
downInput = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Inputs", "Hold Down", true, "Whether down input blocks double jump");
upInput = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Inputs", "Hold Up", false, "Whether up input blocks double jump");
needolinInput = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Inputs", "Hold Needolin", false, "Whether needolin input blocks double jump");
quickMapInput = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Inputs", "Hold Quick Map", false, "Whether quick map input blocks double jump");
harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
[HarmonyPatch(typeof(HeroController), "CanDoubleJump")]
[HarmonyPostfix]
private static void HeroControllerCanDoubleJump(HeroController __instance, ref bool __result)
{
if (__result && enabled.Value)
{
__result = !AllowFloat(__instance);
}
}
private static bool AllowFloat(HeroController heroController)
{
HeroActions inputActions = heroController.inputHandler.inputActions;
if (InvertCondition(Condition(downInput, ((OneAxisInputControl)inputActions.Down).IsPressed), Condition(upInput, ((OneAxisInputControl)inputActions.Up).IsPressed), Condition(needolinInput, ((OneAxisInputControl)inputActions.DreamNail).IsPressed), Condition(quickMapInput, ((OneAxisInputControl)inputActions.QuickMap).IsPressed)))
{
return HorizontalCondition(inputActions);
}
return false;
}
private static bool HorizontalCondition(HeroActions inputActions)
{
if (!allowHorizontalInput.Value)
{
if (!((OneAxisInputControl)inputActions.Right).IsPressed)
{
return !((OneAxisInputControl)inputActions.Left).IsPressed;
}
return false;
}
return true;
}
private static bool InvertCondition(params bool[] results)
{
bool flag = invertCondition.Value;
foreach (bool flag2 in results)
{
flag = (invertCondition.Value ? (flag && !flag2) : (flag || flag2));
}
return flag;
}
private static bool Condition(ConfigEntry<bool> isRequired, bool ifTrue)
{
if (!isRequired.Value)
{
return false;
}
return ifTrue;
}
}
}