Just discovered that when I asked FreeRefills to stock a number of Super Mana Potions in my inventory, it would not fetch missing items from the bank.
After debugging it, it seems the item link is not identical, even though the item id is.
Here's a sample:
[cffffffff|Hitem:22832:0:0:0:0:0:0:1761199772|h[Super Mana Potion]|h|r
[cffffffff|Hitem:22832:0:0:0:0:0:0:509156531|h[Super Mana Potion]|h|r
one is the item that I added from my inventory to the list, the other is from the bank, however which is which I don't remember as I removed the debug code before adding this comment :P
What that large number in there is doing I have no idea, but when I modified FR to consider only the item id, enchant id and suffix id (to handle the known things that varies), it correctly fetched mana potions.
The two functions I added:
function FreeRefills:GetItemID(link)
id, enchant, suffix = strmatch( ( link or "" ) , "item:(%-?%d+):(%-?%d+):%-?%d+:%-?%d+:%-?%d+:%-?%d+:(%-?%d+):%-?%d+" )
return ( id or 0 ) .. ":" .. ( enchant or 0 ) .. ":" .. ( suffix or 0 )
end
function FreeRefills:IsSameItem(slotLink, itemLink)
local slotItemID = self:GetItemID(slotLink);
local itemItemID = self:GetItemID(itemLink);
if slotItemID == itemItemID then
return true
else
return false
end
end
The first function is loosely copied from ArkInventory and rewritten, but I've seen this in at least two other addons as well so I can't really say who is the original author.
LootBank was thus changed as follows:
if self:IsSameItem(slotID, itemID) then
this was two places, one for the main bank bag scan, and one for the extra bags.
Could this type of bug be present in the other ways to fetch items as well, like from vendors?
Hope this helps and that you can incorporate the changes into the addon. |