From 3b20485c79e637f2ecbb284b64e398e091174edb Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 08:18:28 -0700 Subject: [PATCH] feat: show spell tooltip on macro action bar hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hovering a macro button on the action bar previously showed "Macro #N" with raw macro text. Now resolves the macro's primary spell via the cached lookup and shows its full rich tooltip (name, school, cost, cast time, range, description) — same as hovering a regular spell button. Falls back to the raw text display if no primary spell is found. Also shows the cooldown remaining in red when the spell is on cooldown. --- src/ui/game_screen.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 57f82c0d..a386dc9e 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -9106,13 +9106,29 @@ void GameScreen::renderActionBar(game::GameHandler& gameHandler) { ImGui::EndTooltip(); } else if (slot.type == game::ActionBarSlot::MACRO) { ImGui::BeginTooltip(); - ImGui::Text("Macro #%u", slot.id); - const std::string& macroText = gameHandler.getMacroText(slot.id); - if (!macroText.empty()) { - ImGui::Separator(); - ImGui::TextUnformatted(macroText.c_str()); - } else { - ImGui::TextDisabled("(no text — right-click to Edit)"); + // Show the primary spell's rich tooltip (like WoW does for macro buttons) + uint32_t macroSpellId = resolveMacroPrimarySpellId(slot.id, gameHandler); + bool showedRich = false; + if (macroSpellId != 0) { + showedRich = spellbookScreen.renderSpellInfoTooltip(macroSpellId, gameHandler, assetMgr); + if (onCooldown && macroCooldownRemaining > 0.0f) { + float cd = macroCooldownRemaining; + if (cd >= 60.0f) + ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), + "Cooldown: %d min %d sec", (int)cd/60, (int)cd%60); + else + ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "Cooldown: %.1f sec", cd); + } + } + if (!showedRich) { + ImGui::Text("Macro #%u", slot.id); + const std::string& macroText = gameHandler.getMacroText(slot.id); + if (!macroText.empty()) { + ImGui::Separator(); + ImGui::TextUnformatted(macroText.c_str()); + } else { + ImGui::TextDisabled("(no text — right-click to Edit)"); + } } ImGui::EndTooltip(); } else if (slot.type == game::ActionBarSlot::ITEM) {