From 8f68d1efb9e041672253bcf1123e666ff956423f Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 08:30:27 -0700 Subject: [PATCH] feat: show WoW class colors on player nameplates Player nameplates previously used a flat cyan for all players. Now they display the canonical Blizzard class color (Warrior=#C79C6E, Paladin=#F58CBA, Hunter=#ABD473, etc.) read from UNIT_FIELD_BYTES_0. This makes it easy to identify player classes at a glance in the world, especially useful in PvP and group content. NPC nameplates keep the existing red (hostile) / yellow (friendly) coloring. --- src/ui/game_screen.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index ca5b2b50..c843be56 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -7213,12 +7213,31 @@ void GameScreen::renderNameplates(game::GameHandler& gameHandler) { ImVec2 textSize = ImGui::CalcTextSize(labelBuf); float nameX = sx - textSize.x * 0.5f; float nameY = sy - barH - 12.0f; - // Name color: other player=cyan, hostile=red, non-hostile=yellow (WoW convention) - ImU32 nameColor = isPlayer - ? IM_COL32( 80, 200, 255, A(230)) // cyan — other players - : unit->isHostile() + // Name color: players get WoW class colors; NPCs use hostility (red/yellow) + ImU32 nameColor; + if (isPlayer) { + // Determine class from UNIT_FIELD_BYTES_0 byte 1; cyan fallback for unknown class + nameColor = IM_COL32(80, 200, 255, A(230)); + uint8_t cid = static_cast( + (unit->getField(game::fieldIndex(game::UF::UNIT_FIELD_BYTES_0)) >> 8) & 0xFF); + switch (cid) { + case 1: nameColor = IM_COL32(199, 156, 110, A(230)); break; // Warrior + case 2: nameColor = IM_COL32(245, 140, 186, A(230)); break; // Paladin + case 3: nameColor = IM_COL32(171, 212, 115, A(230)); break; // Hunter + case 4: nameColor = IM_COL32(255, 245, 105, A(230)); break; // Rogue + case 5: nameColor = IM_COL32(255, 255, 255, A(230)); break; // Priest + case 6: nameColor = IM_COL32(196, 31, 59, A(230)); break; // Death Knight + case 7: nameColor = IM_COL32( 0, 112, 222, A(230)); break; // Shaman + case 8: nameColor = IM_COL32(105, 204, 240, A(230)); break; // Mage + case 9: nameColor = IM_COL32(148, 130, 201, A(230)); break; // Warlock + case 11: nameColor = IM_COL32(255, 125, 10, A(230)); break; // Druid + default: break; + } + } else { + nameColor = unit->isHostile() ? IM_COL32(220, 80, 80, A(230)) // red — hostile NPC : IM_COL32(240, 200, 100, A(230)); // yellow — friendly NPC + } drawList->AddText(ImVec2(nameX + 1.0f, nameY + 1.0f), IM_COL32(0, 0, 0, A(160)), labelBuf); drawList->AddText(ImVec2(nameX, nameY), nameColor, labelBuf);