Typo in variable name (`ink`) prevents “Usage Learning” from working properly
tflo opened this issue · 2 comments
[Scrap v9.1.2; WoW Retail 9.2.5]
Please check line 65 in the OnItemRefund
function in Scrap/addons/merchant/learning.lua:
local id = ink and tonumber(link:match('item:(%d+)'))
I couldn’t find an ink
variable declared anywhere in the addon, so I guess this is a simple typo and the variable should read link
(which you declared in line 64).
As it is now, the nil check evaluates always to nil and thus id
will always be nil too.
As a result, buying back a previously vendored item, does never decrease the item’s counter in the ml
table. The item remains marked as junk forever, no matter how many times I would buy it back.
Speaking about “Usage Learning”, there is one thing I don’t fully understand:
The “Set as junk” message is triggered when an item reaches an ml
value of 2
(eg by vendoring a maxstack-one item 2 times). The “Set as useful” messages comes when the value drops below 2. (Lines 56 and 79 in learning.lua).
However, in the junk definition IsJunk
at line 77 in main.lua, the threshold is 1
, if I’m reading it correctly. And indeed, if I vendor an item once, it gets already marked as junk, whereas the message only comes when I have vendored the 2nd piece.
Similar, when bringing down the ml value from 3 to 1 (via buying back), I get the “Set as useful” message, though the item is still marked and treated as junk.
Is this intentional?
– Tom
Thank you for the detailed analysis. ink
is definitively a typo. I'll go over the rest.