-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainLootFilter.lua
More file actions
41 lines (36 loc) · 1.25 KB
/
MainLootFilter.lua
File metadata and controls
41 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local private = select(2, ...) ---@class PrivateNamespace
if Chattynator then
local function FilterLoot(data)
if data.typeInfo.type == "LOOT"
and (data.typeInfo.player == nil or (
data.typeInfo.player.name ~= ""
and data.typeInfo.player.name ~= data.recordedBy
))
then
return false
end
return true
end
Chattynator.API.AddFilter(FilterLoot, 1, 1)
else
---@param chatFrame Frame
---@param event string
---@param ... any
---@return boolean filterMessage Whether to filter this message
---@return any ... arg2...arg11
---@diagnostic disable-next-line: unused-local
local function MainLootFilter_OnEvent(chatFrame, event, ...)
if chatFrame:GetName() ~= "ChatFrame1" then
-- Always allow the message in other chat frames
private.Debug("Loot message allowed for", chatFrame:GetName())
return false, ...
end
local guid = select(12, ...) or ""
if C_AccountInfo.IsGUIDRelatedToLocalAccount(guid) then
return false, ...
else
return true, ...
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", MainLootFilter_OnEvent)
end