hi guyz,
i wrote this script for auto abandon items and open stuffs,
lately, added CLASS to avoid some of my characater abandon valuable items,
but it's not working correctly(the items i need to abandon when i played mage its not working. so sorry for forgot to mention it.) and i dont know how to make it work.
pls help me out, thank you guyz...
btw, it's for classic.
Lua Code:
local UnitClass,GetContainerNumSlots,GetContainerItemInfo,PickupContainerItem,DeleteCursorItem,UseContainerItem,select
= UnitClass,GetContainerNumSlots,GetContainerItemInfo,PickupContainerItem,DeleteCursorItem,UseContainerItem,select
local n, filename, Id = UnitClass("player")
local x
if (n == "Mage") then x = true else x = false end
local items = { -- abandon list
--food
[4608] = x,
[4599] = x,
}
local open = { -- open list
[20767] = true,
[2744] = true,
[5523] = true,
[5524] = true,
[7973] = true,
[15874] = true,
[21150] = true,
}
local f = CreateFrame('Frame', nil, UIParent)
f:RegisterEvent('LOOT_CLOSED')
f:SetScript('OnEvent', function(self, event, ...)
for b = 0, 4 do
for s = 1, GetContainerNumSlots(b) do
local id = select(10,GetContainerItemInfo(b,s))
if items[id] then PickupContainerItem(b,s) DeleteCursorItem()
--print("clean")
end
if open[id] then UseContainerItem(b, s)
--print("open")
end
end
end
end)