diff --git a/HSUI.csproj b/HSUI.csproj index fe80e61..29baf89 100644 --- a/HSUI.csproj +++ b/HSUI.csproj @@ -9,9 +9,9 @@ HSUI - 1.0.2.2 - 1.0.2.2 - 1.0.2.2 + 1.0.2.3 + 1.0.2.3 + 1.0.2.3 diff --git a/HSUI.json b/HSUI.json index a0d7140..e78ead6 100644 --- a/HSUI.json +++ b/HSUI.json @@ -2,7 +2,7 @@ "Author": "Knack117", "Name": "HSUI", "InternalName": "HSUI", - "AssemblyVersion": "1.0.2.2", + "AssemblyVersion": "1.0.2.3", "Description": "HSUI provides a highly configurable HUD replacement for FFXIV, recreated from DelvUI using KamiToolKit, FFXIVClientStructs, and Dalamud. Features unit frames, castbars, job gauges, nameplates, party frames, status effects, enemy list, configurable hotbars with drag-and-drop, and profiles.", "ApplicableVersion": "any", "RepoUrl": "https://github.com/Knack117/HSUI", diff --git a/Helpers/InputsHelper.cs b/Helpers/InputsHelper.cs index 632587b..bb679a3 100644 --- a/Helpers/InputsHelper.cs +++ b/Helpers/InputsHelper.cs @@ -294,9 +294,34 @@ namespace HSUI.Helpers if (ImGui.GetTime() >= suppressUntil) _suppressExecuteSlotByIdForDrop = (99, 99, 0); + // Record for keypress flash (hotbarId 0-9 = bars 1-10, slotId 0-11) + LastExecutedBar = (int)hotbarId + 1; + LastExecutedSlot = (int)slotId; + LastExecutedTime = ImGui.GetTime(); + return _executeSlotByIdHook != null ? _executeSlotByIdHook.Original(module, hotbarId, slotId) : (byte)0; } + /// Bar 1-10, Slot 0-11. Set when ExecuteSlotById is invoked (keybind or click). + public static int LastExecutedBar { get; private set; } = -1; + public static int LastExecutedSlot { get; private set; } = -1; + public static double LastExecutedTime { get; private set; } + + /// True if this slot was executed within the given duration (seconds). + public static bool WasSlotJustExecuted(int hotbarIndex, int slotIndex, double durationSec = 0.2) + { + if (LastExecutedBar != hotbarIndex || LastExecutedSlot != slotIndex) return false; + return (ImGui.GetTime() - LastExecutedTime) <= durationSec; + } + + /// 0=just pressed, 1=fully faded. For smooth flash decay. + public static float GetKeypressFlashAlpha(int hotbarIndex, int slotIndex, double durationSec = 0.2) + { + if (!WasSlotJustExecuted(hotbarIndex, slotIndex, durationSec)) return 0f; + double elapsed = ImGui.GetTime() - LastExecutedTime; + return (float)(1.0 - (elapsed / durationSec)); + } + private bool IsActionValid(ulong actionID, IGameObject? target) { if (target == null || actionID == 0 || _sheet == null) diff --git a/Interface/GeneralElements/ActionBarsHud.cs b/Interface/GeneralElements/ActionBarsHud.cs index e472d06..95afa57 100644 --- a/Interface/GeneralElements/ActionBarsHud.cs +++ b/Interface/GeneralElements/ActionBarsHud.cs @@ -195,6 +195,16 @@ namespace HSUI.Interface.GeneralElements DrawHelper.DrawOutlinedText(cdText, textPos, 0xFFFFFFFF, 0xFF000000, drawList, 1); } } + + if (Config.ShowKeypressFlash) + { + float flashAlpha = InputsHelper.GetKeypressFlashAlpha(Config.HotbarIndex, i, 0.2); + if (flashAlpha > 0.001f) + { + byte a = (byte)(flashAlpha * 0.5f * 255); + drawList.AddRectFilled(pos, pos + size, (uint)(a << 24 | 0xFFFFFF)); + } + } } if (Config.ShowSlotNumbers && !slot.IsEmpty) diff --git a/Interface/GeneralElements/HotbarsConfig.cs b/Interface/GeneralElements/HotbarsConfig.cs index eb76a3f..56bc21e 100644 --- a/Interface/GeneralElements/HotbarsConfig.cs +++ b/Interface/GeneralElements/HotbarsConfig.cs @@ -67,11 +67,15 @@ namespace HSUI.Interface.GeneralElements [Order(29)] public bool ShowComboHighlight = true; + [Checkbox("Show Keypress Flash")] + [Order(30)] + public bool ShowKeypressFlash = true; + [NestedConfig("Combo Highlight", 31)] public ComboHighlightConfig ComboHighlightConfig = new(); [Checkbox("Debug Drag & Drop")] - [Order(30)] + [Order(32)] public bool DebugDragDrop = false; [NestedConfig("Visibility", 70)] diff --git a/changelog.md b/changelog.md index 3779faf..f99a3b6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# 1.0.2.3 +- **Hotbars**: Keypress flash indicator — slots flash when you press their keybind (or click). Toggle in Hotbars → per-hotbar "Show Keypress Flash". + # 1.0.2.2 - **Critical fix**: ColorUtils.GetColorByScale was throwing (corrupted config or divide-by-zero), causing Party Frames to crash the draw loop and preventing Hotbars and later elements from rendering. Added null checks, divide-by-zero guard, and try-catch fallback. diff --git a/pluginmaster.json b/pluginmaster.json index 6e7c66b..71b205f 100644 --- a/pluginmaster.json +++ b/pluginmaster.json @@ -4,9 +4,9 @@ "Name": "HSUI", "Punchline": "A modern HUD replacement built for customization.", "Description": "HSUI provides a highly configurable HUD replacement for FFXIV, recreated from DelvUI using KamiToolKit, FFXIVClientStructs, and Dalamud. Features unit frames, castbars, job gauges, nameplates, party frames, status effects, enemy list, configurable hotbars with drag-and-drop, and profiles.", - "Changelog": "Fix: ColorUtils crash that prevented hotbars from showing. Null/divide-by-zero guards in GetColorByScale.", + "Changelog": "Hotbars: Keypress flash indicator when pressing slot keybinds. Toggle per hotbar.", "InternalName": "HSUI", - "AssemblyVersion": "1.0.2.2", + "AssemblyVersion": "1.0.2.3", "RepoUrl": "https://github.com/Knack117/HSUI", "ApplicableVersion": "any", "Tags": ["UI", "HUD", "Unit Frames", "Nameplates", "Party Frames", "Hotbars"], @@ -14,10 +14,10 @@ "DalamudApiLevel": 14, "IconUrl": "https://raw.githubusercontent.com/Knack117/HSUI/main/Media/Images/icon.png", "ImageUrls": [], - "DownloadLinkInstall": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.2/latest.zip", + "DownloadLinkInstall": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.3/latest.zip", "IsHide": false, "IsTestingExclusive": false, - "DownloadLinkTesting": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.2/latest.zip", - "DownloadLinkUpdate": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.2/latest.zip" + "DownloadLinkTesting": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.3/latest.zip", + "DownloadLinkUpdate": "https://github.com/Knack117/HSUI/releases/download/v1.0.2.3/latest.zip" } ]