v1.0.2.3: Keypress flash indicator for hotbar slots

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-01-31 02:59:15 -05:00
parent 1011d126d8
commit 4365f78ef7
7 changed files with 52 additions and 10 deletions
+25
View File
@@ -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;
}
/// <summary>Bar 1-10, Slot 0-11. Set when ExecuteSlotById is invoked (keybind or click).</summary>
public static int LastExecutedBar { get; private set; } = -1;
public static int LastExecutedSlot { get; private set; } = -1;
public static double LastExecutedTime { get; private set; }
/// <summary>True if this slot was executed within the given duration (seconds).</summary>
public static bool WasSlotJustExecuted(int hotbarIndex, int slotIndex, double durationSec = 0.2)
{
if (LastExecutedBar != hotbarIndex || LastExecutedSlot != slotIndex) return false;
return (ImGui.GetTime() - LastExecutedTime) <= durationSec;
}
/// <summary>0=just pressed, 1=fully faded. For smooth flash decay.</summary>
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)