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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MoreKeybinds")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription(" Adds keyboard shortcuts for Refresh(R),Banish(F), and Skip(Q) buttons. Now you can piano your keyboard to level up even faster!")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("MoreKeybinds")]
[assembly: AssemblyTitle("MoreKeybinds")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 MoreKeybinds
{
[BepInPlugin("BedlessSleeper_MoreKeybinds", "MoreKeybinds", "0.1.1")]
public class Plugin : BasePlugin
{
public const string MODNAME = "MoreKeybinds";
public const string AUTHOR = "BedlessSleeper";
public const string GUID = "BedlessSleeper_MoreKeybinds";
public const string VERSION = "0.1.1";
internal static ManualLogSource log;
public static bool enableKeybinds;
public static GameObject levelupGO;
public static Button refreshButton;
public static Button banishButton;
public static Button skipButton;
private Harmony harmony;
public override void Load()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
log = ((BasePlugin)this).Log;
ManualLogSource val = log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MoreKeybinds");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] loading...");
}
val.LogInfo(val2);
try
{
harmony = new Harmony("BedlessSleeper_MoreKeybinds");
harmony.PatchAll();
ManualLogSource val3 = log;
val2 = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MoreKeybinds");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] patches applied successfully.");
}
val3.LogInfo(val2);
}
catch (Exception ex)
{
ManualLogSource val4 = log;
BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(15, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>("MoreKeybinds");
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("] Load error: ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Exception>(ex);
}
val4.LogError(val5);
}
}
}
[HarmonyPatch]
public static class LevelupScreen_OpenPatch
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("LevelupScreen");
return AccessTools.Method(type, "Open", (Type[])null, (Type[])null);
}
private static void Postfix(object __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Plugin.enableKeybinds = true;
Plugin.levelupGO = ((Component)(MonoBehaviour)__instance).gameObject;
string text = "New/W_Offers/Header/Footer/Buttons/";
Transform obj = Plugin.levelupGO.transform.Find(text + "B_Refresh");
Plugin.refreshButton = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null);
Transform obj2 = Plugin.levelupGO.transform.Find(text + "B_Banish");
Plugin.banishButton = ((obj2 != null) ? ((Component)obj2).GetComponent<Button>() : null);
Transform obj3 = Plugin.levelupGO.transform.Find(text + "B_Skip");
Plugin.skipButton = ((obj3 != null) ? ((Component)obj3).GetComponent<Button>() : null);
}
}
[HarmonyPatch]
public static class LevelupScreen_CloseLevelupScreenPatch
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("LevelupScreen");
return AccessTools.Method(type, "CloseLevelupScreen", (Type[])null, (Type[])null);
}
private static void Postfix()
{
Plugin.enableKeybinds = false;
Plugin.levelupGO = null;
Plugin.refreshButton = null;
Plugin.banishButton = null;
Plugin.skipButton = null;
}
}
[HarmonyPatch]
public static class LevelupScreen_OnClose
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("LevelupScreen");
return AccessTools.Method(type, "OnClose", (Type[])null, (Type[])null);
}
private static void Postfix()
{
Plugin.enableKeybinds = false;
Plugin.levelupGO = null;
Plugin.refreshButton = null;
Plugin.banishButton = null;
Plugin.skipButton = null;
}
}
[HarmonyPatch]
public static class LevelupScreen_UpdatePatch
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("LevelupScreen");
return AccessTools.Method(type, "Update", (Type[])null, (Type[])null);
}
private static void Postfix()
{
if (Plugin.enableKeybinds)
{
if (Input.GetKeyDown((KeyCode)114) && (Object)(object)Plugin.refreshButton != (Object)null && ((Component)Plugin.refreshButton).gameObject.activeInHierarchy && CanInputR())
{
((UnityEvent)Plugin.refreshButton.onClick).Invoke();
}
if (Input.GetKeyDown((KeyCode)102) && (Object)(object)Plugin.banishButton != (Object)null && ((Component)Plugin.banishButton).gameObject.activeInHierarchy && CanInputF())
{
((UnityEvent)Plugin.banishButton.onClick).Invoke();
}
if (Input.GetKeyDown((KeyCode)113) && (Object)(object)Plugin.skipButton != (Object)null && ((Component)Plugin.skipButton).gameObject.activeInHierarchy && CanInputQ())
{
((UnityEvent)Plugin.skipButton.onClick).Invoke();
}
}
}
private static bool CanInputR()
{
return true;
}
private static bool CanInputF()
{
return true;
}
private static bool CanInputQ()
{
return true;
}
}
}