Skip to content

Instantly share code, notes, and snippets.

@Wetxius
Created November 24, 2020 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wetxius/429c16362b6821e75dfa2101b3b97f92 to your computer and use it in GitHub Desktop.
Save Wetxius/429c16362b6821e75dfa2101b3b97f92 to your computer and use it in GitHub Desktop.
ShestakUI\Modules\Blizzard\Errors.lua
local T, C, L, _ = unpack(select(2, ...))
----------------------------------------------------------------------------------------
-- Clear UIErrorsFrame(module from Kousei by Haste)
----------------------------------------------------------------------------------------
if C.general.error_filter == "WHITELIST" or C.general.error_filter == "BLACKLIST" then
local frame = CreateFrame("Frame")
frame:RegisterEvent("UI_ERROR_MESSAGE")
frame:SetScript("OnEvent", function(_, _, messageType, text)
if C.general.error_filter == "WHITELIST" then
if T.white_list[text] then
UIErrorsFrame:TryDisplayMessage(messageType, text, RED_FONT_COLOR:GetRGB())
else
L_INFO_ERRORS = text
end
elseif C.general.error_filter == "BLACKLIST" then
if T.black_list[text] then
L_INFO_ERRORS = text
else
UIErrorsFrame:TryDisplayMessage(messageType, text, RED_FONT_COLOR:GetRGB())
end
end
end)
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
end
SlashCmdList.ERROR = function()
UIErrorsFrame:AddMessage(L_INFO_ERRORS, 1, 0, 0)
end
SLASH_ERROR1 = "/error"
----------------------------------------------------------------------------------------
-- Clear all UIErrors frame in combat
----------------------------------------------------------------------------------------
if C.general.error_filter == "COMBAT" then
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:SetScript("OnEvent", function(_, event)
if event == "PLAYER_REGEN_DISABLED" then
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
else
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
end
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment