47 lines
1.2 KiB
Lua
47 lines
1.2 KiB
Lua
-- OnlyMyLoot.lua
|
|
-- Checks the GUID from CHAT_MSG_LOOT events to see if it matches the local account's GUID.
|
|
|
|
local addonName, addon = ...
|
|
|
|
local enabled = true
|
|
local numberFiltered = 0
|
|
|
|
local function onlyMyLoot_OnEvent(self, event, ...)
|
|
-- If this is disabled, don't filter it
|
|
if (not enabled) then
|
|
return false
|
|
end
|
|
guid = select(12, ...)
|
|
-- If it's my loot, don't filter it, otherwise filter it. guid apparently can be nil
|
|
if (C_AccountInfo.IsGUIDRelatedToLocalAccount(guid or "")) then
|
|
return false, ...
|
|
else
|
|
numberFiltered = numberFiltered + 1
|
|
return true, ...
|
|
end
|
|
end
|
|
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", onlyMyLoot_OnEvent)
|
|
|
|
local function handle(msg)
|
|
msg = msg or ""
|
|
if (msg == "stats" or msg == "?") then
|
|
print("OnlyMyLoot has filtered " .. tostring(numberFiltered) .. " since last interface load.")
|
|
else
|
|
enabled = not(enabled)
|
|
if (enabled) then
|
|
print("OnlyMyLoot enabled; hiding loot that isn't yours!")
|
|
else
|
|
print("OnlyMyLoot disabled.")
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
SLASH_ONLYMYLOOT1 = "/ONLYMYLOOT";
|
|
SLASH_ONLYMYLOOT2 = "/OML";
|
|
|
|
SlashCmdList["ONLYMYLOOT"] = handle
|
|
SlashCmdList["OML"] = handle
|
|
|
|
print("OnlyMyLoot is hiding others' loot!") |