mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-28 09:33:52 +00:00
feat: add GetEnchantInfo for enchantment name resolution
GetEnchantInfo(enchantId) looks up the enchantment name from SpellItemEnchantment.dbc (field 14). Returns the display name like "Crusader", "+22 Intellect", or "Mongoose" for a given enchant ID. Used by equipment comparison addons and tooltip addons to display enchantment names on equipped gear. The enchant ID comes from the item's ITEM_FIELD_ENCHANTMENT update field. Also adds getEnchantName() to GameHandler for C++ access.
This commit is contained in:
parent
922d6bc8f6
commit
b9a1b0244b
3 changed files with 28 additions and 0 deletions
|
|
@ -23431,6 +23431,21 @@ const std::string& GameHandler::getSpellDescription(uint32_t spellId) const {
|
|||
return (it != spellNameCache_.end()) ? it->second.description : EMPTY_STRING;
|
||||
}
|
||||
|
||||
std::string GameHandler::getEnchantName(uint32_t enchantId) const {
|
||||
if (enchantId == 0) return {};
|
||||
auto* am = core::Application::getInstance().getAssetManager();
|
||||
if (!am || !am->isInitialized()) return {};
|
||||
auto dbc = am->loadDBC("SpellItemEnchantment.dbc");
|
||||
if (!dbc || !dbc->isLoaded()) return {};
|
||||
// Name is at field 14 (consistent across Classic/TBC/WotLK)
|
||||
for (uint32_t i = 0; i < dbc->getRecordCount(); ++i) {
|
||||
if (dbc->getUInt32(i, 0) == enchantId) {
|
||||
return dbc->getString(i, 14);
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
uint8_t GameHandler::getSpellDispelType(uint32_t spellId) const {
|
||||
const_cast<GameHandler*>(this)->loadSpellNameCache();
|
||||
auto it = spellNameCache_.find(spellId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue