Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c46a50b7e | |||
| 293f83dc36 | |||
| 9f9d5e1781 | |||
| ee7a2d71a0 | |||
| 7a61e11e37 | |||
| 27e743c80f | |||
| 2822f730f5 |
@@ -708,6 +708,8 @@ namespace HSUI.Config
|
||||
typeof(PullTimerConfig),
|
||||
typeof(LimitBreakConfig),
|
||||
typeof(MPTickerConfig),
|
||||
typeof(DutyListScenarioConfig),
|
||||
typeof(MainMenuConfig),
|
||||
|
||||
// Colors
|
||||
typeof(TanksColorConfig),
|
||||
|
||||
@@ -40,6 +40,9 @@ 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
|
||||
LimitGauge = 0xC79F450A, // _LimitBreak_a
|
||||
StatusEffects = 0x4A569616, // _Status_a
|
||||
|
||||
+3
-3
@@ -9,9 +9,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>HSUI</AssemblyName>
|
||||
<AssemblyVersion>1.0.8.19</AssemblyVersion>
|
||||
<FileVersion>1.0.8.19</FileVersion>
|
||||
<InformationalVersion>1.0.8.19</InformationalVersion>
|
||||
<AssemblyVersion>1.0.8.24</AssemblyVersion>
|
||||
<FileVersion>1.0.8.24</FileVersion>
|
||||
<InformationalVersion>1.0.8.24</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"Author": "Knack117",
|
||||
"Name": "HSUI",
|
||||
"InternalName": "HSUI",
|
||||
"AssemblyVersion": "1.0.8.19",
|
||||
"AssemblyVersion": "1.0.8.24",
|
||||
"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",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using HSUI.Config;
|
||||
using HSUI.Interface.GeneralElements;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
@@ -335,6 +336,56 @@ namespace HSUI.Helpers
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when the given area overlaps a game addon (e.g. dialogue box) and should not be drawn on top of it.
|
||||
/// Used by hotbars when "Show HUD during dialogue" is on, to avoid cooldown overlays bleeding through dialogue.
|
||||
/// Uses full clip rects when Window Clipping is enabled, otherwise a minimal dialogue-addon check.
|
||||
/// </summary>
|
||||
public bool SlotOverlapsGameAddon(Vector2 pos, Vector2 size)
|
||||
{
|
||||
// When Window Clipping is enabled, use full clip rects (all game addons)
|
||||
ClipRect? clipRect = GetClipRectForArea(pos, size);
|
||||
if (clipRect.HasValue) { return true; }
|
||||
|
||||
// When "Show HUD during dialogue" is on and we're in dialogue, check dialogue addons
|
||||
// (works even when full Window Clipping is disabled)
|
||||
var hudOptions = ConfigurationManager.Instance?.GetConfigObject<HUDOptionsConfig>();
|
||||
if (hudOptions?.ShowHudDuringDialogue != true) { return false; }
|
||||
if (!Plugin.Condition[ConditionFlag.OccupiedInQuestEvent] && !Plugin.Condition[ConditionFlag.OccupiedInEvent])
|
||||
{ return false; }
|
||||
|
||||
return GetClipRectForDialogueAddon(pos, size).HasValue;
|
||||
}
|
||||
|
||||
private static readonly string[] _dialogueAddonNames = { "Talk", "SelectString", "SelectIconString", "Journal" };
|
||||
|
||||
private unsafe ClipRect? GetClipRectForDialogueAddon(Vector2 pos, Vector2 size)
|
||||
{
|
||||
ClipRect area = new ClipRect(pos, pos + size);
|
||||
|
||||
foreach (string addonName in _dialogueAddonNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
var addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName(addonName, 1).Address;
|
||||
if (addon == null || addon->RootNode == null || !addon->IsVisible) { continue; }
|
||||
|
||||
float margin = 5 * addon->Scale;
|
||||
Vector2 addonPos = new Vector2(addon->X + addon->RootNode->X * addon->Scale + margin,
|
||||
addon->Y + addon->RootNode->Y * addon->Scale + margin);
|
||||
Vector2 addonSize = new Vector2(
|
||||
addon->RootNode->Width * addon->Scale - margin * 2,
|
||||
addon->RootNode->Height * addon->Scale - margin * 2);
|
||||
ClipRect addonRect = new ClipRect(addonPos, addonPos + addonSize);
|
||||
|
||||
if (addonRect.IntersectsWith(area)) { return addonRect; }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ClipRect[] GetInvertedClipRects(ClipRect clipRect)
|
||||
{
|
||||
float maxX = ImGui.GetMainViewport().Size.X;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using HSUI.Interface;
|
||||
|
||||
namespace HSUI.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracks which HUD element currently has its context menu open, so visibility can be ignored for that element
|
||||
/// while the menu is open (e.g. "hide unless hovered" would otherwise hide the element when the mouse moves to the menu).
|
||||
/// </summary>
|
||||
public static class ContextMenuVisibilityHelper
|
||||
{
|
||||
private static HudElement? _elementWithContextMenuOpen;
|
||||
|
||||
/// <summary>Call when opening a context menu for this element.</summary>
|
||||
public static void SetContextMenuOpen(HudElement? element)
|
||||
{
|
||||
_elementWithContextMenuOpen = element;
|
||||
}
|
||||
|
||||
/// <summary>True if the given element currently has its context menu open.</summary>
|
||||
public static bool IsContextMenuOpenFor(HudElement element)
|
||||
{
|
||||
return _elementWithContextMenuOpen != null && _elementWithContextMenuOpen == element;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-6
@@ -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,13 +354,17 @@ 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)
|
||||
{
|
||||
drawAction(ImGui.GetWindowDrawList());
|
||||
return;
|
||||
if (!needsInput && !needsWindow)
|
||||
{
|
||||
drawAction(ImGui.GetWindowDrawList());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
windowFlags |= ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoBringToFrontOnFocus;
|
||||
@@ -405,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;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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));
|
||||
|
||||
@@ -177,15 +177,20 @@ namespace HSUI.Interface.GeneralElements
|
||||
|
||||
if (showCd && slot.CooldownPercent > 0 && _pendingSlotIconIndex != i)
|
||||
{
|
||||
float total = 100f;
|
||||
float elapsed = total - slot.CooldownPercent;
|
||||
DrawHelper.DrawIconCooldown(pos, size, elapsed, total, drawList);
|
||||
if (showCdNumbers && slot.CooldownSecondsLeft > 0)
|
||||
// Skip cooldown overlay when slot overlaps game UI (e.g. dialogue box)
|
||||
// to avoid hotbar cooldowns showing through during "Show HUD during dialogue"
|
||||
if (!ClipRectsHelper.Instance.SlotOverlapsGameAddon(pos, size))
|
||||
{
|
||||
string cdText = slot.CooldownSecondsLeft.ToString();
|
||||
Vector2 textSize = ImGui.CalcTextSize(cdText);
|
||||
Vector2 textPos = pos + (size - textSize) * 0.5f;
|
||||
DrawHelper.DrawOutlinedText(cdText, textPos, 0xFFFFFFFF, 0xFF000000, drawList, 1);
|
||||
float total = 100f;
|
||||
float elapsed = total - slot.CooldownPercent;
|
||||
DrawHelper.DrawIconCooldown(pos, size, elapsed, total, drawList);
|
||||
if (showCdNumbers && slot.CooldownSecondsLeft > 0)
|
||||
{
|
||||
string cdText = slot.CooldownSecondsLeft.ToString();
|
||||
Vector2 textSize = ImGui.CalcTextSize(cdText);
|
||||
Vector2 textPos = pos + (size - textSize) * 0.5f;
|
||||
DrawHelper.DrawOutlinedText(cdText, textPos, 0xFFFFFFFF, 0xFF000000, drawList, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -317,15 +317,20 @@ namespace HSUI.Interface.GeneralElements
|
||||
|
||||
if (showCd && slot.CooldownPercent > 0 && _pendingSlotIconIndex != i)
|
||||
{
|
||||
float total = 100f;
|
||||
float elapsed = total - slot.CooldownPercent;
|
||||
DrawHelper.DrawIconCooldown(pos, size, elapsed, total, drawList);
|
||||
if (showCdNumbers && slot.CooldownSecondsLeft > 0)
|
||||
// Skip cooldown overlay when slot overlaps game UI (e.g. dialogue box)
|
||||
// to avoid hotbar cooldowns showing through during "Show HUD during dialogue"
|
||||
if (!ClipRectsHelper.Instance.SlotOverlapsGameAddon(pos, size))
|
||||
{
|
||||
string cdText = slot.CooldownSecondsLeft.ToString();
|
||||
Vector2 textSize = ImGui.CalcTextSize(cdText);
|
||||
Vector2 textPos = pos + (size - textSize) * 0.5f;
|
||||
DrawHelper.DrawOutlinedText(cdText, textPos, 0xFFFFFFFF, 0xFF000000, drawList, 1);
|
||||
float total = 100f;
|
||||
float elapsed = total - slot.CooldownPercent;
|
||||
DrawHelper.DrawIconCooldown(pos, size, elapsed, total, drawList);
|
||||
if (showCdNumbers && slot.CooldownSecondsLeft > 0)
|
||||
{
|
||||
string cdText = slot.CooldownSecondsLeft.ToString();
|
||||
Vector2 textSize = ImGui.CalcTextSize(cdText);
|
||||
Vector2 textPos = pos + (size - textSize) * 0.5f;
|
||||
DrawHelper.DrawOutlinedText(cdText, textPos, 0xFFFFFFFF, 0xFF000000, drawList, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
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("Duty List & Scenario Guide", 0)]
|
||||
public class DutyListScenarioConfig : AnchorablePluginConfigObject
|
||||
{
|
||||
[Checkbox("Show Quest Icons")]
|
||||
[Order(20)]
|
||||
public bool ShowQuestIcons = true;
|
||||
|
||||
[DragInt("Icon Size", min = 12, max = 48)]
|
||||
[Order(21, collapseWith = nameof(ShowQuestIcons))]
|
||||
public int IconSize = 24;
|
||||
|
||||
[DragFloat("Font Scale", min = 0.5f, max = 2f)]
|
||||
[Order(23)]
|
||||
public float FontScale = 1f;
|
||||
|
||||
[Font("Font")]
|
||||
[Order(24)]
|
||||
public string FontID = "Default";
|
||||
|
||||
[ColorEdit4("Text Color")]
|
||||
[Order(30)]
|
||||
public PluginConfigColor TextColor = new(new Vector4(1f, 1f, 1f, 1f));
|
||||
|
||||
[ColorEdit4("Background Color")]
|
||||
[Order(31)]
|
||||
public PluginConfigColor BackgroundColor = new(new Vector4(0f, 0f, 0f, 0f));
|
||||
|
||||
[ColorEdit4("Divider Color")]
|
||||
[Order(32)]
|
||||
public PluginConfigColor DividerColor = new(new Vector4(1f, 1f, 1f, 0.6f));
|
||||
|
||||
[Checkbox("Show Duty Finder section when in queue")]
|
||||
[Order(35)]
|
||||
public bool ShowDutyFinderSection = true;
|
||||
|
||||
[ColorEdit4("Duty Finder title color")]
|
||||
[Order(36, collapseWith = nameof(ShowDutyFinderSection))]
|
||||
public PluginConfigColor DutyFinderTitleColor = new(new Vector4(1f, 0.85f, 0.2f, 1f));
|
||||
|
||||
[ColorEdit4("Duty Finder detail color")]
|
||||
[Order(37, collapseWith = nameof(ShowDutyFinderSection))]
|
||||
public PluginConfigColor DutyFinderDetailColor = new(new Vector4(0.4f, 0.75f, 1f, 1f));
|
||||
|
||||
[NestedConfig("Visibility", 70)]
|
||||
public VisibilityConfig VisibilityConfig = new();
|
||||
|
||||
public DutyListScenarioConfig()
|
||||
{
|
||||
Size = new Vector2(320, 200);
|
||||
}
|
||||
|
||||
public new static DutyListScenarioConfig DefaultConfig()
|
||||
{
|
||||
var config = new DutyListScenarioConfig
|
||||
{
|
||||
Position = new Vector2(ImGui.GetMainViewport().Size.X * 0.38f, -ImGui.GetMainViewport().Size.Y * 0.35f),
|
||||
Size = new Vector2(320, 200),
|
||||
Anchor = DrawAnchor.TopRight
|
||||
};
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using HSUI.Config;
|
||||
using HSUI.Helpers;
|
||||
using HSUI.Interface;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace HSUI.Interface.GeneralElements
|
||||
{
|
||||
public class DutyListScenarioHud : DraggableHudElement, IHudElementWithVisibilityConfig
|
||||
{
|
||||
private DutyListScenarioConfig Config => (DutyListScenarioConfig)_config;
|
||||
public VisibilityConfig VisibilityConfig => Config.VisibilityConfig;
|
||||
|
||||
public DutyListScenarioHud(DutyListScenarioConfig config, string displayName)
|
||||
: base(config, displayName) { }
|
||||
|
||||
protected override (List<Vector2>, List<Vector2>) ChildrenPositionsAndSizes()
|
||||
{
|
||||
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)
|
||||
return;
|
||||
|
||||
var dutyListEntries = DutyListScenarioHelper.GetDutyListEntries();
|
||||
var scenarioEntries = DutyListScenarioHelper.GetScenarioGuideEntries();
|
||||
var dutyFinderInfo = DutyListScenarioHelper.GetDutyFinderQueueInfo();
|
||||
var dutyInfo = DutyListScenarioHelper.GetDutyInfo();
|
||||
|
||||
bool hasDutyList = dutyListEntries.Count > 0;
|
||||
bool hasScenario = scenarioEntries.Count > 0;
|
||||
// Show queue info when in queue; show duty info when in duty (not in queue). Same section, different content.
|
||||
bool hasDutyFinder = Config.ShowDutyFinderSection && dutyFinderInfo != null;
|
||||
bool hasDutyInfo = Config.ShowDutyFinderSection && dutyInfo != null;
|
||||
|
||||
if (!hasDutyList && !hasScenario && !hasDutyFinder && !hasDutyInfo)
|
||||
return;
|
||||
|
||||
Vector2 basePos = Utils.GetAnchoredPosition(origin + Config.Position, Config.Size, Config.Anchor);
|
||||
Vector2 iconSize = new Vector2(Config.IconSize, Config.IconSize);
|
||||
float lineHeight = Config.IconSize + 4;
|
||||
float padding = 6;
|
||||
float contentWidth = Config.Size.X - padding * 2;
|
||||
|
||||
AddDrawAction(Config.StrataLevel, () =>
|
||||
{
|
||||
DrawHelper.DrawInWindow(ID, basePos, Config.Size, true, (drawList) =>
|
||||
{
|
||||
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;
|
||||
uint textColor = Config.TextColor.Base;
|
||||
|
||||
if (Config.FontID != "Default" && FontsManager.Instance != null)
|
||||
{
|
||||
using (FontsManager.Instance.PushFont(Config.FontID))
|
||||
{
|
||||
ImGui.SetWindowFontScale(Config.FontScale);
|
||||
DrawContent(drawList, ref y, basePos.X + padding, contentWidth, lineHeight, iconSize, textColor, hasDutyList, hasScenario, hasDutyFinder, hasDutyInfo, dutyListEntries, scenarioEntries, dutyFinderInfo, dutyInfo);
|
||||
ImGui.SetWindowFontScale(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.PushFont(UiBuilder.DefaultFont);
|
||||
ImGui.SetWindowFontScale(Config.FontScale);
|
||||
DrawContent(drawList, ref y, basePos.X + padding, contentWidth, lineHeight, iconSize, textColor, hasDutyList, hasScenario, hasDutyFinder, hasDutyInfo, dutyListEntries, scenarioEntries, dutyFinderInfo, dutyInfo);
|
||||
ImGui.SetWindowFontScale(1);
|
||||
ImGui.PopFont();
|
||||
}
|
||||
drawList.PopClipRect();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static string TruncateText(string text, float maxWidth)
|
||||
{
|
||||
if (ImGui.CalcTextSize(text).X <= maxWidth)
|
||||
return text;
|
||||
string suffix = "...";
|
||||
while (text.Length > 1 && ImGui.CalcTextSize(text + suffix).X > maxWidth)
|
||||
text = text[..^1];
|
||||
return text + suffix;
|
||||
}
|
||||
|
||||
private void DrawContent(
|
||||
ImDrawListPtr drawList,
|
||||
ref float y,
|
||||
float x,
|
||||
float contentWidth,
|
||||
float lineHeight,
|
||||
Vector2 iconSize,
|
||||
uint textColor,
|
||||
bool hasDutyList,
|
||||
bool hasScenario,
|
||||
bool hasDutyFinder,
|
||||
bool hasDutyInfo,
|
||||
List<DutyListScenarioHelper.DutyListEntry> dutyListEntries,
|
||||
List<DutyListScenarioHelper.ScenarioGuideEntry> scenarioEntries,
|
||||
DutyListScenarioHelper.DutyFinderQueueInfo? dutyFinderInfo,
|
||||
DutyListScenarioHelper.DutyInfo? dutyInfo)
|
||||
{
|
||||
const uint TankIconId = 62581;
|
||||
const uint HealerIconId = 62582;
|
||||
const uint DPSIconId = 62583;
|
||||
|
||||
if (hasDutyInfo && dutyInfo != null)
|
||||
{
|
||||
uint titleColor = Config.DutyFinderTitleColor.Base;
|
||||
uint detailColor = Config.DutyFinderDetailColor.Base;
|
||||
|
||||
drawList.AddText(new Vector2(x, y), titleColor, "Duty Information");
|
||||
y += lineHeight;
|
||||
|
||||
string dutyText = TruncateText(dutyInfo.DutyName, contentWidth);
|
||||
drawList.AddText(new Vector2(x, y), detailColor, dutyText);
|
||||
y += lineHeight;
|
||||
|
||||
if (!string.IsNullOrEmpty(dutyInfo.TimerText))
|
||||
{
|
||||
drawList.AddText(new Vector2(x, y), detailColor, TruncateText(dutyInfo.TimerText, contentWidth));
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
foreach (var obj in dutyInfo.Objectives)
|
||||
{
|
||||
string line = string.IsNullOrWhiteSpace(obj.Text) ? "???" : obj.Text;
|
||||
if (!string.IsNullOrWhiteSpace(obj.Progress))
|
||||
line += ": " + obj.Progress;
|
||||
drawList.AddText(new Vector2(x, y), detailColor, TruncateText(line, contentWidth));
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
y += 4;
|
||||
if (hasScenario || hasDutyList)
|
||||
{
|
||||
float divY = y + 2;
|
||||
drawList.AddRectFilled(new Vector2(x, divY), new Vector2(x + contentWidth, divY + 2f), Config.DividerColor.Base);
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
else if (hasDutyFinder && dutyFinderInfo != null)
|
||||
{
|
||||
uint titleColor = Config.DutyFinderTitleColor.Base;
|
||||
uint detailColor = Config.DutyFinderDetailColor.Base;
|
||||
|
||||
drawList.AddText(new Vector2(x, y), titleColor, "Duty Finder");
|
||||
y += lineHeight;
|
||||
|
||||
string dutyText = TruncateText(dutyFinderInfo.DutyName, contentWidth);
|
||||
drawList.AddText(new Vector2(x, y), detailColor, dutyText);
|
||||
y += lineHeight;
|
||||
|
||||
string statusText = TruncateText(dutyFinderInfo.StatusText, contentWidth);
|
||||
drawList.AddText(new Vector2(x, y), detailColor, statusText);
|
||||
y += lineHeight;
|
||||
|
||||
float roleX = x;
|
||||
roleX += 4;
|
||||
DrawHelper.DrawIcon(TankIconId, new Vector2(roleX, y), new Vector2(iconSize.X * 0.8f, iconSize.Y * 0.8f), false, detailColor, drawList);
|
||||
roleX += iconSize.X * 0.8f + 2;
|
||||
drawList.AddText(new Vector2(roleX, y), detailColor, $":{dutyFinderInfo.TanksFound}/{dutyFinderInfo.TanksNeeded}");
|
||||
roleX += ImGui.CalcTextSize($":{dutyFinderInfo.TanksFound}/{dutyFinderInfo.TanksNeeded}").X + 6;
|
||||
DrawHelper.DrawIcon(HealerIconId, new Vector2(roleX, y), new Vector2(iconSize.X * 0.8f, iconSize.Y * 0.8f), false, detailColor, drawList);
|
||||
roleX += iconSize.X * 0.8f + 2;
|
||||
drawList.AddText(new Vector2(roleX, y), detailColor, $":{dutyFinderInfo.HealersFound}/{dutyFinderInfo.HealersNeeded}");
|
||||
roleX += ImGui.CalcTextSize($":{dutyFinderInfo.HealersFound}/{dutyFinderInfo.HealersNeeded}").X + 6;
|
||||
DrawHelper.DrawIcon(DPSIconId, new Vector2(roleX, y), new Vector2(iconSize.X * 0.8f, iconSize.Y * 0.8f), false, detailColor, drawList);
|
||||
roleX += iconSize.X * 0.8f + 2;
|
||||
drawList.AddText(new Vector2(roleX, y), detailColor, $":{dutyFinderInfo.DPSFound}/{dutyFinderInfo.DPSNeeded}");
|
||||
y += lineHeight;
|
||||
|
||||
string elapsedStr = $"{(int)dutyFinderInfo.TimeElapsed.TotalMinutes}:{dutyFinderInfo.TimeElapsed.Seconds:D2}";
|
||||
string timeLine = "Time Elapsed: " + elapsedStr;
|
||||
if (!string.IsNullOrEmpty(dutyFinderInfo.AverageWaitText))
|
||||
timeLine += " / Average Wait Time: " + dutyFinderInfo.AverageWaitText;
|
||||
timeLine = TruncateText(timeLine, contentWidth);
|
||||
drawList.AddText(new Vector2(x, y), detailColor, timeLine);
|
||||
y += lineHeight + 4;
|
||||
|
||||
if (hasScenario || hasDutyList)
|
||||
{
|
||||
float divY = y + 2;
|
||||
drawList.AddRectFilled(new Vector2(x, divY), new Vector2(x + contentWidth, divY + 2f), Config.DividerColor.Base);
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasScenario)
|
||||
{
|
||||
foreach (var entry in scenarioEntries)
|
||||
{
|
||||
float lineX = x;
|
||||
if (Config.ShowQuestIcons && entry.IconId != 0)
|
||||
{
|
||||
DrawHelper.DrawIcon(entry.IconId, new Vector2(lineX, y), iconSize, false, textColor, drawList);
|
||||
lineX += iconSize.X + 4;
|
||||
}
|
||||
|
||||
string text = TruncateText($"{entry.Label}: Lv. {entry.Level} {entry.QuestName}", contentWidth - (lineX - x));
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
drawList.AddText(new Vector2(lineX, y), textColor, text);
|
||||
|
||||
// Use full line height for hit area so the second line (Job) doesn't get covered by the first (MSQ)
|
||||
if (ImGui.IsMouseHoveringRect(new Vector2(lineX, y), new Vector2(x + contentWidth, y + lineHeight))
|
||||
&& ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
DutyListScenarioHelper.OpenMapForQuestIssuer(entry.QuestRowId);
|
||||
}
|
||||
|
||||
y += lineHeight;
|
||||
}
|
||||
if (hasDutyList)
|
||||
{
|
||||
float divY = y + 2;
|
||||
drawList.AddRectFilled(new Vector2(x, divY), new Vector2(x + contentWidth, divY + 2f), Config.DividerColor.Base);
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDutyList)
|
||||
{
|
||||
uint objectiveColor = ImGui.ColorConvertFloat4ToU32(new Vector4(0.78f, 0.78f, 0.78f, 1f));
|
||||
|
||||
foreach (var entry in dutyListEntries)
|
||||
{
|
||||
float lineX = x;
|
||||
if (Config.ShowQuestIcons && entry.IconId != 0)
|
||||
{
|
||||
DrawHelper.DrawIcon(entry.IconId, new Vector2(lineX, y), iconSize, false, textColor, drawList);
|
||||
lineX += iconSize.X + 4;
|
||||
}
|
||||
|
||||
string nameText = TruncateText(entry.QuestName, contentWidth - (lineX - x));
|
||||
var nameSize = ImGui.CalcTextSize(nameText);
|
||||
drawList.AddText(new Vector2(lineX, y), textColor, nameText);
|
||||
|
||||
if (entry.QuestId != 0
|
||||
&& ImGui.IsMouseHoveringRect(new Vector2(lineX, y), new Vector2(lineX + nameSize.X, y + nameSize.Y))
|
||||
&& ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
DutyListScenarioHelper.OpenJournalForQuest(entry.QuestId);
|
||||
}
|
||||
|
||||
y += lineHeight;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(entry.ObjectiveText))
|
||||
{
|
||||
float objX = lineX + 8;
|
||||
string objText = TruncateText("• " + entry.ObjectiveText, contentWidth - (objX - x));
|
||||
var objSize = ImGui.CalcTextSize(objText);
|
||||
drawList.AddText(new Vector2(objX, y), objectiveColor, objText);
|
||||
|
||||
if (entry.QuestId != 0
|
||||
&& ImGui.IsMouseHoveringRect(new Vector2(objX, y), new Vector2(objX + objSize.X, y + objSize.Y))
|
||||
&& ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
DutyListScenarioHelper.OpenMapForQuestObjective(entry.QuestId, entry.Sequence);
|
||||
}
|
||||
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
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;
|
||||
Helpers.ContextMenuVisibilityHelper.SetContextMenuOpen(this);
|
||||
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;
|
||||
Helpers.ContextMenuVisibilityHelper.SetContextMenuOpen(null);
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ namespace HSUI.Interface
|
||||
private bool _hidingCastBar = false;
|
||||
private Vector2 _pullTimerPos = Vector2.Zero;
|
||||
private bool _hidingPullTimer = false;
|
||||
private bool _hidingDutyListOffScreen = false;
|
||||
private bool _toDoListVisibleBeforeHide = true;
|
||||
|
||||
public HudHelper()
|
||||
{
|
||||
@@ -63,6 +65,7 @@ namespace HSUI.Interface
|
||||
SetGameHudElementsHidden(Array.Empty<uint>(), true);
|
||||
UpdateDefaultCastBar(true);
|
||||
UpdateDefaultPulltimer(true);
|
||||
UpdateDefaultDutyList(true);
|
||||
UpdateDefaultNameplates(true);
|
||||
UpdateJobGauges(true);
|
||||
}
|
||||
@@ -107,6 +110,7 @@ namespace HSUI.Interface
|
||||
UpdateJobGauges();
|
||||
UpdateDefaultHudElementsHidden();
|
||||
UpdateDefaultCastBar();
|
||||
UpdateDefaultDutyList();
|
||||
UpdateDefaultNameplates();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -122,6 +126,10 @@ namespace HSUI.Interface
|
||||
|
||||
public bool IsElementHidden(HudElement element)
|
||||
{
|
||||
// When this element's context menu is open, ignore visibility so the element stays visible
|
||||
if (ContextMenuVisibilityHelper.IsContextMenuOpenFor(element))
|
||||
return false;
|
||||
|
||||
IHudElementWithVisibilityConfig? e = element as IHudElementWithVisibilityConfig;
|
||||
if (e == null || e.VisibilityConfig == null) { return false; }
|
||||
|
||||
@@ -253,6 +261,18 @@ namespace HSUI.Interface
|
||||
if (enemyList?.Enabled == true)
|
||||
AddElements(ElementKind.EnemyList);
|
||||
|
||||
var dutyListScenario = ConfigurationManager.Instance?.GetConfigObject<DutyListScenarioConfig>();
|
||||
if (dutyListScenario?.Enabled == true)
|
||||
{
|
||||
// Only hide Scenario Tree via layout. Keep ToDoList in layout so it stays created/updated; we move it off-screen in UpdateDefaultDutyList so we can read objective text.
|
||||
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())
|
||||
{
|
||||
@@ -293,6 +313,8 @@ namespace HSUI.Interface
|
||||
|
||||
/// <summary>Visibility (ByteValue2) of game HUD elements before we hid them. Restored on disable/unload.</summary>
|
||||
private readonly Dictionary<uint, byte> _gameHudVisibilityBeforeHide = new();
|
||||
/// <summary>When we force-show ToDoList for off-screen text reading, save its ByteValue2 here to restore on disable.</summary>
|
||||
private readonly Dictionary<uint, byte> _gameHudForceShowBeforeRestore = new();
|
||||
|
||||
private unsafe void SetGameHudElementsHidden(uint[] hashesToHide, bool forceRestore)
|
||||
{
|
||||
@@ -316,6 +338,17 @@ namespace HSUI.Interface
|
||||
hasChanges = true;
|
||||
}
|
||||
_gameHudVisibilityBeforeHide.Clear();
|
||||
|
||||
foreach (ref var entry in entries)
|
||||
{
|
||||
if (!_gameHudForceShowBeforeRestore.TryGetValue(entry.AddonNameHash, out byte saved))
|
||||
continue;
|
||||
if (entry.ByteValue2 == saved)
|
||||
continue;
|
||||
entry.ByteValue2 = saved;
|
||||
hasChanges = true;
|
||||
}
|
||||
_gameHudForceShowBeforeRestore.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,6 +363,44 @@ namespace HSUI.Interface
|
||||
entry.ByteValue2 = 0x0;
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// When Duty List/Scenario is enabled, force-show the Duty List (ToDoList) so the addon is created and we can move it off-screen for text reading
|
||||
var dutyListScenario = ConfigurationManager.Instance?.GetConfigObject<DutyListScenarioConfig>();
|
||||
if (dutyListScenario?.Enabled == true)
|
||||
{
|
||||
uint toDoListHash = (uint)ElementKind.ToDoList;
|
||||
foreach (ref var entry in entries)
|
||||
{
|
||||
if (entry.AddonNameHash != toDoListHash)
|
||||
continue;
|
||||
if (!_gameHudForceShowBeforeRestore.ContainsKey(entry.AddonNameHash))
|
||||
_gameHudForceShowBeforeRestore[entry.AddonNameHash] = entry.ByteValue2;
|
||||
if (entry.ByteValue2 != 0x0)
|
||||
continue;
|
||||
entry.ByteValue2 = 0x1;
|
||||
hasChanges = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint toDoListHash = (uint)ElementKind.ToDoList;
|
||||
if (_gameHudForceShowBeforeRestore.TryGetValue(toDoListHash, out byte saved))
|
||||
{
|
||||
foreach (ref var entry in entries)
|
||||
{
|
||||
if (entry.AddonNameHash != toDoListHash)
|
||||
continue;
|
||||
if (entry.ByteValue2 != saved)
|
||||
{
|
||||
entry.ByteValue2 = saved;
|
||||
hasChanges = true;
|
||||
}
|
||||
_gameHudForceShowBeforeRestore.Remove(toDoListHash);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanges)
|
||||
@@ -418,6 +489,45 @@ namespace HSUI.Interface
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>When Duty List/Scenario is enabled, hide the game's Duty List addon with IsVisible=false so it stays at layout position and remains populated for objective text; restore on disable.</summary>
|
||||
private unsafe void UpdateDefaultDutyList(bool forceRestore = false)
|
||||
{
|
||||
var dutyListScenario = ConfigurationManager.Instance?.GetConfigObject<DutyListScenarioConfig>();
|
||||
bool shouldHide = !forceRestore && (dutyListScenario?.Enabled ?? false);
|
||||
|
||||
if (shouldHide && !_hidingDutyListOffScreen)
|
||||
{
|
||||
Plugin.AddonLifecycle.RegisterListener(AddonEvent.PreDraw, "_ToDoList", (addonEvent, args) =>
|
||||
{
|
||||
AtkUnitBase* addon = (AtkUnitBase*)args.Addon.Address;
|
||||
if (addon == null) return;
|
||||
addon->IsVisible = false;
|
||||
});
|
||||
|
||||
var addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName("_ToDoList", 1).Address;
|
||||
if (addon == null) addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName("_ToDoList", 0).Address;
|
||||
if (addon != null)
|
||||
{
|
||||
_toDoListVisibleBeforeHide = addon->IsVisible;
|
||||
addon->IsVisible = false;
|
||||
}
|
||||
|
||||
_hidingDutyListOffScreen = true;
|
||||
}
|
||||
else if ((forceRestore || !shouldHide) && _hidingDutyListOffScreen)
|
||||
{
|
||||
Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PreDraw, "_ToDoList");
|
||||
|
||||
var addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName("_ToDoList", 1).Address;
|
||||
if (addon == null) addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName("_ToDoList", 0).Address;
|
||||
if (addon != null)
|
||||
addon->IsVisible = _toDoListVisibleBeforeHide;
|
||||
|
||||
_toDoListVisibleBeforeHide = true;
|
||||
_hidingDutyListOffScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Dictionary<uint, Type> _jobIdToConfigType = new()
|
||||
{
|
||||
[JobIDs.PLD] = typeof(PaladinConfig), [JobIDs.WAR] = typeof(WarriorConfig),
|
||||
|
||||
@@ -448,6 +448,14 @@ namespace HSUI.Interface
|
||||
var partyCooldownsHud = new PartyCooldownsHud(partyCooldownsConfig, "Party Cooldowns");
|
||||
_hudElements.Add(partyCooldownsConfig, partyCooldownsHud);
|
||||
_hudElementsWithPreview.Add(partyCooldownsHud);
|
||||
|
||||
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)
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
# 1.0.8.24
|
||||
- **Visibility**: When a context menu is open for an element (e.g. Main Menu bar), visibility settings are ignored for that element so it stays visible while the menu is open.
|
||||
- **Duty List & Scenario Guide**: Fixed wrong objectives for the top entries — objectives are now matched by quest name to the game's string array instead of by index, so each quest shows the correct objective text.
|
||||
|
||||
# 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.0.8.20
|
||||
- **Duty List & Scenario Guide**: New combined HUD element replacing the game's Duty List and Scenario Guide. Shows active quests and levequests with quest icons, plus Main Scenario and Job Quest hints. Configurable position, size, font, colors, and visibility.
|
||||
- **Hotbars**: Fixed cooldown overlays showing through game UI (e.g. dialogue box) when "Show HUD during dialogue and interaction" is enabled. Hotbar cooldown timers and numbers are now skipped for slots that overlap dialogue, select, or journal addons.
|
||||
|
||||
# 1.0.8.19
|
||||
- **Hotbars**: Visibility settings moved from Visibility → Hotbars to each Hotbar 1–10 menu. The Visibility → Hotbars tab has been removed.
|
||||
|
||||
|
||||
+1
-1
@@ -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.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.19","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.19/latest.zip","IsHide":false,"IsTestingExclusive":false,"DownloadLinkTesting":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.19/latest.zip","DownloadLinkUpdate":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.19/latest.zip","LastUpdate":"1772292053"}]
|
||||
[{"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.24: Context menu keeps element visible; Duty List objectives fixed (match by quest name). 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.24","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.24/latest.zip","IsHide":false,"IsTestingExclusive":false,"DownloadLinkTesting":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.24/latest.zip","DownloadLinkUpdate":"http://brassnet.ddns.net:33983/KnackAtNite/HSUI/releases/download/v1.0.8.24/latest.zip","LastUpdate":"1772673600"}]
|
||||
|
||||
Reference in New Issue
Block a user