Originally Posted by lyravega
In short, when we get an item, the event will fire, and we check if it is a new item, then if it is a trash item by using the passed badID and slotIndex. The API function, GetItemType() will return 48 if it is a trash quality item. If it is so, we mark it as junk.
|
About trash items : I am VR1 and
never got any trash item (if they are supposed to go under the trash inventory tab). I still wonder what they are
Problem is, my addon doesn't handle 'trash items' (to mark them as junk) but any 'already marked as junk' item. Could be crafting materials or anything not 'trash items'. Therefore I can't be checking the itemType == 48 thing I guess (if 48 = trash quality item).
Here is how I am handling the garbage
(note I had issues with items gained thru deconstruction or bank retrievals)
Lua Code:
-- Loot or deconstruction
if not IsItemJunk(bagId, slotId) and RJ.User.Memory[itemData.itemId] ~=nil and isNewItem then
SetItemIsJunk(bagId, slotId, true)
if RJ.User.Options.Verbous then d(RJ.niceName .. " |cffffff[" .. itemData.itemLink .. "]|r moved to junk !") end
-- Bank pulls
elseif GetGameTimeMilliseconds() - RJ.bankEvent < RJ.trackDelay and not IsItemJunk(bagId, slotId) and RJ.User.Memory[itemData.itemId] ~= nil and not isNewItem then
SetItemIsJunk(bagId, slotId, true)
if RJ.User.Options.Verbous then d(RJ.niceName .. " |cffffff[" .. itemData.itemLink .. "]|r moved to junk !") end
-- Manually inserting new junk item
elseif IsItemJunk(bagId, slotId) and RJ.User.Memory[itemData.itemId] == nil and not isNewItem then
RJ.User.Memory[itemData.itemId] = itemData;
if RJ.User.Options.Verbous then d(RJ.niceName .. " |cffffff[" .. itemData.itemLink .. "]|r added to junklist.") end
-- Manually removing junk items
elseif not IsItemJunk(bagId, slotId) and RJ.User.Memory[itemData.itemId] ~= nil and not isNewItem and not RJ.craftEvent then
RJ.User.Memory[itemData.itemId] = nil
if RJ.User.Options.Verbous then d(RJ.niceName .. " |cffffff[" .. itemData.itemLink .. "]|r removed from junklist.") end
end
Might not be perfect but working so far. The
GetGameTimeMilliseconds() - RJ.bankEvent < RJ.trackDelay checks if a bank pull happened in the last 50 milliseconds. The
not RJ.craftEvent check if we are 'inside' a craft event (after craft started and before craft completed). Had to do this because items would sometimes (go figure) get removed from my addon junk list while deconstructing or pulling bank items.