using System; using System.Diagnostics; using System.IO; 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 GlobalSettings; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; [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("AccessibilityMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6+befaaeec1cef115c680be831b2e9703c07553f5d")] [assembly: AssemblyProduct("AccessibilityMod")] [assembly: AssemblyTitle("AccessibilityMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.6.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 AccessibilityMod { internal static class AccessibilityConfig { internal static ConfigEntry ModEnabled; internal static void Bind(ConfigFile config) { ModEnabled = config.Bind("General", "Enabled", true, "Master toggle for the Accessibility Mod."); } } [BepInPlugin("fireb0rn.AccessibilityMod", "Accessibility Mod", "1.0.6")] public class AccessibilityPlugin : BaseUnityPlugin { internal const string PluginGuid = "fireb0rn.AccessibilityMod"; internal const string PluginName = "Accessibility Mod"; internal const string PluginVersion = "1.0.6"; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) AccessibilityConfig.Bind(((BaseUnityPlugin)this).Config); string location = ((BaseUnityPlugin)this).Info.Location; AccessibilitySettings.Load((!string.IsNullOrEmpty(location)) ? Path.GetDirectoryName(location) : Paths.PluginPath, ((BaseUnityPlugin)this).Logger); new Harmony("fireb0rn.AccessibilityMod").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Accessibility Mod 1.0.6 loaded."); } } internal static class AccessibilitySettings { internal sealed class Data { public DiveDash diveDash { get; set; } = new DiveDash(); public NeutralPogo neutralPogo { get; set; } = new NeutralPogo(); } internal sealed class DiveDash { public bool enabled { get; set; } = true; public float speedBoost { get; set; } = 0.23f; } internal sealed class NeutralPogo { public bool enabled { get; set; } = true; public float speedBoost { get; set; } = 0.25f; } internal const string FileName = "settings.json"; internal static Data Current { get; private set; } = new Data(); internal static void Load(string directory, ManualLogSource logger) { Data data = new Data(); string text = Path.Combine(directory, "settings.json"); try { if (File.Exists(text)) { JsonConvert.PopulateObject(File.ReadAllText(text), (object)data); logger.LogInfo((object)("Loaded settings from " + text + ".")); } else { logger.LogInfo((object)("No settings.json found; writing defaults to " + text + ".")); } File.WriteAllText(text, JsonConvert.SerializeObject((object)data, (Formatting)1)); } catch (Exception ex) { logger.LogWarning((object)("Could not load settings.json; using defaults. " + ex.Message)); data = new Data(); } Current = data; } } [HarmonyPatch(typeof(HeroController), "FixedUpdate")] internal static class DiveDashSpeedEffect { private const float SprintSpeedRatio = 2.121212f; private static bool IsEnabled { get { if (AccessibilityConfig.ModEnabled.Value && AccessibilitySettings.Current.diveDash.enabled && PlayerData.instance != null && PlayerData.instance.hasDash) { return IsHunterCrestEquipped; } return false; } } private static bool IsHunterCrestEquipped { get { ToolCrest hunterCrest = Gameplay.HunterCrest; ToolCrest hunterCrest2 = Gameplay.HunterCrest2; ToolCrest hunterCrest3 = Gameplay.HunterCrest3; if ((!((Object)(object)hunterCrest != (Object)null) || !((ToolBase)hunterCrest).IsEquipped) && (!((Object)(object)hunterCrest2 != (Object)null) || !((ToolBase)hunterCrest2).IsEquipped)) { if ((Object)(object)hunterCrest3 != (Object)null) { return ((ToolBase)hunterCrest3).IsEquipped; } return false; } return true; } } [HarmonyPostfix] private static void BoostSprintSpeed(HeroController __instance) { //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (!IsEnabled || !__instance.cState.isSprinting || !__instance.cState.onGround || __instance.cState.downAttacking || __instance.cState.isBinding || __instance.IsSprintMasterActive || __instance.IsUsingQuickening) { return; } Rigidbody2D rb2d = __instance.rb2d; if ((Object)(object)rb2d == (Object)null) { return; } Vector2 linearVelocity = rb2d.linearVelocity; float num = Mathf.Abs(linearVelocity.x); if (!(num <= 0f)) { float speedBoost = AccessibilitySettings.Current.diveDash.speedBoost; if (linearVelocity.x > 0f == __instance.cState.facingRight && !__instance.cState.dashing && num < __instance.DASH_SPEED) { float num2 = __instance.RUN_SPEED * speedBoost; linearVelocity.x += Mathf.Sign(linearVelocity.x) * num2; num = Mathf.Abs(linearVelocity.x); } float num3 = __instance.RUN_SPEED * (2.121212f + speedBoost); if (num > num3) { linearVelocity.x = Mathf.Sign(linearVelocity.x) * num3; } rb2d.linearVelocity = linearVelocity; } } } [HarmonyPatch(typeof(HeroController), "Move")] internal static class NeutralPogoSpeedEffect { private static bool IsEnabled { get { if (AccessibilityConfig.ModEnabled.Value && AccessibilitySettings.Current.neutralPogo.enabled && PlayerData.instance != null) { return !PlayerData.instance.hasDash; } return false; } } private static bool IsPogoing(HeroController hc) { HeroControllerStates cState = hc.cState; if (!cState.downAttacking && !cState.downSpiking && !cState.downSpikeAntic && !cState.downSpikeBouncing && !cState.downSpikeBouncingShort && !cState.downSpikeRecovery && !cState.bouncing) { return cState.recoilingDrill; } return true; } [HarmonyPostfix] private static void BoostRunSpeed(HeroController __instance, bool useInput) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!IsEnabled || !useInput || __instance.cState.wallSliding || !__instance.cState.onGround || __instance.cState.isSprinting || __instance.cState.dashing || __instance.cState.isBinding || IsPogoing(__instance) || __instance.IsUsingQuickening) { return; } Rigidbody2D rb2d = __instance.rb2d; if (!((Object)(object)rb2d == (Object)null)) { float speedBoost = AccessibilitySettings.Current.neutralPogo.speedBoost; Vector2 linearVelocity = rb2d.linearVelocity; if (Mathf.Abs(linearVelocity.x) > 0f) { linearVelocity.x *= 1f + speedBoost; } float num = __instance.RUN_SPEED * (1f + speedBoost); if (Mathf.Abs(linearVelocity.x) > num) { linearVelocity.x = Mathf.Sign(linearVelocity.x) * num; } rb2d.linearVelocity = linearVelocity; } } } }