mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
feat: display creature subtitle in target frame
Shows the NPC subtitle (e.g. '<Warchief of the Horde>') 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.
This commit is contained in:
parent
8cb0f1d0ef
commit
1165aa6e74
2 changed files with 14 additions and 0 deletions
|
|
@ -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. "<Warchief of the Horde>"), 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 {
|
||||
|
|
|
|||
|
|
@ -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. "<Warchief of the Horde>", "Captain of the Guard")
|
||||
if (target->getType() == game::ObjectType::UNIT) {
|
||||
auto unit = std::static_pointer_cast<game::Unit>(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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue