feat: show spell tooltip on macro action bar hover

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.
This commit is contained in:
Kelsi 2026-03-20 08:18:28 -07:00
parent a103fb5168
commit 3b20485c79

View file

@ -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) {