chat: detect and disable chat parsing on combatlog

This commit is contained in:
shagu
2021-01-18 16:12:41 +01:00
parent 8a1842e2af
commit c4e0bb7a76
+18
View File
@@ -274,6 +274,19 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
local frame = _G["ChatFrame"..i]
local tab = _G["ChatFrame"..i.."Tab"]
local combat = 0
for _, msg in pairs(_G["ChatFrame"..i].messageTypeList) do
if strfind(msg, "SPELL", 1) or strfind(msg, "COMBAT", 1) then
combat = combat + 1
end
end
if combat > 5 then
frame.pfCombatLog = true
else
frame.pfCombatLog = nil
end
for _, tex in pairs(CHAT_FRAME_TEXTURES) do
_G["ChatFrame"..i..tex]:SetTexture()
_G["ChatFrame"..i..tex]:Hide()
@@ -631,6 +644,11 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
local function AddMessage(frame, text, a1, a2, a3, a4, a5)
if not text then return end
-- skip chat parsing on combat log
if frame.pfCombatLog then
return frame:HookAddMessage(text, a1, a2, a3, a4, a5)
end
-- Remove prat CLINKs
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- tbc
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- vanilla