WeakAuras.CheckForItemBonusId and extraEnchantID
Merxxz opened this issue ยท 0 comments
Description
I want to add a load condition for a bonusID tied to an engineering tinker. According to Wowpedia this is the final number in the item link and was added in Patch 9.1. Looking at the code for WeakAuras.CheckForItemBonusId, it's because WA is actually looking for ":"..bonusID..":"
, which poses a problem when the last bonusID is in the format of ":"..bonusID.."|h"
.
I'm not sure how pull requests work, but I took a stab at putting in a fix below.
WeakAuras.CheckForItemBonusId = function(ids)
local endChars = {":", "|h"}
for id in tostring(ids):gmatch('([^,]+)') do
id = ":" .. tostring(id:trim())
for slot in pairs(Private.item_slot_types) do
local itemLink = GetInventoryItemLink('player', slot)
if itemLink then
for _, v in pairs(endChars) do
if itemLink:find(id .. v, 1, true) then
return true
end
end
end
end
end
return false
end
EDIT:
Thought about it and a simpler change can be found below.
WeakAuras.CheckForItemBonusId = function(ids)
for id in tostring(ids):gmatch('([^,]+)') do
id = ":" .. tostring(id:trim()) .. "[:|]"
for slot in pairs(Private.item_slot_types) do
local itemLink = GetInventoryItemLink('player', slot)
if itemLink and itemLink:find(id, 1, false) then
return true
end
end
end
return false
end
WeakAuras Version
WeakAuras 3.5.0
World of Warcraft Flavor
Retail (Default)
Tested with only WeakAuras
- Yes
- No
Lua Error
No response
Reproduction Steps
n/a
Last Good Version
No response
Screenshots
No response
Export String
No response