mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
fix: populate item class, subclass, and equip slot in GetItemInfo
GetItemInfo returned empty strings for item class (field 6), subclass (field 7), and equip slot (field 9). Now returns: - Class: mapped from itemClass enum (Consumable, Weapon, Armor, etc.) - Subclass: from parsed subclassName (Sword, Mace, Shield, etc.) - EquipSlot: mapped from inventoryType to INVTYPE_ strings (INVTYPE_HEAD, INVTYPE_CHEST, INVTYPE_WEAPON, etc.) These fields are used by equipment comparison addons, character sheet displays, and bag sorting addons to categorize and filter items.
This commit is contained in:
parent
a7e8a6eb83
commit
101ea9fd17
1 changed files with 30 additions and 3 deletions
|
|
@ -1819,10 +1819,37 @@ static int lua_GetItemInfo(lua_State* L) {
|
|||
lua_pushnumber(L, info->quality); // 3: quality
|
||||
lua_pushnumber(L, info->itemLevel); // 4: iLevel
|
||||
lua_pushnumber(L, info->requiredLevel); // 5: requiredLevel
|
||||
lua_pushstring(L, ""); // 6: class (type string)
|
||||
lua_pushstring(L, ""); // 7: subclass
|
||||
// 6: class (type string) — map itemClass to display name
|
||||
{
|
||||
static const char* kItemClasses[] = {
|
||||
"Consumable", "Bag", "Weapon", "Gem", "Armor", "Reagent", "Projectile",
|
||||
"Trade Goods", "Generic", "Recipe", "Money", "Quiver", "Quest", "Key",
|
||||
"Permanent", "Miscellaneous", "Glyph"
|
||||
};
|
||||
if (info->itemClass < 17)
|
||||
lua_pushstring(L, kItemClasses[info->itemClass]);
|
||||
else
|
||||
lua_pushstring(L, "Miscellaneous");
|
||||
}
|
||||
// 7: subclass — use subclassName from ItemDef if available, else generic
|
||||
lua_pushstring(L, info->subclassName.empty() ? "" : info->subclassName.c_str());
|
||||
lua_pushnumber(L, info->maxStack > 0 ? info->maxStack : 1); // 8: maxStack
|
||||
lua_pushstring(L, ""); // 9: equipSlot
|
||||
// 9: equipSlot — WoW inventoryType to INVTYPE string
|
||||
{
|
||||
static const char* kInvTypes[] = {
|
||||
"", "INVTYPE_HEAD", "INVTYPE_NECK", "INVTYPE_SHOULDER",
|
||||
"INVTYPE_BODY", "INVTYPE_CHEST", "INVTYPE_WAIST", "INVTYPE_LEGS",
|
||||
"INVTYPE_FEET", "INVTYPE_WRIST", "INVTYPE_HAND", "INVTYPE_FINGER",
|
||||
"INVTYPE_TRINKET", "INVTYPE_WEAPON", "INVTYPE_SHIELD",
|
||||
"INVTYPE_RANGED", "INVTYPE_CLOAK", "INVTYPE_2HWEAPON",
|
||||
"INVTYPE_BAG", "INVTYPE_TABARD", "INVTYPE_ROBE",
|
||||
"INVTYPE_WEAPONMAINHAND", "INVTYPE_WEAPONOFFHAND", "INVTYPE_HOLDABLE",
|
||||
"INVTYPE_AMMO", "INVTYPE_THROWN", "INVTYPE_RANGEDRIGHT",
|
||||
"INVTYPE_QUIVER", "INVTYPE_RELIC"
|
||||
};
|
||||
uint32_t invType = info->inventoryType;
|
||||
lua_pushstring(L, invType < 29 ? kInvTypes[invType] : "");
|
||||
}
|
||||
// 10: texture (icon path from ItemDisplayInfo.dbc)
|
||||
if (info->displayInfoId != 0) {
|
||||
std::string iconPath = gh->getItemIconPath(info->displayInfoId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue