mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: resolve item icon paths from ItemDisplayInfo.dbc for Lua API
Add ItemIconPathResolver that lazily loads ItemDisplayInfo.dbc to map displayInfoId → icon texture path. This fixes three Lua API functions that previously returned nil for item icons: - GetItemInfo() field 10 (texture) now returns the icon path - GetActionTexture() for item-type action bar slots now returns icons - GetLootSlotInfo() field 1 (texture) now returns proper item icons instead of incorrectly using the spell icon resolver Follows the same lazy-loading pattern as SpellIconPathResolver. The DBC is loaded once on first query and cached for all subsequent lookups.
This commit is contained in:
parent
e21f808714
commit
7105672f06
3 changed files with 54 additions and 6 deletions
|
|
@ -294,6 +294,13 @@ public:
|
|||
return spellIconPathResolver_ ? spellIconPathResolver_(spellId) : std::string{};
|
||||
}
|
||||
|
||||
// Item icon path resolver: displayInfoId -> texture path (e.g., "Interface\\Icons\\INV_Sword_04")
|
||||
using ItemIconPathResolver = std::function<std::string(uint32_t)>;
|
||||
void setItemIconPathResolver(ItemIconPathResolver r) { itemIconPathResolver_ = std::move(r); }
|
||||
std::string getItemIconPath(uint32_t displayInfoId) const {
|
||||
return itemIconPathResolver_ ? itemIconPathResolver_(displayInfoId) : 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)>;
|
||||
|
|
@ -2662,6 +2669,7 @@ private:
|
|||
AddonChatCallback addonChatCallback_;
|
||||
AddonEventCallback addonEventCallback_;
|
||||
SpellIconPathResolver spellIconPathResolver_;
|
||||
ItemIconPathResolver itemIconPathResolver_;
|
||||
RandomPropertyNameResolver randomPropertyNameResolver_;
|
||||
EmoteAnimCallback emoteAnimCallback_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue