mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: show NPC subtitle on nameplates
Display creature subtitles (e.g. <Reagent Vendor>, <Innkeeper>) 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.
This commit is contained in:
parent
209f60031e
commit
fd7886f4ce
1 changed files with 15 additions and 11 deletions
|
|
@ -11205,27 +11205,31 @@ void GameScreen::renderNameplates(game::GameHandler& gameHandler) {
|
||||||
? IM_COL32(220, 80, 80, A(230)) // red — hostile NPC
|
? IM_COL32(220, 80, 80, A(230)) // red — hostile NPC
|
||||||
: IM_COL32(240, 200, 100, A(230)); // yellow — friendly NPC
|
: IM_COL32(240, 200, 100, A(230)); // yellow — friendly NPC
|
||||||
}
|
}
|
||||||
// Guild name for player nameplates: shift name up to make room
|
// Sub-label below the name: guild tag for players, subtitle for NPCs
|
||||||
std::string guildTag;
|
std::string subLabel;
|
||||||
if (isPlayer) {
|
if (isPlayer) {
|
||||||
uint32_t guildId = gameHandler.getEntityGuildId(guid);
|
uint32_t guildId = gameHandler.getEntityGuildId(guid);
|
||||||
if (guildId != 0) {
|
if (guildId != 0) {
|
||||||
const std::string& gn = gameHandler.lookupGuildName(guildId);
|
const std::string& gn = gameHandler.lookupGuildName(guildId);
|
||||||
if (!gn.empty()) guildTag = "<" + gn + ">";
|
if (!gn.empty()) subLabel = "<" + gn + ">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// NPC subtitle (e.g. "<Reagent Vendor>", "<Innkeeper>")
|
||||||
|
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 + 1.0f, nameY + 1.0f), IM_COL32(0, 0, 0, A(160)), labelBuf);
|
||||||
drawList->AddText(ImVec2(nameX, nameY), nameColor, labelBuf);
|
drawList->AddText(ImVec2(nameX, nameY), nameColor, labelBuf);
|
||||||
|
|
||||||
// Guild tag below the name (WoW-style <Guild Name> in lighter color)
|
// Sub-label below the name (WoW-style <Guild Name> or <NPC Title> in lighter color)
|
||||||
if (!guildTag.empty()) {
|
if (!subLabel.empty()) {
|
||||||
ImVec2 guildSz = ImGui::CalcTextSize(guildTag.c_str());
|
ImVec2 subSz = ImGui::CalcTextSize(subLabel.c_str());
|
||||||
float guildX = sx - guildSz.x * 0.5f;
|
float subX = sx - subSz.x * 0.5f;
|
||||||
float guildY = nameY + textSize.y + 1.0f;
|
float subY = 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(subX + 1.0f, subY + 1.0f), IM_COL32(0, 0, 0, A(120)), subLabel.c_str());
|
||||||
drawList->AddText(ImVec2(guildX, guildY), IM_COL32(180, 180, 180, A(200)), guildTag.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
|
// Group leader crown to the right of the name on player nameplates
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue