feat: resolve random property/suffix names for item display

Load ItemRandomProperties.dbc and ItemRandomSuffix.dbc lazily to resolve
suffix names like "of the Eagle", "of the Monkey" etc. Add
getRandomPropertyName(id) callback on GameHandler wired through Application.
Append suffix to item names in SMSG_ITEM_PUSH_RESULT loot notifications
so items display as "Leggings of the Eagle" instead of just "Leggings".
This commit is contained in:
Kelsi 2026-03-20 19:18:30 -07:00
parent 23a7d3718c
commit 4b3e377add
3 changed files with 47 additions and 1 deletions

View file

@ -294,6 +294,14 @@ public:
return spellIconPathResolver_ ? spellIconPathResolver_(spellId) : std::string{};
}
// Random property/suffix name resolver: randomPropertyId -> suffix name (e.g., "of the Eagle")
// Positive IDs → ItemRandomProperties.dbc; negative IDs → ItemRandomSuffix.dbc (abs value)
using RandomPropertyNameResolver = std::function<std::string(int32_t)>;
void setRandomPropertyNameResolver(RandomPropertyNameResolver r) { randomPropertyNameResolver_ = std::move(r); }
std::string getRandomPropertyName(int32_t id) const {
return randomPropertyNameResolver_ ? randomPropertyNameResolver_(id) : std::string{};
}
// Emote animation callback: (entityGuid, animationId)
using EmoteAnimCallback = std::function<void(uint64_t, uint32_t)>;
void setEmoteAnimCallback(EmoteAnimCallback cb) { emoteAnimCallback_ = std::move(cb); }
@ -2654,6 +2662,7 @@ private:
AddonChatCallback addonChatCallback_;
AddonEventCallback addonEventCallback_;
SpellIconPathResolver spellIconPathResolver_;
RandomPropertyNameResolver randomPropertyNameResolver_;
EmoteAnimCallback emoteAnimCallback_;
// Targeting