using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using JetBrains.Annotations;
using Nessie.ATLYSS.EasySettings;
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: AssemblyTitle("AtlyssItemTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AtlyssItemTweaks")]
[assembly: AssemblyCopyright("Copyright © crpz1 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("66fa1810-9987-4b06-aeee-7ed34abe5e0d")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
[assembly: AssemblyVersion("1.3.0.29")]
namespace AtlyssUIShortcuts;
[BepInPlugin("crpz.AtlyssUIShortcuts", "AtlyssUIShortcuts", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AtlyssUIShortcuts : BaseUnityPlugin
{
internal static ConfigEntry<bool> UnlockCursorConfig;
internal static ConfigEntry<bool> InviteConfig;
internal static ConfigEntry<bool> WorldPortalScrollConfig;
internal static ConfigEntry<bool> WorldPortalKeyHoldConfig;
internal static ConfigEntry<KeyCode> UnlockCursorBind;
internal static ConfigEntry<KeyCode> InviteAcceptBind;
internal static ConfigEntry<KeyCode> InviteDeclineBind;
internal static ConfigEntry<int> WorldPortalKeyHoldFrameDelay;
public static bool unlockedByUs;
private string[] delimiters = new string[1] { " (" };
private int currentHoldDelay = 0;
[CanBeNull]
internal static AtlyssUIShortcuts instance;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
InitConfig();
instance = this;
if (EasySettingsCompat.enabled)
{
EasySettingsCompat.SetupSettings();
}
Logger.Log((LogLevel)8, (object)"hii :3");
}
private void Update()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player._mainPlayer == (Object)null || (int)Player._mainPlayer._currentGameCondition != 1 || (Object)(object)CameraFunction._current == (Object)null)
{
return;
}
if (UnlockCursorConfig.Value)
{
if (unlockedByUs && !CameraFunction._current._unlockedCamera)
{
Logger.Log((LogLevel)32, (object)"unlocking because we were forced to");
unlockedByUs = false;
}
if (Input.GetKeyDown(UnlockCursorBind.Value) && !CameraFunction._current._unlockedCamera)
{
Logger.Log((LogLevel)32, (object)("KeyDownEvent: " + NameOfKey(UnlockCursorBind.Value)));
CameraFunction._current._unlockedCamera = true;
unlockedByUs = true;
}
else if (Input.GetKeyUp(UnlockCursorBind.Value) && unlockedByUs)
{
Logger.Log((LogLevel)32, (object)("KeyUpEvent: " + NameOfKey(UnlockCursorBind.Value)));
CameraFunction._current._unlockedCamera = false;
unlockedByUs = false;
}
}
HandleWorldPortalScroll();
HandleWorldPortalNavKeyHold();
if (!InviteConfig.Value || (Object)(object)AtlyssNetworkManager._current == (Object)null || (Object)(object)PartyUIManager._current == (Object)null || AtlyssNetworkManager._current._soloMode || (Object)(object)PartyUIManager._current._partyObject != (Object)null || !PartyUIManager._current._partyInviteElement.isEnabled)
{
return;
}
Text componentInChildren = ((Component)PartyUIManager._current._acceptInviteButton).GetComponentInChildren<Text>();
Text componentInChildren2 = ((Component)PartyUIManager._current._declineInviteButton).GetComponentInChildren<Text>();
if (!componentInChildren.text.Contains("(" + NameOfKey(InviteAcceptBind.Value) + ")"))
{
if (componentInChildren.text.Contains("("))
{
componentInChildren.text = componentInChildren.text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries)[0];
componentInChildren2.text = componentInChildren2.text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries)[0];
}
componentInChildren.text = componentInChildren.text + " (" + NameOfKey(InviteAcceptBind.Value) + ")";
componentInChildren2.text = componentInChildren2.text + " (" + NameOfKey(InviteDeclineBind.Value) + ")";
}
if (Input.GetKeyDown(InviteAcceptBind.Value))
{
Player._mainPlayer.Cmd_SetPartyInviteCondition((PartyInviteStatus)3);
}
if (Input.GetKeyDown(InviteDeclineBind.Value))
{
Player._mainPlayer.Cmd_SetPartyInviteCondition((PartyInviteStatus)4);
}
}
private void HandleWorldPortalNavKeyHold()
{
//IL_0077: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
if (!WorldPortalKeyHoldConfig.Value)
{
return;
}
WorldPortalManager current = WorldPortalManager._current;
if (!current._isOpen)
{
return;
}
if (Input.GetKeyDown((KeyCode)32))
{
Type type = ((object)current).GetType();
MethodInfo method = type.GetMethod("Init_WorldPortalTeleport", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(current, null);
}
return;
}
if (Input.GetKeyDown(InputControlManager.current._left) || Input.GetKeyDown(InputControlManager.current._right))
{
Logger.Log((LogLevel)32, (object)"HWPNKH: first frame");
currentHoldDelay = 21;
return;
}
if (currentHoldDelay > 0)
{
currentHoldDelay--;
return;
}
if (Input.GetKey(InputControlManager.current._left))
{
Logger.Log((LogLevel)32, (object)"HWPNKH: left");
WorldPortalManager._current.Change_ZoneSelectionPage(-1);
currentHoldDelay = WorldPortalKeyHoldFrameDelay.Value;
}
if (Input.GetKey(InputControlManager.current._right))
{
Logger.Log((LogLevel)32, (object)"HWPNKH: right");
WorldPortalManager._current.Change_ZoneSelectionPage(1);
currentHoldDelay = WorldPortalKeyHoldFrameDelay.Value;
}
}
private void HandleWorldPortalScroll()
{
//IL_004c: 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 (!WorldPortalScrollConfig.Value || (Object)(object)WorldPortalManager._current == (Object)null)
{
return;
}
WorldPortalManager current = WorldPortalManager._current;
if (current._isOpen)
{
int num = current.CurrentWorldPortalSelection;
if (Input.mouseScrollDelta.y < 0f)
{
num = ((num + 1 < current._worldPortalEntries.Count) ? (num + 1) : 0);
}
else if (Input.mouseScrollDelta.y > 0f)
{
num = ((num != 0) ? (num - 1) : (current._worldPortalEntries.Count - 1));
}
current.CurrentWorldPortalSelection = num;
}
}
private void InitConfig()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("Features", "UnlockCursorEnabled");
ConfigDescription val2 = new ConfigDescription("Enable unlocking the cursor with a keybind.", (AcceptableValueBase)null, Array.Empty<object>());
UnlockCursorConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(val, true, val2);
ConfigDefinition val3 = new ConfigDefinition("Features", "InviteBindEnable");
ConfigDescription val4 = new ConfigDescription("Enable accepting and declining party invites with a keybind.", (AcceptableValueBase)null, Array.Empty<object>());
InviteConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(val3, true, val4);
ConfigDefinition val5 = new ConfigDefinition("Features", "WorldPortalScrollEnabled");
ConfigDescription val6 = new ConfigDescription("Enable scrolling between waypoints on the world portal.", (AcceptableValueBase)null, Array.Empty<object>());
WorldPortalScrollConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(val5, true, val6);
ConfigDefinition val7 = new ConfigDefinition("Features", "WorldPortalKeyHoldEnabled");
ConfigDescription val8 = new ConfigDescription("Enable holding of left/right key to cycle through waypoints on the world portal.", (AcceptableValueBase)null, Array.Empty<object>());
WorldPortalKeyHoldConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(val7, true, val8);
ConfigDefinition val9 = new ConfigDefinition("Keybinds", "UnlockCursorKeybind");
ConfigDescription val10 = new ConfigDescription("Unlock Mouse", (AcceptableValueBase)null, Array.Empty<object>());
UnlockCursorBind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(val9, (KeyCode)308, val10);
ConfigDefinition val11 = new ConfigDefinition("Keybinds", "InviteAcceptKeybind");
ConfigDescription val12 = new ConfigDescription("Accept Invite", (AcceptableValueBase)null, Array.Empty<object>());
InviteAcceptBind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(val11, (KeyCode)121, val12);
ConfigDefinition val13 = new ConfigDefinition("Keybinds", "InviteDeclineKeybind");
ConfigDescription val14 = new ConfigDescription("Decline Invite", (AcceptableValueBase)null, Array.Empty<object>());
InviteDeclineBind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(val13, (KeyCode)110, val14);
ConfigDefinition val15 = new ConfigDefinition("Keybinds", "WPHoldFrameDelay");
AcceptableValueRange<int> val16 = new AcceptableValueRange<int>(0, 60);
ConfigDescription val17 = new ConfigDescription("Frames to wait before cycling to a new world portal waypoint while holding left/right", (AcceptableValueBase)(object)val16, Array.Empty<object>());
WorldPortalKeyHoldFrameDelay = ((BaseUnityPlugin)this).Config.Bind<int>(val15, 5, val17);
}
private string NameOfKey(KeyCode key)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return Enum.GetName(typeof(KeyCode), key);
}
}
public static class EasySettingsCompat
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__3_0;
internal void <SetupSettings>b__3_0()
{
((BaseUnityPlugin)AtlyssUIShortcuts.instance).Config.Save();
}
}
private static bool? _enabled;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("EasySettings");
}
return _enabled.Value;
}
}
public static void SetupSettings()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0031: 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_003c: Expected O, but got Unknown
Settings.OnInitialized.AddListener(new UnityAction(AddSettings));
UnityEvent onApplySettings = Settings.OnApplySettings;
object obj = <>c.<>9__3_0;
if (obj == null)
{
UnityAction val = delegate
{
((BaseUnityPlugin)AtlyssUIShortcuts.instance).Config.Save();
};
<>c.<>9__3_0 = val;
obj = (object)val;
}
onApplySettings.AddListener((UnityAction)obj);
}
private static void AddSettings()
{
SettingsTab modTab = Settings.ModTab;
modTab.AddHeader("UIShortcuts");
modTab.AddToggle(AtlyssUIShortcuts.UnlockCursorConfig);
modTab.AddToggle(AtlyssUIShortcuts.InviteConfig);
modTab.AddToggle(AtlyssUIShortcuts.WorldPortalScrollConfig);
modTab.AddToggle(AtlyssUIShortcuts.WorldPortalKeyHoldConfig);
modTab.AddSpace();
modTab.AddKeyButton(AtlyssUIShortcuts.UnlockCursorBind);
modTab.AddKeyButton(AtlyssUIShortcuts.InviteAcceptBind);
modTab.AddKeyButton(AtlyssUIShortcuts.InviteDeclineBind);
modTab.AddAdvancedSlider(AtlyssUIShortcuts.WorldPortalKeyHoldFrameDelay);
}
}