From fd7886f4ce3191de486110085e2f0892baae7ff7 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 10:05:49 -0700 Subject: [PATCH] feat: show NPC subtitle on nameplates Display creature subtitles (e.g. , ) below NPC names on nameplates, mirroring the guild tag display for players. The subtitle is fetched from the creature info cache populated by SMSG_CREATURE_QUERY_RESPONSE. --- src/ui/game_screen.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 9aacfa58..c2325886 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -11205,27 +11205,31 @@ void GameScreen::renderNameplates(game::GameHandler& gameHandler) { ? IM_COL32(220, 80, 80, A(230)) // red — hostile NPC : IM_COL32(240, 200, 100, A(230)); // yellow — friendly NPC } - // Guild name for player nameplates: shift name up to make room - std::string guildTag; + // Sub-label below the name: guild tag for players, subtitle for NPCs + std::string subLabel; if (isPlayer) { uint32_t guildId = gameHandler.getEntityGuildId(guid); if (guildId != 0) { const std::string& gn = gameHandler.lookupGuildName(guildId); - if (!gn.empty()) guildTag = "<" + gn + ">"; + if (!gn.empty()) subLabel = "<" + gn + ">"; } + } else { + // NPC subtitle (e.g. "", "") + std::string sub = gameHandler.getCachedCreatureSubName(unit->getEntry()); + if (!sub.empty()) subLabel = "<" + sub + ">"; } - if (!guildTag.empty()) nameY -= 10.0f; // shift name up for guild line + if (!subLabel.empty()) nameY -= 10.0f; // shift name up for sub-label line drawList->AddText(ImVec2(nameX + 1.0f, nameY + 1.0f), IM_COL32(0, 0, 0, A(160)), labelBuf); drawList->AddText(ImVec2(nameX, nameY), nameColor, labelBuf); - // Guild tag below the name (WoW-style in lighter color) - if (!guildTag.empty()) { - ImVec2 guildSz = ImGui::CalcTextSize(guildTag.c_str()); - float guildX = sx - guildSz.x * 0.5f; - float guildY = nameY + textSize.y + 1.0f; - drawList->AddText(ImVec2(guildX + 1.0f, guildY + 1.0f), IM_COL32(0, 0, 0, A(120)), guildTag.c_str()); - drawList->AddText(ImVec2(guildX, guildY), IM_COL32(180, 180, 180, A(200)), guildTag.c_str()); + // Sub-label below the name (WoW-style or in lighter color) + if (!subLabel.empty()) { + ImVec2 subSz = ImGui::CalcTextSize(subLabel.c_str()); + float subX = sx - subSz.x * 0.5f; + float subY = nameY + textSize.y + 1.0f; + drawList->AddText(ImVec2(subX + 1.0f, subY + 1.0f), IM_COL32(0, 0, 0, A(120)), subLabel.c_str()); + drawList->AddText(ImVec2(subX, subY), IM_COL32(180, 180, 180, A(200)), subLabel.c_str()); } // Group leader crown to the right of the name on player nameplates