Originally Posted by Edda
Know issue : nothing is working - lawl
The addon doesn't even get loaded. And it's good as such cuz it's still not working the way it should - Im trying to find how to detect items marked as junk right now :/
And I think I didn't fully understand your request. You want your tagged 'Junk' items being moved to your 'Junk' tab automatically is that right ??? I understood you only want to somehow display a list of any items you actually tagged as such - didn't get the auto-move request here :|
But I think it's totally doable just need to figure out how to bloody detect those junk items. I thought I found the right function but it seems it doesn't do what it should :/
Ill keep you in the know
|
Lets try some hack
To mark item as junk game uses function:
SetItemIsJunk(integer bagId, integer slotIndex, bool junk)
I didn't try it, but it could work:
Lua Code:
local myJunkMemory = {}
ZO_PreHook(SetItemIsJunk, function(bagId, slotId, junk)
local itemLink = GetItemLink(bagId, slotId)
local itemId = select(4, ZO_LinkHandler_ParseLink(itemLink)) --string, if you want number use tonumber(itemId)
myJunkMemory[itemId] = junk and true or nil
return false
end)
Then you can use something like this:
Lua Code:
local function OnInventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSoundCategory, updateReason)
if updateReason == INVENTORY_UPDATE_REASON_DURABILITY_CHANGE or bagId ~= BAG_BACKPACK then
return
end
local itemLink = GetItemLink(bagId, slotId)
local itemId = select(4, ZO_LinkHandler_ParseLink(itemLink))
if myJunkMemory[itemId] then
SetItemIsJunk(bagId, slotId, true)
end
end
EVENT_MANAGER:RegisterForEvent("myAddon_InventorySingleSlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE, OnInventorySlotUpdate)