Compare commits

...

4 Commits

Author SHA1 Message Date
KnackAtNite 293f83dc36 v1.0.8.23: Main Menu bar; Duty List transparent background
Made-with: Cursor
2026-03-04 01:38:48 -05:00
KnackAtNite 9f9d5e1781 v1.0.8.22: Duty List hide-unless-hovered fix, tooltip gauge cost section
Made-with: Cursor
2026-03-02 19:40:33 -05:00
KnackAtNite ee7a2d71a0 Merge pull request 'fix: Duty List hide-unless-hovered + tooltip job gauge cost section formatting' (#3) from feature/improvement into main 2026-03-03 00:39:30 +00:00
Jorg 7a61e11e37 fix: Duty List hide-unless-hovered + tooltip job gauge cost section formatting
Duty List & Scenario Guide:
- Fix 'Hide unless hovered' visibility option not working. Override
  GetScreenBounds() in DutyListScenarioHud so the hover hit-test rect
  matches the drawn panel position exactly (same formula as draw code).

Tooltips (game-style formatting):
- Treat job gauge/resource costs as a new section with section label color
  (e.g. Soul Gauge Cost, Beast Gauge Cost, Lily Cost, Kenki, Ninki,
  Cartridge, Oath, Polyglot, Addersgall, Astral/Lunar Sign, Battery/Heat).
- In BuildFormattedActionTooltipBody: recognize gauge cost lines in the
  stats block and emit them as their own section (newline + green label).
- Fix tooltip break when stats and description share the first block:
  switch to description on first non-stats line instead of dropping it,
  so ability description text is never lost.

Made-with: Cursor
2026-03-02 13:33:30 -06:00
15 changed files with 791 additions and 31 deletions
+1
View File
@@ -709,6 +709,7 @@ namespace HSUI.Config
typeof(LimitBreakConfig),
typeof(MPTickerConfig),
typeof(DutyListScenarioConfig),
typeof(MainMenuConfig),
// Colors
typeof(TanksColorConfig),
+1
View File
@@ -40,6 +40,7 @@ public enum ElementKind : uint
EnemyList = 0xB8BD6685, // _EnemyList_a
// Misc HUD
MainMenu = 0x8AF95A70, // _MainCommand_a (Main Menu)
ToDoList = 0xA29100D2, // _ToDoList_a (Duty List)
ScenarioTree = 0x88EE6357, // ScenarioTree_a (Scenario Guide)
ExperienceBar = 0x21E53CCE, // _Exp_a
+3 -3
View File
@@ -9,9 +9,9 @@
<PropertyGroup>
<AssemblyName>HSUI</AssemblyName>
<AssemblyVersion>1.0.8.21</AssemblyVersion>
<FileVersion>1.0.8.21</FileVersion>
<InformationalVersion>1.0.8.21</InformationalVersion>
<AssemblyVersion>1.0.8.23</AssemblyVersion>
<FileVersion>1.0.8.23</FileVersion>
<InformationalVersion>1.0.8.23</InformationalVersion>
</PropertyGroup>
<PropertyGroup>
+1 -1
View File
@@ -2,7 +2,7 @@
"Author": "Knack117",
"Name": "HSUI",
"InternalName": "HSUI",
"AssemblyVersion": "1.0.8.21",
"AssemblyVersion": "1.0.8.23",
"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",
+5 -4
View File
@@ -334,7 +334,7 @@ namespace HSUI.Helpers
DrawGradientFilledRect(cursorPos, new Vector2(Math.Max(1, barSize.X * shield), h), color, drawList);
}
public static void DrawInWindow(string name, Vector2 pos, Vector2 size, bool needsInput, Action<ImDrawListPtr> drawAction)
public static void DrawInWindow(string name, Vector2 pos, Vector2 size, bool needsInput, Action<ImDrawListPtr> drawAction, bool allowInputInClipRect = false)
{
const ImGuiWindowFlags windowFlags = ImGuiWindowFlags.NoTitleBar |
ImGuiWindowFlags.NoScrollbar |
@@ -344,7 +344,7 @@ namespace HSUI.Helpers
bool inputs = InputsHelper.Instance?.IsProxyEnabled == true ? false : needsInput;
DrawInWindow(name, pos, size, inputs, false, windowFlags, drawAction);
DrawInWindow(name, pos, size, inputs, false, windowFlags, drawAction, allowInputInClipRect);
}
public static void DrawInWindow(
@@ -354,7 +354,8 @@ namespace HSUI.Helpers
bool needsInput,
bool needsWindow,
ImGuiWindowFlags windowFlags,
Action<ImDrawListPtr> drawAction)
Action<ImDrawListPtr> drawAction,
bool allowInputInClipRect = false)
{
if (!ClipRectsHelper.Instance.Enabled || ClipRectsHelper.Instance.Mode == WindowClippingMode.Performance)
@@ -408,7 +409,7 @@ namespace HSUI.Helpers
if (ClipRectsHelper.Instance.Mode == WindowClippingMode.Hide) { return; }
ImGuiWindowFlags flags = windowFlags;
if (needsInput && clipRect.Value.Contains(ImGui.GetMousePos()))
if (needsInput && !allowInputInClipRect && clipRect.Value.Contains(ImGui.GetMousePos()))
{
flags |= ImGuiWindowFlags.NoInputs;
}
+434
View File
@@ -0,0 +1,434 @@
using AtkValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace HSUI.Helpers
{
public readonly struct MainMenuEntry
{
public uint CommandId { get; }
public uint IconId { get; }
public string Name { get; }
public MainMenuEntry(uint commandId, uint iconId, string name)
{
CommandId = commandId;
IconId = iconId;
Name = name ?? "";
}
}
public static class MainMenuHelper
{
/// <summary>Names of the 7 top-level Main Menu categories. Clicking these opens the context menu, not a direct action.</summary>
private static readonly string[] MainMenuCategoryNames =
{
"Character", "Duty", "Logs", "Travel", "Party", "Social", "System"
};
/// <summary>Fixed icon IDs for categories (from sheet). Used for display; command row is still resolved by name.</summary>
private static readonly IReadOnlyDictionary<string, uint> FixedCategoryIconIds = new Dictionary<string, uint>(StringComparer.OrdinalIgnoreCase)
{
{ "Duty", 5 },
{ "Logs", 21 },
{ "Travel", 7 },
{ "Social", 20 }
};
/// <summary>Categories that must use the category header row (smallest RowId in MainCommandCategory) so the context menu matches the game bar.</summary>
private static readonly HashSet<string> UseCategoryHeaderForMenu = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"Logs",
"Travel"
};
/// <summary>Submenu item names that uniquely identify the Logs category (from default game context menu).</summary>
private static readonly string[] LogsCategoryAnchorNames = { "Hunting Log", "Sightseeing Log", "Crafting Log", "Gathering Log", "Fishing Log", "Fish Guide", "Orchestrion List", "Challenge Log" };
/// <summary>Submenu item names that uniquely identify the Travel category (from default game context menu).</summary>
private static readonly string[] TravelCategoryAnchorNames = { "Aether Currents", "Mount Speed", "Shared FATE", "Map", "Teleport", "Return" };
/// <summary>Get the 7 top-level Main Menu categories (Character, Duty, Logs, Travel, Party, Social, System) that are enabled. Clicking these opens the context menu.</summary>
public static List<MainMenuEntry> GetEnabledMainCommands()
{
var list = new List<MainMenuEntry>();
try
{
var sheet = Plugin.DataManager.GetExcelSheet<MainCommand>();
if (sheet == null) return list;
return GetEnabledMainCommandsUnsafe(list, sheet);
}
catch (Exception ex)
{
Plugin.Logger.Warning($"[HSUI] MainMenuHelper.GetEnabledMainCommands: {ex.Message}");
}
return list;
}
/// <summary>True if the sheet row name matches the main menu category (exact or flexible).</summary>
private static bool MatchesCategoryName(string rowName, string categoryName)
{
if (string.IsNullOrEmpty(rowName)) return false;
string r = rowName.Trim();
if (string.Equals(r, categoryName, StringComparison.OrdinalIgnoreCase))
return true;
if (string.Equals(categoryName, "Duty", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("Duty", StringComparison.OrdinalIgnoreCase) >= 0;
if (string.Equals(categoryName, "Travel", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("Travel", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Teleport", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Return", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Aetheryte", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Port", StringComparison.OrdinalIgnoreCase) >= 0;
if (string.Equals(categoryName, "Party", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("Party", StringComparison.OrdinalIgnoreCase) >= 0;
if (string.Equals(categoryName, "Logs", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("Log", StringComparison.OrdinalIgnoreCase) >= 0
|| string.Equals(r, "Journal", StringComparison.OrdinalIgnoreCase)
|| r.IndexOf("Quest", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Completion", StringComparison.OrdinalIgnoreCase) >= 0;
if (string.Equals(categoryName, "Social", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("Social", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Friend", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Contact", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Linkshell", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Free Company", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Fellowship", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Group", StringComparison.OrdinalIgnoreCase) >= 0;
if (string.Equals(categoryName, "System", StringComparison.OrdinalIgnoreCase))
return r.IndexOf("System", StringComparison.OrdinalIgnoreCase) >= 0
|| r.IndexOf("Config", StringComparison.OrdinalIgnoreCase) >= 0;
return false;
}
/// <summary>Get the category header row ID (smallest RowId in the same MainCommandCategory). For Logs/Travel we identify the category by submenu item names from the default game menu.</summary>
private static unsafe uint GetCategoryHeaderCommandId(string categoryName, Lumina.Excel.ExcelSheet<MainCommand> sheet, AgentHUD* agentHud)
{
uint categoryGroupId = 0;
string[]? anchorNames = null;
if (string.Equals(categoryName, "Logs", StringComparison.OrdinalIgnoreCase))
anchorNames = LogsCategoryAnchorNames;
else if (string.Equals(categoryName, "Travel", StringComparison.OrdinalIgnoreCase))
anchorNames = TravelCategoryAnchorNames;
if (anchorNames != null)
{
// Find category by a row that matches one of the known submenu names (e.g. "Hunting Log", "Aether Currents").
foreach (var row in sheet)
{
uint id = row.RowId;
if (id == 0) continue;
if (!agentHud->IsMainCommandEnabled(id)) continue;
string name = "";
try { name = row.Name.ToString(); }
catch { }
name = name?.Trim() ?? "";
foreach (string anchor in anchorNames)
{
if (name.IndexOf(anchor, StringComparison.OrdinalIgnoreCase) >= 0)
{
try { categoryGroupId = row.MainCommandCategory.RowId; break; }
catch { }
break;
}
}
if (categoryGroupId != 0) break;
}
}
if (categoryGroupId == 0)
{
// Fallback: exact "Logs"/"Travel" or flexible category name match
bool exactOnly = string.Equals(categoryName, "Logs", StringComparison.OrdinalIgnoreCase)
|| string.Equals(categoryName, "Travel", StringComparison.OrdinalIgnoreCase);
foreach (var row in sheet)
{
uint id = row.RowId;
if (id == 0) continue;
string name = "";
try { name = row.Name.ToString(); }
catch { }
if (exactOnly && !string.Equals(name.Trim(), categoryName, StringComparison.OrdinalIgnoreCase))
continue;
if (!exactOnly && !MatchesCategoryName(name, categoryName))
continue;
if (!agentHud->IsMainCommandEnabled(id))
continue;
try { categoryGroupId = row.MainCommandCategory.RowId; break; }
catch { }
}
}
if (categoryGroupId == 0)
{
foreach (var row in sheet)
{
uint id = row.RowId;
if (id == 0) continue;
string name = "";
try { name = row.Name.ToString(); }
catch { }
if (!MatchesCategoryName(name, categoryName) || !agentHud->IsMainCommandEnabled(id))
continue;
try { categoryGroupId = row.MainCommandCategory.RowId; break; }
catch { }
}
}
if (categoryGroupId == 0) return 0;
uint headerId = 0;
foreach (var row in sheet)
{
if (row.RowId == 0) continue;
try { if (row.MainCommandCategory.RowId != categoryGroupId) continue; }
catch { continue; }
if (!agentHud->IsMainCommandEnabled(row.RowId)) continue;
if (headerId == 0 || row.RowId < headerId)
headerId = row.RowId;
}
return headerId;
}
private static unsafe List<MainMenuEntry> GetEnabledMainCommandsUnsafe(List<MainMenuEntry> list, Lumina.Excel.ExcelSheet<MainCommand> sheet)
{
var agentHud = AgentHUD.Instance();
if (agentHud == null) return list;
foreach (string categoryName in MainMenuCategoryNames)
{
// Logs and Travel: use category header row so context menu matches game bar.
if (UseCategoryHeaderForMenu.Contains(categoryName))
{
uint headerId = GetCategoryHeaderCommandId(categoryName, sheet, agentHud);
if (headerId != 0)
{
uint iconId = 0;
if (FixedCategoryIconIds.TryGetValue(categoryName, out uint fixedIconId))
iconId = fixedIconId;
if (iconId == 0)
iconId = GetFallbackIconIdForCategory(categoryName);
list.Add(new MainMenuEntry(headerId, iconId, categoryName));
continue;
}
}
foreach (var row in sheet)
{
uint id = row.RowId;
if (id == 0) continue;
string name = "";
try { name = row.Name.ToString(); }
catch { }
if (!MatchesCategoryName(name, categoryName))
continue;
if (!agentHud->IsMainCommandEnabled(id))
continue;
// Icon: use fixed icon ID for Duty/Logs/Travel/Social (from sheet); others use sheet → game → fallback.
uint iconId = 0;
if (FixedCategoryIconIds.TryGetValue(categoryName, out uint fixedIconId))
iconId = fixedIconId;
if (iconId == 0)
{
try { iconId = (uint)row.Icon; }
catch { }
}
if (iconId == 0)
iconId = GetIconIdForMainCommand(id);
if (iconId == 0)
iconId = GetFallbackIconIdForCategory(categoryName);
list.Add(new MainMenuEntry(id, iconId, categoryName));
break;
}
}
return list;
}
/// <summary>Resolve icon for a Main Command. Uses RaptureHotbarModule when sheet row.Icon is 0.</summary>
public static unsafe uint GetIconIdForMainCommand(uint commandId)
{
try
{
var module = RaptureHotbarModule.Instance();
if (module != null && module->ModuleReady)
{
var bar = module->StandardHotbars[0];
var slot = bar.GetHotbarSlot(0);
if (slot != null)
{
int gameIcon = slot->GetIconIdForSlot(RaptureHotbarModule.HotbarSlotType.MainCommand, commandId);
if (gameIcon > 0) return (uint)gameIcon;
}
}
}
catch (Exception ex)
{
Plugin.Logger.Warning($"[HSUI] MainMenuHelper.GetIconIdForMainCommand({commandId}): {ex.Message}");
}
return 0;
}
/// <summary>Fallback icon when game and sheet both return 0. Duty = 61002 (exclamation) to match default bar.</summary>
private static uint GetFallbackIconIdForCategory(string categoryName)
{
return (categoryName?.ToLowerInvariant()) switch
{
"character" => 61001,
"duty" => 61002,
"logs" => 61003,
"travel" => 61004,
"party" => 61005,
"social" => 61006,
"system" => 61007,
_ => 0
};
}
/// <summary>Execute a main command by ID (e.g. Character, Social, Collection).</summary>
public static unsafe void ExecuteMainCommand(uint commandId)
{
try
{
var uiModule = Framework.Instance()->GetUIModule();
if (uiModule == null) return;
uiModule->ExecuteMainCommand(commandId);
}
catch (Exception ex)
{
Plugin.Logger.Warning($"[HSUI] MainMenuHelper.ExecuteMainCommand({commandId}): {ex.Message}");
}
}
/// <summary>Open the context submenu for a category, or execute directly if no submenu. When sub-commands exist, the HUD shows a custom context menu; otherwise executes the command.</summary>
public static unsafe void OpenSubmenuOrExecute(uint categoryCommandId)
{
var subIds = GetSubCommandIds(categoryCommandId);
if (subIds != null && subIds.Count > 0)
return; // Caller should use GetSubCommandEntries and show custom menu; we don't call OpenSystemMenu (crashes)
ExecuteMainCommand(categoryCommandId);
}
/// <summary>Get sub-command entries (id + display name) for the category. Same options as the default main menu bar context menu. Returns empty if category has no sub-commands.</summary>
public static List<(uint CommandId, string Name)> GetSubCommandEntries(uint categoryCommandId)
{
var list = new List<(uint, string)>();
try
{
var subIds = GetSubCommandIds(categoryCommandId);
if (subIds == null || subIds.Count == 0) return list;
var sheet = Plugin.DataManager.GetExcelSheet<MainCommand>();
if (sheet == null) return list;
foreach (uint id in subIds)
{
string name = "";
if (sheet.TryGetRow(id, out var row))
{
try { name = row.Name.ToString(); }
catch { }
}
if (string.IsNullOrEmpty(name)) name = $"#{id}";
list.Add((id, name));
}
}
catch (Exception ex)
{
Plugin.Logger.Warning($"[HSUI] MainMenuHelper.GetSubCommandEntries({categoryCommandId}): {ex.Message}");
}
return list;
}
/// <summary>Get MainCommand IDs that belong to the same category as the given command (for submenu).</summary>
private static unsafe List<uint> GetSubCommandIds(uint categoryCommandId)
{
var list = new List<uint>();
try
{
var sheet = Plugin.DataManager.GetExcelSheet<MainCommand>();
if (sheet == null) return list;
var agentHud = AgentHUD.Instance();
if (agentHud == null) return list;
if (!sheet.TryGetRow(categoryCommandId, out var categoryRow)) return list;
uint categoryGroupId;
try
{
categoryGroupId = categoryRow.MainCommandCategory.RowId;
}
catch { return list; }
foreach (var row in sheet)
{
if (row.RowId == 0) continue;
try
{
if (row.MainCommandCategory.RowId != categoryGroupId) continue;
}
catch { continue; }
if (!agentHud->IsMainCommandEnabled(row.RowId)) continue;
list.Add(row.RowId);
}
}
catch (Exception ex)
{
Plugin.Logger.Warning($"[HSUI] MainMenuHelper.GetSubCommandIds({categoryCommandId}): {ex.Message}");
}
return list;
}
/// <summary>Open the game's system menu with the given MainCommand IDs (context submenu).</summary>
private static unsafe void OpenSystemMenuWithCommands(List<uint> commandIds)
{
if (commandIds == null || commandIds.Count == 0) return;
if (commandIds.Count > 17) return; // game limit
var agentHud = AgentHUD.Instance();
if (agentHud == null) return;
int count = commandIds.Count;
int allocSize = 5 + 17 + 18; // atkValueArgs layout: [4]=size, [5..21]=commands, [23..]=optional name strings
var ptr = (AtkValue*)Marshal.AllocHGlobal(allocSize * sizeof(AtkValue));
try
{
// Zero entire buffer so the game never reads garbage as string pointers (prevents crash in Utf8String.SetString)
for (int i = 0; i < allocSize; i++)
{
ptr[i].Type = AtkValueType.Null;
ptr[i].Int = 0;
}
ptr[4].ChangeType(AtkValueType.UInt);
ptr[4].UInt = (uint)count;
for (int i = 0; i < count; i++)
{
ptr[5 + i].ChangeType(AtkValueType.Int);
ptr[5 + i].Int = (int)commandIds[i];
}
agentHud->OpenSystemMenu(ptr, (uint)count);
}
finally
{
Marshal.FreeHGlobal(new IntPtr(ptr));
}
}
}
}
+66 -20
View File
@@ -88,8 +88,17 @@ namespace HSUI.Helpers
private bool _dataIsValid = false;
/// <summary>Set when an HUD element (e.g. Main Menu) has the mouse over it this frame. World object tooltip will not show.</summary>
private bool _mouseOverHudElement = false;
private const float IconSize = 24f;
/// <summary>Call when the mouse is over an interactive HUD element so world object tooltip is not shown.</summary>
public void NotifyMouseOverHudElement()
{
_mouseOverHudElement = true;
}
public void ShowTooltipOnCursor(string text, string? title = null, uint id = 0, string name = "", uint? iconId = null, TooltipIdKind idKind = TooltipIdKind.None, List<TooltipSegment>? formattedText = null)
{
ShowTooltip(text, ImGui.GetMousePos(), title, id, name, iconId, idKind, formattedText);
@@ -114,7 +123,13 @@ namespace HSUI.Helpers
_currentIconId = iconId;
_formattedSegments = formattedText;
// calcualte title size
// When showing a simple tooltip with no title (e.g. HUD), clear previous title/body so we don't mix with last frame's world tooltip
if (title == null)
{
_currentTooltipTitle = null;
}
// calculate title size
_titleSize = Vector2.Zero;
if (title != null)
{
@@ -199,19 +214,17 @@ namespace HSUI.Helpers
/// </summary>
public void ShowWorldObjectTooltip()
{
// Don't overwrite if an HUD element already set a tooltip this frame (e.g. Main Menu icon)
if (_dataIsValid)
return;
// Don't show world tooltip when mouse is over an interactive HUD element (e.g. Main Menu bar)
if (_mouseOverHudElement)
return;
try
{
_worldTooltipConfig ??= ConfigurationManager.Instance.GetConfigObject<WorldObjectTooltipConfig>();
if (_worldTooltipConfig == null || !_worldTooltipConfig.Enabled)
return;
}
catch (Exception ex)
{
// Config not ready yet or not found - silently skip
if (_config.DebugTooltips)
Plugin.Logger.Warning($"[HSUI Tooltip] WorldObjectTooltipConfig not available: {ex.Message}");
return;
}
IGameObject? mouseOverTarget = Plugin.TargetManager.MouseOverTarget;
if (mouseOverTarget == null)
@@ -294,6 +307,13 @@ namespace HSUI.Helpers
{
ShowTooltipOnCursor(body, name, 0, "", iconId);
}
}
catch (Exception ex)
{
// Config not ready yet or not found - silently skip
if (_config.DebugTooltips)
Plugin.Logger.Warning($"[HSUI Tooltip] WorldObjectTooltipConfig not available: {ex.Message}");
}
}
private static unsafe uint? GetWorldObjectIconId(IGameObject gameObject)
@@ -310,6 +330,7 @@ namespace HSUI.Helpers
public void RemoveTooltip()
{
_dataIsValid = false;
_mouseOverHudElement = false;
_formattedSegments = null;
}
@@ -463,8 +484,9 @@ namespace HSUI.Helpers
if (string.IsNullOrEmpty(description))
return result;
// Pattern: section labels to color (Additional Effect, Duration, X Effect, Maximum Charges, Blood Gauge Cost, Combo, roles)
var sectionRegex = new Regex(@"\b(Additional Effect:|Duration:|Maximum Charges:|Blood Gauge Cost:|Combo Action:|Combo Potency:|Combo Bonus:|Tank:|Melee:|Ranged:|Caster:|Healer:|[A-Za-z][A-Za-z0-9\s]+ Effect:)", RegexOptions.None);
// Pattern: section labels to color (Additional Effect, Duration, X Effect, Maximum Charges, job gauge costs, Combo, roles)
// Job gauge/resource costs: Soul (RPR), Blood/Beast (DRK/WAR), Kenki/Ninki (SAM/NIN), Cartridge (GNB), Oath (PLD), Lily (WHM), etc.
var sectionRegex = new Regex(@"\b(Additional Effect:|Duration:|Maximum Charges:|Blood Gauge Cost:|Soul Gauge Cost:|Beast Gauge Cost:|Kenki Gauge Cost:|Kenki Cost:|Ninki Gauge Cost:|Ninki Cost:|Cartridge Cost:|Oath Gauge Cost:|Lily Cost:|Polyglot Cost:|Addersgall Cost:|Addersting Cost:|Astral Sign Cost:|Lunar Sign Cost:|Battery Gauge Cost:|Heat Gauge Cost:|[A-Za-z][A-Za-z0-9\s]*\s+Cost:|Combo Action:|Combo Potency:|Combo Bonus:|Tank:|Melee:|Ranged:|Caster:|Healer:|[A-Za-z][A-Za-z0-9\s]+ Effect:)", RegexOptions.None);
// Pattern: "Grants X X Effect:" - captures status name X
var grantsRegex = new Regex(@"Grants\s+(.+?)\s+\1\s+Effect:", RegexOptions.Singleline);
@@ -579,25 +601,33 @@ namespace HSUI.Helpers
var secondaryColor = config.SecondaryLabelColor.Vector;
var blocks = body.Split(new[] { "\n\n" }, StringSplitOptions.None);
int descStart = 0;
bool hasStats = false;
// Stats block: may contain "Potency: X" and "Cast: ... | Recast: ..." on separate lines
// Job gauge/resource cost line pattern (e.g. "Soul Gauge Cost: 50", "Lily Cost: 1") - treat as own section with section color
var gaugeCostLineRegex = new Regex(@"^(.+?\s+Cost:)\s*(.*)$", RegexOptions.None);
// Stats block: may contain "Potency: X", "Cast: ... | Recast: ...", and job gauge cost lines.
// Once we hit a line that doesn't match any of these, treat it and the rest as description (don't drop it).
List<string> descBlocks = new List<string>();
bool inDescription = false;
for (int i = 0; i < blocks.Length; i++)
{
string block = blocks[i].Trim();
var lines = block.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
bool blockIsStats = false;
List<string> descLinesInBlock = new List<string>();
foreach (string line in lines)
{
string part = line.Trim();
if (inDescription)
{
descLinesInBlock.Add(part);
continue;
}
if (part.StartsWith("Potency:", StringComparison.OrdinalIgnoreCase))
{
if (hasStats) result.Add(new TooltipSegment("\n", textColor));
result.Add(new TooltipSegment("Potency:", secondaryColor));
result.Add(new TooltipSegment(" " + part.Substring(8).TrimStart(), textColor));
hasStats = true;
blockIsStats = true;
}
else if (part.Contains("Cast:") || part.Contains("Recast:"))
{
@@ -605,19 +635,35 @@ namespace HSUI.Helpers
var statsSegs = FormatActionStats(part, textColor, secondaryColor);
result.AddRange(statsSegs);
hasStats = true;
blockIsStats = true;
}
else if (gaugeCostLineRegex.IsMatch(part))
{
var match = gaugeCostLineRegex.Match(part);
string label = match.Groups[1].Value.TrimEnd();
string value = match.Groups[2].Value.Trim();
if (hasStats) result.Add(new TooltipSegment("\n", textColor));
result.Add(new TooltipSegment(label + (string.IsNullOrEmpty(value) ? "" : " "), sectionColor));
if (!string.IsNullOrEmpty(value))
result.Add(new TooltipSegment(value, textColor));
hasStats = true;
}
else
{
inDescription = true;
descLinesInBlock.Add(part);
}
}
if (!blockIsStats)
if (descLinesInBlock.Count > 0)
descBlocks.Add(string.Join("\n", descLinesInBlock));
if (inDescription)
{
descStart = i;
descBlocks.AddRange(blocks.Skip(i + 1).Select(b => b.Trim()).Where(b => b.Length > 0));
break;
}
descStart = i + 1;
}
// Description: exactly one newline after stats, then description with compact section spacing
string desc = string.Join("\n", blocks.Skip(descStart)).Trim();
string desc = string.Join("\n\n", descBlocks).Trim();
if (!string.IsNullOrEmpty(desc))
{
if (hasStats) result.Add(new TooltipSegment("\n", textColor));
@@ -32,7 +32,7 @@ namespace HSUI.Interface.GeneralElements
[ColorEdit4("Background Color")]
[Order(31)]
public PluginConfigColor BackgroundColor = new(new Vector4(0f, 0f, 0f, 0.5f));
public PluginConfigColor BackgroundColor = new(new Vector4(0f, 0f, 0f, 0f));
[ColorEdit4("Divider Color")]
[Order(32)]
@@ -21,6 +21,13 @@ namespace HSUI.Interface.GeneralElements
return (new List<Vector2> { Config.Position }, new List<Vector2> { Config.Size });
}
/// <summary>Screen-space bounds for visibility "hide unless hovered" must match the draw position exactly.</summary>
public override (Vector2 min, Vector2 max) GetScreenBounds(Vector2 origin)
{
Vector2 topLeft = Utils.GetAnchoredPosition(origin + ParentPos() + Config.Position, Config.Size, Config.Anchor);
return (topLeft, topLeft + Config.Size);
}
public override void DrawChildren(Vector2 origin)
{
if (!Config.Enabled)
@@ -50,7 +57,9 @@ namespace HSUI.Interface.GeneralElements
{
DrawHelper.DrawInWindow(ID, basePos, Config.Size, true, (drawList) =>
{
drawList.AddRectFilled(basePos, basePos + Config.Size, Config.BackgroundColor.Base, 4);
uint bgColor = Config.BackgroundColor.Base;
if ((bgColor & 0xFF000000) != 0)
drawList.AddRectFilled(basePos, basePos + Config.Size, bgColor, 4);
drawList.PushClipRect(basePos, basePos + Config.Size, true);
float y = basePos.Y + padding;
@@ -0,0 +1,61 @@
using Dalamud.Bindings.ImGui;
using HSUI.Config;
using HSUI.Config.Attributes;
using HSUI.Enums;
using System.Numerics;
namespace HSUI.Interface.GeneralElements
{
[Section("Other Elements")]
[SubSection("Main Menu", 0)]
public class MainMenuConfig : AnchorablePluginConfigObject
{
[Combo("Layout", new[] { "Horizontal", "Vertical" })]
[Order(18)]
public int LayoutDirection = 0; // 0 = horizontal, 1 = vertical
[DragInt("Icon Size", min = 16, max = 64)]
[Order(20)]
public int IconSize = 36;
[DragInt("Spacing", min = 0, max = 24)]
[Order(21)]
public int Spacing = 4;
[ColorEdit4("Background Color")]
[Order(30)]
public PluginConfigColor BackgroundColor = new(new Vector4(0f, 0f, 0f, 0.6f));
[ColorEdit4("Icon Tint")]
[Order(31)]
public PluginConfigColor IconTint = new(new Vector4(1f, 1f, 1f, 1f));
[ColorEdit4("Hover Tint")]
[Order(32)]
public PluginConfigColor HoverTint = new(new Vector4(1f, 1f, 1f, 1f));
[Checkbox("Show Labels")]
[Order(35)]
public bool ShowLabels = false;
[NestedConfig("Visibility", 70)]
public VisibilityConfig VisibilityConfig = new();
public MainMenuConfig()
{
// Width fits 7 icons (36px) + 6 gaps (4px) + 8 margin = 284
Size = new Vector2(284, 48);
}
public new static MainMenuConfig DefaultConfig()
{
var viewport = ImGui.GetMainViewport().Size;
return new MainMenuConfig
{
Position = new Vector2(0, viewport.Y * 0.5f - 24),
Size = new Vector2(284, 48),
Anchor = DrawAnchor.Bottom
};
}
}
}
+190
View File
@@ -0,0 +1,190 @@
using Dalamud.Bindings.ImGui;
using HSUI.Config;
using HSUI.Helpers;
using HSUI.Interface;
using System;
using System.Collections.Generic;
using System.Numerics;
namespace HSUI.Interface.GeneralElements
{
public class MainMenuHud : DraggableHudElement, IHudElementWithVisibilityConfig
{
private const float BarPadding = 0f;
private const float BackgroundRounding = 6f;
/// <summary>Extra padding around content when drawing the background so the bar doesn't extend past the icons.</summary>
private const float BackgroundEdgePad = 2f;
private MainMenuConfig Config => (MainMenuConfig)_config;
public VisibilityConfig VisibilityConfig => Config.VisibilityConfig;
/// <summary>When set, the context menu with these entries should be shown (same frame or next). Cleared when popup closes.</summary>
private List<(uint CommandId, string Name)>? _contextMenuEntries = null;
public MainMenuHud(MainMenuConfig config, string displayName)
: base(config, displayName) { }
protected override (List<Vector2>, List<Vector2>) ChildrenPositionsAndSizes()
{
return (new List<Vector2> { Config.Position }, new List<Vector2> { Config.Size });
}
public override (Vector2 min, Vector2 max) GetScreenBounds(Vector2 origin)
{
Vector2 topLeft = Utils.GetAnchoredPosition(origin + ParentPos() + Config.Position, Config.Size, Config.Anchor);
return (topLeft, topLeft + Config.Size);
}
public override void DrawChildren(Vector2 origin)
{
if (!Config.Enabled)
return;
var entries = MainMenuHelper.GetEnabledMainCommands();
if (entries.Count == 0)
return;
Vector2 basePos = Utils.GetAnchoredPosition(origin + Config.Position, Config.Size, Config.Anchor);
Vector2 iconSize = new Vector2(Config.IconSize, Config.IconSize);
bool horizontal = Config.LayoutDirection == 0;
AddDrawAction(Config.StrataLevel, () =>
{
DrawHelper.DrawInWindow(ID, basePos, Config.Size, true, (drawListParam) =>
{
var drawList = ImGui.GetWindowDrawList();
// Compute total content size and starting position so icons are centered in the bar
int count = entries.Count;
float contentW, contentH;
if (horizontal)
{
contentW = count * iconSize.X + (count > 0 ? (count - 1) * Config.Spacing : 0);
if (Config.ShowLabels)
{
for (int i = 0; i < count; i++)
contentW += ImGui.CalcTextSize(entries[i].Name).X + Config.Spacing;
}
contentH = iconSize.Y;
}
else
{
contentW = iconSize.X;
contentH = 0;
foreach (var e in entries)
{
float h = iconSize.Y + Config.Spacing;
if (Config.ShowLabels && !string.IsNullOrEmpty(e.Name))
h += ImGui.CalcTextSize(e.Name).Y + 2;
contentH += h;
}
if (contentH > 0) contentH -= Config.Spacing;
}
float startX = basePos.X + BarPadding + Math.Max(0, (Config.Size.X - 2f * BarPadding - contentW) / 2f);
float startY = basePos.Y + BarPadding + Math.Max(0, (Config.Size.Y - 2f * BarPadding - contentH) / 2f);
// Draw background only over the content area so no gray bar shows on left/right
Vector2 bgMin = new Vector2(startX - BackgroundEdgePad, basePos.Y);
Vector2 bgMax = new Vector2(startX + contentW + BackgroundEdgePad, basePos.Y + Config.Size.Y);
if (!horizontal)
{
bgMin = new Vector2(basePos.X, startY - BackgroundEdgePad);
bgMax = new Vector2(basePos.X + Config.Size.X, startY + contentH + BackgroundEdgePad);
}
drawList.AddRectFilled(bgMin, bgMax, Config.BackgroundColor.Base, BackgroundRounding);
drawList.PushClipRect(basePos, basePos + Config.Size, true);
float x = startX;
float y = startY;
int index = 0;
foreach (var entry in entries)
{
Vector2 iconPos = horizontal
? new Vector2(x, basePos.Y + (Config.Size.Y - iconSize.Y) / 2f)
: new Vector2(basePos.X + (Config.Size.X - iconSize.X) / 2f, y);
Vector2 iconEnd = iconPos + iconSize;
// Use InvisibleButton so ImGui tracks hover/click for this icon
ImGui.SetCursorScreenPos(iconPos);
ImGui.InvisibleButton($"##mainmenu_icon_{ID}_{index}", iconSize);
bool hovered = ImGui.IsItemHovered();
uint tint = Config.IconTint.Base;
if (hovered)
{
tint = Config.HoverTint.Base;
TooltipsHelper.Instance.NotifyMouseOverHudElement();
TooltipsHelper.Instance.ShowTooltipOnCursor(entry.Name);
}
if (ImGui.IsItemClicked(ImGuiMouseButton.Left) || ImGui.IsItemClicked(ImGuiMouseButton.Right))
{
var subEntries = MainMenuHelper.GetSubCommandEntries(entry.CommandId);
if (subEntries != null && subEntries.Count > 0)
{
_contextMenuEntries = subEntries;
ImGui.OpenPopup("HSUI_MainMenu_Context");
ImGui.SetNextWindowPos(ImGui.GetMousePos());
}
else
{
MainMenuHelper.ExecuteMainCommand(entry.CommandId);
}
}
if (entry.IconId != 0)
DrawHelper.DrawIcon(entry.IconId, iconPos, iconSize, false, tint, drawList);
float labelH = 0;
if (Config.ShowLabels && !string.IsNullOrEmpty(entry.Name))
{
float labelW = ImGui.CalcTextSize(entry.Name).X;
labelH = ImGui.CalcTextSize(entry.Name).Y;
Vector2 labelPos = horizontal
? new Vector2(iconPos.X + iconSize.X + Config.Spacing, basePos.Y + (Config.Size.Y - labelH) / 2f)
: new Vector2(basePos.X + (Config.Size.X - labelW) / 2f, iconPos.Y + iconSize.Y + 2);
drawList.AddText(labelPos, Config.IconTint.Base, entry.Name);
}
if (horizontal)
{
float advance = iconSize.X + Config.Spacing;
if (Config.ShowLabels) advance += ImGui.CalcTextSize(entry.Name).X + Config.Spacing;
x += advance;
}
else
{
y += iconSize.Y + 2 + labelH + Config.Spacing;
}
index++;
}
drawList.PopClipRect();
// Draw context menu popup (same options as default main menu bar)
if (ImGui.BeginPopup("HSUI_MainMenu_Context", ImGuiWindowFlags.NoMove))
{
if (_contextMenuEntries != null)
{
foreach (var (cmdId, name) in _contextMenuEntries)
{
if (ImGui.Selectable(name))
{
uint commandId = cmdId;
Plugin.Framework.RunOnFrameworkThread(() => MainMenuHelper.ExecuteMainCommand(commandId));
ImGui.CloseCurrentPopup();
}
}
}
ImGui.EndPopup();
}
else
{
_contextMenuEntries = null;
}
}, true);
});
}
}
}
+5
View File
@@ -264,6 +264,11 @@ namespace HSUI.Interface
AddElements(ElementKind.ScenarioTree);
}
var mainMenu = ConfigurationManager.Instance?.GetConfigObject<MainMenuConfig>();
// Disabled while troubleshooting: keep game's Main Menu visible so we can compare behavior.
// if (mainMenu?.Enabled == true)
// AddElements(ElementKind.MainMenu);
// NamePlate is not in HUD Layout config; use UpdateDefaultNameplates (IsVisible) for that
if (IsCurrentJobHudEnabled())
{
+4
View File
@@ -452,6 +452,10 @@ namespace HSUI.Interface
var dutyListScenarioConfig = ConfigurationManager.Instance.GetConfigObject<DutyListScenarioConfig>();
var dutyListScenarioHud = new DutyListScenarioHud(dutyListScenarioConfig, "Duty List & Scenario Guide");
_hudElements.Add(dutyListScenarioConfig, dutyListScenarioHud);
var mainMenuConfig = ConfigurationManager.Instance.GetConfigObject<MainMenuConfig>();
var mainMenuHud = new MainMenuHud(mainMenuConfig, "Main Menu");
_hudElements.Add(mainMenuConfig, mainMenuHud);
}
public void Draw(uint jobId)
+8
View File
@@ -1,3 +1,11 @@
# 1.0.8.23
- **Main Menu**: New customizable main menu bar replacing the game's bar. Correct icons (Duty, Logs, Travel, Social) and context menus; Logs/Travel identified by submenu names. Background drawn only behind icons (no extra side padding). Crash fix when executing from context menu (RunOnFrameworkThread).
- **Duty List & Scenario Guide**: Background transparent by default; optional skip draw when fully transparent.
# 1.0.8.22
- **Duty List & Scenario Guide**: Fix "Hide unless hovered" visibility option — override GetScreenBounds() so hover hit-test matches drawn panel.
- **Tooltips**: Job gauge/resource costs (Soul Gauge, Beast Gauge, Lily, Kenki, etc.) now show as section with label color. Fix tooltip break when stats and description share first block.
# 1.0.8.21
- **Duty List & Scenario Guide**: Duty Information when inside a duty (dungeon/trial/raid) — shows duty name, elapsed timer, and objectives. Replaces queue info with in-duty info when BoundByDuty. Objective progress shown as "X out of Y step(s)" with checkmark when completed (replaces raw 0/1:0). Average wait time from queue status messages (static format preferred); multiple queued duties supported; redundant "Average Wait Time" label fixed.
+1 -1
View File
@@ -1 +1 @@
[{"Author":"Knack117","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":"1.0.8.20: Fixed cooldown overlays showing through game UI (dialogue box) when Show HUD during dialogue enabled. 1.0.8.19: Hotbar visibility moved to per-hotbar menus; removed Visibility Hotbars tab. 1.0.8.18: Visibility \"Hide unless hovered\" option. 1.0.8.17: Controller hotbars (cross layout, separate storage, sync with game). 1.0.8.16: Show HUD during dialogue and interaction. 1.0.8.15: Tooltips game-style formatting. 1.0.8.14: Mouse GCD Indicator. 1.0.8.13: Item tooltips now show. 1.0.8.12: Item/HQ icons now draw on hotbar. 1.0.8.11: Hotbar tooltip crash fix. 1.0.8.10: Hotbar crash fix when dragging inventory items. 1.0.8.9: Gearset persists on slot. 1.0.8.8: Gearset drag-drop fix. 1.0.8.7: Fixed Gearset icon clearing. 1.0.8.6: Crafting action tooltips full description. 1.0.8.4: Alliance Frames 1 and 2 fix; Hide in duty no longer hides alliance frames. 1.0.8.3: Fix left-click staying broken after disable. 1.0.8.2: Charge icons stay lit until all charges spent.","InternalName":"HSUI","AssemblyVersion":"1.0.8.20","RepoUrl":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI","ApplicableVersion":"any","Tags":["UI","HUD","Unit Frames","Nameplates","Party Frames","Hotbars"],"CategoryTags":["UI"],"DalamudApiLevel":14,"IconUrl":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/raw/branch/main/Media/Images/icon.png","ImageUrls":[],"DownloadLinkInstall":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.20/latest.zip","IsHide":false,"IsTestingExclusive":false,"DownloadLinkTesting":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.20/latest.zip","DownloadLinkUpdate":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.20/latest.zip","LastUpdate":"1772378453"}]
[{"Author":"Knack117","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":"1.0.8.23: Main Menu bar; Duty List & Scenario Guide transparent background. 1.0.8.22: Duty List hide-unless-hovered fix; tooltips job gauge costs. 1.0.8.21: Duty List in-duty info. 1.0.8.20: Fixed cooldown overlays showing through game UI (dialogue box) when Show HUD during dialogue enabled. 1.0.8.19: Hotbar visibility moved to per-hotbar menus; removed Visibility Hotbars tab. 1.0.8.18: Visibility \"Hide unless hovered\" option. 1.0.8.17: Controller hotbars (cross layout, separate storage, sync with game). 1.0.8.16: Show HUD during dialogue and interaction. 1.0.8.15: Tooltips game-style formatting. 1.0.8.14: Mouse GCD Indicator. 1.0.8.13: Item tooltips now show. 1.0.8.12: Item/HQ icons now draw on hotbar. 1.0.8.11: Hotbar tooltip crash fix. 1.0.8.10: Hotbar crash fix when dragging inventory items. 1.0.8.9: Gearset persists on slot. 1.0.8.8: Gearset drag-drop fix. 1.0.8.7: Fixed Gearset icon clearing. 1.0.8.6: Crafting action tooltips full description. 1.0.8.4: Alliance Frames 1 and 2 fix; Hide in duty no longer hides alliance frames. 1.0.8.3: Fix left-click staying broken after disable. 1.0.8.2: Charge icons stay lit until all charges spent.","InternalName":"HSUI","AssemblyVersion":"1.0.8.23","RepoUrl":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI","ApplicableVersion":"any","Tags":["UI","HUD","Unit Frames","Nameplates","Party Frames","Hotbars"],"CategoryTags":["UI"],"DalamudApiLevel":14,"IconUrl":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/raw/branch/main/Media/Images/icon.png","ImageUrls":[],"DownloadLinkInstall":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.23/latest.zip","IsHide":false,"IsTestingExclusive":false,"DownloadLinkTesting":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.23/latest.zip","DownloadLinkUpdate":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.23/latest.zip","LastUpdate":"1772500800"}]