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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
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("SprintDoubleBind")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dc3e7376bfb4b1522fb0723f4fa1d4ab359818d4")]
[assembly: AssemblyProduct("SprintDoubleBind")]
[assembly: AssemblyTitle("SprintDoubleBind")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SprintDoubleBind
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kencul.SprintDoubleBind", "SprintDoubleBind", "1.0.0")]
public class SprintDoubleBind : BaseUnityPlugin
{
public const string PluginGUID = "kencul.SprintDoubleBind";
public const string PluginAuthor = "kencul";
public const string PluginName = "SprintDoubleBind";
public const string PluginVersion = "1.0.0";
private bool _keyPressedThisFrame = false;
public ConfigEntry<bool> SprintScrollUpEnabled { get; set; }
public ConfigEntry<bool> SprintScrollDownEnabled { get; set; }
public ConfigEntry<bool> SprintKeyEnabled { get; set; }
public ConfigEntry<KeyboardShortcut> SprintBindKey { get; set; }
public void Awake()
{
//IL_008e: 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_00e1: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
SprintScrollUpEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SprintScrollUpEnabled", false, "Enables scrolling up as a secondary keybind for sprinting");
SprintScrollDownEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SprintScrollDownEnabled", true, "Enable scrolling down as a secondary keybind for sprinting");
SprintKeyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SprintKeyEnabled", true, "Enables using a custom keybind as a secondary keybind for sprinting");
SprintBindKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "SprintBindKey", new KeyboardShortcut((KeyCode)326, Array.Empty<KeyCode>()), "The key/button that will toggle sprint if sprint key is enabled. Supports keyboard keys and mouse buttons");
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
AddConfigOptions();
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Configurable Sprint Mod initialized. Applying FixedUpdate Hook.");
PlayerCharacterMasterController.FixedUpdate += new hook_FixedUpdate(PlayerCharacterMasterController_FixedUpdate);
}
private void AddConfigOptions()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0056: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SprintScrollUpEnabled));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SprintScrollDownEnabled));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SprintKeyEnabled));
ModSettingsManager.AddOption((BaseOption)new KeyBindOption(SprintBindKey, new KeyBindConfig
{
checkIfDisabled = new IsDisabledDelegate(Check)
}));
}
private bool Check()
{
return !SprintKeyEnabled.Value;
}
public void Update()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (_keyPressedThisFrame)
{
return;
}
Vector2 mouseScrollDelta = Input.mouseScrollDelta;
if (SprintScrollDownEnabled.Value && mouseScrollDelta.y < 0f)
{
_keyPressedThisFrame = true;
}
if (SprintScrollUpEnabled.Value && mouseScrollDelta.y > 0f)
{
_keyPressedThisFrame = true;
}
if (SprintKeyEnabled.Value)
{
IInputSystem current = UnityInput.Current;
KeyboardShortcut value = SprintBindKey.Value;
if (current.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
_keyPressedThisFrame = true;
}
}
}
private void PlayerCharacterMasterController_FixedUpdate(orig_FixedUpdate orig, PlayerCharacterMasterController self)
{
orig.Invoke(self);
if (self.networkUser?.localUser != null && !self.networkUser.localUser.isUIFocused)
{
CharacterBody body = self.body;
InputBankTest bodyInputs = self.bodyInputs;
if ((Object)(object)body != (Object)null && (Object)(object)bodyInputs != (Object)null && _keyPressedThisFrame)
{
self.sprintInputPressReceived = true;
_keyPressedThisFrame = false;
}
}
}
public void OnDestroy()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
PlayerCharacterMasterController.FixedUpdate -= new hook_FixedUpdate(PlayerCharacterMasterController_FixedUpdate);
}
}
}