From f9b359727fdcc2151f51639ddda7945d06c378c8 Mon Sep 17 00:00:00 2001 From: Sattva <74269253+Sattva-108@users.noreply.github.com> Date: Wed, 22 Jan 2025 02:14:26 +0300 Subject: [PATCH] HideErrors - no reload now --- Changelog and Notes.txt | 2 -- Leatrix_Plus.lua | 41 ++++++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Changelog and Notes.txt b/Changelog and Notes.txt index b79d334..a965ca6 100644 --- a/Changelog and Notes.txt +++ b/Changelog and Notes.txt @@ -24,8 +24,6 @@ Manage Debuffs - Test IT in fight. -- What i plan to do in near future list from easy to hard -------------------------------------------------------------------------------- -Minimap - show time by user option. - MinimapButton - Add functions to alt-click and other clicks on button (prio - error text togggle) Minimap - MailIcon - Move - Create Dropdown with anchor. diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index f0be3b2..46b189a 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -683,7 +683,6 @@ function LeaPlusLC:ReloadCheck() or (LeaPlusLC["RestoreChatMessages"] ~= LeaPlusDB["RestoreChatMessages"]) -- Restore chat messages -- Text - or (LeaPlusLC["HideErrorMessages"] ~= LeaPlusDB["HideErrorMessages"]) -- Hide error messages or (LeaPlusLC["NoHitIndicators"] ~= LeaPlusDB["NoHitIndicators"]) -- Hide portrait text or (LeaPlusLC["HideZoneText"] ~= LeaPlusDB["HideZoneText"]) -- Hide zone text or (LeaPlusLC["HideKeybindText"] ~= LeaPlusDB["HideKeybindText"]) -- Hide keybind text @@ -3865,14 +3864,14 @@ function LeaPlusLC:Isolated() -- Hide error messages ---------------------------------------------------------------------- - if LeaPlusLC["HideErrorMessages"] == "On" then - -- Error message events - local OrigErrHandler = UIErrorsFrame:GetScript('OnEvent') - UIErrorsFrame:SetScript('OnEvent', function(self, event, err, ...) - if event == "UI_ERROR_MESSAGE" then - -- Hide error messages - if LeaPlusLC["ShowErrorsFlag"] == 1 then + -- Error message events + local OrigErrHandler = UIErrorsFrame:GetScript('OnEvent') + local function UpdateErrorMessageVisibility() + if LeaPlusLC["HideErrorMessages"] == "On" and LeaPlusLC["ShowErrorsFlag"] == 1 then + UIErrorsFrame:SetScript('OnEvent', function(self, event, err, ...) + if event == "UI_ERROR_MESSAGE" then + -- Hide error messages for specific conditions if err == ERR_INV_FULL or err == ERR_QUEST_LOG_FULL or err == ERR_RAID_GROUP_ONLY or @@ -3888,21 +3887,29 @@ function LeaPlusLC:Isolated() string.match(err, "afford") or string.match(err, "shapeshift") or string.match(err, "disarm") - then return OrigErrHandler(self, event, err, ...) end - else + elseif event == 'UI_INFO_MESSAGE' then + -- Show information messages return OrigErrHandler(self, event, err, ...) end - elseif event == 'UI_INFO_MESSAGE' then - -- Show information messages - return OrigErrHandler(self, event, err, ...) - end - end) - + end) + else + UIErrorsFrame:SetScript('OnEvent', OrigErrHandler) + end end + -- Hook the checkbox click to toggle visibility + LeaPlusCB["HideErrorMessages"]:HookScript("OnClick", function(self) + LeaPlusLC["ShowErrorsFlag"] = self:GetChecked() and 1 or 0 + UpdateErrorMessageVisibility() -- Update the error message visibility state + end) + + -- Initial check to set the correct visibility on load + UpdateErrorMessageVisibility() + + -- Release memory LeaPlusLC.Isolated = nil end @@ -19547,7 +19554,7 @@ LeaPlusLC:CfgBtn("FilterChatMessagesBtn", LeaPlusCB["FilterChatMessages"]) pg = "Page4"; LeaPlusLC:MakeTx(LeaPlusLC[pg], "Visibility", 146, -72); -LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideErrorMessages", "Hide error messages", 146, -92, true, "If checked, most error messages (such as 'Not enough rage') will not be shown. Some important errors are excluded.|n|nIf you have the minimap button enabled, you can hold down the alt key and click it to toggle error messages without affecting this setting.") +LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideErrorMessages", "Hide error messages", 146, -92, false, "If checked, most error messages (such as 'Not enough rage') will not be shown. Some important errors are excluded.|n|nIf you have the minimap button enabled, you can hold down the alt key and click it to toggle error messages without affecting this setting.") LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoHitIndicators", "Hide portrait numbers", 146, -112, true, "If checked, damage and healing numbers in the player and pet portrait frames will be hidden.") LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideZoneText", "Hide zone text", 146, -132, true, "If checked, zone text will not be shown (eg. 'Ironforge').") LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideKeybindText", "Hide keybind text", 146, -152, true, "If checked, keybind text will not be shown on action buttons.")