feat: resolve title names from CharTitles.dbc in SMSG_TITLE_EARNED

Previously SMSG_TITLE_EARNED only showed the numeric bit index.
Now it lazy-loads CharTitles.dbc and formats the full title string
with the player's name (e.g. "Title earned: Commander Kelsi!").

- Add CharTitles layout to WotLK (TitleBit=36) and TBC (TitleBit=20) layouts
- loadTitleNameCache() maps each titleBit to its English title string
- SMSG_TITLE_EARNED substitutes %s placeholder with local player's name
- Falls back to "Title earned (bit N)!" if DBC is unavailable
This commit is contained in:
Kelsi 2026-03-12 19:05:54 -07:00
parent cd01d07a91
commit 81b95b4af7
4 changed files with 69 additions and 6 deletions

View file

@ -2694,6 +2694,12 @@ private:
std::unordered_map<uint32_t, SpellNameEntry> spellNameCache_;
bool spellNameCacheLoaded_ = false;
// Title cache: maps titleBit → title string (lazy-loaded from CharTitles.dbc)
// The strings use "%s" as a player-name placeholder (e.g. "Commander %s", "%s the Explorer").
std::unordered_map<uint32_t, std::string> titleNameCache_;
bool titleNameCacheLoaded_ = false;
void loadTitleNameCache();
// Achievement caches (lazy-loaded from Achievement.dbc on first earned event)
std::unordered_map<uint32_t, std::string> achievementNameCache_;
std::unordered_map<uint32_t, std::string> achievementDescCache_;