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 MurphysKeybindMenu v1.0.3
plugins/MurphysKeybindMenu.dll
Decompiled an hour agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; 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("MurphysKeybindMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MurphysKeybindMenu")] [assembly: AssemblyTitle("MurphysKeybindMenu")] [assembly: AssemblyVersion("1.0.0.0")] [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 MurphysKeybindMenu { internal sealed class CharacterFlight { private Component controller; private Rigidbody body; private bool originalGravity; private bool originalKinematic; private bool originalCollisions; private RigidbodyInterpolation originalInterpolation; private Vector3 direction; public bool Start(Component player, Component avatar) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (GameApi.Read<bool>(avatar, "isTumbling")) { return false; } Rigidbody component = player.GetComponent<Rigidbody>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } GameApi.Read<float>(player, "kinematicTimer"); originalGravity = component.useGravity; originalKinematic = component.isKinematic; originalCollisions = component.detectCollisions; originalInterpolation = component.interpolation; controller = player; body = component; if (!body.isKinematic) { body.velocity = Vector3.zero; body.angularVelocity = Vector3.zero; } body.interpolation = (RigidbodyInterpolation)1; KeepFlightPhysics(); return true; } private void KeepFlightPhysics() { GameApi.Write(controller, "kinematicTimer", 0.2f); body.useGravity = false; body.detectCollisions = false; body.isKinematic = true; } public bool Update(Component player, Component avatar, bool blocked) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) direction = Vector3.zero; if (!Object.op_Implicit((Object)(object)body) || (Object)(object)controller != (Object)(object)player || GameApi.Read<bool>(avatar, "isTumbling")) { return false; } KeepFlightPhysics(); GameApi.Write(controller, "InputDisableTimer", 0.2f); if (blocked) { return true; } Camera main = Camera.main; Transform val = (Object.op_Implicit((Object)(object)main) ? ((Component)main).transform : player.transform); direction = val.forward * (float)(Held((KeyCode)119) - Held((KeyCode)115)) + val.right * (float)(Held((KeyCode)100) - Held((KeyCode)97)) + Vector3.up * (float)(Held((KeyCode)32) - Held((KeyCode)306)); direction = Vector3.ClampMagnitude(direction, 1f) * (Input.GetKey((KeyCode)304) ? 10f : 5f); return true; } private static int Held(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Input.GetKey(key) ? 1 : 0; } public void Move() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)controller)) { KeepFlightPhysics(); body.MovePosition(body.position + direction * Time.fixedDeltaTime); } } public void Stop() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = body; Component val2 = controller; body = null; controller = null; direction = Vector3.zero; try { if (Object.op_Implicit((Object)(object)val2)) { GameApi.Write(val2, "kinematicTimer", 0f); } } finally { if (Object.op_Implicit((Object)(object)val)) { val.useGravity = originalGravity; val.detectCollisions = originalCollisions; val.isKinematic = originalKinematic; val.interpolation = originalInterpolation; if (!val.isKinematic) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } } } } } internal static class GameApi { private const BindingFlags MemberFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, Type> types = new Dictionary<string, Type>(); private static readonly Dictionary<(Type, string), MemberInfo> members = new Dictionary<(Type, string), MemberInfo>(); private static Assembly gameAssembly; private static Type GameType(string name) { if (types.TryGetValue(name, out var value)) { return value; } if (gameAssembly == null) { gameAssembly = Array.Find(AppDomain.CurrentDomain.GetAssemblies(), (Assembly assembly) => assembly.GetName().Name == "Assembly-CSharp"); } value = gameAssembly?.GetType(name) ?? throw new TypeLoadException(name); types.Add(name, value); return value; } private static MemberInfo FindMember(Type type, string name) { (Type, string) key = (type, name); if (members.TryGetValue(key, out var value)) { return value; } Type type2 = type; while (type2 != null) { value = type2.GetField(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (value != null) { return members[key] = value; } type2 = type2.BaseType; } Type type3 = type; while (type3 != null) { value = type3.GetProperty(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (value != null) { return members[key] = value; } type3 = type3.BaseType; } throw new MissingMemberException(type.FullName, name); } public static T Read<T>(object owner, string name) { MemberInfo memberInfo = FindMember((owner as Type) ?? owner.GetType(), name); object obj = ((owner is Type) ? null : owner); return (T)((memberInfo is FieldInfo fieldInfo) ? fieldInfo.GetValue(obj) : ((PropertyInfo)memberInfo).GetValue(obj)); } public static void Write(object owner, string name, object value) { MemberInfo memberInfo = FindMember(owner.GetType(), name); if (memberInfo is FieldInfo fieldInfo) { fieldInfo.SetValue(owner, value); } else { ((PropertyInfo)memberInfo).SetValue(owner, value); } } private static Component Instance(string type) { return Read<Component>(GameType(type), "instance"); } public static bool TryGetLivingPlayer(out Component controller, out Component avatar) { controller = Instance("PlayerController"); avatar = (Object.op_Implicit((Object)(object)controller) ? Read<Component>(controller, "playerAvatarScript") : null); if (Object.op_Implicit((Object)(object)avatar) && avatar.gameObject.activeInHierarchy && Read<bool>(avatar, "isLocal")) { return !Read<bool>(avatar, "deadSet"); } return false; } public static bool NativeInputBlocked(bool includePausePage) { Component val = Instance("MenuManager"); if (Object.op_Implicit((Object)(object)val) && Read<bool>(val, "textInputActive")) { return true; } if (includePausePage && Object.op_Implicit((Object)(object)val)) { object obj = Read<object>(val, "currentMenuPage"); Component val2 = (Component)((obj is Component) ? obj : null); if (val2 != null && Object.op_Implicit((Object)(object)val2) && val2.gameObject.activeInHierarchy) { return true; } } Component val3 = Instance("ChatManager"); if (Object.op_Implicit((Object)(object)val3)) { return Read<bool>(val3, "chatActive"); } return false; } } [BepInPlugin("com.murphyslavv.repo.keybindmenu", "Murphys Keybind Menu", "1.0.3")] public sealed class Plugin : BaseUnityPlugin { private enum Effect { GodMode, Fly, Sprint } private sealed class Binding { public string Label { get; } public ConfigEntry<KeyboardShortcut> Shortcut { get; } public bool Enabled { get; set; } public Binding(string label, ConfigEntry<KeyboardShortcut> shortcut) { Label = label; Shortcut = shortcut; } } private const KeyCode MenuKey = (KeyCode)292; private const int WindowId = 1296777729; private readonly Dictionary<Effect, Binding> bindings = new Dictionary<Effect, Binding>(); private readonly Dictionary<KeyCode, (Effect Effect, int Modifiers)> pressedShortcuts = new Dictionary<KeyCode, (Effect, int)>(); private readonly CharacterFlight flight = new CharacterFlight(); private Effect? capture; private Component activeAvatar; private Component godHealth; private bool originalGodMode; private bool visible; private bool cursorWasVisible; private bool flightInputBlocked; private bool livingPlayer; private CursorLockMode previousCursorLock; private Rect window; private GUIStyle statusStyle; private GUIStyle hudLabelStyle; private GUIStyle hudStateStyle; private GUIStyle creatorCreditStyle; private Texture2D signatureTexture; private bool signatureLoadAttempted; private string status = ""; private void Awake() { Bind(Effect.GodMode, "God Mode", (KeyCode)103); Bind(Effect.Fly, "Fly", (KeyCode)0); Bind(Effect.Sprint, "Infinite Sprint", (KeyCode)0); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Murphys Keybind Menu loaded. F11 opens the menu."); } private void Bind(Effect effect, string label, KeyCode defaultKey) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<KeyboardShortcut> shortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", effect.ToString(), new KeyboardShortcut(defaultKey, Array.Empty<KeyCode>()), "Toggle " + label); bindings.Add(effect, new Binding(label, shortcut)); } private void Update() { if (Application.isFocused && Input.GetKeyDown((KeyCode)292) && !capture.HasValue) { try { if (visible || !GameApi.NativeInputBlocked(includePausePage: false)) { SetVisible(!visible); } } catch (Exception error) { ReportError(error); } } else if (!visible && Application.isFocused && Input.anyKeyDown) { HandleShortcuts(); } if (visible && Application.isFocused) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } try { livingPlayer = GameApi.TryGetLivingPlayer(out var controller, out var avatar); if (activeAvatar == null) { return; } if (!livingPlayer || (Object)(object)avatar != (Object)(object)activeAvatar) { StopEffects(); return; } if (bindings[Effect.GodMode].Enabled) { KeepGodMode(avatar); } if (bindings[Effect.Sprint].Enabled) { GameApi.Write(controller, "EnergyCurrent", GameApi.Read<float>(controller, "EnergyStart")); } if (bindings[Effect.Fly].Enabled) { flightInputBlocked = visible || !Application.isFocused || GameApi.NativeInputBlocked(includePausePage: true); if (!flight.Update(controller, avatar, flightInputBlocked)) { bindings[Effect.Fly].Enabled = false; flight.Stop(); status = "Flight stopped. Stand up before enabling it again."; } } } catch (Exception error2) { if (activeAvatar == null) { livingPlayer = false; return; } StopEffects(); ReportError(error2); } } private void HandleShortcuts() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) pressedShortcuts.Clear(); foreach (KeyValuePair<Effect, Binding> binding in bindings) { KeyboardShortcut value = binding.Value.Shortcut.Value; KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey; if ((int)mainKey != 0 && (int)mainKey != 292 && (int)mainKey != 27 && Input.GetKeyDown(mainKey)) { int num = HeldModifierCount(value); if (num >= 0 && (!pressedShortcuts.TryGetValue(mainKey, out (Effect, int) value2) || num > value2.Item2)) { pressedShortcuts[mainKey] = (binding.Key, num); } } } if (pressedShortcuts.Count == 0) { return; } try { if (GameApi.NativeInputBlocked(includePausePage: true)) { status = "Close the game menu or chat to use shortcuts."; return; } foreach (var value3 in pressedShortcuts.Values) { Toggle(value3.Effect); } } catch (Exception error) { ReportError(error); } } private static int HeldModifierCount(KeyboardShortcut shortcut) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Input.GetKey(modifier)) { return -1; } num++; } return num; } private void FixedUpdate() { if (visible || flightInputBlocked || !Application.isFocused || !bindings[Effect.Fly].Enabled || !Object.op_Implicit((Object)(object)activeAvatar)) { return; } try { flight.Move(); } catch (Exception error) { StopEffects(); ReportError(error); } } private void Toggle(Effect effect) { Binding binding = bindings[effect]; try { if (binding.Enabled) { binding.Enabled = false; if (effect == Effect.GodMode) { RestoreGodMode(); } if (effect == Effect.Fly) { flight.Stop(); } if (!bindings[Effect.GodMode].Enabled && !bindings[Effect.Fly].Enabled && !bindings[Effect.Sprint].Enabled) { activeAvatar = null; } status = binding.Label + " off."; return; } if (!GameApi.TryGetLivingPlayer(out var controller, out var avatar)) { status = "Enter a run with a living player to enable " + binding.Label + "."; return; } if ((Object)(object)avatar != (Object)(object)activeAvatar) { StopEffects(); } if (effect == Effect.GodMode) { KeepGodMode(avatar); } if (effect == Effect.Fly) { flightInputBlocked = true; if (!flight.Start(controller, avatar)) { status = "Flight needs a ready player who is standing."; return; } } activeAvatar = avatar; binding.Enabled = true; status = binding.Label + " on."; } catch (Exception error) { StopEffects(); ReportError(error); } } private void KeepGodMode(Component avatar) { Component val = GameApi.Read<Component>(avatar, "playerHealth"); if (!Object.op_Implicit((Object)(object)val) || GameApi.Read<int>(val, "health") <= 0) { throw new InvalidOperationException("Local health is unavailable."); } if ((Object)(object)val != (Object)(object)godHealth) { RestoreGodMode(); originalGodMode = GameApi.Read<bool>(val, "godMode"); godHealth = val; } if (!GameApi.Read<bool>(val, "godMode")) { GameApi.Write(val, "godMode", true); } } private void RestoreGodMode() { Component val = godHealth; godHealth = null; if (Object.op_Implicit((Object)(object)val) && GameApi.Read<bool>(val, "godMode")) { GameApi.Write(val, "godMode", originalGodMode); } } private void StopEffects() { activeAvatar = null; foreach (Binding value in bindings.Values) { value.Enabled = false; } try { RestoreGodMode(); } catch (Exception error) { ReportError(error); } try { flight.Stop(); } catch (Exception error2) { ReportError(error2); } } private void ReportError(Exception error) { string message = error.GetBaseException().Message; status = "Unavailable: " + message; ((BaseUnityPlugin)this).Logger.LogWarning((object)status); } private void SetVisible(bool open) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (visible == open) { return; } visible = open; capture = null; if (open) { previousCursorLock = Cursor.lockState; cursorWasVisible = Cursor.visible; if (((Rect)(ref window)).width <= 0f) { window = new Rect(Mathf.Max(0f, ((float)Screen.width - 445f) * 0.5f), Mathf.Max(0f, ((float)Screen.height - 240f) * 0.4f), 445f, 0f); } } else { Cursor.lockState = previousCursorLock; Cursor.visible = cursorWasVisible; } } private void OnDisable() { SetVisible(open: false); StopEffects(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)signatureTexture)) { Object.Destroy((Object)(object)signatureTexture); } } private void OnGUI() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (livingPlayer && (int)Event.current.type == 7) { DrawStatusHud(); } if (visible) { window = GUILayout.Window(1296777729, window, new WindowFunction(DrawWindow), "Murphys Keybind Menu", Array.Empty<GUILayoutOption>()); } } private void DrawStatusHud() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) float num = (float)bindings.Count * 19f + 14f; Rect val = default(Rect); ((Rect)(ref val))..ctor(14f, (float)Screen.height - num - 14f, 176f, num); Color color = GUI.color; GUI.color = new Color(0.06f, 0.07f, 0.1f, 0.87f); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; if (hudLabelStyle == null) { hudLabelStyle = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)3 }; hudLabelStyle.normal.textColor = Color.white; hudStateStyle = new GUIStyle(hudLabelStyle) { alignment = (TextAnchor)5 }; } float num2 = ((Rect)(ref val)).y + 7f; using Dictionary<Effect, Binding>.Enumerator enumerator = bindings.GetEnumerator(); Binding value; string text; Color textColor = default(Color); float num4; for (; enumerator.MoveNext(); num4 = ((Rect)(ref val)).x + 7f, GUI.Label(new Rect(num4, num2, 103f, 19f), value.Label, hudLabelStyle), hudStateStyle.normal.textColor = textColor, GUI.Label(new Rect(num4 + 103f, num2, 59f, 19f), text, hudStateStyle), num2 += 19f) { KeyValuePair<Effect, Binding> current = enumerator.Current; value = current.Value; text = "OFF"; ((Color)(ref textColor))..ctor(0.72f, 0.76f, 0.82f); if (!value.Enabled) { continue; } int num3; object obj; if (current.Key == Effect.Fly) { num3 = (flightInputBlocked ? 1 : 0); if (num3 != 0) { obj = "PAUSED"; goto IL_013e; } } else { num3 = 0; } obj = "ON"; goto IL_013e; IL_013e: text = (string)obj; textColor = ((num3 != 0) ? new Color(1f, 0.77f, 0.42f) : new Color(0.48f, 0.91f, 0.71f)); } } private void DrawWindow(int id) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown CaptureKey(Event.current); DrawSignatureHeader(); foreach (KeyValuePair<Effect, Binding> binding in bindings) { DrawBinding(binding.Key, binding.Value); } string text = ((!capture.HasValue) ? status : ((status.Length > 0) ? status : ("Press a key or combination for " + bindings[capture.Value].Label + ". Esc cancels."))); if (text.Length > 0) { if (statusStyle == null) { statusStyle = new GUIStyle(GUI.skin.label) { wordWrap = true }; } GUILayout.Label(text, statusStyle, Array.Empty<GUILayoutOption>()); } if (GUILayout.Button("Close (F11)", Array.Empty<GUILayoutOption>())) { SetVisible(open: false); } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref window)).width, 20f)); } private void DrawSignatureHeader() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002a: Invalid comparison between Unknown and I4 //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown Rect rect = GUILayoutUtility.GetRect(290f, 29f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if ((int)Event.current.type != 7) { return; } if (!signatureLoadAttempted) { signatureLoadAttempted = true; try { using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("MurphysKeybindMenu.Signature.png"); if (stream == null) { throw new InvalidDataException("Signature resource missing."); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); signatureTexture = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; if (!ImageConversion.LoadImage(signatureTexture, memoryStream.ToArray(), true)) { throw new InvalidDataException("Signature image could not be decoded."); } } catch (Exception ex) { if (Object.op_Implicit((Object)(object)signatureTexture)) { Object.Destroy((Object)(object)signatureTexture); } signatureTexture = null; ((BaseUnityPlugin)this).Logger.LogWarning((object)("Menu signature unavailable: " + ex.Message)); } } Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 160f, ((Rect)(ref rect)).height); if (Object.op_Implicit((Object)(object)signatureTexture)) { GUI.DrawTexture(val, (Texture)(object)signatureTexture, (ScaleMode)2, true); } else { GUI.Label(val, "MurphysLavv"); } if (creatorCreditStyle == null) { creatorCreditStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)5, fontSize = 11 }; } GUI.Label(new Rect(((Rect)(ref val)).xMax, ((Rect)(ref rect)).y, ((Rect)(ref rect)).xMax - ((Rect)(ref val)).xMax, ((Rect)(ref rect)).height), "Created by Murphy.Dev", creatorCreditStyle); } private unsafe void DrawBinding(Effect effect, Binding binding) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = binding.Shortcut.Value; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(binding.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); GUILayout.Label(((int)((KeyboardShortcut)(ref value)).MainKey == 0) ? "Unbound" : ((object)(*(KeyboardShortcut*)(&value))/*cast due to .constrained prefix*/).ToString(), Array.Empty<GUILayoutOption>()); if (GUILayout.Button(binding.Enabled ? "On" : "Off", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { Toggle(effect); } if (GUILayout.Button("Change", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { capture = effect; status = ""; } if (GUILayout.Button("Unbind", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { capture = null; binding.Shortcut.Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()); status = binding.Label + " unbound."; } GUILayout.EndHorizontal(); } private unsafe void CaptureKey(Event input) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Invalid comparison between Unknown and I4 //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if (!capture.HasValue || (int)input.type != 4) { return; } KeyCode keyCode = input.keyCode; Effect value = capture.Value; if ((int)keyCode == 27) { capture = null; status = "Binding cancelled."; input.Use(); } else if ((int)keyCode != 0 && (int)keyCode != 304 && (int)keyCode != 303 && (int)keyCode != 306 && (int)keyCode != 305 && (int)keyCode != 308 && (int)keyCode != 307) { List<KeyCode> list = new List<KeyCode>(3); if (input.control) { list.Add((KeyCode)(Input.GetKey((KeyCode)305) ? 305 : 306)); } if (input.shift) { list.Add((KeyCode)(Input.GetKey((KeyCode)303) ? 303 : 304)); } if (input.alt) { list.Add((KeyCode)(Input.GetKey((KeyCode)307) ? 307 : 308)); } input.Use(); KeyboardShortcut val = default(KeyboardShortcut); ((KeyboardShortcut)(ref val))..ctor(keyCode, list.ToArray()); if ((int)keyCode == 292 || IsAssigned(value, val)) { status = "That shortcut is assigned. Choose another key or press Esc."; return; } Binding binding = bindings[value]; binding.Shortcut.Value = val; capture = null; string label = binding.Label; KeyboardShortcut val2 = val; status = label + " bound to " + ((object)(*(KeyboardShortcut*)(&val2))/*cast due to .constrained prefix*/).ToString() + "."; } } private bool IsAssigned(Effect effect, KeyboardShortcut shortcut) { //IL_002c: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Effect, Binding> binding in bindings) { if (binding.Key != effect && ((object)binding.Value.Shortcut.Value/*cast due to .constrained prefix*/).Equals((object?)shortcut)) { return true; } } return false; } } }