evil-morfar / RCLootCouncil2

RCLootCouncil - addon for World of Warcraft
https://rclootcouncil.com
GNU Lesser General Public License v3.0
19 stars 29 forks source link

Remove db.localizedSubtypes #65

Closed SafeteeWoW closed 6 years ago

SafeteeWoW commented 6 years ago

By the help of typeID and subTypeID and global constants LE_ITEM_*, we can get rid of localizedSubtypes. I really dislike to do localizedSubtypes this. This is how Blizzard checks item type

--FrameXML/WorldMapFrame.lua
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID);
if ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then
    ...
end

itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, iconFileDataID, itemSellPrice, itemTypeID, itemSubClassID, bindType, expacID, itemSetID, 
isCraftingReagent = GetItemInfo(itemID or "itemString" or "itemName" or "itemLink") 

itemType == GetItemClassInfo(itemTypeID)
itemSubType == GetItemSubClassInfo(itemTypeID, itemSubClassID)

typeID can be compared with global constants LE_ITEM_CLASS_*, such as LE_ITEM_CLASS_ARMOR, subTypeID can be compared with global constants LE_ITEM_*_*, such as LE_ITEM_ARMOR_CLOTH.

It seems these constants are not defined in blizzard interface code, so I search those constants by

for k, v in pairs(_G) do
    if string.find(k, "LE_ITEM_" then
        print(k, v)
    end
end

The arguments of GetItemTypeText, SendResponse and AutoPassCheck are changed.


No backward compatibility is broken.


We should remove "link" argument in GetItemTypeText and AutoPassCheck after merged with #57. It feels redundant

SafeteeWoW commented 6 years ago

Check this https://github.com/SafeteeWoW/wow-global-numbers/blob/master/wow-global-numbers.lua

SafeteeWoW commented 6 years ago

Need to make changes after merged with #44

SafeteeWoW commented 6 years ago
SafeteeWoW commented 6 years ago

See #73