34 lines
766 B
Lua
34 lines
766 B
Lua
--CHAT_MSG_LOOT
|
|
function(_,msg,who)
|
|
local who = who:match(UnitName("player"))
|
|
local what = msg:match("%[([a-zA-Z ' -]+)%]")
|
|
if who == UnitName("player") then
|
|
local link = ""
|
|
for i = 0, 4 do
|
|
for j = 1, GetContainerNumSlots(i) do
|
|
if GetContainerItemLink(i,j) then
|
|
if GetItemInfo(GetContainerItemLink(i, j)) == what then
|
|
link = GetContainerItemLink(i, j)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
table.insert(aura_env.loot, {["Who"] = who, ["What"] = what, ["When"] = GetTime() + 2.5, ["Link"] = link})
|
|
end
|
|
end
|
|
|
|
--DISPLAY
|
|
function()
|
|
local output = ""
|
|
for k,v in ipairs(aura_env.loot) do
|
|
if v.When < GetTime() then
|
|
table.remove(aura_env.loot, k)
|
|
else
|
|
output = output .. v.Link .. "\n"
|
|
end
|
|
end
|
|
return output
|
|
end
|
|
|
|
--INIT
|
|
aura_env.loot = {} |