From 1165aa6e74a87fac3c6b905be9e0f153667fd0cf Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 14:14:25 -0700 Subject: [PATCH] feat: display creature subtitle in target frame Shows the NPC subtitle (e.g. '') below the creature name in the target frame, using the subName field already parsed from SMSG_CREATURE_QUERY_RESPONSE. Adds getCachedCreatureSubName() accessor to GameHandler. Matches the official client's presentation. --- include/game/game_handler.hpp | 5 +++++ src/ui/game_screen.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 352fceb6..fefedffc 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -548,6 +548,11 @@ public: } std::string getCachedPlayerName(uint64_t guid) const; std::string getCachedCreatureName(uint32_t entry) const; + // Returns the creature subname/title (e.g. ""), empty if not cached + std::string getCachedCreatureSubName(uint32_t entry) const { + auto it = creatureInfoCache.find(entry); + return (it != creatureInfoCache.end()) ? it->second.subName : ""; + } // Returns the creature rank (0=Normal,1=Elite,2=RareElite,3=Boss,4=Rare) // or -1 if not cached yet int getCreatureRank(uint32_t entry) const { diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index c1201aa4..feb0cee6 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -3315,6 +3315,15 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) { ImVec2(ImGui::CalcTextSize(name.c_str()).x, 0)); ImGui::PopStyleColor(4); + // Creature subtitle (e.g. "", "Captain of the Guard") + if (target->getType() == game::ObjectType::UNIT) { + auto unit = std::static_pointer_cast(target); + const std::string sub = gameHandler.getCachedCreatureSubName(unit->getEntry()); + if (!sub.empty()) { + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 0.9f), "<%s>", sub.c_str()); + } + } + // Right-click context menu on the target name if (ImGui::BeginPopupContextItem("##TargetNameCtx")) { const bool isPlayer = (target->getType() == game::ObjectType::PLAYER);