using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Project too-many-emotes")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Project too-many-emotes")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a36e8062-eaaf-433e-bd67-e49ec781b591")] [assembly: AssemblyFileVersion("2.0.3.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("2.0.3.0")] namespace ATLYSSEmoteDeck; [BepInPlugin("com.eleen.atlyss.emotedeck", "Emote Deck", "2.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("ATLYSS.exe")] [DefaultExecutionOrder(-9000)] public class EmoteDeckPlugin : BaseUnityPlugin { public const string PluginGuid = "com.eleen.atlyss.emotedeck"; public const string PluginName = "Emote Deck"; public const string PluginVersion = "2.0.3"; public const int MaxPages = 10; public const int MaxSlots = 100; internal static EmoteDeckPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry CfgMainWindowKey; internal static ConfigEntry CfgGridWindowKey; internal static ConfigEntry CfgMainX; internal static ConfigEntry CfgMainY; internal static ConfigEntry CfgMainW; internal static ConfigEntry CfgMainH; internal static ConfigEntry CfgMainOpacity; internal static ConfigEntry CfgGridX; internal static ConfigEntry CfgGridY; internal static ConfigEntry CfgGridW; internal static ConfigEntry CfgGridH; internal static ConfigEntry CfgGridOpacity; internal static ConfigEntry CfgGridColumns; internal static ConfigEntry CfgGridIconAspect; internal static ConfigEntry CfgGridAutoColumns; internal static ConfigEntry CfgGridAutoIconAspect; internal static ConfigEntry CfgCloseGridAfterEmote; internal static ConfigEntry CfgGridViewMode; internal static ConfigEntry CfgGridMouseMode; internal static ConfigEntry CfgGridShowHeaderControls; internal static ConfigEntry CfgActiveSlotCount; internal static ConfigEntry CfgBlockGameInputWhileMainWindowOpen; internal static ConfigEntry CfgBlockGameInputWhileGridWindowOpen; internal static ConfigEntry CfgDebugLogging; internal static ConfigEntry CfgIncludeNativeVanillaWhenWheelBaseExists; internal static ConfigEntry CfgHiddenPackages; internal static ConfigEntry CfgEnableChatCommands; internal static ConfigEntry CfgEnableNamedSlotCommands; internal static ConfigEntry CfgEnableClosestNameMatch; internal static ConfigEntry CfgClosestMatchIncludeCustomCommands; internal static ConfigEntry CfgEnableCustomChatPrefix; internal static ConfigEntry CfgChatCommandPrefix; internal static ConfigEntry CfgEnableCustomSlotCommands; internal static ConfigEntry CfgDeckSlotKeys; internal static ConfigEntry CfgDeckCustomCommands; internal static ConfigEntry CfgMigratedCompactSlotStorage; internal static readonly ConfigEntry[] CfgSlotCustomCommands = new ConfigEntry[100]; internal static readonly ConfigEntry[] CfgPageCustomCommands = new ConfigEntry[10]; internal static ConfigEntry CfgEnablePages; internal static ConfigEntry CfgPageCount; internal static ConfigEntry CfgCurrentPage; internal static ConfigEntry[] CfgPageSlotKeys = new ConfigEntry[10]; internal static ConfigEntry CfgEnableRecent; internal static ConfigEntry CfgRecentLimit; internal static ConfigEntry CfgRecentKeys; internal static ConfigEntry CfgEnableFavorites; internal static ConfigEntry CfgFavoriteKeys; internal static ConfigEntry CfgAutoRescanEnabled; internal static ConfigEntry CfgPickerAutoAdvanceSlot; internal static ConfigEntry CfgPickerHideAssigned; internal static ConfigEntry CfgMigratedAutoAdvanceDefaultOff; internal static ConfigEntry CfgSettingsDeckOpen; internal static ConfigEntry CfgSettingsSystemsOpen; internal static ConfigEntry CfgSettingsEmotesOpen; internal static ConfigEntry CfgSettingsChatOpen; internal static ConfigEntry CfgSettingsGridOpen; internal static ConfigEntry CfgSettingsPickerOpen; internal static ConfigEntry CfgSettingsKeybindsOpen; internal static ConfigEntry CfgSettingsAdvancedOpen; internal static readonly ConfigEntry[] CfgSlotEmoteKeys = new ConfigEntry[100]; private KeyCode _mainWindowKey = (KeyCode)121; private KeyCode _gridWindowKey = (KeyCode)116; private EmoteDeckWindow _window; private Harmony _harmony; private float _nextAutoRefreshTime; private bool _forceNextAutoRefresh; private bool _configSaveQueued; private float _configSaveAt; private readonly HashSet _suppressedHotkeyActivations = new HashSet(); private int _suppressHotkeysUntilFrame; internal readonly List AllEmotes = new List(); internal readonly Dictionary EmotesByKey = new Dictionary(StringComparer.OrdinalIgnoreCase); internal readonly List PackageIds = new List(); internal readonly HashSet HiddenPackages = new HashSet(StringComparer.OrdinalIgnoreCase); internal readonly string[][] PageSlotKeys = new string[10][]; internal readonly string[][] PageCustomCommands = new string[10][]; internal readonly List RecentKeys = new List(); internal readonly List FavoriteKeys = new List(); private int _lastRegistryFingerprint; private static FieldInfo _chatEmoteBufferField; internal bool EmoteWheelBridgeAvailable { get; private set; } internal int LastWheelEmoteCount { get; private set; } internal int LastNativeEmoteCount { get; private set; } internal float LastRegistryRefreshTime { get; private set; } internal int RegistryRevision { get; private set; } internal int FilterRevision { get; private set; } internal int SlotRevision { get; private set; } internal int RecentRevision { get; private set; } internal int FavoriteRevision { get; private set; } internal KeyCode MainWindowKey => _mainWindowKey; internal KeyCode GridWindowKey => _gridWindowKey; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; BindConfig(); ReloadHotkeysFromConfig(); LoadHiddenPackagesFromConfig(); LoadPageSlotsFromConfig(); LoadCustomCommandsFromConfig(); LoadRecentAndFavoritesFromConfig(); RefreshEmoteRegistry(); ScheduleAutoRescan(1f, force: false); TryPatchHarmonyHooks(); _window = new EmoteDeckWindow(this); TrySetupEasySettingsBridge(); Log.LogInfo((object)("[EmoteDeck] Loaded 2.0.3 mainKey=" + ((object)Unsafe.As(ref _mainWindowKey)/*cast due to .constrained prefix*/).ToString() + " gridKey=" + ((object)Unsafe.As(ref _gridWindowKey)/*cast due to .constrained prefix*/).ToString() + " emotes=" + AllEmotes.Count)); } private void BindConfig() { CfgMainWindowKey = ((BaseUnityPlugin)this).Config.Bind("Input", "MainWindowKey", "Y", "Open/close the Emote Deck main window. Set to None to disable the global main-window hotkey."); CfgGridWindowKey = ((BaseUnityPlugin)this).Config.Bind("Input", "GridWindowKey", "T", "Open/close the Emote Grid window. Set to None to disable the global grid hotkey."); CfgMainX = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "X", 240f, "Main window X position."); CfgMainY = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Y", 120f, "Main window Y position."); CfgMainW = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Width", 620f, "Main window width."); CfgMainH = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Height", 640f, "Main window height."); CfgMainOpacity = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "ContentOpacity", 0.92f, "Opacity for main window content/background below the header. 0 = transparent, 1 = opaque."); CfgGridX = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "X", 260f, "Grid window X position."); CfgGridY = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Y", 160f, "Grid window Y position."); CfgGridW = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Width", 720f, "Grid window width."); CfgGridH = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Height", 480f, "Grid window height."); CfgGridOpacity = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Opacity", 0.88f, "Grid window content/background opacity. 0 = transparent, 1 = opaque."); CfgGridColumns = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Columns", 8, "Column count when AutoColumns is off."); CfgGridIconAspect = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "IconAspectRatio", 1f, "Icon width/height ratio when AutoIconAspectRatio is off. 1.0 = square, 1.3 = wider, 0.8 = taller."); CfgGridAutoColumns = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "AutoColumns", true, "Choose columns from the current grid width. This prevents clipped columns and horizontal scrolling."); CfgGridAutoIconAspect = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "AutoIconAspectRatio", true, "Use icon cells that scale with the grid width."); CfgCloseGridAfterEmote = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "CloseAfterEmote", true, "Close the grid window after clicking an emote."); CfgGridViewMode = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "View", "Standard", "Grid view: Standard, Compact, Mini, or Names."); CfgGridViewMode.Value = NormalizeGridViewModeValue(CfgGridViewMode.Value); CfgGridMouseMode = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "MouseMode", "Auto", "Grid mouse mode: Auto, Always, or Off. Auto unlocks only when Close grid after emote is on."); CfgGridMouseMode.Value = NormalizeGridMouseModeValue(CfgGridMouseMode.Value); CfgGridShowHeaderControls = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "ShowHeaderControls", true, "Show the second header row in the grid window."); CfgActiveSlotCount = ((BaseUnityPlugin)this).Config.Bind("Behavior", "ActiveSlotCount", 24, "Number of slots shown on each deck page. Range 1-100."); CfgBlockGameInputWhileMainWindowOpen = ((BaseUnityPlugin)this).Config.Bind("Behavior", "BlockGameInputWhileMainWindowOpen", false, "Block player movement, combat, hotbar, and interact input while the main window is open."); CfgBlockGameInputWhileGridWindowOpen = ((BaseUnityPlugin)this).Config.Bind("Behavior", "BlockGameInputWhileGridWindowOpen", false, "Block player movement, combat, hotbar, and interact input while the grid window is open."); CfgIncludeNativeVanillaWhenWheelBaseExists = ((BaseUnityPlugin)this).Config.Bind("Behavior", "IncludeNativeVanillaWhenWheelBaseExists", false, "Show native /emote commands even when Emote Wheel Base is available. Keeping this off usually avoids duplicates."); CfgHiddenPackages = ((BaseUnityPlugin)this).Config.Bind("Filters", "HiddenPackages", "", "Semicolon-separated package IDs hidden in Picker and Grid."); CfgEnableChatCommands = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "EnableChatCommands", true, "Allow commands like /ed 1 to play deck slots."); CfgEnableNamedSlotCommands = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "EnableNamedSlotCommands", true, "Allow /ed commands that use emote names, like /ed point or /ed fist bump."); CfgEnableClosestNameMatch = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "EnableClosestNameMatch", false, "If an /ed name command is close enough, play the nearest matching emote."); CfgClosestMatchIncludeCustomCommands = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "ClosestMatchIncludeCustomCommands", false, "Let closest match also check custom slot commands."); CfgEnableCustomChatPrefix = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "EnableCustomPrefix", false, "Allow the /ed command prefix to be changed."); CfgChatCommandPrefix = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "CommandPrefix", "/ed", "Prefix used for Emote Deck chat commands."); CfgChatCommandPrefix.Value = NormalizeChatCommandPrefix(CfgChatCommandPrefix.Value); CfgEnableCustomSlotCommands = ((BaseUnityPlugin)this).Config.Bind("ChatCommands", "EnableCustomSlotCommands", false, "Allow direct custom commands like /pnt. These can overlap with other slash commands."); CfgEnablePages = ((BaseUnityPlugin)this).Config.Bind("Pages", "EnablePages", false, "Enable separate Emote Deck pages."); CfgPageCount = ((BaseUnityPlugin)this).Config.Bind("Pages", "PageCount", 4, "Number of deck pages when pages are enabled. Range 1-10."); CfgCurrentPage = ((BaseUnityPlugin)this).Config.Bind("Pages", "CurrentPage", 1, "Current deck page. Range 1-10."); for (int i = 1; i < 10; i++) { CfgPageSlotKeys[i] = ((BaseUnityPlugin)this).Config.Bind("Pages", "Page" + (i + 1).ToString("D2", CultureInfo.InvariantCulture) + "Slots", "", "Packed slot keys for page " + (i + 1) + "."); CfgPageCustomCommands[i] = ((BaseUnityPlugin)this).Config.Bind("CustomCommands", "Page" + (i + 1).ToString("D2", CultureInfo.InvariantCulture) + "Commands", "", "Packed custom chat commands for page " + (i + 1) + "."); } CfgEnableRecent = ((BaseUnityPlugin)this).Config.Bind("Recent", "EnableRecent", false, "Show a Recent grid mode."); CfgRecentLimit = ((BaseUnityPlugin)this).Config.Bind("Recent", "RecentLimit", 24, "Maximum recent emotes to keep. Range 1-100."); CfgRecentKeys = ((BaseUnityPlugin)this).Config.Bind("Recent", "RecentKeys", "", "Packed recent emote keys."); CfgEnableFavorites = ((BaseUnityPlugin)this).Config.Bind("Favorites", "EnableFavorites", false, "Show a Favorites grid mode and star buttons."); CfgFavoriteKeys = ((BaseUnityPlugin)this).Config.Bind("Favorites", "FavoriteKeys", "", "Packed favorite emote keys."); CfgAutoRescanEnabled = ((BaseUnityPlugin)this).Config.Bind("Behavior", "AutoRescan", true, "Rescan after windows open so newly loaded emotes can appear."); CfgPickerAutoAdvanceSlot = ((BaseUnityPlugin)this).Config.Bind("Behavior", "PickerAutoAdvanceSlot", false, "After setting an emote in Picker, move to the next slot."); CfgPickerHideAssigned = ((BaseUnityPlugin)this).Config.Bind("Behavior", "PickerHideAssigned", false, "Hide emotes already assigned on any enabled page."); CfgMigratedAutoAdvanceDefaultOff = ((BaseUnityPlugin)this).Config.Bind("Migrations", "AutoAdvanceDefaultOff_0110", false, "Internal migration flag. Do not edit."); if (!CfgMigratedAutoAdvanceDefaultOff.Value) { CfgPickerAutoAdvanceSlot.Value = false; CfgMigratedAutoAdvanceDefaultOff.Value = true; } CfgDebugLogging = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugLogging", false, "Enable debug logs."); CfgSettingsDeckOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "DeckOpen", true, "Show the Deck settings section."); CfgSettingsSystemsOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "SystemsOpen", true, "Show the Pages/Recent/Favorites settings section."); CfgSettingsEmotesOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "EmotesOpen", true, "Show the Emotes and pack filters settings section."); CfgSettingsChatOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "ChatOpen", true, "Show the Chat commands settings section."); CfgSettingsGridOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "GridOpen", true, "Show the Grid settings section."); CfgSettingsPickerOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "PickerOpen", true, "Show the Picker settings section."); CfgSettingsKeybindsOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "KeybindsOpen", true, "Show the Keybinds settings section."); CfgSettingsAdvancedOpen = ((BaseUnityPlugin)this).Config.Bind("SettingsUI", "AdvancedOpen", true, "Show the Advanced settings section."); CfgDeckSlotKeys = ((BaseUnityPlugin)this).Config.Bind("Deck", "Page01Slots", DefaultPageOneSlots(), "Packed slot keys for page 1. Semicolon-separated. Empty trailing slots are omitted."); CfgDeckCustomCommands = ((BaseUnityPlugin)this).Config.Bind("Deck", "Page01Commands", "", "Packed custom slot commands for page 1. Semicolon-separated. Empty trailing slots are omitted."); CfgMigratedCompactSlotStorage = ((BaseUnityPlugin)this).Config.Bind("Migrations", "CompactSlotStorage_0201", false, "Internal migration flag. Do not edit."); MigrateLegacySlotConfigIfNeeded(); } private static string DefaultPageOneSlots() { return "Base:Point;Base:Clap;Base:Think;Base:Shrug;Base:Dance;Base:Taunt"; } private void MigrateLegacySlotConfigIfNeeded() { string[] array = new string[100]; string[] array2 = new string[100]; UnpackConfigList((CfgDeckSlotKeys != null) ? CfgDeckSlotKeys.Value : DefaultPageOneSlots(), array); UnpackConfigList((CfgDeckCustomCommands != null) ? CfgDeckCustomCommands.Value : string.Empty, array2); bool flag = false; bool flag2 = false; for (int i = 0; i < 100; i++) { string key = "Slot" + (i + 1).ToString("D3", CultureInfo.InvariantCulture); if (TryGetRawConfigValue("Slots", key, out var value)) { array[i] = value ?? string.Empty; flag = true; if (!string.IsNullOrEmpty(array[i])) { flag2 = true; } } if (TryGetRawConfigValue("CustomCommands", key, out var value2)) { array2[i] = (TryNormalizeCustomSlotCommand(value2, out var normalized, out var _) ? normalized : string.Empty); flag = true; if (!string.IsNullOrEmpty(array2[i])) { flag2 = true; } } } if (flag) { BackupLegacyConfigFileIfNeeded(); if (CfgDeckSlotKeys != null) { CfgDeckSlotKeys.Value = PackConfigList(array); } if (CfgDeckCustomCommands != null) { CfgDeckCustomCommands.Value = PackConfigList(array2); } RemoveLegacySlotConfigEntries(); if (CfgMigratedCompactSlotStorage != null) { CfgMigratedCompactSlotStorage.Value = true; } SavePluginConfig(); if (flag2 && Log != null) { Log.LogInfo((object)"[EmoteDeck] Legacy slot config migrated into compact storage."); } } else if (CfgMigratedCompactSlotStorage != null && !CfgMigratedCompactSlotStorage.Value) { CfgMigratedCompactSlotStorage.Value = true; SavePluginConfig(); } } private bool TryGetRawConfigValue(string section, string key, out string value) { value = null; if (TryGetRawConfigValueFromLoadedConfig(section, key, out value)) { return true; } if (TryGetRawConfigValueFromFile(section, key, out value)) { return true; } return false; } private bool TryGetRawConfigValueFromLoadedConfig(string section, string key, out string value) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown value = null; try { ConfigDefinition val = new ConfigDefinition(section, key); PropertyInfo property = typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value2 = property.GetValue(((BaseUnityPlugin)this).Config, null); if (value2 is IDictionary dictionary) { if (dictionary.Contains(val)) { object obj = dictionary[val]; value = ((obj != null) ? obj.ToString() : string.Empty); return true; } foreach (DictionaryEntry item in dictionary) { if (ConfigDefinitionMatches(item.Key, section, key)) { object value3 = item.Value; value = ((value3 != null) ? value3.ToString() : string.Empty); return true; } } } } MethodInfo method = typeof(ConfigFile).GetMethod("TryGetEntry", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { object[] array = new object[2] { val, null }; object obj2 = method.Invoke(((BaseUnityPlugin)this).Config, array); if (obj2 is bool && (bool)obj2 && array.Length > 1 && array[1] != null) { object obj3 = array[1]; PropertyInfo property2 = obj3.GetType().GetProperty("BoxedValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object obj4 = ((property2 != null) ? property2.GetValue(obj3, null) : obj3); value = ((obj4 != null) ? obj4.ToString() : string.Empty); return true; } } } catch { } return false; } private static bool ConfigDefinitionMatches(object definition, string section, string key) { if (definition == null) { return false; } try { ConfigDefinition val = (ConfigDefinition)((definition is ConfigDefinition) ? definition : null); if (val != (ConfigDefinition)null) { return string.Equals(val.Section, section, StringComparison.OrdinalIgnoreCase) && string.Equals(val.Key, key, StringComparison.OrdinalIgnoreCase); } Type type = definition.GetType(); PropertyInfo property = type.GetProperty("Section", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PropertyInfo property2 = type.GetProperty("Key", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); string a = ((property != null) ? (property.GetValue(definition, null) as string) : null); string a2 = ((property2 != null) ? (property2.GetValue(definition, null) as string) : null); return string.Equals(a, section, StringComparison.OrdinalIgnoreCase) && string.Equals(a2, key, StringComparison.OrdinalIgnoreCase); } catch { } return false; } private bool TryGetRawConfigValueFromFile(string section, string key, out string value) { value = null; try { string configFilePath = GetConfigFilePath(); if (string.IsNullOrEmpty(configFilePath) || !File.Exists(configFilePath)) { return false; } string a = string.Empty; string[] array = File.ReadAllLines(configFilePath); for (int i = 0; i < array.Length; i++) { string text = array[i] ?? string.Empty; string text2 = text.Trim(); if (text2.Length == 0 || text2.StartsWith("#")) { continue; } if (text2.StartsWith("[") && text2.EndsWith("]") && text2.Length >= 2) { a = text2.Substring(1, text2.Length - 2).Trim(); } else { if (!string.Equals(a, section, StringComparison.OrdinalIgnoreCase)) { continue; } int num = text.IndexOf('='); if (num >= 0) { string a2 = text.Substring(0, num).Trim(); if (string.Equals(a2, key, StringComparison.OrdinalIgnoreCase)) { value = text.Substring(num + 1).Trim(); return true; } } } } } catch { } return false; } private static string GetConfigFilePath() { try { string text = Path.Combine(Paths.ConfigPath, "com.eleen.atlyss.emotedeck.cfg"); if (!string.IsNullOrEmpty(text)) { return text; } } catch { } return null; } private void BackupLegacyConfigFileIfNeeded() { try { string configFilePath = GetConfigFilePath(); if (!string.IsNullOrEmpty(configFilePath) && File.Exists(configFilePath)) { string text = configFilePath + ".legacy-slot-backup"; if (!File.Exists(text)) { File.Copy(configFilePath, text, overwrite: false); } } } catch { } } private void RemoveLegacySlotConfigEntries() { for (int i = 0; i < 100; i++) { string key = "Slot" + (i + 1).ToString("D3", CultureInfo.InvariantCulture); RemoveConfigEntryIfPresent("Slots", key); RemoveConfigEntryIfPresent("CustomCommands", key); } } private void RemoveConfigEntryIfPresent(string section, string key) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown try { ConfigDefinition val = new ConfigDefinition(section, key); bool flag = false; MethodInfo method = typeof(ConfigFile).GetMethod("Remove", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(ConfigDefinition) }, null); if (method != null) { object obj = method.Invoke(((BaseUnityPlugin)this).Config, new object[1] { val }); flag = !(obj is bool) || (bool)obj; } PropertyInfo property = typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value = property.GetValue(((BaseUnityPlugin)this).Config, null); if (value is IDictionary dictionary) { if (dictionary.Contains(val)) { dictionary.Remove(val); flag = true; } else { ArrayList arrayList = new ArrayList(); foreach (DictionaryEntry item in dictionary) { if (ConfigDefinitionMatches(item.Key, section, key)) { arrayList.Add(item.Key); } } for (int i = 0; i < arrayList.Count; i++) { dictionary.Remove(arrayList[i]); flag = true; } } } } if (flag) { } } catch { } } private static void UnpackConfigList(string raw, string[] target) { if (target != null) { for (int i = 0; i < target.Length; i++) { target[i] = string.Empty; } string[] array = SplitConfigList(raw); int num = Math.Min(target.Length, array.Length); for (int j = 0; j < num; j++) { target[j] = array[j] ?? string.Empty; } } } private static string[] SplitConfigList(string raw) { if (string.IsNullOrEmpty(raw)) { return new string[0]; } return raw.Split(new char[1] { ';' }, StringSplitOptions.None); } private static string PackConfigList(string[] values) { if (values == null || values.Length == 0) { return string.Empty; } int num = -1; for (int num2 = values.Length - 1; num2 >= 0; num2--) { if (!string.IsNullOrEmpty(values[num2])) { num = num2; break; } } if (num < 0) { return string.Empty; } string[] array = new string[num + 1]; for (int i = 0; i <= num; i++) { array[i] = values[i] ?? string.Empty; } return string.Join(";", array); } internal static string NormalizeGridViewModeValue(string value) { if (string.IsNullOrEmpty(value)) { return "Standard"; } if (string.Equals(value, "Standard", StringComparison.OrdinalIgnoreCase)) { return "Standard"; } if (string.Equals(value, "Compact", StringComparison.OrdinalIgnoreCase)) { return "Compact"; } if (string.Equals(value, "Mini", StringComparison.OrdinalIgnoreCase)) { return "Mini"; } if (string.Equals(value, "Names", StringComparison.OrdinalIgnoreCase)) { return "Names"; } if (string.Equals(value, "Names only", StringComparison.OrdinalIgnoreCase)) { return "Names"; } return "Standard"; } internal static string GridViewModeLabel(string value) { value = NormalizeGridViewModeValue(value); if (value == "Names") { return "Names only"; } return value; } internal static string NormalizeGridMouseModeValue(string value) { if (string.IsNullOrEmpty(value)) { return "Auto"; } if (string.Equals(value, "Auto", StringComparison.OrdinalIgnoreCase)) { return "Auto"; } if (string.Equals(value, "Always", StringComparison.OrdinalIgnoreCase)) { return "Always"; } if (string.Equals(value, "Off", StringComparison.OrdinalIgnoreCase)) { return "Off"; } if (string.Equals(value, "Never", StringComparison.OrdinalIgnoreCase)) { return "Off"; } return "Auto"; } internal static string GridMouseModeLabel(string value) { return NormalizeGridMouseModeValue(value); } internal static string NormalizeChatCommandPrefix(string value) { string text = (value ?? string.Empty).Trim(); if (text.Length == 0) { return "/ed"; } if (!text.StartsWith("/")) { text = "/" + text; } int num = text.IndexOf(' '); if (num >= 0) { text = text.Substring(0, num); } text = text.Replace("<", string.Empty).Replace(">", string.Empty).Replace("\\0", string.Empty); if (text.Length < 2) { return "/ed"; } if (text.Length > 24) { text = text.Substring(0, 24); } return text; } internal static string GetActiveChatCommandPrefix() { if (CfgEnableCustomChatPrefix != null && CfgEnableCustomChatPrefix.Value) { return NormalizeChatCommandPrefix((CfgChatCommandPrefix != null) ? CfgChatCommandPrefix.Value : "/ed"); } return "/ed"; } internal static bool TryNormalizeCustomSlotCommand(string value, out string normalized, out string error) { normalized = string.Empty; error = null; string text = (value ?? string.Empty).Trim(); if (text.Length == 0) { return true; } if (!text.StartsWith("/")) { text = "/" + text; } if (text.Length < 2) { error = "Command is too short."; return false; } if (text.Length > 32) { error = "Command is too long."; return false; } if (text.IndexOfAny(new char[4] { ' ', '\t', '\r', '\n' }) >= 0) { error = "Use one command word only."; return false; } if (text.IndexOf('<') >= 0 || text.IndexOf('>') >= 0) { error = "Rich text characters are not allowed."; return false; } string activeChatCommandPrefix = GetActiveChatCommandPrefix(); if (string.Equals(text, "/ed", StringComparison.OrdinalIgnoreCase) || string.Equals(text, activeChatCommandPrefix, StringComparison.OrdinalIgnoreCase)) { error = "That command is already used by the slot command prefix."; return false; } normalized = text; return true; } internal static bool IsBlockedMouseBindKey(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 return (int)key == 323 || (int)key == 324; } internal static string KeyLabel(string value) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(value)) { return "None"; } if (!Enum.TryParse(value, ignoreCase: true, out KeyCode result)) { return value; } return KeyLabel(result); } internal unsafe static string KeyLabel(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 if ((int)key == 0) { return "None"; } if ((int)key == 323) { return "Left Mouse"; } if ((int)key == 324) { return "Right Mouse"; } if ((int)key == 325) { return "Middle Mouse"; } if ((int)key == 326) { return "Mouse 4"; } if ((int)key == 327) { return "Mouse 5"; } if ((int)key == 328) { return "Mouse 6"; } if ((int)key == 329) { return "Mouse 7"; } return ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(); } internal void SavePluginConfig() { try { _configSaveQueued = false; ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Config save failed: " + ex.Message)); } } internal void QueueConfigSave(float delaySeconds) { if (delaySeconds < 0.05f) { delaySeconds = 0.05f; } _configSaveQueued = true; _configSaveAt = Time.unscaledTime + delaySeconds; } internal void QueueConfigSave() { QueueConfigSave(0.6f); } internal void ScheduleAutoRescan(float delaySeconds, bool force) { if (CfgAutoRescanEnabled != null && CfgAutoRescanEnabled.Value) { if (delaySeconds < 0.05f) { delaySeconds = 0.05f; } float num = Time.unscaledTime + delaySeconds; if (_nextAutoRefreshTime <= 0f || num < _nextAutoRefreshTime) { _nextAutoRefreshTime = num; } if (force) { _forceNextAutoRefresh = true; } } } private void FlushQueuedConfigSaveIfDue() { if (_configSaveQueued && Time.unscaledTime >= _configSaveAt) { SavePluginConfig(); } } private void OnDestroy() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) EmoteDeckInputBlocker.SetWindowState(mainOpen: false, default(Rect), gridOpen: false, default(Rect), blockGameplayInput: false); try { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } catch { } if (_window != null) { _window.SaveOpenWindowRects(); } if (_configSaveQueued) { SavePluginConfig(); } } private void TryPatchHarmonyHooks() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { if (_harmony == null) { _harmony = new Harmony("com.eleen.atlyss.emotedeck"); } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Harmony init failed. Guards were skipped: " + ex.Message)); return; } TryPatchScrollRectOnScroll(); TryPatchGuiWindowPointerGuard(); TryPatchUiRaycastGuards(); TryPatchChatCommandGuard(); TryPatchGameplayInputGuards(); } private void TryPatchChatCommandGuard() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown try { if (_harmony == null) { _harmony = new Harmony("com.eleen.atlyss.emotedeck"); } MethodInfo methodInfo = AccessTools.Method(typeof(ChatBehaviour), "Cmd_SendChatMessage", new Type[2] { typeof(string), typeof(ChatChannel) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EmoteDeckChatCommandPatch), "Prefix", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Log.LogWarning((object)"[EmoteDeck] Chat command guard skipped: method lookup failed."); return; } _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[EmoteDeck] Chat command guard patched."); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Chat command guard failed and was skipped: " + ex.Message)); } } private void TryPatchScrollRectOnScroll() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown try { Type type = FindType("UnityEngine.UI.ScrollRect"); Type type2 = FindType("UnityEngine.EventSystems.PointerEventData"); if (type == null || type2 == null) { Log.LogWarning((object)"[EmoteDeck] ScrollRect.OnScroll guard skipped: Unity UI/EventSystems types were not found."); return; } MethodInfo methodInfo = AccessTools.Method(type, "OnScroll", new Type[1] { type2 }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EmoteDeckScrollRectOnScrollPatch), "Prefix", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Log.LogWarning((object)"[EmoteDeck] ScrollRect.OnScroll guard skipped: method lookup failed."); return; } _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[EmoteDeck] ScrollRect.OnScroll guard patched."); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] ScrollRect.OnScroll guard failed and was skipped: " + ex.Message)); } } private void TryPatchGuiWindowPointerGuard() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown try { if (_harmony == null) { _harmony = new Harmony("com.eleen.atlyss.emotedeck"); } MethodInfo methodInfo = AccessTools.Method(typeof(EmoteDeckGuiWindowPointerPatch), "Prefix", (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogWarning((object)"[EmoteDeck] GUI.Window pointer guard skipped: prefix lookup failed."); return; } int num = 0; MethodInfo[] methods = typeof(GUI).GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo2 in methods) { if (!(methodInfo2 == null) && !(methodInfo2.Name != "Window") && !(methodInfo2.ReturnType != typeof(Rect))) { ParameterInfo[] parameters = methodInfo2.GetParameters(); if (parameters.Length >= 2 && !(parameters[0].ParameterType != typeof(int)) && !(parameters[1].ParameterType != typeof(Rect))) { _harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } } } Log.LogInfo((object)("[EmoteDeck] GUI.Window pointer guards patched: " + num + ".")); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] GUI.Window pointer guard failed and was skipped: " + ex.Message)); } } private void TryPatchUiRaycastGuards() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown try { if (_harmony == null) { _harmony = new Harmony("com.eleen.atlyss.emotedeck"); } Type type = FindType("UnityEngine.EventSystems.EventSystem"); Type type2 = FindType("UnityEngine.EventSystems.PointerEventData"); Type type3 = FindType("UnityEngine.EventSystems.RaycastResult"); if (type == null || type2 == null || type3 == null) { Log.LogWarning((object)"[EmoteDeck] EventSystem.RaycastAll guard skipped: EventSystem types were not found."); return; } Type type4 = typeof(List<>).MakeGenericType(type3); MethodInfo methodInfo = AccessTools.Method(type, "RaycastAll", new Type[2] { type2, type4 }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EmoteDeckEventSystemRaycastAllPatch), "Postfix", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Log.LogWarning((object)"[EmoteDeck] EventSystem.RaycastAll guard skipped: method lookup failed."); return; } _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[EmoteDeck] EventSystem.RaycastAll pointer guard patched."); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] EventSystem.RaycastAll guard failed and was skipped: " + ex.Message)); } } private void TryPatchGameplayInputGuards() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown try { int patched = 0; MethodInfo prefix = AccessTools.Method(typeof(EmoteDeckGameplayInputPatch), "Prefix", (Type[])null, (Type[])null); MethodInfo methodInfo = AccessTools.Method(typeof(EmoteDeckPlayerLocalParamsPatch), "Postfix", (Type[])null, (Type[])null); TryPatchPrefix(typeof(PlayerMove), "Handle_MovementControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerMove), "Handle_DashControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerMove), "Handle_JumpControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCasting), "Client_SkillControl", prefix, ref patched); TryPatchPrefix(typeof(ActionBarManager), "OnActionkeyPress", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_WeaponSheatheControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_QuickSwapWeaponControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_CombatControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerInteract), "Handle_InteractControl", prefix, ref patched); MethodInfo methodInfo2 = FindPlayerLocalParamsMethod(); if (methodInfo2 != null && methodInfo != null) { _harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); patched++; } else { Log.LogWarning((object)"[EmoteDeck] Player._inUI postfix guard skipped: method lookup failed."); } Log.LogInfo((object)("[EmoteDeck] Gameplay input guards patched: " + patched + ".")); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Gameplay input guard patch failed and was skipped: " + ex.Message)); } } private void TryPatchPrefix(Type type, string methodName, MethodInfo prefix, ref int patched) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown try { if (!(type == null) && !(prefix == null)) { MethodInfo methodInfo = AccessTools.Method(type, methodName, (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogWarning((object)("[EmoteDeck] Input guard skipped: " + type.Name + "." + methodName + " not found.")); } else { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(prefix), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); patched++; } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Input guard failed: " + type.Name + "." + methodName + ": " + ex.Message)); } } private static MethodInfo FindPlayerLocalParamsMethod() { try { MethodInfo[] methods = typeof(Player).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo == null)) { string text = methodInfo.Name ?? string.Empty; if (text.IndexOf("Handle_LocalParams", StringComparison.Ordinal) >= 0) { return methodInfo; } } } } catch { } return null; } internal void ReloadHotkeysFromConfig() { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) _mainWindowKey = ParseOptionalKeyCode(CfgMainWindowKey.Value, "MainWindowKey"); _gridWindowKey = ParseOptionalKeyCode(CfgGridWindowKey.Value, "GridWindowKey"); } private void TrySetupEasySettingsBridge() { EmoteDeckEasySettingsBridge.TryInstall(this); ((MonoBehaviour)this).StartCoroutine(EmoteDeckEasySettingsBridge.DelayedInstall(this)); } internal unsafe void SetMainWindowKeyFromEasySettings(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (IsBlockedMouseBindKey(key)) { EmoteDeckEasySettingsBridge.ResetMainKeyButton(this); return; } CfgMainWindowKey.Value = (((int)key == 0) ? "None" : ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString()); ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(this); SuppressHotkeyActivationUntilReleased(key); QueueConfigSave(0.15f); } internal unsafe void SetGridWindowKeyFromEasySettings(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (IsBlockedMouseBindKey(key)) { EmoteDeckEasySettingsBridge.ResetGridKeyButton(this); return; } CfgGridWindowKey.Value = (((int)key == 0) ? "None" : ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString()); ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(this); SuppressHotkeyActivationUntilReleased(key); QueueConfigSave(0.15f); } internal unsafe static KeyCode ParseRequiredKeyCode(string value, KeyCode fallback, string name) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(value) && Enum.TryParse(value, ignoreCase: true, out KeyCode result) && (int)result != 0 && !IsBlockedMouseBindKey(result)) { return result; } if (Log != null) { Log.LogWarning((object)("[EmoteDeck] Invalid or disabled required key " + name + "='" + value + "'. Falling back to " + ((object)(*(KeyCode*)(&fallback))/*cast due to .constrained prefix*/).ToString() + ".")); } return fallback; } internal static KeyCode ParseOptionalKeyCode(string value, string name) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) if (string.IsNullOrWhiteSpace(value) || string.Equals(value, "None", StringComparison.OrdinalIgnoreCase)) { return (KeyCode)0; } if (Enum.TryParse(value, ignoreCase: true, out KeyCode result) && !IsBlockedMouseBindKey(result)) { return result; } if (Log != null) { Log.LogWarning((object)("[EmoteDeck] Invalid optional key " + name + "='" + value + "'. Disabling it.")); } return (KeyCode)0; } internal void SuppressHotkeyActivationUntilReleased(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000b: 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) if ((int)key != 0 && !IsBlockedMouseBindKey(key)) { _suppressedHotkeyActivations.Add(key); int num = Time.frameCount + 2; if (num > _suppressHotkeysUntilFrame) { _suppressHotkeysUntilFrame = num; } } } private void UpdateSuppressedHotkeyActivations() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (_suppressedHotkeyActivations.Count == 0 || Time.frameCount <= _suppressHotkeysUntilFrame) { return; } List list = null; foreach (KeyCode suppressedHotkeyActivation in _suppressedHotkeyActivations) { if (!IsKeyCurrentlyHeld(suppressedHotkeyActivation)) { if (list == null) { list = new List(); } list.Add(suppressedHotkeyActivation); } } if (list != null) { for (int i = 0; i < list.Count; i++) { _suppressedHotkeyActivations.Remove(list[i]); } } } private bool IsHotkeyActivationSuppressed(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } return _suppressedHotkeyActivations.Contains(key); } private static bool IsKeyCurrentlyHeld(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } try { return Input.GetKey(key); } catch { return false; } } private void Update() { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) if (_window == null) { return; } UpdateSuppressedHotkeyActivations(); EmoteDeckEasySettingsBridge.PollSync(this); if (_window.IsCapturingKeyBind) { return; } if (CfgAutoRescanEnabled.Value && _nextAutoRefreshTime > 0f && Time.unscaledTime >= _nextAutoRefreshTime) { bool flag = _window.IsMainOpen || _window.IsGridOpen; bool flag2 = _forceNextAutoRefresh || AllEmotes.Count == 0; _forceNextAutoRefresh = false; if (flag2 || flag) { if (flag2) { RefreshEmoteRegistry(); } else { RefreshEmoteRegistryIfChanged(); } _nextAutoRefreshTime = (flag ? (Time.unscaledTime + ((AllEmotes.Count == 0) ? 3f : 10f)) : 0f); } else { _nextAutoRefreshTime = 0f; } } if (!IsChatTyping()) { if ((int)_mainWindowKey != 0 && Input.GetKeyDown(_mainWindowKey) && !IsHotkeyActivationSuppressed(_mainWindowKey)) { _window.ToggleMainWindow(); return; } if ((int)_gridWindowKey != 0 && _gridWindowKey != _mainWindowKey && Input.GetKeyDown(_gridWindowKey) && !IsHotkeyActivationSuppressed(_gridWindowKey)) { _window.ToggleGridWindow(); return; } } FlushQueuedConfigSaveIfDue(); } private void LateUpdate() { if (_window != null) { _window.MaintainInputState(); } } private void OnGUI() { if (_window != null) { _window.OnGUI(); } } internal int GetActiveSlotCount() { int num = CfgActiveSlotCount.Value; if (num < 1) { num = 1; } if (num > 100) { num = 100; } return num; } internal int GetPageCount() { int num = CfgPageCount.Value; if (num < 1) { num = 1; } if (num > 10) { num = 10; } return num; } internal int GetCurrentPageIndex() { if (!CfgEnablePages.Value) { return 0; } int pageCount = GetPageCount(); int num = CfgCurrentPage.Value - 1; if (num < 0) { num = 0; } if (num >= pageCount) { num = pageCount - 1; } return num; } internal int GetEffectiveDeckPageCount() { return (!CfgEnablePages.Value) ? 1 : GetPageCount(); } internal int GetTotalDeckSlotCapacity() { return GetActiveSlotCount() * GetEffectiveDeckPageCount(); } internal string GetSlotKeyForPage(int pageIndex, int index) { if (index < 0 || index >= 100) { return string.Empty; } if (!CfgEnablePages.Value || pageIndex <= 0) { pageIndex = 0; } if (pageIndex >= 10) { return string.Empty; } EnsurePageSlotArray(pageIndex); return PageSlotKeys[pageIndex][index] ?? string.Empty; } internal int CountAssignedSlotsInPage(int pageIndex) { int num = 0; int activeSlotCount = GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { if (TryGetSlotEmoteForPage(pageIndex, i, out var _)) { num++; } } return num; } internal int CountAssignedSlotsAcrossEnabledPages() { int num = 0; int effectiveDeckPageCount = GetEffectiveDeckPageCount(); for (int i = 0; i < effectiveDeckPageCount; i++) { num += CountAssignedSlotsInPage(i); } return num; } internal void SetCurrentPageIndex(int pageIndex) { int pageCount = GetPageCount(); if (pageIndex < 0) { pageIndex = 0; } if (pageIndex >= pageCount) { pageIndex = pageCount - 1; } CfgCurrentPage.Value = pageIndex + 1; QueueConfigSave(); } internal string GetSlotKey(int index) { return GetSlotKeyForPage(GetCurrentPageIndex(), index); } internal void TouchSlotRevision() { SlotRevision++; } internal void SetSlotKey(int index, string key) { if (index >= 0 && index < 100) { int num = GetCurrentPageIndex(); if (!CfgEnablePages.Value || num <= 0) { num = 0; } EnsurePageSlotArray(num); PageSlotKeys[num][index] = key ?? string.Empty; SavePageSlotConfig(num); TouchSlotRevision(); SavePluginConfig(); } } internal bool TryGetSlotEmote(int index, out EmoteEntry entry) { return TryGetSlotEmoteForPage(GetCurrentPageIndex(), index, out entry); } internal bool TryGetSlotEmoteForPage(int pageIndex, int index, out EmoteEntry entry) { entry = null; string slotKeyForPage = GetSlotKeyForPage(pageIndex, index); if (string.IsNullOrEmpty(slotKeyForPage)) { return false; } return EmotesByKey.TryGetValue(slotKeyForPage, out entry) && entry != null; } internal bool IsAssignedOnCurrentDeck(string key) { if (string.IsNullOrEmpty(key)) { return false; } int activeSlotCount = GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { if (string.Equals(GetSlotKey(i), key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } internal bool IsAssignedOnAnyEnabledPage(string key) { if (string.IsNullOrEmpty(key)) { return false; } int activeSlotCount = GetActiveSlotCount(); int effectiveDeckPageCount = GetEffectiveDeckPageCount(); for (int i = 0; i < effectiveDeckPageCount; i++) { for (int j = 0; j < activeSlotCount; j++) { if (string.Equals(GetSlotKeyForPage(i, j), key, StringComparison.OrdinalIgnoreCase)) { return true; } } } return false; } private void LoadPageSlotsFromConfig() { for (int i = 0; i < 10; i++) { EnsurePageSlotArray(i); string packedSlotConfigValue = GetPackedSlotConfigValue(i); UnpackConfigList(packedSlotConfigValue, PageSlotKeys[i]); } } private string GetPackedSlotConfigValue(int page) { if (page <= 0) { return (CfgDeckSlotKeys != null) ? (CfgDeckSlotKeys.Value ?? string.Empty) : string.Empty; } return (CfgPageSlotKeys[page] != null) ? (CfgPageSlotKeys[page].Value ?? string.Empty) : string.Empty; } private void EnsurePageSlotArray(int page) { if (page >= 0 && page < 10 && (PageSlotKeys[page] == null || PageSlotKeys[page].Length != 100)) { PageSlotKeys[page] = new string[100]; } } private void SavePageSlotConfig(int page) { if (page < 0 || page >= 10) { return; } EnsurePageSlotArray(page); string value = PackConfigList(PageSlotKeys[page]); if (page <= 0) { if (CfgDeckSlotKeys != null) { CfgDeckSlotKeys.Value = value; } } else if (CfgPageSlotKeys[page] != null) { CfgPageSlotKeys[page].Value = value; } } private void LoadCustomCommandsFromConfig() { for (int i = 0; i < 10; i++) { EnsurePageCustomCommandArray(i); string packedCustomCommandConfigValue = GetPackedCustomCommandConfigValue(i); string[] array = SplitConfigList(packedCustomCommandConfigValue); for (int j = 0; j < 100; j++) { string value = ((j < array.Length) ? array[j] : string.Empty); PageCustomCommands[i][j] = (TryNormalizeCustomSlotCommand(value, out var normalized, out var _) ? normalized : string.Empty); } } } private string GetPackedCustomCommandConfigValue(int page) { if (page <= 0) { return (CfgDeckCustomCommands != null) ? (CfgDeckCustomCommands.Value ?? string.Empty) : string.Empty; } return (CfgPageCustomCommands[page] != null) ? (CfgPageCustomCommands[page].Value ?? string.Empty) : string.Empty; } private void EnsurePageCustomCommandArray(int page) { if (page >= 0 && page < 10 && (PageCustomCommands[page] == null || PageCustomCommands[page].Length != 100)) { PageCustomCommands[page] = new string[100]; } } private void SavePageCustomCommandConfig(int page) { if (page < 0 || page >= 10) { return; } EnsurePageCustomCommandArray(page); string value = PackConfigList(PageCustomCommands[page]); if (page <= 0) { if (CfgDeckCustomCommands != null) { CfgDeckCustomCommands.Value = value; } } else if (CfgPageCustomCommands[page] != null) { CfgPageCustomCommands[page].Value = value; } } internal string GetCustomCommandForPage(int pageIndex, int index) { if (index < 0 || index >= 100) { return string.Empty; } if (!CfgEnablePages.Value || pageIndex <= 0) { pageIndex = 0; } if (pageIndex >= 10) { return string.Empty; } EnsurePageCustomCommandArray(pageIndex); return PageCustomCommands[pageIndex][index] ?? string.Empty; } internal string GetCustomCommand(int index) { return GetCustomCommandForPage(GetCurrentPageIndex(), index); } internal bool SetCustomCommand(int index, string rawCommand, out string normalized, out string error) { normalized = string.Empty; if (index < 0 || index >= 100) { error = "Slot is out of range."; return false; } if (!TryNormalizeCustomSlotCommand(rawCommand, out normalized, out error)) { return false; } if (normalized.Length > 0 && TryFindCustomCommand(normalized, GetCurrentPageIndex(), index, out var pageIndex, out var slotIndex)) { error = "Already used on page " + (pageIndex + 1).ToString(CultureInfo.InvariantCulture) + ", slot " + (slotIndex + 1).ToString(CultureInfo.InvariantCulture) + "."; return false; } int num = GetCurrentPageIndex(); if (!CfgEnablePages.Value || num <= 0) { num = 0; } EnsurePageCustomCommandArray(num); PageCustomCommands[num][index] = normalized; SavePageCustomCommandConfig(num); SavePluginConfig(); return true; } internal bool TryFindCustomCommand(string command, int ignorePage, int ignoreSlot, out int pageIndex, out int slotIndex) { pageIndex = -1; slotIndex = -1; if (!TryNormalizeCustomSlotCommand(command, out var normalized, out var _) || normalized.Length == 0) { return false; } int effectiveDeckPageCount = GetEffectiveDeckPageCount(); int activeSlotCount = GetActiveSlotCount(); for (int i = 0; i < effectiveDeckPageCount; i++) { for (int j = 0; j < activeSlotCount; j++) { if (i != ignorePage || j != ignoreSlot) { string customCommandForPage = GetCustomCommandForPage(i, j); if (string.Equals(customCommandForPage, normalized, StringComparison.OrdinalIgnoreCase)) { pageIndex = i; slotIndex = j; return true; } } } } return false; } internal bool TryFindCustomCommandSlot(string message, out int pageIndex, out int slotIndex) { pageIndex = -1; slotIndex = -1; if (!CfgEnableCustomSlotCommands.Value) { return false; } if (!TryNormalizeCustomSlotCommand(message, out var normalized, out var _) || normalized.Length == 0) { return false; } return TryFindCustomCommand(normalized, -1, -1, out pageIndex, out slotIndex); } internal void MoveToNextPage() { if (CfgEnablePages.Value) { int pageCount = GetPageCount(); int currentPageIndex = GetCurrentPageIndex(); if (currentPageIndex + 1 < pageCount) { SetCurrentPageIndex(currentPageIndex + 1); } } } internal void MoveToPreviousPage() { if (CfgEnablePages.Value) { int currentPageIndex = GetCurrentPageIndex(); if (currentPageIndex > 0) { SetCurrentPageIndex(currentPageIndex - 1); } } } private static List ParseKeyList(string raw) { List list = new List(); string[] array = (raw ?? string.Empty).Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0 && !ContainsString(list, text)) { list.Add(text); } } return list; } private static bool ContainsString(List list, string key) { for (int i = 0; i < list.Count; i++) { if (string.Equals(list[i], key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static void RemoveString(List list, string key) { for (int num = list.Count - 1; num >= 0; num--) { if (string.Equals(list[num], key, StringComparison.OrdinalIgnoreCase)) { list.RemoveAt(num); } } } private void LoadRecentAndFavoritesFromConfig() { RecentKeys.Clear(); FavoriteKeys.Clear(); RecentKeys.AddRange(ParseKeyList(CfgRecentKeys.Value)); FavoriteKeys.AddRange(ParseKeyList(CfgFavoriteKeys.Value)); } private void SaveRecentKeys() { CfgRecentKeys.Value = string.Join(";", RecentKeys.ToArray()); RecentRevision++; QueueConfigSave(); } private void SaveFavoriteKeys() { CfgFavoriteKeys.Value = string.Join(";", FavoriteKeys.ToArray()); FavoriteRevision++; QueueConfigSave(); } internal void NoteRecent(EmoteEntry entry) { if (entry != null && CfgEnableRecent.Value && !string.IsNullOrEmpty(entry.Key)) { RemoveString(RecentKeys, entry.Key); RecentKeys.Insert(0, entry.Key); int num = Mathf.Clamp(CfgRecentLimit.Value, 1, 100); while (RecentKeys.Count > num) { RecentKeys.RemoveAt(RecentKeys.Count - 1); } SaveRecentKeys(); } } internal bool IsFavorite(string key) { if (string.IsNullOrEmpty(key)) { return false; } return ContainsString(FavoriteKeys, key); } internal void ToggleFavorite(EmoteEntry entry) { if (entry != null && !string.IsNullOrEmpty(entry.Key)) { if (IsFavorite(entry.Key)) { RemoveString(FavoriteKeys, entry.Key); } else { FavoriteKeys.Add(entry.Key); } SaveFavoriteKeys(); } } internal void BuildEntryListFromKeys(List keys, List dest) { dest.Clear(); for (int i = 0; i < keys.Count; i++) { if (EmotesByKey.TryGetValue(keys[i], out var value) && value != null) { dest.Add(value); } } } internal List GetVisibleEmotes() { List list = new List(); for (int i = 0; i < AllEmotes.Count; i++) { EmoteEntry emoteEntry = AllEmotes[i]; if (emoteEntry != null && IsPackageVisible(emoteEntry.PackageId)) { list.Add(emoteEntry); } } return list; } internal bool IsPackageVisible(string packageId) { string item = (string.IsNullOrEmpty(packageId) ? "Unknown" : packageId); return !HiddenPackages.Contains(item); } internal void SetPackageVisible(string packageId, bool visible) { string item = (string.IsNullOrEmpty(packageId) ? "Unknown" : packageId); if (visible) { HiddenPackages.Remove(item); } else { HiddenPackages.Add(item); } SaveHiddenPackagesToConfig(); } internal void ShowAllPackages() { HiddenPackages.Clear(); SaveHiddenPackagesToConfig(); } internal void HideAllPackages() { HiddenPackages.Clear(); for (int i = 0; i < PackageIds.Count; i++) { HiddenPackages.Add(PackageIds[i]); } SaveHiddenPackagesToConfig(); } private void LoadHiddenPackagesFromConfig() { HiddenPackages.Clear(); string text = CfgHiddenPackages.Value ?? string.Empty; string[] array = text.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.Length > 0) { HiddenPackages.Add(text2); } } } private void SaveHiddenPackagesToConfig() { List list = new List(HiddenPackages); list.Sort(StringComparer.OrdinalIgnoreCase); CfgHiddenPackages.Value = string.Join(";", list.ToArray()); FilterRevision++; SavePluginConfig(); } private bool IsChatTyping() { try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { if (mainPlayer._inChat) { return true; } if ((Object)(object)mainPlayer._chatBehaviour != (Object)null && mainPlayer._chatBehaviour._focusedInChat) { return true; } } } catch { } try { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null && current._focusedInChat) { return true; } } catch { } return IsUnityTextInputFocused(); } private static bool IsUnityTextInputFocused() { try { Type type = FindType("UnityEngine.EventSystems.EventSystem"); if (type == null) { return false; } PropertyInfo property = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return false; } PropertyInfo property2 = type.GetProperty("currentSelectedGameObject", BindingFlags.Instance | BindingFlags.Public); GameObject val = (GameObject)((property2 != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { return false; } Type type2 = FindType("UnityEngine.UI.InputField"); if (type2 != null && (Object)(object)val.GetComponent(type2) != (Object)null) { return true; } Type type3 = FindType("TMPro.TMP_InputField"); if (type3 != null && (Object)(object)val.GetComponent(type3) != (Object)null) { return true; } } catch { } return false; } private void RefreshEmoteRegistryIfChanged() { int lastRegistryFingerprint = _lastRegistryFingerprint; int num = ComputeRegistryFingerprintCheap(); if (num != lastRegistryFingerprint) { RefreshEmoteRegistry(); } } private int ComputeRegistryFingerprintCheap() { int num = 17; try { Type type = FindType("AtlyssEmotes.EmoteManager"); if (type != null) { PropertyInfo property = type.GetProperty("allEmotes", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj is IDictionary dictionary) { num = num * 31 + dictionary.Count; } } } catch { } try { ScriptableEmoteList nativeScriptableEmoteList = GetNativeScriptableEmoteList(); if ((Object)(object)nativeScriptableEmoteList != (Object)null && nativeScriptableEmoteList._emoteCommandList != null) { num = num * 31 + nativeScriptableEmoteList._emoteCommandList.Length; } } catch { } return num; } internal void RefreshEmoteRegistry() { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); EmoteWheelBridgeAvailable = FindType("AtlyssEmotes.EmoteManager") != null; int lastWheelEmoteCount = CollectEmoteWheelEntries(dictionary); bool flag = false; foreach (EmoteEntry value in dictionary.Values) { if (value != null && string.Equals(value.PackageId, "Base", StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } int lastNativeEmoteCount = 0; if (!flag || CfgIncludeNativeVanillaWhenWheelBaseExists.Value) { lastNativeEmoteCount = CollectNativeVanillaEntries(dictionary); } AllEmotes.Clear(); foreach (EmoteEntry value2 in dictionary.Values) { if (value2 != null && !string.Equals(value2.Key, "None", StringComparison.OrdinalIgnoreCase)) { AllEmotes.Add(value2); } } AllEmotes.Sort(CompareEmotes); EmotesByKey.Clear(); PackageIds.Clear(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < AllEmotes.Count; i++) { EmoteEntry emoteEntry = AllEmotes[i]; if (!EmotesByKey.ContainsKey(emoteEntry.Key)) { EmotesByKey.Add(emoteEntry.Key, emoteEntry); } string item = (string.IsNullOrEmpty(emoteEntry.PackageId) ? "Unknown" : emoteEntry.PackageId); if (hashSet.Add(item)) { PackageIds.Add(item); } } PackageIds.Sort(StringComparer.OrdinalIgnoreCase); LastWheelEmoteCount = lastWheelEmoteCount; LastNativeEmoteCount = lastNativeEmoteCount; LastRegistryRefreshTime = Time.unscaledTime; RegistryRevision++; _lastRegistryFingerprint = ComputeRegistryFingerprintCheap(); if (CfgDebugLogging.Value) { Log.LogInfo((object)("[EmoteDeck] Registry refreshed. total=" + AllEmotes.Count + " wheel=" + lastWheelEmoteCount + " native=" + lastNativeEmoteCount + " packages=" + PackageIds.Count)); } } private static int CompareEmotes(EmoteEntry a, EmoteEntry b) { int num = string.Compare(a.PackageId, b.PackageId, StringComparison.OrdinalIgnoreCase); if (num != 0) { return num; } return string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase); } private int CollectEmoteWheelEntries(Dictionary merged) { int num = 0; try { Type type = FindType("AtlyssEmotes.EmoteManager"); if (type == null) { return 0; } PropertyInfo property = type.GetProperty("allEmotes", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (!(obj is IDictionary dictionary)) { return 0; } foreach (DictionaryEntry item in dictionary) { string text = item.Key as string; object value = item.Value; if (!string.IsNullOrEmpty(text) && value != null && !string.Equals(text, "None", StringComparison.OrdinalIgnoreCase)) { Type type2 = value.GetType(); string text2 = ReadFieldString(type2, value, "emoteName"); string text3 = ReadFieldString(type2, value, "emoteID"); string text4 = ReadFieldString(type2, value, "packageName"); bool flag = ReadFieldBool(type2, value, "isVanilla"); Sprite icon = ReadFieldSprite(type2, value, "icon"); if (string.IsNullOrEmpty(text4)) { text4 = ExtractPackageFromKey(text); } if (string.IsNullOrEmpty(text2)) { text2 = ExtractNameFromKey(text); } EmoteEntry emoteEntry = new EmoteEntry(); emoteEntry.Key = text; emoteEntry.DisplayName = text2; emoteEntry.PackageId = text4; emoteEntry.Source = "Emote Wheel"; emoteEntry.AnimationTag = (flag ? text3 : text); emoteEntry.IsVanilla = flag; emoteEntry.Icon = icon; emoteEntry.SortName = text4 + ":" + text2; if (!string.IsNullOrEmpty(emoteEntry.AnimationTag) && !merged.ContainsKey(emoteEntry.Key)) { merged.Add(emoteEntry.Key, emoteEntry); num++; } } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Emote Wheel reflection failed: " + ex.GetType().Name + ": " + ex.Message)); } return num; } private int CollectNativeVanillaEntries(Dictionary merged) { int num = 0; try { ScriptableEmoteList nativeScriptableEmoteList = GetNativeScriptableEmoteList(); if ((Object)(object)nativeScriptableEmoteList == (Object)null || nativeScriptableEmoteList._emoteCommandList == null) { return 0; } for (int i = 0; i < nativeScriptableEmoteList._emoteCommandList.Length; i++) { EmoteCommand val = nativeScriptableEmoteList._emoteCommandList[i]; if (val != null && !string.IsNullOrEmpty(val._emoteChatCommand) && !string.IsNullOrEmpty(val._emoteAnimationTag)) { string key = "Vanilla:" + val._emoteChatCommand; if (!merged.ContainsKey(key)) { EmoteEntry emoteEntry = new EmoteEntry(); emoteEntry.Key = key; emoteEntry.DisplayName = PrettyCommandName(val._emoteChatCommand); emoteEntry.PackageId = "Vanilla"; emoteEntry.Source = "Game"; emoteEntry.AnimationTag = val._emoteAnimationTag; emoteEntry.IsVanilla = true; emoteEntry.Icon = null; emoteEntry.SortName = "Vanilla:" + emoteEntry.DisplayName; merged.Add(key, emoteEntry); num++; } } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Native emote reflection failed: " + ex.GetType().Name + ": " + ex.Message)); } return num; } private static ScriptableEmoteList GetNativeScriptableEmoteList() { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current == (Object)null) { return null; } FieldInfo field = typeof(ChatBehaviour).GetField("_scriptableEmoteList", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return null; } object? value = field.GetValue(current); return (ScriptableEmoteList)((value is ScriptableEmoteList) ? value : null); } private static Type FindType(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = null; try { type = assemblies[i].GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } return null; } private static string ReadFieldString(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return string.Empty; } object value = field.GetValue(obj); return (value as string) ?? string.Empty; } catch { return string.Empty; } } private static bool ReadFieldBool(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return false; } object value = field.GetValue(obj); return value is bool && (bool)value; } catch { return false; } } private static Sprite ReadFieldSprite(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return null; } object? value = field.GetValue(obj); return (Sprite)((value is Sprite) ? value : null); } catch { return null; } } private static string ExtractPackageFromKey(string key) { int num = key.IndexOf(':'); if (num > 0) { return key.Substring(0, num); } return "Unknown"; } private static string ExtractNameFromKey(string key) { int num = key.IndexOf(':'); if (num >= 0 && num + 1 < key.Length) { return key.Substring(num + 1); } return key; } private static string PrettyCommandName(string cmd) { if (string.IsNullOrEmpty(cmd)) { return "Emote"; } string text = cmd.Trim(); if (text.StartsWith("/")) { text = text.Substring(1); } if (text.Length == 0) { return cmd; } return char.ToUpperInvariant(text[0]) + ((text.Length > 1) ? text.Substring(1) : string.Empty); } internal bool TryHandleChatCommand(string message) { if (string.IsNullOrWhiteSpace(message)) { return false; } string text = message.Trim(); if (TryHandleWindowChatCommand(text)) { return true; } if (TryFindCustomCommandSlot(text, out var pageIndex, out var slotIndex)) { return TryPlaySlotFromChat(pageIndex, slotIndex); } if (CfgEnableChatCommands == null || !CfgEnableChatCommands.Value) { return false; } string activeChatCommandPrefix = GetActiveChatCommandPrefix(); if (!text.Equals(activeChatCommandPrefix, StringComparison.OrdinalIgnoreCase) && !text.StartsWith(activeChatCommandPrefix + " ", StringComparison.OrdinalIgnoreCase)) { return false; } string text2 = ((text.Length > activeChatCommandPrefix.Length) ? text.Substring(activeChatCommandPrefix.Length).Trim() : string.Empty); if (text2.Length == 0 || text2.Equals("help", StringComparison.OrdinalIgnoreCase) || text2 == "?") { ShowLocalChatNotice("Use " + activeChatCommandPrefix + " 1, " + activeChatCommandPrefix + " p2 1, or " + activeChatCommandPrefix + " point."); return true; } if (TryParseDeckCommandArgs(text2, out var pageIndex2, out var slotIndex2, out var error)) { return TryPlaySlotFromChat(pageIndex2, slotIndex2); } if (CfgEnableNamedSlotCommands != null && CfgEnableNamedSlotCommands.Value) { if (TryFindNamedSlotCommand(text2, out pageIndex2, out slotIndex2, out var error2)) { return TryPlaySlotFromChat(pageIndex2, slotIndex2); } ShowLocalChatNotice(error2 ?? error ?? "No matching emote slot."); return true; } ShowLocalChatNotice(error); return true; } private bool TryHandleWindowChatCommand(string trimmed) { if (string.IsNullOrEmpty(trimmed)) { return false; } string activeChatCommandPrefix = GetActiveChatCommandPrefix(); string activeCommand = activeChatCommandPrefix + "set"; string activeCommand2 = activeChatCommandPrefix + "mod"; string activeCommand3 = activeChatCommandPrefix + "grid"; if (IsWindowCommand(trimmed, "/edset", activeCommand)) { if (_window != null) { _window.ToggleSettingsTab(); } return true; } if (IsWindowCommand(trimmed, "/edmod", activeCommand2)) { if (_window != null) { _window.ToggleMainWindow(); } return true; } if (IsWindowCommand(trimmed, "/edgrid", activeCommand3)) { if (_window != null) { _window.ToggleGridWindow(); } return true; } return false; } private static bool IsWindowCommand(string trimmed, string defaultCommand, string activeCommand) { return string.Equals(trimmed, defaultCommand, StringComparison.OrdinalIgnoreCase) || string.Equals(trimmed, activeCommand, StringComparison.OrdinalIgnoreCase); } private bool TryPlaySlotFromChat(int pageIndex, int slotIndex) { int activeSlotCount = GetActiveSlotCount(); if (slotIndex < 0 || slotIndex >= activeSlotCount) { ShowLocalChatNotice("Slot " + (slotIndex + 1).ToString(CultureInfo.InvariantCulture) + " is outside the active slot count."); return true; } int effectiveDeckPageCount = GetEffectiveDeckPageCount(); if (pageIndex < 0 || pageIndex >= effectiveDeckPageCount) { ShowLocalChatNotice("Page " + (pageIndex + 1).ToString(CultureInfo.InvariantCulture) + " is not available."); return true; } string slotKeyForPage = GetSlotKeyForPage(pageIndex, slotIndex); if (string.IsNullOrEmpty(slotKeyForPage)) { ShowLocalChatNotice("Slot " + (slotIndex + 1).ToString(CultureInfo.InvariantCulture) + " is empty."); return true; } if (!EmotesByKey.TryGetValue(slotKeyForPage, out var value) || value == null) { ShowLocalChatNotice("That emote is not loaded. Try Rescan."); return true; } if (TryPlayEmote(value, out var status)) { TryCancelProfessionActionAfterEmote(); } else if (!string.IsNullOrEmpty(status) && status.IndexOf("cooling down", StringComparison.OrdinalIgnoreCase) < 0) { ShowLocalChatNotice(status); } return true; } private bool TryParseDeckCommandArgs(string args, out int pageIndex, out int slotIndex, out string error) { pageIndex = GetCurrentPageIndex(); slotIndex = -1; error = null; string[] array = args.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 1) { if (!int.TryParse(array[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { error = "Expected a slot number or emote name."; return false; } slotIndex = result - 1; return true; } if (array.Length == 2) { if (!TryParsePageToken(array[0], out var page) || !int.TryParse(array[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2)) { error = "Use /ed 1, /ed p2 1, or /ed point."; return false; } if (!CfgEnablePages.Value && page > 1) { error = "Pages are not enabled."; return false; } int effectiveDeckPageCount = GetEffectiveDeckPageCount(); if (page < 1 || page > effectiveDeckPageCount) { error = "Page " + page.ToString(CultureInfo.InvariantCulture) + " is not available."; return false; } pageIndex = page - 1; slotIndex = result2 - 1; return true; } if (array.Length == 3 && array[0].Equals("page", StringComparison.OrdinalIgnoreCase)) { if (!int.TryParse(array[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result3) || !int.TryParse(array[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result4)) { error = "Use /ed page 2 1."; return false; } if (!CfgEnablePages.Value && result3 > 1) { error = "Pages are not enabled."; return false; } int effectiveDeckPageCount2 = GetEffectiveDeckPageCount(); if (result3 < 1 || result3 > effectiveDeckPageCount2) { error = "Page " + result3.ToString(CultureInfo.InvariantCulture) + " is not available."; return false; } pageIndex = result3 - 1; slotIndex = result4 - 1; return true; } error = "Use /ed 1, /ed p2 1, or /ed point."; return false; } private bool TryFindNamedSlotCommand(string args, out int pageIndex, out int slotIndex, out string error) { pageIndex = -1; slotIndex = -1; error = null; int pageIndex2; string query; bool flag = TryExtractPageFromNamedArgs(args, out pageIndex2, out query); if (!flag) { query = args; } query = (query ?? string.Empty).Trim(); string text = NormalizeEmoteCommandName(query); if (text.Length == 0) { error = "Expected an emote name."; return false; } if (!ValidateNamedCommandPage(flag, pageIndex2, out error)) { return false; } int activeSlotCount = GetActiveSlotCount(); int num = (flag ? pageIndex2 : 0); int num2 = (flag ? (pageIndex2 + 1) : GetEffectiveDeckPageCount()); int num3 = -1; int num4 = -1; int num5 = 0; for (int i = num; i < num2; i++) { for (int j = 0; j < activeSlotCount; j++) { string slotKeyForPage = GetSlotKeyForPage(i, j); if (string.IsNullOrEmpty(slotKeyForPage) || !EmotesByKey.TryGetValue(slotKeyForPage, out var value) || value == null) { continue; } string customCommandForPage = GetCustomCommandForPage(i, j); if (!(NormalizeEmoteCommandName(customCommandForPage) != text) || DoesEntryMatchNameCommand(value, text)) { num5++; num3 = i; num4 = j; if (num5 > 1) { error = "More than one slot matches \"" + query + "\". Try " + GetActiveChatCommandPrefix() + " p" + (i + 1).ToString(CultureInfo.InvariantCulture) + " " + query + "."; return false; } } } } if (num5 == 1) { pageIndex = num3; slotIndex = num4; return true; } if (CfgEnableClosestNameMatch != null && CfgEnableClosestNameMatch.Value) { if (TryFindClosestNamedSlotCommand(text, query, flag, pageIndex2, out pageIndex, out slotIndex, out var error2)) { return true; } if (!string.IsNullOrEmpty(error2)) { error = error2; return false; } } error = "No slot matches \"" + query + "\"."; return false; } private bool ValidateNamedCommandPage(bool hasExplicitPage, int explicitPage, out string error) { error = null; if (!hasExplicitPage) { return true; } if (!CfgEnablePages.Value && explicitPage > 0) { error = "Pages are not enabled."; return false; } int effectiveDeckPageCount = GetEffectiveDeckPageCount(); if (explicitPage < 0 || explicitPage >= effectiveDeckPageCount) { error = "Page " + (explicitPage + 1).ToString(CultureInfo.InvariantCulture) + " is not available."; return false; } return true; } private bool TryFindClosestNamedSlotCommand(string normalizedQuery, string rawQuery, bool hasExplicitPage, int explicitPage, out int pageIndex, out int slotIndex, out string error) { pageIndex = -1; slotIndex = -1; error = null; if (string.IsNullOrEmpty(normalizedQuery)) { return false; } int activeSlotCount = GetActiveSlotCount(); int num = (hasExplicitPage ? explicitPage : 0); int num2 = (hasExplicitPage ? (explicitPage + 1) : GetEffectiveDeckPageCount()); bool flag = CfgClosestMatchIncludeCustomCommands != null && CfgClosestMatchIncludeCustomCommands.Value; int num3 = -1; int num4 = -1; int num5 = int.MaxValue; int num6 = 0; for (int i = num; i < num2; i++) { for (int j = 0; j < activeSlotCount; j++) { string slotKeyForPage = GetSlotKeyForPage(i, j); if (!string.IsNullOrEmpty(slotKeyForPage) && EmotesByKey.TryGetValue(slotKeyForPage, out var value) && value != null && TryGetClosestNameScore(value, flag ? GetCustomCommandForPage(i, j) : string.Empty, normalizedQuery, out var score)) { if (score < num5) { num5 = score; num3 = i; num4 = j; num6 = 1; } else if (score == num5 && (num3 != i || num4 != j)) { num6++; } } } } if (num3 >= 0 && num4 >= 0) { pageIndex = num3; slotIndex = num4; if (num6 > 1) { ShowLocalChatNotice("Several close matches. Playing the closest one."); } return true; } return false; } private static bool TryGetClosestNameScore(EmoteEntry entry, string customCommand, string normalizedQuery, out int score) { score = int.MaxValue; if (entry == null || string.IsNullOrEmpty(normalizedQuery)) { return false; } bool matched = false; AddClosestScore(NormalizeEmoteCommandName(entry.DisplayName), normalizedQuery, ref score, ref matched); AddClosestScore(NormalizeEmoteCommandName(ExtractNameFromKey(entry.Key)), normalizedQuery, ref score, ref matched); AddClosestScore(NormalizeEmoteCommandName(entry.AnimationTag), normalizedQuery, ref score, ref matched); if (!string.IsNullOrEmpty(customCommand)) { AddClosestScore(NormalizeEmoteCommandName(customCommand), normalizedQuery, ref score, ref matched); } return matched; } private static void AddClosestScore(string candidate, string query, ref int bestScore, ref bool matched) { if (string.IsNullOrEmpty(candidate) || string.IsNullOrEmpty(query)) { return; } int num; if (candidate.StartsWith(query, StringComparison.Ordinal)) { num = candidate.Length - query.Length; } else if (query.Length >= 3 && candidate.IndexOf(query, StringComparison.Ordinal) >= 0) { num = 100 + candidate.IndexOf(query, StringComparison.Ordinal) + Math.Abs(candidate.Length - query.Length); } else { if (query.Length < 3) { return; } int num2 = LevenshteinDistance(candidate, query); int num3 = Math.Min(3, Math.Max(1, query.Length / 3)); if (num2 > num3) { return; } num = 200 + num2 * 10 + Math.Abs(candidate.Length - query.Length); } if (num < bestScore) { bestScore = num; } matched = true; } private static int LevenshteinDistance(string a, string b) { if (a == null) { a = string.Empty; } if (b == null) { b = string.Empty; } int length = a.Length; int length2 = b.Length; if (length == 0) { return length2; } if (length2 == 0) { return length; } int[] array = new int[length2 + 1]; int[] array2 = new int[length2 + 1]; for (int i = 0; i <= length2; i++) { array[i] = i; } for (int j = 1; j <= length; j++) { array2[0] = j; char c = a[j - 1]; for (int k = 1; k <= length2; k++) { int num = ((c != b[k - 1]) ? 1 : 0); int val = array[k] + 1; int val2 = array2[k - 1] + 1; int val3 = array[k - 1] + num; array2[k] = Math.Min(Math.Min(val, val2), val3); } int[] array3 = array; array = array2; array2 = array3; } return array[length2]; } private static bool DoesEntryMatchNameCommand(EmoteEntry entry, string normalizedQuery) { if (entry == null || string.IsNullOrEmpty(normalizedQuery)) { return false; } if (NormalizeEmoteCommandName(entry.DisplayName) == normalizedQuery) { return true; } if (NormalizeEmoteCommandName(ExtractNameFromKey(entry.Key)) == normalizedQuery) { return true; } if (NormalizeEmoteCommandName(entry.AnimationTag) == normalizedQuery) { return true; } return false; } private static bool TryExtractPageFromNamedArgs(string args, out int pageIndex, out string query) { pageIndex = -1; query = args ?? string.Empty; string text = (args ?? string.Empty).Trim(); if (text.Length == 0) { return false; } string[] array = text.Split(new char[2] { ' ', '\t' }, 3, StringSplitOptions.RemoveEmptyEntries); if (array.Length >= 2 && TryParsePageToken(array[0], out var page)) { pageIndex = page - 1; query = ((array.Length >= 2) ? array[1] : string.Empty); if (array.Length == 3) { query = array[1] + " " + array[2]; } return true; } if (array.Length >= 3 && array[0].Equals("page", StringComparison.OrdinalIgnoreCase) && int.TryParse(array[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { pageIndex = result - 1; query = array[2]; return true; } return false; } private static string NormalizeEmoteCommandName(string value) { string text = (value ?? string.Empty).Trim(); if (text.StartsWith("/")) { text = text.Substring(1); } StringBuilder stringBuilder = new StringBuilder(text.Length); bool flag = false; foreach (char c in text) { if (c == '_' || c == '-' || char.IsWhiteSpace(c)) { if (!flag && stringBuilder.Length > 0) { stringBuilder.Append(' '); flag = true; } } else if (char.IsLetterOrDigit(c)) { stringBuilder.Append(char.ToLowerInvariant(c)); flag = false; } } return stringBuilder.ToString().Trim(); } private static bool TryParsePageToken(string token, out int page) { page = 0; if (string.IsNullOrEmpty(token)) { return false; } string text = token.Trim(); if (text.StartsWith("p", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(1); } return int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out page); } private static void ShowLocalChatNotice(string text) { try { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null) { current.New_ChatMessage("[Emote Deck] " + (text ?? string.Empty)); } } catch { try { if (Log != null) { Log.LogInfo((object)("[EmoteDeck] " + text)); } } catch { } } } private static void TryCancelProfessionActionAfterEmote() { try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null && (Object)(object)mainPlayer._pProfession != (Object)null && mainPlayer._pProfession._isProfessionAction) { mainPlayer._pProfession.Cancel_ProfessionAction(); } } catch { } } internal bool TryPlayEmote(EmoteEntry entry, out string status) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 status = string.Empty; if (entry == null) { status = "No emote selected."; return false; } if (string.IsNullOrEmpty(entry.AnimationTag)) { status = "That emote has no animation tag."; return false; } try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer == (Object)null || (Object)(object)mainPlayer._pVisual == (Object)null) { status = "Local player not found."; return false; } if ((int)mainPlayer._currentPlayerCondition != 2) { status = "Player is not active."; return false; } ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null) { float num = ReadChatEmoteBuffer(current); if (num > 0f) { status = "Emotes are cooling down."; return false; } } mainPlayer._pVisual.Cmd_CrossFadeAnim(entry.AnimationTag, 0.1f, 11); mainPlayer._pVisual.Local_CrossFadeAnim(entry.AnimationTag, 0.1f, 11); if ((Object)(object)current != (Object)null) { WriteChatEmoteBuffer(current, 0.85f); } NoteRecent(entry); status = "Played " + entry.DisplayName + "."; if (CfgDebugLogging.Value) { Log.LogInfo((object)("[EmoteDeck] Play " + entry.Key + " tag=" + entry.AnimationTag + " source=" + entry.Source)); } return true; } catch (Exception ex) { status = "Play failed: " + ex.GetType().Name + ": " + ex.Message; Log.LogWarning((object)("[EmoteDeck] " + status)); return false; } } private static float ReadChatEmoteBuffer(ChatBehaviour chat) { try { if (_chatEmoteBufferField == null) { _chatEmoteBufferField = typeof(ChatBehaviour).GetField("_emoteBuffer", BindingFlags.Instance | BindingFlags.NonPublic); } if (_chatEmoteBufferField == null) { return 0f; } if (_chatEmoteBufferField.GetValue(chat) is float result) { return result; } } catch { } return 0f; } private static void WriteChatEmoteBuffer(ChatBehaviour chat, float value) { try { if (_chatEmoteBufferField == null) { _chatEmoteBufferField = typeof(ChatBehaviour).GetField("_emoteBuffer", BindingFlags.Instance | BindingFlags.NonPublic); } if (_chatEmoteBufferField != null) { _chatEmoteBufferField.SetValue(chat, value); } } catch { } } } internal sealed class EmoteEntry { public string Key; public string DisplayName; public string PackageId; public string Source; public string AnimationTag; public bool IsVanilla; public Sprite Icon; public string SortName; } internal enum BindTarget { None, MainWindow, GridWindow } internal enum GridMode { Deck, Recent, Favorites } internal static class EmoteDeckEasySettingsBridge { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__14_0; internal void b__14_0() { TryRegisterIfReady(EmoteDeckPlugin.Instance); } } private const string EasySettingsTypeName = "Nessie.ATLYSS.EasySettings.Settings"; private static bool _subscribed; private static bool _registered; private static bool _registering; private static bool _loggedMissing; private static bool _syncingButtons; private static int _activeEasySettingsBindTarget; private static float _activeEasySettingsBindUntil; private static KeyCode _lastSyncedMainKey; private static KeyCode _lastSyncedGridKey; private static object _mainKeyButton; private static object _gridKeyButton; internal static void TryInstall(EmoteDeckPlugin plugin) { if (!((Object)(object)plugin == (Object)null)) { TrySubscribe(plugin); TryRegisterIfReady(plugin); } } internal static IEnumerator DelayedInstall(EmoteDeckPlugin plugin) { yield return (object)new WaitForSeconds(0.5f); TryInstall(plugin); yield return (object)new WaitForSeconds(1.5f); TryRegisterIfReady(plugin); yield return (object)new WaitForSeconds(4f); TryRegisterIfReady(plugin); } private static void TrySubscribe(EmoteDeckPlugin plugin) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if (_subscribed) { return; } Type type = FindType("Nessie.ATLYSS.EasySettings.Settings"); if (type == null) { LogMissingOnce(plugin); return; } try { PropertyInfo property = type.GetProperty("OnInitialized", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return; } MethodInfo method = obj.GetType().GetMethod("AddListener", new Type[1] { typeof(UnityAction) }); if (method == null) { return; } object obj2 = <>c.<>9__14_0; if (obj2 == null) { UnityAction val = delegate { TryRegisterIfReady(EmoteDeckPlugin.Instance); }; <>c.<>9__14_0 = val; obj2 = (object)val; } UnityAction val2 = (UnityAction)obj2; method.Invoke(obj, new object[1] { val2 }); _subscribed = true; } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings hook failed: " + ex.GetType().Name + ": " + ex.Message)); } } } private static void TryRegisterIfReady(EmoteDeckPlugin plugin) { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)plugin == (Object)null || _registered || _registering) { return; } Type type = FindType("Nessie.ATLYSS.EasySettings.Settings"); if (type == null) { LogMissingOnce(plugin); } else { if (!IsEasySettingsReady(type)) { return; } _registering = true; try { MethodInfo method = type.GetMethod("GetOrAddCustomTab", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); if (method == null) { return; } object obj = method.Invoke(null, new object[1] { "Eleen's Lab" }); if (obj == null) { return; } Type type2 = obj.GetType(); MethodInfo method2 = type2.GetMethod("AddHeader", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); MethodInfo method3 = type2.GetMethod("AddKeyButton", BindingFlags.Instance | BindingFlags.Public, null, new Type[2] { typeof(string), typeof(KeyCode) }, null); if (!(method3 == null)) { if (method2 != null) { method2.Invoke(obj, new object[1] { "Emote Deck" }); } _mainKeyButton = method3.Invoke(obj, new object[2] { "Main window", plugin.MainWindowKey }); _gridKeyButton = method3.Invoke(obj, new object[2] { "Emote grid", plugin.GridWindowKey }); HookKeyButton(_mainKeyButton, main: true); HookKeyButton(_gridKeyButton, main: false); _registered = true; SyncButtonsFromConfig(plugin); TryUpdateEasySettingsVisibility(type); if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogInfo((object)"[EmoteDeck] EasySettings keys registered."); } } } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings registration failed: " + ex.GetType().Name + ": " + ex.Message)); } } finally { _registering = false; } } } private static bool IsEasySettingsReady(Type settingsType) { try { if ((Object)(object)SettingsManager._current == (Object)null) { return false; } PropertyInfo property = settingsType.GetProperty("ModTab", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return false; } FieldInfo field = obj.GetType().GetField("Content", BindingFlags.Instance | BindingFlags.Public); object obj2 = ((field != null) ? field.GetValue(obj) : null); if (obj2 == null) { return false; } Type type = FindType("Nessie.ATLYSS.EasySettings.TemplateManager"); if (type != null) { FieldInfo field2 = type.GetField("_keyButtonTemplate", BindingFlags.Static | BindingFlags.NonPublic); if (field2 != null && field2.GetValue(null) == null) { return false; } } return true; } catch { return false; } } private static void TryUpdateEasySettingsVisibility(Type settingsType) { try { MethodInfo method = settingsType.GetMethod("UpdateTabVisibility", BindingFlags.Static | BindingFlags.NonPublic); if (method != null) { method.Invoke(null, null); } } catch { } } private static void HookKeyButton(object keyButton, bool main) { if (keyButton == null) { return; } try { PropertyInfo property = keyButton.GetType().GetProperty("OnValueChanged", BindingFlags.Instance | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(keyButton, null) : null); if (obj != null) { MethodInfo method = obj.GetType().GetMethod("AddListener", new Type[1] { typeof(UnityAction) }); if (!(method == null)) { UnityAction val = (main ? new UnityAction(OnMainKeyChanged) : new UnityAction(OnGridKeyChanged)); method.Invoke(obj, new object[1] { val }); HookKeyButtonClick(keyButton, main); } } } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings key hook failed: " + ex.GetType().Name + ": " + ex.Message)); } } } private static void HookKeyButtonClick(object keyButton, bool main) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown if (keyButton == null) { return; } try { PropertyInfo property = keyButton.GetType().GetProperty("OnClicked", BindingFlags.Instance | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(keyButton, null) : null); if (obj == null) { return; } MethodInfo method = obj.GetType().GetMethod("AddListener", new Type[1] { typeof(UnityAction) }); if (!(method == null)) { UnityAction val = (UnityAction)delegate { MarkEasySettingsBindStarted(main); }; method.Invoke(obj, new object[1] { val }); } } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings key click hook failed: " + ex.GetType().Name + ": " + ex.Message)); } } } private static void MarkEasySettingsBindStarted(bool main) { _activeEasySettingsBindTarget = (main ? 1 : 2); _activeEasySettingsBindUntil = Time.unscaledTime + 30f; } private static bool IsActiveEasySettingsBindTarget(bool main) { int num = (main ? 1 : 2); return _activeEasySettingsBindTarget == num && Time.unscaledTime <= _activeEasySettingsBindUntil; } private static void ClearActiveEasySettingsBindTarget(bool main) { int num = (main ? 1 : 2); if (_activeEasySettingsBindTarget == num) { _activeEasySettingsBindTarget = 0; _activeEasySettingsBindUntil = 0f; } } private static void OnMainKeyChanged(KeyCode key) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!_syncingButtons) { EmoteDeckPlugin instance = EmoteDeckPlugin.Instance; if (!((Object)(object)instance == (Object)null)) { instance.SetMainWindowKeyFromEasySettings(key); ClearActiveEasySettingsBindTarget(main: true); } } } private static void OnGridKeyChanged(KeyCode key) { //IL_001f: 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) if (_syncingButtons) { return; } EmoteDeckPlugin instance = EmoteDeckPlugin.Instance; if (!((Object)(object)instance == (Object)null)) { if ((int)key == 0 && !IsActiveEasySettingsBindTarget(main: false)) { ResetGridKeyButton(instance); return; } instance.SetGridWindowKeyFromEasySettings(key); ClearActiveEasySettingsBindTarget(main: false); } } internal static void ResetMainKeyButton(EmoteDeckPlugin plugin) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)plugin == (Object)null)) { SetButtonValueSilent(_mainKeyButton, plugin.MainWindowKey); _lastSyncedMainKey = plugin.MainWindowKey; } } internal static void ResetGridKeyButton(EmoteDeckPlugin plugin) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)plugin == (Object)null)) { SetButtonValueSilent(_gridKeyButton, plugin.GridWindowKey); _lastSyncedGridKey = plugin.GridWindowKey; } } internal static void PollSync(EmoteDeckPlugin plugin) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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) if (_registered && !((Object)(object)plugin == (Object)null) && !_registering && (plugin.MainWindowKey != _lastSyncedMainKey || plugin.GridWindowKey != _lastSyncedGridKey)) { SyncButtonsFromConfig(plugin); } } internal static void SyncButtonsFromConfig(EmoteDeckPlugin plugin) { //IL_0025: 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_0042: 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_004d: 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) if (!_registered || (Object)(object)plugin == (Object)null) { return; } _syncingButtons = true; try { SetButtonValueSilent(_mainKeyButton, plugin.MainWindowKey); SetButtonValueSilent(_gridKeyButton, plugin.GridWindowKey); _lastSyncedMainKey = plugin.MainWindowKey; _lastSyncedGridKey = plugin.GridWindowKey; } finally { _syncingButtons = false; } } private unsafe static void SetButtonValueSilent(object keyButton, KeyCode key) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (keyButton == null) { return; } try { Type type = keyButton.GetType(); FieldInfo field = type.GetField("_value", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(keyButton, key); } FieldInfo field2 = type.GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(keyButton, key); } object fieldValue = GetFieldValue(type, keyButton, "ButtonLabel"); SetTextObject(fieldValue, ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString()); SyncRegisteredEasySettingsKeyBind(keyButton, fieldValue, key); } catch { } } private static object GetFieldValue(Type t, object obj, string name) { try { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return null; } return field.GetValue(obj); } catch { return null; } } private static void SetTextObject(object textObject, string text) { if (textObject == null) { return; } try { PropertyInfo property = textObject.GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public); if (property != null && property.CanWrite) { property.SetValue(textObject, text, null); } } catch { } } private unsafe static void SyncRegisteredEasySettingsKeyBind(object keyButton, object buttonLabel, KeyCode key) { try { SettingsManager current = SettingsManager._current; if ((Object)(object)current == (Object)null) { return; } FieldInfo field = typeof(SettingsManager).GetField("keyBindButtons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Array array = ((field != null) ? (field.GetValue(current) as Array) : null); if (array == null) { return; } string text = ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(); object fieldValue = GetFieldValue(keyButton.GetType(), keyButton, "Button"); for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value == null) { continue; } Type type = value.GetType(); object fieldValue2 = GetFieldValue(type, value, "_buttonLabel"); object fieldValue3 = GetFieldValue(type, value, "_button"); if (fieldValue2 == buttonLabel || fieldValue3 == fieldValue) { FieldInfo field2 = type.GetField("_keyBind", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(value, text); } SetTextObject(fieldValue2, text); break; } } } catch { } } private static void LogMissingOnce(EmoteDeckPlugin plugin) { if (!_loggedMissing) { _loggedMissing = true; if ((Object)(object)plugin != (Object)null && EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogInfo((object)"[EmoteDeck] EasySettings not found. Native settings tab integration skipped."); } } } private static Type FindType(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = null; try { type = assemblies[i].GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } return null; } } internal static class EmoteDeckInputBlocker { private const int MainWindowId = 1162104113; private const int GridWindowId = 1162102577; private static bool _mainOpen; private static bool _gridOpen; private static Rect _mainRect; private static Rect _gridRect; private static bool _blockGameplayInput; private static bool _pointerCapturedByEmoteDeck; public static void SetWindowState(bool mainOpen, Rect mainRect, bool gridOpen, Rect gridRect, bool blockGameplayInput) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) _mainOpen = mainOpen; _mainRect = mainRect; _gridOpen = gridOpen; _gridRect = gridRect; _blockGameplayInput = blockGameplayInput && (_mainOpen || _gridOpen); if (!_mainOpen && !_gridOpen) { _pointerCapturedByEmoteDeck = false; } if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1) && !Input.GetMouseButton(2)) { _pointerCapturedByEmoteDeck = false; } } public static bool ShouldBlockGameplayInput() { return _blockGameplayInput; } public static bool IsEmoteDeckWindowId(int id) { return id == 1162104113 || id == 1162102577; } public static bool IsMouseOverEmoteDeckWindow() { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) Vector3 mousePosition = Input.mousePosition; return IsScreenPointOverEmoteDeckWindow(new Vector2(mousePosition.x, mousePosition.y)); } public static bool IsScreenPointOverEmoteDeckWindow(Vector2 screenPoint) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 guiMouse = default(Vector2); ((Vector2)(ref guiMouse))..ctor(screenPoint.x, (float)Screen.height - screenPoint.y); return IsGuiPointOverEmoteDeckWindow(guiMouse); } public static bool IsGuiPointOverEmoteDeckWindow(Vector2 guiMouse) { //IL_000d: 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) if (_mainOpen && ((Rect)(ref _mainRect)).Contains(guiMouse)) { return true; } if (_gridOpen && ((Rect)(ref _gridRect)).Contains(guiMouse)) { return true; } return false; } public static bool ShouldBlockPointerInput(object pointerEventData) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!_mainOpen && !_gridOpen) { return false; } if (pointerEventData == null) { return IsMouseOverEmoteDeckWindow(); } try { Type type = pointerEventData.GetType(); object obj = null; PropertyInfo property = type.GetProperty("position", BindingFlags.Instance | BindingFlags.Public); if (property != null) { obj = property.GetValue(pointerEventData, null); } else { FieldInfo field = type.GetField("position", BindingFlags.Instance | BindingFlags.Public); if (field != null) { obj = field.GetValue(pointerEventData); } } if (obj is Vector2) { return IsScreenPointOverEmoteDeckWindow((Vector2)obj); } } catch { } return IsMouseOverEmoteDeckWindow(); } public static bool ShouldBlockExternalGuiWindow(int id) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 if (IsEmoteDeckWindowId(id)) { return false; } if (!_mainOpen && !_gridOpen) { return false; } Event current = Event.current; EventType val = (EventType)((current == null) ? 11 : (((int)current.rawType == 11) ? ((int)current.type) : ((int)current.rawType))); if ((int)val == 8 || (int)val == 7 || (int)val == 12 || (int)val == 11) { return false; } bool flag = IsMouseOverEmoteDeckWindow(); if ((int)val == 0 && flag) { _pointerCapturedByEmoteDeck = true; } if ((int)val != 0 && (int)val != 3 && (int)val != 1 && (int)val != 6) { return false; } bool result = flag || _pointerCapturedByEmoteDeck; if ((int)val == 1) { _pointerCapturedByEmoteDeck = false; } return result; } public static bool ShouldBlockEventSystemPointerInput() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!_mainOpen && !_gridOpen) { return false; } bool flag = IsMouseOverEmoteDeckWindow(); bool flag2 = Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2); bool flag3 = Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2); bool flag4 = Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(2); Vector2 mouseScrollDelta = Input.mouseScrollDelta; bool flag5 = ((Vector2)(ref mouseScrollDelta)).sqrMagnitude > 0.0001f; if (flag2 && flag) { _pointerCapturedByEmoteDeck = true; } bool result = (flag && (flag2 || flag3 || flag4 || flag5)) || (_pointerCapturedByEmoteDeck && (flag3 || flag4)); if (flag4 && !flag3) { _pointerCapturedByEmoteDeck = false; } return result; } public static bool HasNonZeroScrollDelta(object pointerEventData) { //IL_007c: 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) if (pointerEventData == null) { return false; } try { Type type = pointerEventData.GetType(); object obj = null; PropertyInfo property = type.GetProperty("scrollDelta", BindingFlags.Instance | BindingFlags.Public); if (property != null) { obj = property.GetValue(pointerEventData, null); } else { FieldInfo field = type.GetField("scrollDelta", BindingFlags.Instance | BindingFlags.Public); if (field != null) { obj = field.GetValue(pointerEventData); } } if (obj is Vector2 val) { return ((Vector2)(ref val)).sqrMagnitude > 0.0001f; } } catch { } return false; } } internal static class EmoteDeckScrollRectOnScrollPatch { private static bool Prefix(object __0) { if (EmoteDeckInputBlocker.HasNonZeroScrollDelta(__0) && EmoteDeckInputBlocker.ShouldBlockPointerInput(__0)) { return false; } return true; } } internal static class EmoteDeckGuiWindowPointerPatch { private static bool Prefix(int __0, Rect __1, ref Rect __result) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!EmoteDeckInputBlocker.ShouldBlockExternalGuiWindow(__0)) { return true; } __result = __1; return false; } } internal static class EmoteDeckEventSystemRaycastAllPatch { private static void Postfix(object eventData, object raycastResults) { if (raycastResults == null || !EmoteDeckInputBlocker.ShouldBlockPointerInput(eventData)) { return; } try { if (raycastResults is IList list) { list.Clear(); return; } MethodInfo method = raycastResults.GetType().GetMethod("Clear", BindingFlags.Instance | BindingFlags.Public); if (method != null) { method.Invoke(raycastResults, null); } } catch { } } } internal static class EmoteDeckChatCommandPatch { private static bool Prefix(string _message) { try { EmoteDeckPlugin instance = EmoteDeckPlugin.Instance; if ((Object)(object)instance == (Object)null) { return true; } if (instance.TryHandleChatCommand(_message)) { return false; } } catch (Exception ex) { try { if (EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] Chat command failed: " + ex.Message)); } } catch { } } return true; } } internal static class EmoteDeckGameplayInputPatch { private static bool Prefix(object __instance) { if (!EmoteDeckInputBlocker.ShouldBlockGameplayInput()) { return true; } TryNeutralizeInstance(__instance); return false; } private static void TryNeutralizeInstance(object instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) try { PlayerMove val = (PlayerMove)((instance is PlayerMove) ? instance : null); if ((Object)(object)val != (Object)null) { val.inputIn = Vector3.zero; val._worldSpaceInput = Vector3.zero; return; } PlayerCombat val2 = (PlayerCombat)((instance is PlayerCombat) ? instance : null); if ((Object)(object)val2 != (Object)null) { val2._localBlockingInput = false; } } catch { } } } internal static class EmoteDeckPlayerLocalParamsPatch { private static void Postfix(Player __instance) { if (!EmoteDeckInputBlocker.ShouldBlockGameplayInput()) { return; } try { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player._mainPlayer) { __instance._inUI = true; } } catch { } } } internal sealed class EmoteDeckWindow { private struct GridMetrics { public int Columns; public int Rows; public float CellW; public float CellH; public float LabelH; public float Spacing; public float RowH; public float TotalContentH; public bool NamesOnly; public bool ShowIcon; public bool ShowLabel; } private const int MainWindowId = 1162104113; private const int GridWindowId = 1162102577; private const float MinMainW = 520f; private const float MinMainH = 380f; private const float MinGridW = 260f; private const float MinGridH = 160f; private readonly EmoteDeckPlugin _plugin; private Rect _mainRect; private Rect _gridRect; private bool _mainOpen; private bool _gridOpen; private bool _mainResizing; private bool _gridResizing; private bool _windowPointerCaptured; private Vector2 _resizeStart; private Rect _resizeOrig; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible; private bool _hasSavedCursor; private bool _playerInUiForced; private bool _savedCameraUnlocked; private bool _hasSavedCamera; private int _tab; private Vector2 _slotsScroll; private Vector2 _pickerScroll; private Vector2 _pickerSlotScroll; private Vector2 _filterScroll; private Vector2 _settingsScroll; private Vector2 _gridScroll; private string _slotCountText; private string _chatPrefixText; private readonly Dictionary _customCommandDrafts = new Dictionary(StringComparer.Ordinal); private int _commandEditingSlot = -1; private string _searchText = string.Empty; private int _editingSlot = -1; private string _statusText = string.Empty; private float _statusUntil; private readonly List _pickerCache = new List(); private readonly List _specialGridEntries = new List(); private float _mainContentHeight; private float _pickerViewHeight = 220f; private GridMode _gridMode = GridMode.Deck; private bool _gridViewDropdownOpen; private bool _gridMouseModeDropdownOpen; private bool _settingsGridViewDropdownOpen; private bool _settingsGridMouseModeDropdownOpen; private string _pickerCacheSearch = null; private int _pickerCacheRegistryRevision = -1; private int _pickerCacheFilterRevision = -1; private int _pickerCacheSlotRevision = -1; private bool _pickerCacheHideAssigned; private int _pickerCachePage = -1; private BindTarget _bindTarget = BindTarget.None; private int _bindStartedFrame = -1; private string _bindStatus = string.Empty; private GUIStyle _transparentWindowStyle; private GUIStyle _headerStyle; private GUIStyle _smallLabelStyle; private GUIStyle _centerLabelStyle; private GUIStyle _miniButtonStyle; internal bool IsCapturingKeyBind => _bindTarget != BindTarget.None; internal bool IsMainOpen => _mainOpen; internal bool IsGridOpen => _gridOpen; internal EmoteDeckWindow(EmoteDeckPlugin plugin) { //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_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) _plugin = plugin; _mainRect = new Rect(EmoteDeckPlugin.CfgMainX.Value, EmoteDeckPlugin.CfgMainY.Value, EmoteDeckPlugin.CfgMainW.Value, EmoteDeckPlugin.CfgMainH.Value); _gridRect = new Rect(EmoteDeckPlugin.CfgGridX.Value, EmoteDeckPlugin.CfgGridY.Value, EmoteDeckPlugin.CfgGridW.Value, EmoteDeckPlugin.CfgGridH.Value); _slotCountText = EmoteDeckPlugin.CfgActiveSlotCount.Value.ToString(CultureInfo.InvariantCulture); _chatPrefixText = EmoteDeckPlugin.NormalizeChatCommandPrefix(EmoteDeckPlugin.CfgChatCommandPrefix.Value); } internal void ToggleMainWindow() { if (_mainOpen) { CloseMainWindow(); } else { OpenMainWindow(); } } internal void ToggleGridWindow() { if (_gridOpen) { CloseGridWindow(); } else { OpenGridWindow(); } } internal void OpenSettingsTab() { OpenMainWindow(); _tab = 2; GUI.FocusControl((string)null); } internal void ToggleSettingsTab() { if (_mainOpen && _tab == 2) { CloseMainWindow(); } else { OpenSettingsTab(); } } internal void OpenMainWindow() { if (!_mainOpen) { _mainOpen = true; SaveCursorIfNeeded(); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; ApplyPlayerInUIIfNeeded(); UpdateInputBlockerState(); _plugin.ScheduleAutoRescan(0.25f, force: true); ClampToScreen(ref _mainRect, 520f, 380f); } } internal void CloseMainWindow() { if (_mainOpen) { _mainOpen = false; _windowPointerCaptured = false; _bindTarget = BindTarget.None; _editingSlot = -1; SaveMainRect(); UpdateInputBlockerState(); _plugin.SavePluginConfig(); ReleaseInputStateIfUnused(); } } internal void OpenGridWindow() { if (!_gridOpen) { _gridOpen = true; ApplyPlayerInUIIfNeeded(); if (ShouldUnlockMouseForGridWindow()) { ApplyGridMouseUnlockIfNeeded(); } UpdateInputBlockerState(); _plugin.ScheduleAutoRescan(0.25f, force: true); ClampToScreen(ref _gridRect, 260f, 160f); } } internal void CloseGridWindow() { if (_gridOpen) { _gridOpen = false; _windowPointerCaptured = false; _gridViewDropdownOpen = false; _gridMouseModeDropdownOpen = false; SaveGridRect(); UpdateInputBlockerState(); _plugin.SavePluginConfig(); ReleaseInputStateIfUnused(); } } internal void SaveOpenWindowRects() { if (_mainOpen) { SaveMainRect(); } if (_gridOpen) { SaveGridRect(); } } internal void MaintainInputState() { UpdateInputBlockerState(); if (_mainOpen || _gridOpen) { if (ShouldBlockGameplayInputForOpenWindows()) { ApplyPlayerInUIIfNeeded(); } else { ReleasePlayerInUIState(); } if (_gridOpen && ShouldUnlockMouseForGridWindow()) { ApplyGridMouseUnlockIfNeeded(); } else { ReleaseGridMouseUnlockIfSafe(); } } else { ReleaseInputStateIfUnused(); } } private void SaveCursorIfNeeded() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!_hasSavedCursor) { _savedCursorLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; _hasSavedCursor = true; } } private void ApplyPlayerInUIIfNeeded() { if (!ShouldBlockGameplayInputForOpenWindows()) { return; } try { Player mainPlayer = Player._mainPlayer; if (!((Object)(object)mainPlayer == (Object)null)) { mainPlayer._inUI = true; _playerInUiForced = true; } } catch { } } private bool ShouldUnlockMouseForGridWindow() { if (!_gridOpen) { return false; } string gridMouseMode = GetGridMouseMode(); if (gridMouseMode == "Always") { return true; } if (gridMouseMode == "Off") { return false; } return EmoteDeckPlugin.CfgCloseGridAfterEmote.Value; } private void ApplyGridMouseUnlockIfNeeded() { if (ShouldUnlockMouseForGridWindow()) { SaveCursorIfNeeded(); try { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } catch { } ApplyCameraUnlockIfNeeded(); } } private void ApplyCameraUnlockIfNeeded() { try { if (!((Object)(object)CameraFunction._current == (Object)null)) { if (!_hasSavedCamera) { _savedCameraUnlocked = CameraFunction._current._unlockedCamera; _hasSavedCamera = true; } CameraFunction._current._unlockedCamera = true; } } catch { } } private void ReleaseGridMouseUnlockIfSafe() { if (_hasSavedCamera) { try { if ((Object)(object)CameraFunction._current != (Object)null) { CameraFunction._current._unlockedCamera = _savedCameraUnlocked; } } catch { } _hasSavedCamera = false; } ReleaseCursorStateIfSafe(); } private void ReleasePlayerInUIState() { if (!_playerInUiForced || IsGameUiOrChatActive()) { return; } try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { mainPlayer._inUI = false; } } catch { } _playerInUiForced = false; } private bool IsGameUiOrChatActive() { try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { if (mainPlayer._inChat) { return true; } if ((Object)(object)mainPlayer._chatBehaviour != (Object)null && mainPlayer._chatBehaviour._focusedInChat) { return true; } } } catch { } try { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null && current._focusedInChat) { return true; } } catch { } try { if ((Object)(object)TabMenu._current != (Object)null && TabMenu._current._isOpen) { return true; } } catch { } try { if ((Object)(object)SettingsManager._current != (Object)null && SettingsManager._current._isOpen) { return true; } } catch { } try { if ((Object)(object)DialogManager._current != (Object)null && DialogManager._current._isDialogEnabled) { return true; } } catch { } return false; } private void ReleaseInputStateIfUnused() { if (_mainOpen || _gridOpen) { return; } if (_hasSavedCamera) { try { if ((Object)(object)CameraFunction._current != (Object)null) { CameraFunction._current._unlockedCamera = _savedCameraUnlocked; } } catch { } _hasSavedCamera = false; } ReleasePlayerInUIState(); ReleaseCursorStateIfSafe(); } private void ReleaseCursorStateIfSafe() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (_hasSavedCursor && !_mainOpen && (!_gridOpen || !ShouldUnlockMouseForGridWindow()) && !IsGameUiOrChatActive()) { try { Cursor.lockState = _savedCursorLock; Cursor.visible = _savedCursorVisible; } catch { } _hasSavedCursor = false; } } internal void OnGUI() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0053: 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) EnsureStyles(); Event current = Event.current; EventType pointerEventType = GetPointerEventType(current); bool startedOverWindow = IsPointerEvent(pointerEventType) && IsMouseOverOpenWindow(GetGuiMouseScreenPos()); UpdateInputBlockerState(); if (IsCapturingKeyBind && HandleKeyBindCapture(current)) { UpdateInputBlockerState(); HandleWindowPointerEvent(current, pointerEventType, startedOverWindow); return; } if (_mainOpen) { DrawMainOnGUI(); } if (_gridOpen) { DrawGridOnGUI(); } HandleWindowPointerEvent(current, pointerEventType, startedOverWindow); UpdateInputBlockerState(); } private static EventType GetPointerEventType(Event e) { //IL_000f: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_004b: 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_0042: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (e == null) { return (EventType)11; } if ((int)e.rawType == 0 || (int)e.rawType == 3 || (int)e.rawType == 1 || (int)e.rawType == 2 || (int)e.rawType == 6) { return e.rawType; } return e.type; } private static bool IsPointerEvent(EventType type) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 return (int)type == 0 || (int)type == 3 || (int)type == 1 || (int)type == 2 || (int)type == 6; } private void HandleWindowPointerEvent(Event e, EventType originalType, bool startedOverWindow) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0026: 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_0033: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 if (e != null) { if ((int)originalType == 0 && startedOverWindow) { _windowPointerCaptured = true; } if ((startedOverWindow && (int)originalType == 6) || (startedOverWindow && (int)originalType == 0) || (_windowPointerCaptured && ((int)originalType == 3 || (int)originalType == 2 || (int)originalType == 1))) { UseEventIfSafe(e); } if ((int)originalType == 1) { _windowPointerCaptured = false; } } } private void DrawMainOnGUI() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (_mainResizing) { HandleResizeEvent(current, main: true); } _mainRect = GUI.Window(1162104113, _mainRect, new WindowFunction(DrawMainWindow), GUIContent.none, GetTransparentWindowStyle()); ClampToScreen(ref _mainRect, 520f, 380f); } private void DrawGridOnGUI() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (_gridResizing) { HandleResizeEvent(current, main: false); } _gridRect = GUI.Window(1162102577, _gridRect, new WindowFunction(DrawGridWindow), GUIContent.none, GetTransparentWindowStyle()); ClampToScreen(ref _gridRect, 260f, 160f); } private void HandleResizeEvent(Event e, bool main) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (e == null) { return; } if ((int)e.rawType == 1 || (int)e.type == 1 || !Input.GetMouseButton(0)) { if (main) { _mainResizing = false; SaveMainRect(); } else { _gridResizing = false; SaveGridRect(); } _plugin.SavePluginConfig(); UseEventIfSafe(e); } else if ((int)e.type == 3 || (int)e.type == 2) { Vector2 guiMouseScreenPos = GetGuiMouseScreenPos(); Vector2 val = guiMouseScreenPos - _resizeStart; if (main) { ((Rect)(ref _mainRect)).width = Mathf.Max(520f, ((Rect)(ref _resizeOrig)).width + val.x); ((Rect)(ref _mainRect)).height = Mathf.Max(380f, ((Rect)(ref _resizeOrig)).height + val.y); ClampToScreen(ref _mainRect, 520f, 380f); } else { ((Rect)(ref _gridRect)).width = Mathf.Max(260f, ((Rect)(ref _resizeOrig)).width + val.x); ((Rect)(ref _gridRect)).height = Mathf.Max(160f, ((Rect)(ref _resizeOrig)).height + val.y); ClampToScreen(ref _gridRect, 260f, 160f); } GUI.changed = true; UseEventIfSafe(e); } } private void DrawMainWindow(int id) { //IL_0076: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref _mainRect)).width, ((Rect)(ref _mainRect)).height); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(0f, 0f, ((Rect)(ref _mainRect)).width, 26f); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(0f, 26f, ((Rect)(ref _mainRect)).width, ((Rect)(ref _mainRect)).height - 26f); DrawSolid(val, new Color(0f, 0f, 0f, 0.02f)); DrawSolid(rect, new Color(0.05f, 0.05f, 0.05f, 0.98f)); DrawSolid(rect2, new Color(0f, 0f, 0f, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value))); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref _mainRect)).width - 26f, 3f, 22f, 20f); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref val2)).x - 38f, 5f, 34f, 18f); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(((Rect)(ref val3)).x - 92f, 7f, 88f, 14f); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(((Rect)(ref val4)).x - 56f, 4f, 54f, 18f); GUI.Label(new Rect(8f, 4f, Mathf.Max(0f, ((Rect)(ref val5)).x - 10f), 18f), "Emote Deck [" + ((object)_plugin.MainWindowKey/*cast due to .constrained prefix*/).ToString() + "]", _headerStyle); GUI.Label(val5, "Opacity", _smallLabelStyle); float value = EmoteDeckPlugin.CfgMainOpacity.Value; float num = GUI.HorizontalSlider(val4, value, 0f, 1f); GUI.Label(val3, Mathf.RoundToInt(num * 100f).ToString(CultureInfo.InvariantCulture) + "%", _smallLabelStyle); if (Mathf.Abs(num - value) > 0.001f) { EmoteDeckPlugin.CfgMainOpacity.Value = num; _plugin.QueueConfigSave(); } if (GUI.Button(val2, "X", _miniButtonStyle)) { CloseMainWindow(); return; } Rect windowContentRect = GetWindowContentRect(_mainRect, 26f, reserveResizeCorner: true); Rect rect3 = default(Rect); ((Rect)(ref rect3))..ctor(((Rect)(ref windowContentRect)).x, Mathf.Max(((Rect)(ref windowContentRect)).y, ((Rect)(ref windowContentRect)).yMax - 28f), ((Rect)(ref windowContentRect)).width, 28f); ((Rect)(ref windowContentRect)).height = Mathf.Max(40f, ((Rect)(ref windowContentRect)).height - 28f - 5f); ((Rect)(ref rect3)).y = ((Rect)(ref windowContentRect)).yMax + 5f; _mainContentHeight = ((Rect)(ref windowContentRect)).height; bool flag = false; Color color = GUI.color; try { GUILayout.BeginArea(windowContentRect); flag = true; GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value)); DrawTabs(); DrawBindBannerIfNeeded(); switch (_tab) { case 0: DrawSlotsTab(); break; case 1: DrawPickerTab(); break; case 2: DrawSettingsTab(); break; default: DrawHelpTab(); break; } } finally { GUI.color = color; if (flag) { GUILayout.EndArea(); } } DrawMainFooter(rect3); ConsumeScrollWheelInsideLocalWindow(val); GUI.DragWindow(new Rect(0f, 0f, Mathf.Max(0f, ((Rect)(ref val5)).x - 8f), 26f)); DrawResizeHandle(new Rect(((Rect)(ref _mainRect)).width - 16f - 3f, ((Rect)(ref _mainRect)).height - 16f - 3f, 16f, 16f), main: true); } private void DrawGridWindow(int id) { //IL_07cc: 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) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) bool flag = EmoteDeckPlugin.CfgGridShowHeaderControls.Value; float num = (flag ? 50f : 25f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, num); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, 25f); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(0f, 25f, ((Rect)(ref _gridRect)).width, 25f); Rect rect3 = default(Rect); ((Rect)(ref rect3))..ctor(0f, num, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height - num); DrawSolid(val, new Color(0f, 0f, 0f, 0.02f)); DrawSolid(rect, new Color(0.05f, 0.05f, 0.05f, 0.98f)); if (flag) { DrawSolid(rect2, new Color(0.035f, 0.035f, 0.035f, 0.98f)); } DrawSolid(rect3, new Color(0f, 0f, 0f, Mathf.Clamp01(EmoteDeckPlugin.CfgGridOpacity.Value))); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref _gridRect)).width - 26f, 3f, 22f, 19f); bool flag2 = ((Rect)(ref _gridRect)).width >= 520f; bool flag3 = ((Rect)(ref _gridRect)).width < 440f; bool flag4 = ((Rect)(ref _gridRect)).width < 350f; float num2 = ((((Rect)(ref _gridRect)).width < 340f) ? 60f : ((((Rect)(ref _gridRect)).width < 400f) ? 70f : 84f)); float num3 = ((((Rect)(ref _gridRect)).width < 340f) ? 30f : 34f); float num4 = (flag3 ? 38f : 76f); string text = (flag3 ? "Ctrl" : "Controls"); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(((Rect)(ref val3)).x - num3 - 4f, 5f, num3, 16f); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(((Rect)(ref val4)).x - num2 - 4f, 7f, num2, 14f); Rect val6 = (flag2 ? new Rect(((Rect)(ref val5)).x - 54f, 4f, 50f, 16f) : new Rect(0f, 0f, 0f, 0f)); float num5 = (flag2 ? (((Rect)(ref val6)).x - 10f) : (((Rect)(ref val5)).x - 10f)); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num5 - num4, 3f, num4, 19f); bool flag5 = ((Rect)(ref val7)).x >= 82f; float num6 = (flag5 ? ((Rect)(ref val7)).x : (flag2 ? ((Rect)(ref val6)).x : ((Rect)(ref val5)).x)); string text2 = (flag4 ? "Emote Grid" : ("Emote Grid [" + ((object)_plugin.GridWindowKey/*cast due to .constrained prefix*/).ToString() + "]")); GUI.Label(new Rect(8f, 4f, Mathf.Max(0f, num6 - 10f), 18f), text2, _headerStyle); if (flag5) { bool flag6 = GUI.Toggle(val7, flag, text, GUI.skin.button); if (flag6 != flag) { EmoteDeckPlugin.CfgGridShowHeaderControls.Value = flag6; _plugin.SavePluginConfig(); flag = flag6; if (!flag) { _gridViewDropdownOpen = false; _gridMouseModeDropdownOpen = false; } num = (flag ? 50f : 25f); ((Rect)(ref rect3))..ctor(0f, num, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height - num); } } if (flag2) { GUI.Label(val6, "Opacity", _smallLabelStyle); } float value = EmoteDeckPlugin.CfgGridOpacity.Value; float num7 = GUI.HorizontalSlider(val5, value, 0f, 1f); GUI.Label(val4, Mathf.RoundToInt(num7 * 100f).ToString(CultureInfo.InvariantCulture) + "%", _smallLabelStyle); if (Mathf.Abs(num7 - value) > 0.001f) { EmoteDeckPlugin.CfgGridOpacity.Value = num7; _plugin.QueueConfigSave(); } if (GUI.Button(val3, "X", _miniButtonStyle)) { CloseGridWindow(); return; } Rect val8 = default(Rect); Rect rect4 = default(Rect); Rect val9 = default(Rect); Rect rect5 = default(Rect); Rect val10 = default(Rect); bool flag7 = false; bool flag8 = false; if (flag) { float num8 = 8f; float num9 = 29f; bool flag9 = ((Rect)(ref _gridRect)).width < 340f; float num10 = (flag9 ? 28f : 32f); float num11 = ((((Rect)(ref _gridRect)).width < 300f) ? 82f : ((((Rect)(ref _gridRect)).width < 360f) ? 96f : 112f)); float num12 = (flag9 ? 44f : 74f); float num13 = ((((Rect)(ref _gridRect)).width < 300f) ? 68f : ((((Rect)(ref _gridRect)).width < 360f) ? 76f : 92f)); string text3 = (flag9 ? "Mouse" : "Mouse mode"); ((Rect)(ref val8))..ctor(num8, num9 + 1f, num10, 16f); num8 += num10 + 4f; ((Rect)(ref rect4))..ctor(num8, num9, num11, 19f); num8 += num11 + 8f; ((Rect)(ref val9))..ctor(num8, num9 + 1f, num12, 16f); num8 += num12 + 4f; ((Rect)(ref rect5))..ctor(num8, num9, num13, 19f); num8 += num13 + 8f; ((Rect)(ref val10))..ctor(num8, num9, 46f, 19f); flag7 = ((Rect)(ref rect5)).xMax <= ((Rect)(ref _gridRect)).width - 8f; flag8 = ((Rect)(ref val10)).xMax <= ((Rect)(ref _gridRect)).width - 8f; if (flag7) { GUI.Label(val8, "View", _smallLabelStyle); GUI.Label(val9, text3, _smallLabelStyle); if (flag8 && GUI.Button(val10, "Main", _miniButtonStyle)) { ToggleMainWindow(); } } } Rect windowContentRect = GetWindowContentRect(_gridRect, num, reserveResizeCorner: true); bool flag10 = flag && flag7 && (_gridViewDropdownOpen || _gridMouseModeDropdownOpen); bool flag11 = false; Color color = GUI.color; try { if (!flag10) { GUILayout.BeginArea(windowContentRect); flag11 = true; GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgGridOpacity.Value)); DrawGridContents(((Rect)(ref windowContentRect)).width, ((Rect)(ref windowContentRect)).height); } } finally { GUI.color = color; if (flag11) { GUILayout.EndArea(); } } if (flag10) { DrawSolid(windowContentRect, new Color(0f, 0f, 0f, 0.84f)); } if (flag && flag7) { DrawGridViewDropdown(rect4, settings: false); DrawGridMouseModeDropdown(rect5, settings: false); } ConsumeScrollWheelInsideLocalWindow(val); GUI.DragWindow(new Rect(0f, 0f, Mathf.Max(0f, num6 - 8f), 25f)); DrawResizeHandle(new Rect(((Rect)(ref _gridRect)).width - 16f - 3f, ((Rect)(ref _gridRect)).height - 16f - 3f, 16f, 16f), main: false); } private void DrawTabs() { GUILayout.BeginHorizontal(Array.Empty()); DrawTabButton(0, "Slots", 70f); DrawTabButton(1, "Picker", 78f); DrawTabButton(2, "Settings", 88f); DrawTabButton(3, "Help", 58f); GUILayout.FlexibleSpace(); if (GUILayout.Button(_gridOpen ? "Close Grid" : "Open Grid", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) })) { ToggleGridWindow(); } GUILayout.EndHorizontal(); GUILayout.Space(4f); } private void DrawTabButton(int idx, string label, float width) { bool flag = _tab == idx; if (GUILayout.Toggle(flag, label, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }) && !flag) { _tab = idx; GUI.FocusControl((string)null); } } private void DrawBindBannerIfNeeded() { if (IsCapturingKeyBind) { GUILayout.Label(_bindStatus ?? "Press a key. Esc cancels. Backspace clears the bind.", Array.Empty()); GUILayout.Space(2f); } else if (!string.IsNullOrEmpty(_bindStatus)) { GUILayout.Label(_bindStatus, Array.Empty()); GUILayout.Space(2f); } } private void DrawStatusIfNeeded() { if (!string.IsNullOrEmpty(_statusText) && Time.unscaledTime < _statusUntil) { GUILayout.Label(_statusText, Array.Empty()); GUILayout.Space(2f); } } private void DrawMainFooter(Rect rect) { //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_0032: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if (!(((Rect)(ref rect)).width <= 1f) && !(((Rect)(ref rect)).height <= 1f)) { Color color = GUI.color; DrawSolid(rect, new Color(0f, 0f, 0f, 0.22f * Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value))); string text = string.Empty; if (!string.IsNullOrEmpty(_statusText) && Time.unscaledTime < _statusUntil) { text = _statusText; } else if (IsCapturingKeyBind) { text = _bindStatus ?? string.Empty; } if (!string.IsNullOrEmpty(text)) { GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value)); GUI.Label(new Rect(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + 5f, Mathf.Max(20f, ((Rect)(ref rect)).width - 16f), ((Rect)(ref rect)).height - 8f), Trim(text, Mathf.Max(12, Mathf.FloorToInt((((Rect)(ref rect)).width - 16f) / 6.5f))), _smallLabelStyle); } GUI.color = color; } } private string BuildSlotSummaryText() { int activeSlotCount = _plugin.GetActiveSlotCount(); int num = _plugin.CountAssignedSlotsInPage(_plugin.GetCurrentPageIndex()); if (EmoteDeckPlugin.CfgEnablePages.Value) { int pageCount = _plugin.GetPageCount(); int num2 = activeSlotCount * pageCount; int num3 = _plugin.CountAssignedSlotsAcrossEnabledPages(); return activeSlotCount + " slots on each page Pages: " + pageCount + " Across pages: " + num2 + " slots Filled: " + num + " here / " + num3 + " all"; } return "Slots: " + activeSlotCount + " / " + 100 + " Assigned: " + num; } private void DrawSlotsTab() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(BuildSlotSummaryText() + " Emotes: " + _plugin.AllEmotes.Count + " Packs: " + CountVisiblePackages() + " / " + _plugin.PackageIds.Count, Array.Empty()); GUILayout.Space(4f); DrawPageControlsGUILayout(); bool flag = false; try { _slotsScroll = GUILayout.BeginScrollView(_slotsScroll, false, true, GUIStyle.none, GUI.skin.verticalScrollbar, Array.Empty()); flag = true; int activeSlotCount = _plugin.GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { DrawSlotRow(i); } } finally { if (flag) { GUILayout.EndScrollView(); } } } private void DrawSlotRow(int index) { //IL_00c4: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) EmoteEntry entry; bool flag = _plugin.TryGetSlotEmote(index, out entry); string text = (flag ? (entry.PackageId + " / " + entry.DisplayName) : ""); string customCommand = _plugin.GetCustomCommand(index); string text2 = FormatCustomCommandLabel(customCommand); GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); GUILayout.Label((index + 1).ToString("D2", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); Rect rect = GUILayoutUtility.GetRect(26f, 26f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(26f) }); GUI.Box(rect, GUIContent.none); if (flag) { DrawSprite(entry.Icon, rect); } float num = Mathf.Max(80f, ((Rect)(ref _mainRect)).width - 300f - ((!string.IsNullOrEmpty(text2)) ? 94f : 0f) - ((EmoteDeckPlugin.CfgEnableFavorites.Value && flag) ? 34f : 0f)); GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) }); if (!string.IsNullOrEmpty(text2)) { Color color = GUI.color; GUI.color = new Color(1f, 0.82f, 0.22f, color.a); GUILayout.Label("[" + text2 + "]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUI.color = color; } GUILayout.FlexibleSpace(); if (EmoteDeckPlugin.CfgEnableFavorites.Value && flag) { string text3 = (_plugin.IsFavorite(entry.Key) ? "★" : "☆"); if (GUILayout.Button(text3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { _plugin.ToggleFavorite(entry); SetStatus((_plugin.IsFavorite(entry.Key) ? "Favorited " : "Unfavorited ") + entry.DisplayName + "."); } } string text4 = ((_commandEditingSlot == index) ? "Hide cmd" : "Cmd"); if (GUILayout.Button(text4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { _commandEditingSlot = ((_commandEditingSlot == index) ? (-1) : index); SyncCustomCommandDraft(index); GUI.FocusControl((string)null); } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { _plugin.SetSlotKey(index, string.Empty); SetStatus("Cleared slot " + (index + 1) + "."); } GUILayout.EndHorizontal(); if (_commandEditingSlot == index) { DrawSlotCustomCommandRow(index); } GUILayout.EndVertical(); } private string FormatCustomCommandLabel(string command) { string text = (command ?? string.Empty).Trim(); if (text.StartsWith("/")) { text = text.Substring(1); } return text; } private void SyncCustomCommandDraft(int index) { string key = _plugin.GetCurrentPageIndex().ToString(CultureInfo.InvariantCulture) + ":" + index.ToString(CultureInfo.InvariantCulture); _customCommandDrafts[key] = FormatCustomCommandLabel(_plugin.GetCustomCommand(index)); } private void DrawSlotCustomCommandRow(int index) { string key = _plugin.GetCurrentPageIndex().ToString(CultureInfo.InvariantCulture) + ":" + index.ToString(CultureInfo.InvariantCulture); if (!_customCommandDrafts.TryGetValue(key, out var value)) { value = FormatCustomCommandLabel(_plugin.GetCustomCommand(index)); _customCommandDrafts[key] = value; } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }); GUILayout.Space(62f); GUILayout.Label("Command", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); float num = Mathf.Max(90f, ((Rect)(ref _mainRect)).width - 390f); string text = GUILayout.TextField(value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) }); if (!string.Equals(text, value, StringComparison.Ordinal)) { _customCommandDrafts[key] = text; } GUILayout.Label(Trim("Use " + EmoteDeckPlugin.GetActiveChatCommandPrefix() + " " + (string.IsNullOrEmpty(text) ? "name" : text), 22), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { if (_plugin.SetCustomCommand(index, text, out var normalized, out var error)) { _customCommandDrafts[key] = FormatCustomCommandLabel(normalized); SetStatus((normalized.Length > 0) ? ("Command set to " + FormatCustomCommandLabel(normalized) + ".") : "Command cleared."); } else { SetStatus(error ?? "Command was not saved."); } } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }) && _plugin.SetCustomCommand(index, string.Empty, out var _, out var _)) { _customCommandDrafts[key] = string.Empty; SetStatus("Command cleared."); } GUILayout.EndHorizontal(); } private void DrawPageControlsGUILayout() { if (!EmoteDeckPlugin.CfgEnablePages.Value) { return; } int pageCount = _plugin.GetPageCount(); int currentPageIndex = _plugin.GetCurrentPageIndex(); GUILayout.BeginHorizontal(Array.Empty()); GUI.enabled = currentPageIndex > 0; if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) })) { _plugin.MoveToPreviousPage(); } GUI.enabled = true; GUILayout.Label("Page " + (currentPageIndex + 1) + " / " + pageCount, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); GUI.enabled = currentPageIndex + 1 < pageCount; if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) })) { _plugin.MoveToNextPage(); } GUI.enabled = true; GUILayout.Space(8f); int num = Mathf.Min(pageCount, 10); for (int i = 0; i < num; i++) { bool flag = i == currentPageIndex; if (GUILayout.Toggle(flag, (i + 1).ToString(CultureInfo.InvariantCulture), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }) && !flag) { _plugin.SetCurrentPageIndex(i); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); } private void DrawPickerTab() { //IL_02e8: Unknown result type (might be due to invalid IL or missing references) int activeSlotCount = _plugin.GetActiveSlotCount(); DrawPageControlsGUILayout(); DrawPickerSlotSelector(activeSlotCount); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) }); _searchText = GUILayout.TextField(_searchText ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(160f) }); if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { _searchText = string.Empty; } if (GUILayout.Button("Show All Packs", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(112f) })) { _plugin.ShowAllPackages(); } if (GUILayout.Button("Pack filters", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(92f) })) { _tab = 2; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); bool flag = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerHideAssigned.Value, "Hide assigned", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(112f) }); if (flag != EmoteDeckPlugin.CfgPickerHideAssigned.Value) { EmoteDeckPlugin.CfgPickerHideAssigned.Value = flag; _plugin.QueueConfigSave(); _pickerCacheSearch = null; } if (GUILayout.Button("Next empty", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { MoveEditingSlotToNextEmpty(); } if (GUILayout.Button("Clear slot", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { _plugin.SetSlotKey(_editingSlot, string.Empty); SetStatus("Cleared slot " + (_editingSlot + 1) + "."); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); List list = BuildPickerList(); string text = (EmoteDeckPlugin.CfgEnablePages.Value ? ("Page " + (_plugin.GetCurrentPageIndex() + 1).ToString(CultureInfo.InvariantCulture) + " ") : string.Empty); GUILayout.Label("Showing: " + list.Count + " / " + _plugin.AllEmotes.Count + " " + text + "Slot " + (_editingSlot + 1) + ": " + SlotSummary(_editingSlot), Array.Empty()); UpdatePickerViewHeightFromLastControl(GUILayoutUtility.GetLastRect()); DrawVirtualizedPicker(list); } private void UpdatePickerViewHeightFromLastControl(Rect lastControlRect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 Event current = Event.current; if (current != null && (int)current.type == 7 && !(_mainContentHeight <= 0f) && !(((Rect)(ref lastControlRect)).yMax <= 0f)) { float num = _mainContentHeight - ((Rect)(ref lastControlRect)).yMax - 6f; _pickerViewHeight = Mathf.Max(80f, num); } } private void DrawPickerSlotSelector(int activeCount) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0109: 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_029a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) if (activeCount < 1) { activeCount = 1; } if (_editingSlot < 0 || _editingSlot >= activeCount) { _editingSlot = 0; } Rect rect = GUILayoutUtility.GetRect(1f, 46f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 3f, 86f, 20f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + 86f, ((Rect)(ref rect)).y, Mathf.Max(80f, ((Rect)(ref rect)).width - 86f), 46f); GUI.Label(val, "Editing slot:"); float num = Mathf.Max(((Rect)(ref val2)).width - 2f, (float)activeCount * 34f); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(0f, 0f, num, 24f); bool flag = false; try { _pickerSlotScroll = GUI.BeginScrollView(val2, _pickerSlotScroll, val3, false, false); flag = true; Color backgroundColor = GUI.backgroundColor; Rect val4 = default(Rect); for (int i = 0; i < activeCount; i++) { ((Rect)(ref val4))..ctor((float)i * 34f, 0f, 30f, 24f); bool flag2 = _editingSlot == i; EmoteEntry entry; bool flag3 = _plugin.TryGetSlotEmote(i, out entry); if (flag3) { GUI.backgroundColor = (flag2 ? new Color(0.72f, 0.86f, 1f, 1f) : new Color(0.42f, 0.62f, 0.82f, 1f)); } else { GUI.backgroundColor = backgroundColor; } bool flag4 = GUI.Toggle(val4, flag2, (i + 1).ToString(CultureInfo.InvariantCulture), GUI.skin.button); if (flag3) { Color color = (flag2 ? new Color(0.72f, 0.9f, 1f, 0.95f) : new Color(0.48f, 0.74f, 1f, 0.88f)); DrawSolid(new Rect(((Rect)(ref val4)).x + 4f, ((Rect)(ref val4)).y + ((Rect)(ref val4)).height - 4f, Mathf.Max(1f, ((Rect)(ref val4)).width - 8f), 2f), color); } if (flag4 && !flag2) { _editingSlot = i; GUI.FocusControl((string)null); } } GUI.backgroundColor = backgroundColor; } finally { if (flag) { GUI.EndScrollView(); } } } private void MoveEditingSlotToNextEmpty() { int activeSlotCount = _plugin.GetActiveSlotCount(); for (int i = 1; i <= activeSlotCount; i++) { int num = (_editingSlot + i) % activeSlotCount; if (!_plugin.TryGetSlotEmote(num, out var _)) { _editingSlot = num; SetStatus("Slot " + (_editingSlot + 1) + " selected."); return; } } SetStatus("No empty slot here."); } private void AdvanceEditingSlotAfterSet() { if (EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value) { int activeSlotCount = _plugin.GetActiveSlotCount(); if (activeSlotCount > 0 && _editingSlot + 1 < activeSlotCount) { _editingSlot++; } } } private List BuildPickerList() { string text = (_searchText ?? string.Empty).Trim(); bool value = EmoteDeckPlugin.CfgPickerHideAssigned.Value; int currentPageIndex = _plugin.GetCurrentPageIndex(); if (_pickerCacheRegistryRevision == _plugin.RegistryRevision && _pickerCacheFilterRevision == _plugin.FilterRevision && _pickerCacheSlotRevision == _plugin.SlotRevision && _pickerCacheHideAssigned == value && _pickerCachePage == currentPageIndex && string.Equals(_pickerCacheSearch ?? string.Empty, text, StringComparison.Ordinal)) { return _pickerCache; } _pickerCache.Clear(); for (int i = 0; i < _plugin.AllEmotes.Count; i++) { EmoteEntry emoteEntry = _plugin.AllEmotes[i]; if (emoteEntry != null && _plugin.IsPackageVisible(emoteEntry.PackageId) && (!value || !_plugin.IsAssignedOnAnyEnabledPage(emoteEntry.Key)) && (text.Length <= 0 || ContainsIgnoreCase(emoteEntry.DisplayName, text) || ContainsIgnoreCase(emoteEntry.PackageId, text) || ContainsIgnoreCase(emoteEntry.Key, text))) { _pickerCache.Add(emoteEntry); } } _pickerCacheSearch = text; _pickerCacheRegistryRevision = _plugin.RegistryRevision; _pickerCacheFilterRevision = _plugin.FilterRevision; _pickerCacheSlotRevision = _plugin.SlotRevision; _pickerCacheHideAssigned = value; _pickerCachePage = currentPageIndex; return _pickerCache; } private void DrawVirtualizedPicker(List entries) { //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) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) int num = entries?.Count ?? 0; float num2 = Mathf.Max(80f, _pickerViewHeight); Rect rect = GUILayoutUtility.GetRect(1f, num2, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(num2) }); ((Rect)(ref rect)).height = Mathf.Max(80f, ((Rect)(ref rect)).height); float num3 = (((float)num * 32f > ((Rect)(ref rect)).height) ? 18f : 0f); float num4 = Mathf.Max(1f, ((Rect)(ref rect)).width - num3); float num5 = Mathf.Max(((Rect)(ref rect)).height, (float)num * 32f + 4f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, num4, num5); float num6 = Mathf.Max(0f, num5 - ((Rect)(ref rect)).height); if (_pickerScroll.y > num6) { _pickerScroll.y = num6; } if (_pickerScroll.y < 0f) { _pickerScroll.y = 0f; } bool flag = false; try { _pickerScroll = GUI.BeginScrollView(rect, _pickerScroll, val, false, true); flag = true; int num7 = Mathf.Clamp(Mathf.FloorToInt(_pickerScroll.y / 32f) - 2, 0, Math.Max(0, num - 1)); int num8 = Mathf.CeilToInt(((Rect)(ref rect)).height / 32f) + 6; int num9 = Mathf.Min(num, num7 + num8); Rect rowRect = default(Rect); for (int i = num7; i < num9; i++) { ((Rect)(ref rowRect))..ctor(0f, (float)i * 32f, num4, 30f); DrawPickerEntry(rowRect, entries[i], (i & 1) == 1); } } finally { if (flag) { GUI.EndScrollView(); } } } private void DrawPickerEntry(Rect rowRect, EmoteEntry entry, bool alternate) { //IL_007a: 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) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) if (entry == null) { return; } if (alternate) { DrawSolid(rowRect, new Color(1f, 1f, 1f, 0.035f)); } float num = ((Rect)(ref rowRect)).x + 4f; float num2 = ((Rect)(ref rowRect)).y + 2f; float num3 = ((Rect)(ref rowRect)).height - 4f; float num4 = ((Rect)(ref rowRect)).xMax - 4f; Rect val = default(Rect); ((Rect)(ref val))..ctor(num, num2, num3, num3); GUI.Box(val, GUIContent.none); DrawSprite(entry.Icon, Inset(val, 2f)); num = ((Rect)(ref val)).xMax + 6f; float num5 = 50f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num4 - num5, num2, num5, num3); num4 = ((Rect)(ref val2)).x - 4f; float num6 = 50f; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num4 - num6, num2, num6, num3); num4 = ((Rect)(ref val3)).x - 4f; Rect zero = Rect.zero; if (EmoteDeckPlugin.CfgEnableFavorites.Value) { ((Rect)(ref zero))..ctor(num4 - 28f, num2, 28f, num3); num4 = ((Rect)(ref zero)).x - 4f; } float num7 = Mathf.Min(76f, Mathf.Max(54f, (num4 - num) * 0.18f)); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(num4 - num7, num2, num7, num3); num4 = ((Rect)(ref val4)).x - 6f; float num8 = Mathf.Min(118f, Mathf.Max(78f, (num4 - num) * 0.34f)); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(num, num2, num8, num3); num = ((Rect)(ref val5)).xMax + 6f; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num, num2, Mathf.Max(40f, num4 - num), num3); GUI.Label(val5, Trim(entry.PackageId, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref val5)).width / 6.5f))), _smallLabelStyle); GUI.Label(val6, Trim(entry.DisplayName, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref val6)).width / 6.5f))), _smallLabelStyle); GUI.Label(val4, Trim(entry.Source, Mathf.Max(6, Mathf.FloorToInt(((Rect)(ref val4)).width / 6.5f))), _smallLabelStyle); if (EmoteDeckPlugin.CfgEnableFavorites.Value) { string text = (_plugin.IsFavorite(entry.Key) ? "★" : "☆"); if (GUI.Button(zero, text)) { _plugin.ToggleFavorite(entry); SetStatus((_plugin.IsFavorite(entry.Key) ? "Favorited " : "Unfavorited ") + entry.DisplayName + "."); } } if (GUI.Button(val3, "Set")) { int editingSlot = _editingSlot; _plugin.SetSlotKey(editingSlot, entry.Key); SetStatus("Slot " + (editingSlot + 1) + " set to " + entry.DisplayName + "."); AdvanceEditingSlotAfterSet(); } if (GUI.Button(val2, "Play")) { _plugin.TryPlayEmote(entry, out var status); SetStatus(status); } } private string SlotSummary(int slot) { if (_plugin.TryGetSlotEmote(slot, out var entry)) { return entry.PackageId + ":" + entry.DisplayName; } string slotKey = _plugin.GetSlotKey(slot); if (string.IsNullOrEmpty(slotKey)) { return ""; } return "Missing: " + slotKey; } private void DrawFiltersTab() { //IL_00bf: 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_00ce: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Show All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.ShowAllPackages(); } if (GUILayout.Button("Hide All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.HideAllPackages(); } if (GUILayout.Button("Rescan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { _plugin.RefreshEmoteRegistry(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.Label("Choose which packs appear in Picker and Grid. Hidden packs stay assigned in slots.", Array.Empty()); bool flag = false; try { _filterScroll = GUILayout.BeginScrollView(_filterScroll, Array.Empty()); flag = true; for (int i = 0; i < _plugin.PackageIds.Count; i++) { string text = _plugin.PackageIds[i]; bool flag2 = _plugin.IsPackageVisible(text); bool flag3 = GUILayout.Toggle(flag2, text + " (" + CountEmotesInPackage(text) + ")", Array.Empty()); if (flag3 != flag2) { _plugin.SetPackageVisible(text, flag3); } } } finally { if (flag) { GUILayout.EndScrollView(); } } } private bool DrawSettingsSectionHeader(string label, ConfigEntry cfg) { bool flag = cfg?.Value ?? true; bool flag2 = GUILayout.Toggle(flag, (flag ? "▼ " : "▶ ") + label, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (cfg != null && flag2 != flag) { cfg.Value = flag2; _plugin.SavePluginConfig(); flag = flag2; } return flag; } private void DrawPackFiltersInSettings() { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Show All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.ShowAllPackages(); } if (GUILayout.Button("Hide All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.HideAllPackages(); } if (GUILayout.Button("Rescan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { _plugin.RefreshEmoteRegistry(); SetStatus("Rescan done. " + _plugin.AllEmotes.Count + " emotes found."); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label("Pack filters affect Picker and Grid. Hidden packs stay assigned in slots.", Array.Empty()); for (int i = 0; i < _plugin.PackageIds.Count; i++) { string text = _plugin.PackageIds[i]; bool flag = _plugin.IsPackageVisible(text); bool flag2 = GUILayout.Toggle(flag, text + " (" + CountEmotesInPackage(text) + ")", Array.Empty()); if (flag2 != flag) { _plugin.SetPackageVisible(text, flag2); } } } private void DrawSettingsTab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) bool flag = false; try { _settingsScroll = GUILayout.BeginScrollView(_settingsScroll, Array.Empty()); flag = true; if (DrawSettingsSectionHeader("Deck", EmoteDeckPlugin.CfgSettingsDeckOpen)) { bool value = EmoteDeckPlugin.CfgEnablePages.Value; GUILayout.Label(value ? "Slots on each page" : "Slots", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(value ? "Each page" : "Count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) }); int activeSlotCount = _plugin.GetActiveSlotCount(); float num = GUILayout.HorizontalSlider((float)activeSlotCount, 1f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); int num2 = Mathf.Clamp(Mathf.RoundToInt(num), 1, 100); if (num2 != activeSlotCount) { EmoteDeckPlugin.CfgActiveSlotCount.Value = num2; _slotCountText = num2.ToString(CultureInfo.InvariantCulture); _plugin.TouchSlotRevision(); _plugin.QueueConfigSave(); } GUILayout.Label(num2.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) }); _slotCountText = GUILayout.TextField(_slotCountText ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) }); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }) && int.TryParse(_slotCountText, out var result)) { result = Mathf.Clamp(result, 1, 100); EmoteDeckPlugin.CfgActiveSlotCount.Value = result; _slotCountText = result.ToString(CultureInfo.InvariantCulture); _plugin.TouchSlotRevision(); _plugin.SavePluginConfig(); SetStatus(EmoteDeckPlugin.CfgEnablePages.Value ? ("Slots per page set to " + result + ".") : ("Slot count set to " + result + ".")); } GUILayout.EndHorizontal(); if (EmoteDeckPlugin.CfgEnablePages.Value) { GUILayout.Label("Across pages: " + _plugin.GetTotalDeckSlotCapacity() + " slots (" + _plugin.GetActiveSlotCount() + " on each page x " + _plugin.GetPageCount() + " pages).", Array.Empty()); GUILayout.Label("Each page keeps its own slots. The 100 limit is per page.", Array.Empty()); } GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Pages, Recent, Favorites", EmoteDeckPlugin.CfgSettingsSystemsOpen)) { bool flag2 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnablePages.Value, "Enable pages", Array.Empty()); if (flag2 != EmoteDeckPlugin.CfgEnablePages.Value) { EmoteDeckPlugin.CfgEnablePages.Value = flag2; _plugin.TouchSlotRevision(); _plugin.SavePluginConfig(); _gridMode = GridMode.Deck; } if (EmoteDeckPlugin.CfgEnablePages.Value) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Page count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int pageCount = _plugin.GetPageCount(); int num3 = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)pageCount, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), 1, 10); GUILayout.Label(num3.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }); if (num3 != pageCount) { EmoteDeckPlugin.CfgPageCount.Value = num3; if (_plugin.GetCurrentPageIndex() >= num3) { _plugin.SetCurrentPageIndex(num3 - 1); } _plugin.TouchSlotRevision(); _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } bool flag3 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableRecent.Value, "Enable Recent", Array.Empty()); if (flag3 != EmoteDeckPlugin.CfgEnableRecent.Value) { EmoteDeckPlugin.CfgEnableRecent.Value = flag3; if (!flag3 && _gridMode == GridMode.Recent) { _gridMode = GridMode.Deck; } _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableRecent.Value) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Recent limit", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int num4 = Mathf.Clamp(EmoteDeckPlugin.CfgRecentLimit.Value, 1, 100); int num5 = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)num4, 1f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), 1, 100); GUILayout.Label(num5.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }); if (num5 != num4) { EmoteDeckPlugin.CfgRecentLimit.Value = num5; while (_plugin.RecentKeys.Count > num5) { _plugin.RecentKeys.RemoveAt(_plugin.RecentKeys.Count - 1); } EmoteDeckPlugin.CfgRecentKeys.Value = string.Join(";", _plugin.RecentKeys.ToArray()); _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); GUILayout.Label("Recent: " + _plugin.RecentKeys.Count, Array.Empty()); } bool flag4 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableFavorites.Value, "Enable Favorites", Array.Empty()); if (flag4 != EmoteDeckPlugin.CfgEnableFavorites.Value) { EmoteDeckPlugin.CfgEnableFavorites.Value = flag4; if (!flag4 && _gridMode == GridMode.Favorites) { _gridMode = GridMode.Deck; } _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableFavorites.Value) { GUILayout.Label("Favorites: " + _plugin.FavoriteKeys.Count, Array.Empty()); } GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Emotes & Packs", EmoteDeckPlugin.CfgSettingsEmotesOpen)) { GUILayout.Label("Emote Wheel: " + (_plugin.EmoteWheelBridgeAvailable ? "Found" : "Not found") + " Wheel: " + _plugin.LastWheelEmoteCount + " Game: " + _plugin.LastNativeEmoteCount, Array.Empty()); GUILayout.Label("Total: " + _plugin.AllEmotes.Count + " Packs: " + _plugin.PackageIds.Count, Array.Empty()); bool flag5 = GUILayout.Toggle(EmoteDeckPlugin.CfgAutoRescanEnabled.Value, "Auto rescan", Array.Empty()); if (flag5 != EmoteDeckPlugin.CfgAutoRescanEnabled.Value) { EmoteDeckPlugin.CfgAutoRescanEnabled.Value = flag5; _plugin.SavePluginConfig(); } bool flag6 = GUILayout.Toggle(EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value, "Also show game /emote commands with Emote Wheel Base", Array.Empty()); if (flag6 != EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value) { EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value = flag6; _plugin.RefreshEmoteRegistry(); _plugin.SavePluginConfig(); } GUILayout.Space(4f); DrawPackFiltersInSettings(); GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Chat Commands", EmoteDeckPlugin.CfgSettingsChatOpen)) { bool flag7 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableChatCommands.Value, "Enable slot commands", Array.Empty()); if (flag7 != EmoteDeckPlugin.CfgEnableChatCommands.Value) { EmoteDeckPlugin.CfgEnableChatCommands.Value = flag7; _plugin.SavePluginConfig(); } bool flag8 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value, "Enable /ed name commands", Array.Empty()); if (flag8 != EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value) { EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value = flag8; _plugin.SavePluginConfig(); } bool value2 = EmoteDeckPlugin.CfgEnableClosestNameMatch.Value; GUI.enabled = EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value; bool flag9 = GUILayout.Toggle(value2, "Use closest match for /ed names", Array.Empty()); if (EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value && flag9 != value2) { EmoteDeckPlugin.CfgEnableClosestNameMatch.Value = flag9; _plugin.SavePluginConfig(); } bool value3 = EmoteDeckPlugin.CfgClosestMatchIncludeCustomCommands.Value; GUI.enabled = EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value && EmoteDeckPlugin.CfgEnableClosestNameMatch.Value; bool flag10 = GUILayout.Toggle(value3, "Closest match can use custom slot commands", Array.Empty()); if (EmoteDeckPlugin.CfgEnableNamedSlotCommands.Value && EmoteDeckPlugin.CfgEnableClosestNameMatch.Value && flag10 != value3) { EmoteDeckPlugin.CfgClosestMatchIncludeCustomCommands.Value = flag10; _plugin.SavePluginConfig(); } GUI.enabled = true; if (EmoteDeckPlugin.CfgEnableClosestNameMatch.Value) { GUILayout.Label("Closest match only applies after the command prefix, not to direct commands like /pnt.", Array.Empty()); } bool flag11 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableCustomChatPrefix.Value, "Allow custom prefix", Array.Empty()); if (flag11 != EmoteDeckPlugin.CfgEnableCustomChatPrefix.Value) { EmoteDeckPlugin.CfgEnableCustomChatPrefix.Value = flag11; _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableCustomChatPrefix.Value) { GUILayout.Label("Changing the prefix can conflict with another mod that uses the same slash command.", Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Prefix", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) }); GUI.enabled = EmoteDeckPlugin.CfgEnableCustomChatPrefix.Value; _chatPrefixText = GUILayout.TextField(_chatPrefixText ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) }); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { string text = EmoteDeckPlugin.NormalizeChatCommandPrefix(_chatPrefixText); EmoteDeckPlugin.CfgChatCommandPrefix.Value = text; _chatPrefixText = text; _plugin.SavePluginConfig(); SetStatus("Chat prefix set to " + text + "."); } GUI.enabled = true; GUILayout.EndHorizontal(); bool flag12 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableCustomSlotCommands.Value, "Enable direct custom commands", Array.Empty()); if (flag12 != EmoteDeckPlugin.CfgEnableCustomSlotCommands.Value) { EmoteDeckPlugin.CfgEnableCustomSlotCommands.Value = flag12; _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableCustomSlotCommands.Value) { GUILayout.Label("Direct commands can override other slash commands. Use this only if you know the command is free.", Array.Empty()); } string activeChatCommandPrefix = EmoteDeckPlugin.GetActiveChatCommandPrefix(); GUILayout.Label("Use " + activeChatCommandPrefix + " 1, " + activeChatCommandPrefix + " p2 1, or " + activeChatCommandPrefix + " point.", Array.Empty()); GUILayout.Label("Custom slot commands only work after you set one on a slot. Example: " + activeChatCommandPrefix + " pnt.", Array.Empty()); GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Grid", EmoteDeckPlugin.CfgSettingsGridOpen)) { DrawGridViewDropdownGUILayout(); DrawGridMouseModeDropdownGUILayout(); DrawAutoIntSlider("Columns", EmoteDeckPlugin.CfgGridColumns, EmoteDeckPlugin.CfgGridAutoColumns, 1, 30); if (GetGridViewMode() != "Names") { DrawAutoFloatSlider("Icon Shape", EmoteDeckPlugin.CfgGridIconAspect, EmoteDeckPlugin.CfgGridAutoIconAspect, 0.5f, 2f, "F2"); } else { GUILayout.Label("Names only does not use icon shape.", Array.Empty()); } bool flag13 = GUILayout.Toggle(EmoteDeckPlugin.CfgCloseGridAfterEmote.Value, "Close grid after emote", Array.Empty()); if (flag13 != EmoteDeckPlugin.CfgCloseGridAfterEmote.Value) { EmoteDeckPlugin.CfgCloseGridAfterEmote.Value = flag13; MaintainInputState(); _plugin.SavePluginConfig(); } GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Picker", EmoteDeckPlugin.CfgSettingsPickerOpen)) { bool flag14 = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value, "Move to next slot after Set", Array.Empty()); if (flag14 != EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value) { EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value = flag14; _plugin.SavePluginConfig(); } bool flag15 = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerHideAssigned.Value, "Hide assigned emotes", Array.Empty()); if (flag15 != EmoteDeckPlugin.CfgPickerHideAssigned.Value) { EmoteDeckPlugin.CfgPickerHideAssigned.Value = flag15; _pickerCacheSearch = null; _plugin.SavePluginConfig(); } GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Keybinds", EmoteDeckPlugin.CfgSettingsKeybindsOpen)) { DrawKeybindRow("Main window", EmoteDeckPlugin.CfgMainWindowKey, required: false, BindTarget.MainWindow, (KeyCode)121); DrawKeybindRow("Grid window", EmoteDeckPlugin.CfgGridWindowKey, required: false, BindTarget.GridWindow, (KeyCode)116); GUILayout.Space(6f); } if (DrawSettingsSectionHeader("Advanced", EmoteDeckPlugin.CfgSettingsAdvancedOpen)) { bool flag16 = GUILayout.Toggle(EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value, "Block game input while main window is open", Array.Empty()); if (flag16 != EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value) { EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value = flag16; UpdateInputBlockerState(); MaintainInputState(); _plugin.SavePluginConfig(); } bool flag17 = GUILayout.Toggle(EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value, "Block game input while grid window is open", Array.Empty()); if (flag17 != EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value) { EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value = flag17; UpdateInputBlockerState(); MaintainInputState(); _plugin.SavePluginConfig(); } bool flag18 = GUILayout.Toggle(EmoteDeckPlugin.CfgDebugLogging.Value, "Debug logging", Array.Empty()); if (flag18 != EmoteDeckPlugin.CfgDebugLogging.Value) { EmoteDeckPlugin.CfgDebugLogging.Value = flag18; _plugin.SavePluginConfig(); } } } finally { if (flag) { GUILayout.EndScrollView(); } } } private void DrawHelpTab() { GUILayout.Label("About", Array.Empty()); GUILayout.Label("Make pages, keep favorites, and play emotes from the grid or chat.", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Emotes", Array.Empty()); GUILayout.Label("- Emote Wheel packs show up here when Emote Wheel is installed.", Array.Empty()); GUILayout.Label("- Pack filters are in Settings > Emotes and Packs.", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Controls", Array.Empty()); GUILayout.Label("- Y: main window by default.", Array.Empty()); GUILayout.Label("- T: grid window by default.", Array.Empty()); GUILayout.Label("- Drag the header to move. Drag the lower-right corner to resize.", Array.Empty()); GUILayout.Label("- Binding: Esc cancels. Backspace clears the bind.", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Chat commands", Array.Empty()); GUILayout.Label("- /ed 1 plays slot 1 on the current page.", Array.Empty()); GUILayout.Label("- /ed p2 1 plays page 2, slot 1.", Array.Empty()); GUILayout.Label("- /ed point plays a matching emote name.", Array.Empty()); GUILayout.Label("- /edset toggles Settings. /edmod toggles the main window. /edgrid toggles the grid.", Array.Empty()); GUILayout.Label("- Closest match can finish short /ed name commands when it is on.", Array.Empty()); GUILayout.Label("- /ed pnt only works if you set pnt as a custom slot command.", Array.Empty()); GUILayout.Label("- Direct custom commands like /pnt are off by default.", Array.Empty()); } private void DrawGridContents(float viewW, float viewH) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) NormalizeGridMode(); List list = null; if (_gridMode == GridMode.Recent) { _plugin.BuildEntryListFromKeys(_plugin.RecentKeys, _specialGridEntries); list = _specialGridEntries; } else if (_gridMode == GridMode.Favorites) { _plugin.BuildEntryListFromKeys(_plugin.FavoriteKeys, _specialGridEntries); list = _specialGridEntries; } float num = DrawGridToolbar(viewW); float num2 = Mathf.Max(40f, viewH - num); int num3 = list?.Count ?? _plugin.GetActiveSlotCount(); GridMetrics metrics = CalculateGridMetrics(viewW, num2, num3); if (metrics.Columns < 1) { metrics.Columns = 1; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, num, viewW, num2); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, Mathf.Max(1f, viewW - 18f), Mathf.Max(num2, metrics.TotalContentH)); bool flag = false; try { _gridScroll = GUI.BeginScrollView(val, _gridScroll, val2, false, true); flag = true; int num4 = Mathf.Clamp(Mathf.FloorToInt(_gridScroll.y / metrics.RowH) - 1, 0, Math.Max(0, metrics.Rows - 1)); int num5 = Mathf.Clamp(Mathf.CeilToInt((_gridScroll.y + num2) / metrics.RowH) + 1, 0, Math.Max(0, metrics.Rows - 1)); Rect cellRect = default(Rect); for (int i = num4; i <= num5; i++) { for (int j = 0; j < metrics.Columns; j++) { int num6 = i * metrics.Columns + j; if (num6 >= num3) { break; } float num7 = (float)j * (metrics.CellW + metrics.Spacing); float num8 = (float)i * metrics.RowH; ((Rect)(ref cellRect))..ctor(num7, num8, metrics.CellW, metrics.CellH); DrawGridCell(num6, cellRect, metrics, list); } } } finally { if (flag) { GUI.EndScrollView(); } } } private void NormalizeGridMode() { if (_gridMode == GridMode.Recent && !EmoteDeckPlugin.CfgEnableRecent.Value) { _gridMode = GridMode.Deck; } if (_gridMode == GridMode.Favorites && !EmoteDeckPlugin.CfgEnableFavorites.Value) { _gridMode = GridMode.Deck; } } private float DrawGridToolbar(float viewW) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) if (!EmoteDeckPlugin.CfgEnableRecent.Value && !EmoteDeckPlugin.CfgEnableFavorites.Value && !EmoteDeckPlugin.CfgEnablePages.Value) { return 0f; } float result = 28f; float num = 0f; if (GUI.Toggle(new Rect(num, 2f, 58f, 22f), _gridMode == GridMode.Deck, "Slots", GUI.skin.button)) { _gridMode = GridMode.Deck; } num += 62f; if (EmoteDeckPlugin.CfgEnableRecent.Value) { if (GUI.Toggle(new Rect(num, 2f, 68f, 22f), _gridMode == GridMode.Recent, "Recent", GUI.skin.button)) { _gridMode = GridMode.Recent; } num += 72f; } if (EmoteDeckPlugin.CfgEnableFavorites.Value) { if (GUI.Toggle(new Rect(num, 2f, 82f, 22f), _gridMode == GridMode.Favorites, "Favorites", GUI.skin.button)) { _gridMode = GridMode.Favorites; } num += 86f; } if (_gridMode == GridMode.Deck && EmoteDeckPlugin.CfgEnablePages.Value) { int currentPageIndex = _plugin.GetCurrentPageIndex(); int pageCount = _plugin.GetPageCount(); GUI.enabled = currentPageIndex > 0; if (GUI.Button(new Rect(num, 2f, 26f, 22f), "<")) { _plugin.MoveToPreviousPage(); } GUI.enabled = true; num += 30f; GUI.Label(new Rect(num, 4f, 84f, 18f), "Page " + (currentPageIndex + 1) + " / " + pageCount, _smallLabelStyle); num += 86f; GUI.enabled = currentPageIndex + 1 < pageCount; if (GUI.Button(new Rect(num, 2f, 26f, 22f), ">")) { _plugin.MoveToNextPage(); } GUI.enabled = true; num += 32f; } else if (_gridMode == GridMode.Recent) { GUI.Label(new Rect(num + 4f, 4f, Mathf.Max(40f, viewW - num - 10f), 18f), _plugin.RecentKeys.Count + " recent", _smallLabelStyle); } else if (_gridMode == GridMode.Favorites) { GUI.Label(new Rect(num + 4f, 4f, Mathf.Max(40f, viewW - num - 10f), 18f), _plugin.FavoriteKeys.Count + " favorites", _smallLabelStyle); } return result; } private GridMetrics CalculateGridMetrics(float viewW, float viewH, int activeCount) { GridMetrics result = default(GridMetrics); string gridViewMode = GetGridViewMode(); result.NamesOnly = gridViewMode == "Names"; result.ShowIcon = !result.NamesOnly; result.ShowLabel = gridViewMode == "Standard" || gridViewMode == "Compact"; float num = 86f; int num2 = 12; float num3 = 34f; result.Spacing = 6f; result.LabelH = 18f; switch (gridViewMode) { case "Compact": num = 52f; num2 = 24; num3 = 30f; result.Spacing = 4f; result.LabelH = 15f; break; case "Mini": num = 38f; num2 = 30; num3 = 26f; result.Spacing = 4f; result.LabelH = 0f; break; case "Names": num = 92f; num2 = 24; num3 = 58f; result.Spacing = 4f; result.LabelH = 0f; break; } float num4 = Mathf.Max(80f, viewW - 18f); int columns = Mathf.Clamp(EmoteDeckPlugin.CfgGridColumns.Value, 1, 30); if (EmoteDeckPlugin.CfgGridAutoColumns.Value) { result.Columns = Mathf.Clamp(Mathf.FloorToInt((num4 + result.Spacing) / (num + result.Spacing)), 1, num2); if (activeCount > 0) { result.Columns = Mathf.Min(result.Columns, activeCount); } } else { result.Columns = columns; } if (result.Columns < 1) { result.Columns = 1; } result.CellW = Mathf.Max(num3, Mathf.Floor((num4 - result.Spacing * (float)(result.Columns - 1)) / (float)result.Columns)); if (result.NamesOnly) { result.CellH = 24f; } else { float num5 = (EmoteDeckPlugin.CfgGridAutoIconAspect.Value ? 1f : Mathf.Clamp(EmoteDeckPlugin.CfgGridIconAspect.Value, 0.5f, 2f)); result.CellH = Mathf.Max(num3, Mathf.Floor(result.CellW / Mathf.Max(0.05f, num5))); if (!EmoteDeckPlugin.CfgGridAutoIconAspect.Value) { result.CellH = Mathf.Min(result.CellH, Mathf.Max(42f, viewH * 0.65f)); } if (gridViewMode == "Mini") { result.CellH = Mathf.Min(result.CellH, 42f); } } result.RowH = result.CellH + result.LabelH + result.Spacing; result.Rows = ((activeCount > 0) ? Mathf.CeilToInt((float)activeCount / (float)result.Columns) : 0); result.TotalContentH = Mathf.Max(viewH, (float)result.Rows * result.RowH + 4f); return result; } private void DrawGridCell(int slotIndex, Rect cellRect, GridMetrics metrics, List specialEntries) { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) EmoteEntry entry = null; bool flag; if (specialEntries != null) { flag = slotIndex >= 0 && slotIndex < specialEntries.Count; if (flag) { entry = specialEntries[slotIndex]; } } else { flag = _plugin.TryGetSlotEmote(slotIndex, out entry); } bool flag2 = flag && entry != null; bool flag3 = flag2 && _plugin.IsPackageVisible(entry.PackageId); string s = (flag2 ? entry.DisplayName : "Empty"); string text = (flag2 ? (entry.PackageId + ":" + entry.DisplayName) : "Empty"); if (metrics.NamesOnly) { string text2 = (flag2 ? Trim(entry.DisplayName, Mathf.Max(6, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.2f))) : "Empty"); bool enabled = GUI.enabled; if (!flag2) { GUI.enabled = false; } if (GUI.Button(cellRect, new GUIContent(text2, text))) { PlayGridCell(slotIndex, flag, entry); } GUI.enabled = enabled; if (!flag2) { DrawEmptyCellOverlay(cellRect); } else if (!flag3) { DrawSolid(cellRect, new Color(0.15f, 0.15f, 0.15f, 0.45f)); } return; } bool enabled2 = GUI.enabled; if (!flag2) { GUI.enabled = false; } if (GUI.Button(cellRect, new GUIContent("", text))) { PlayGridCell(slotIndex, flag, entry); } GUI.enabled = enabled2; if (flag2) { if (!flag3) { DrawSolid(cellRect, new Color(0.15f, 0.15f, 0.15f, 0.55f)); } DrawSprite(entry.Icon, Inset(cellRect, metrics.ShowLabel ? 4f : 3f)); if ((Object)(object)entry.Icon == (Object)null) { GUI.Label(Inset(cellRect, 4f), Trim(entry.DisplayName, Mathf.Max(4, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.5f))), _centerLabelStyle); } if (EmoteDeckPlugin.CfgEnableFavorites.Value && _plugin.IsFavorite(entry.Key) && ((Rect)(ref cellRect)).width >= 34f) { GUI.Label(new Rect(((Rect)(ref cellRect)).xMax - 18f, ((Rect)(ref cellRect)).y + 2f, 16f, 16f), "★", _centerLabelStyle); } } else { DrawEmptyCellOverlay(cellRect); DrawDimLabel(cellRect, "Empty"); } if (metrics.ShowLabel && metrics.LabelH > 0f) { Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref cellRect)).x, ((Rect)(ref cellRect)).yMax + 1f, ((Rect)(ref cellRect)).width, metrics.LabelH); if (flag2) { GUI.Label(val, Trim(s, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.5f))), _centerLabelStyle); } else { DrawDimLabel(val, "Empty"); } } } private void DrawEmptyCellOverlay(Rect rect) { //IL_0001: 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) DrawSolid(rect, new Color(0f, 0f, 0f, 0.32f)); } private void DrawDimLabel(Rect rect, string text) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) Color color = GUI.color; GUI.color = new Color(color.r, color.g, color.b, color.a * 0.55f); GUI.Label(rect, text, _centerLabelStyle); GUI.color = color; } private void PlayGridCell(int slotIndex, bool assigned, EmoteEntry entry) { if (assigned && entry != null) { _plugin.TryPlayEmote(entry, out var status); SetStatus(status); if (EmoteDeckPlugin.CfgCloseGridAfterEmote.Value) { CloseGridWindow(); } } else { SetStatus("Slot " + (slotIndex + 1) + " is empty."); } } private string GetGridViewMode() { string text = EmoteDeckPlugin.NormalizeGridViewModeValue(EmoteDeckPlugin.CfgGridViewMode.Value); if (text != EmoteDeckPlugin.CfgGridViewMode.Value) { EmoteDeckPlugin.CfgGridViewMode.Value = text; } return text; } private void SetGridViewMode(string mode) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) mode = EmoteDeckPlugin.NormalizeGridViewModeValue(mode); if (EmoteDeckPlugin.CfgGridViewMode.Value != mode) { EmoteDeckPlugin.CfgGridViewMode.Value = mode; _gridScroll = Vector2.zero; _plugin.SavePluginConfig(); } } private string GetGridMouseMode() { string text = EmoteDeckPlugin.NormalizeGridMouseModeValue(EmoteDeckPlugin.CfgGridMouseMode.Value); if (text != EmoteDeckPlugin.CfgGridMouseMode.Value) { EmoteDeckPlugin.CfgGridMouseMode.Value = text; } return text; } private void SetGridMouseMode(string mode) { mode = EmoteDeckPlugin.NormalizeGridMouseModeValue(mode); if (EmoteDeckPlugin.CfgGridMouseMode.Value != mode) { EmoteDeckPlugin.CfgGridMouseMode.Value = mode; _plugin.SavePluginConfig(); MaintainInputState(); } } private void DrawGridViewDropdownGUILayout() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Grid view", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (GUILayout.Button(EmoteDeckPlugin.GridViewModeLabel(GetGridViewMode()) + " v", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { _settingsGridViewDropdownOpen = !_settingsGridViewDropdownOpen; } GUILayout.EndHorizontal(); if (_settingsGridViewDropdownOpen) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(100f); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); DrawGridViewOptionGUILayout("Standard"); DrawGridViewOptionGUILayout("Compact"); DrawGridViewOptionGUILayout("Mini"); DrawGridViewOptionGUILayout("Names"); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } } private void DrawGridViewOptionGUILayout(string mode) { string text = ((GetGridViewMode() == EmoteDeckPlugin.NormalizeGridViewModeValue(mode)) ? (EmoteDeckPlugin.GridViewModeLabel(mode) + " *") : EmoteDeckPlugin.GridViewModeLabel(mode)); if (GUILayout.Button(text, Array.Empty())) { SetGridViewMode(mode); _settingsGridViewDropdownOpen = false; } } private void DrawGridViewDropdown(Rect rect, bool settings) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) bool flag = (settings ? _settingsGridViewDropdownOpen : _gridViewDropdownOpen); if (GUI.Button(rect, EmoteDeckPlugin.GridViewModeLabel(GetGridViewMode()) + " v")) { flag = !flag; if (settings) { _settingsGridViewDropdownOpen = flag; if (flag) { _settingsGridMouseModeDropdownOpen = false; } } else { _gridViewDropdownOpen = flag; if (flag) { _gridMouseModeDropdownOpen = false; } } } if (flag) { float num = ((Rect)(ref rect)).yMax + 2f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Standard", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Compact", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Mini", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Names", settings); } } private void DrawGridViewOptionRect(Rect rect, string mode, bool settings) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) string text = ((GetGridViewMode() == EmoteDeckPlugin.NormalizeGridViewModeValue(mode)) ? (EmoteDeckPlugin.GridViewModeLabel(mode) + " *") : EmoteDeckPlugin.GridViewModeLabel(mode)); if (GUI.Button(rect, text)) { SetGridViewMode(mode); if (settings) { _settingsGridViewDropdownOpen = false; } else { _gridViewDropdownOpen = false; } } } private void DrawGridMouseModeDropdownGUILayout() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Mouse mode", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (GUILayout.Button(EmoteDeckPlugin.GridMouseModeLabel(GetGridMouseMode()) + " v", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { _settingsGridMouseModeDropdownOpen = !_settingsGridMouseModeDropdownOpen; } GUILayout.EndHorizontal(); if (_settingsGridMouseModeDropdownOpen) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(100f); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); DrawGridMouseModeOptionGUILayout("Auto"); DrawGridMouseModeOptionGUILayout("Always"); DrawGridMouseModeOptionGUILayout("Off"); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.Label("Auto unlocks only when Close grid after emote is on.", Array.Empty()); } private void DrawGridMouseModeOptionGUILayout(string mode) { string text = ((GetGridMouseMode() == EmoteDeckPlugin.NormalizeGridMouseModeValue(mode)) ? (EmoteDeckPlugin.GridMouseModeLabel(mode) + " *") : EmoteDeckPlugin.GridMouseModeLabel(mode)); if (GUILayout.Button(text, Array.Empty())) { SetGridMouseMode(mode); _settingsGridMouseModeDropdownOpen = false; } } private void DrawGridMouseModeDropdown(Rect rect, bool settings) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00fc: Unknown result type (might be due to invalid IL or missing references) bool flag = (settings ? _settingsGridMouseModeDropdownOpen : _gridMouseModeDropdownOpen); if (GUI.Button(rect, EmoteDeckPlugin.GridMouseModeLabel(GetGridMouseMode()) + " v")) { flag = !flag; if (settings) { _settingsGridMouseModeDropdownOpen = flag; if (flag) { _settingsGridViewDropdownOpen = false; } } else { _gridMouseModeDropdownOpen = flag; if (flag) { _gridViewDropdownOpen = false; } } } if (flag) { float num = ((Rect)(ref rect)).yMax + 2f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Auto", settings); num += 22f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Always", settings); num += 22f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Off", settings); } } private void DrawGridMouseModeOptionRect(Rect rect, string mode, bool settings) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) string text = ((GetGridMouseMode() == EmoteDeckPlugin.NormalizeGridMouseModeValue(mode)) ? (EmoteDeckPlugin.GridMouseModeLabel(mode) + " *") : EmoteDeckPlugin.GridMouseModeLabel(mode)); if (GUI.Button(rect, text)) { SetGridMouseMode(mode); if (settings) { _settingsGridMouseModeDropdownOpen = false; } else { _gridMouseModeDropdownOpen = false; } } } private void DrawAutoIntSlider(string label, ConfigEntry cfg, ConfigEntry autoCfg, int min, int max) { GUILayout.BeginHorizontal(Array.Empty()); bool value = autoCfg.Value; bool flag = GUILayout.Toggle(value, "Auto", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); if (flag != value) { autoCfg.Value = flag; _plugin.SavePluginConfig(); } GUI.enabled = !autoCfg.Value; GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); int value2 = cfg.Value; int num = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value2, (float)min, (float)max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), min, max); GUILayout.Label(autoCfg.Value ? "auto" : num.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (!autoCfg.Value && num != value2) { cfg.Value = num; _plugin.QueueConfigSave(); } GUI.enabled = true; GUILayout.EndHorizontal(); } private void DrawAutoFloatSlider(string label, ConfigEntry cfg, ConfigEntry autoCfg, float min, float max, string fmt) { GUILayout.BeginHorizontal(Array.Empty()); bool value = autoCfg.Value; bool flag = GUILayout.Toggle(value, "Auto", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); if (flag != value) { autoCfg.Value = flag; _plugin.SavePluginConfig(); } GUI.enabled = !autoCfg.Value; GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); float value2 = cfg.Value; float num = GUILayout.HorizontalSlider(value2, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); GUILayout.Label(autoCfg.Value ? "auto" : num.ToString(fmt, CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (!autoCfg.Value && Mathf.Abs(num - value2) > 0.001f) { cfg.Value = num; _plugin.QueueConfigSave(); } GUI.enabled = true; GUILayout.EndHorizontal(); } private void DrawIntSlider(string label, ConfigEntry cfg, int min, int max) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int value = cfg.Value; int num = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value, (float)min, (float)max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) })), min, max); GUILayout.Label(num.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (num != value) { cfg.Value = num; _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } private void DrawFloatSlider(string label, ConfigEntry cfg, float min, float max, string fmt) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); float value = cfg.Value; float num = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); GUILayout.Label(num.ToString(fmt, CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (Mathf.Abs(num - value) > 0.001f) { cfg.Value = num; _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } private unsafe void DrawKeybindRow(string label, ConfigEntry cfg, bool required, BindTarget target, KeyCode reset) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); GUILayout.Label(EmoteDeckPlugin.KeyLabel(cfg.Value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(88f) }); if (GUILayout.Button((IsCapturingKeyBind && _bindTarget == target) ? "Press a key" : "Rebind", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { StartBind(target); } GUI.enabled = !required; if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) && !required) { cfg.Value = "None"; _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindStatus = label + " cleared."; } GUI.enabled = true; if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) })) { cfg.Value = ((object)(*(KeyCode*)(&reset))/*cast due to .constrained prefix*/).ToString(); _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindStatus = label + " reset to " + ((object)(*(KeyCode*)(&reset))/*cast due to .constrained prefix*/).ToString() + "."; } GUILayout.EndHorizontal(); } private bool ShouldBlockGameplayInputForOpenWindows() { bool flag = EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen != null && EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value; bool flag2 = EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen != null && EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value; return (_mainOpen && flag) || (_gridOpen && flag2); } private void UpdateInputBlockerState() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) EmoteDeckInputBlocker.SetWindowState(_mainOpen, _mainRect, _gridOpen, _gridRect, ShouldBlockGameplayInputForOpenWindows()); } private void ConsumeScrollWheelInsideLocalWindow(Rect localWindowRect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current != null && (int)current.type == 6 && ((Rect)(ref localWindowRect)).Contains(current.mousePosition)) { UseEventIfSafe(current); } } private void ConsumeScrollWheelIfInsideWindow() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current != null && (int)current.type == 6 && IsMouseOverOpenWindow(current.mousePosition)) { UseEventIfSafe(current); } } private bool IsMouseOverOpenWindow(Vector2 guiMouse) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (_mainOpen && ((Rect)(ref _mainRect)).Contains(guiMouse)) { return true; } if (_gridOpen && ((Rect)(ref _gridRect)).Contains(guiMouse)) { return true; } return false; } private static void UseEventIfSafe(Event e) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if (e != null && (int)e.type != 7 && (int)e.type != 8 && (int)e.type != 12 && (int)e.type != 11) { e.Use(); } } private void StartBind(BindTarget target) { _bindTarget = target; _bindStartedFrame = Time.frameCount; _bindStatus = "Press a key or mouse button. Esc cancels. Backspace clears the bind."; GUI.FocusControl((string)null); } private unsafe bool HandleKeyBindCapture(Event e) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) if (!IsCapturingKeyBind) { return false; } if (e == null) { return false; } if (Time.frameCount == _bindStartedFrame) { return false; } KeyCode val = (KeyCode)0; bool flag = false; if ((int)e.type == 4) { val = e.keyCode; flag = (int)val > 0; } else if ((int)e.type == 0) { if (e.button >= 2 && e.button <= 6) { val = (KeyCode)(323 + e.button); flag = true; } else if (e.button == 0 || e.button == 1) { _bindStatus = "Left and right mouse are not used for binds."; UseEventIfSafe(e); return true; } } if (!flag) { return false; } if ((int)val == 27) { _bindTarget = BindTarget.None; _bindStartedFrame = -1; _bindStatus = "Canceled."; UseEventIfSafe(e); return true; } if ((int)val == 8) { if (_bindTarget == BindTarget.MainWindow) { EmoteDeckPlugin.CfgMainWindowKey.Value = "None"; _bindStatus = "Main window key cleared."; } else if (_bindTarget == BindTarget.GridWindow) { EmoteDeckPlugin.CfgGridWindowKey.Value = "None"; _bindStatus = "Grid window key cleared."; } _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindTarget = BindTarget.None; _bindStartedFrame = -1; UseEventIfSafe(e); return true; } if (EmoteDeckPlugin.IsBlockedMouseBindKey(val)) { _bindStatus = "Left and right mouse are not used for binds."; UseEventIfSafe(e); return true; } if (_bindTarget == BindTarget.MainWindow) { EmoteDeckPlugin.CfgMainWindowKey.Value = ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString(); } else if (_bindTarget == BindTarget.GridWindow) { EmoteDeckPlugin.CfgGridWindowKey.Value = ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString(); } _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SuppressHotkeyActivationUntilReleased(val); _plugin.SavePluginConfig(); _bindStatus = "Set to " + EmoteDeckPlugin.KeyLabel(val) + "."; _bindTarget = BindTarget.None; _bindStartedFrame = -1; UseEventIfSafe(e); return true; } private void DrawResizeHandle(Rect r, bool main) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) GUI.Label(r, "↘", _centerLabelStyle); Event current = Event.current; if ((int)current.type == 0 && ((Rect)(ref r)).Contains(current.mousePosition)) { if (main) { _mainResizing = true; } else { _gridResizing = true; } _resizeStart = GetGuiMouseScreenPos(); _resizeOrig = (main ? _mainRect : _gridRect); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; UseEventIfSafe(current); } } private void SaveMainRect() { ClampToScreen(ref _mainRect, 520f, 380f); EmoteDeckPlugin.CfgMainX.Value = ((Rect)(ref _mainRect)).x; EmoteDeckPlugin.CfgMainY.Value = ((Rect)(ref _mainRect)).y; EmoteDeckPlugin.CfgMainW.Value = ((Rect)(ref _mainRect)).width; EmoteDeckPlugin.CfgMainH.Value = ((Rect)(ref _mainRect)).height; } private void SaveGridRect() { ClampToScreen(ref _gridRect, 260f, 160f); EmoteDeckPlugin.CfgGridX.Value = ((Rect)(ref _gridRect)).x; EmoteDeckPlugin.CfgGridY.Value = ((Rect)(ref _gridRect)).y; EmoteDeckPlugin.CfgGridW.Value = ((Rect)(ref _gridRect)).width; EmoteDeckPlugin.CfgGridH.Value = ((Rect)(ref _gridRect)).height; } private int CountVisiblePackages() { int num = 0; for (int i = 0; i < _plugin.PackageIds.Count; i++) { if (_plugin.IsPackageVisible(_plugin.PackageIds[i])) { num++; } } return num; } private int CountEmotesInPackage(string pkg) { int num = 0; for (int i = 0; i < _plugin.AllEmotes.Count; i++) { EmoteEntry emoteEntry = _plugin.AllEmotes[i]; if (emoteEntry != null && string.Equals(emoteEntry.PackageId, pkg, StringComparison.OrdinalIgnoreCase)) { num++; } } return num; } private static bool ContainsIgnoreCase(string haystack, string needle) { if (haystack == null) { haystack = string.Empty; } if (needle == null) { needle = string.Empty; } return haystack.IndexOf(needle, StringComparison.OrdinalIgnoreCase) >= 0; } private static string Trim(string s, int max) { if (string.IsNullOrEmpty(s)) { return string.Empty; } if (s.Length <= max) { return s; } return s.Substring(0, Math.Max(0, max - 3)) + "..."; } private void SetStatus(string msg) { _statusText = msg ?? string.Empty; _statusUntil = Time.unscaledTime + 4f; } private static Rect GetWindowContentRect(Rect windowRect, float headerH, bool reserveResizeCorner) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) float num = (reserveResizeCorner ? 22f : 0f); float num2 = 8f; float num3 = headerH + 6f; float num4 = Mathf.Max(40f, ((Rect)(ref windowRect)).width - 16f - num); float num5 = Mathf.Max(40f, ((Rect)(ref windowRect)).height - headerH - 12f - num); return new Rect(num2, num3, num4, num5); } private static Vector2 GetGuiMouseScreenPos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0024: Unknown result type (might be due to invalid IL or missing references) return new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); } private static Rect Inset(Rect r, float pad) { //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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref r)).x + pad, ((Rect)(ref r)).y + pad, Mathf.Max(1f, ((Rect)(ref r)).width - pad * 2f), Mathf.Max(1f, ((Rect)(ref r)).height - pad * 2f)); } private static void ClampToScreen(ref Rect r, float minW, float minH) { float num = Mathf.Max(1f, (float)Screen.width); float num2 = Mathf.Max(1f, (float)Screen.height); float num3 = Mathf.Min(minW, num); float num4 = Mathf.Min(minH, num2); ((Rect)(ref r)).width = Mathf.Clamp(((Rect)(ref r)).width, num3, num); ((Rect)(ref r)).height = Mathf.Clamp(((Rect)(ref r)).height, num4, num2); float num5 = Mathf.Max(0f, num - ((Rect)(ref r)).width); float num6 = Mathf.Max(0f, num2 - ((Rect)(ref r)).height); ((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 0f, num5); ((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 0f, num6); } private static void DrawSolid(Rect rect, Color color) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } private static void DrawSprite(Sprite sprite, Rect rect) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)sprite == (Object)null) && !((Object)(object)sprite.texture == (Object)null)) { Rect textureRect = sprite.textureRect; Texture texture = (Texture)(object)sprite.texture; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)texture.width, ((Rect)(ref textureRect)).y / (float)texture.height, ((Rect)(ref textureRect)).width / (float)texture.width, ((Rect)(ref textureRect)).height / (float)texture.height); GUI.DrawTextureWithTexCoords(rect, texture, val, true); } } private GUIStyle GetTransparentWindowStyle() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown if (_transparentWindowStyle == null) { _transparentWindowStyle = new GUIStyle(GUI.skin.window); _transparentWindowStyle.normal.background = null; _transparentWindowStyle.onNormal.background = null; _transparentWindowStyle.hover.background = null; _transparentWindowStyle.active.background = null; _transparentWindowStyle.focused.background = null; _transparentWindowStyle.border = new RectOffset(0, 0, 0, 0); _transparentWindowStyle.padding = new RectOffset(0, 0, 0, 0); } return _transparentWindowStyle; } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown if (_headerStyle == null) { _headerStyle = new GUIStyle(GUI.skin.label); _headerStyle.fontStyle = (FontStyle)1; _headerStyle.alignment = (TextAnchor)3; _headerStyle.normal.textColor = Color.white; } if (_smallLabelStyle == null) { _smallLabelStyle = new GUIStyle(GUI.skin.label); _smallLabelStyle.fontSize = 11; _smallLabelStyle.alignment = (TextAnchor)3; _smallLabelStyle.normal.textColor = Color.white; } if (_centerLabelStyle == null) { _centerLabelStyle = new GUIStyle(GUI.skin.label); _centerLabelStyle.fontSize = 11; _centerLabelStyle.alignment = (TextAnchor)4; _centerLabelStyle.wordWrap = true; _centerLabelStyle.normal.textColor = Color.white; } if (_miniButtonStyle == null) { _miniButtonStyle = new GUIStyle(GUI.skin.button); _miniButtonStyle.fontSize = 11; _miniButtonStyle.padding = new RectOffset(2, 2, 1, 1); } } }