From 8094c6864ab7b76c4dc5b3f797cf1c5f4b87c283 Mon Sep 17 00:00:00 2001 From: Sluimerstand Date: Sun, 9 Jun 2024 16:56:47 +0200 Subject: [PATCH] Shift+click Clear to skip the confirmation. --- Core.lua | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Core.lua b/Core.lua index 52ce07e..e621cee 100644 --- a/Core.lua +++ b/Core.lua @@ -266,21 +266,23 @@ function app.CreateWindow() app.ClearButton:SetPushedTexture("Interface\\AddOns\\TransmogLootHelper\\assets\\button-clear.blp") app.ClearButton:GetPushedTexture():SetTexCoord(39/256, 75/256, 81/128, 118/128) app.ClearButton:SetScript("OnClick", function() - StaticPopupDialogs["CLEAR_LOOT"] = { - text = app.NameLong.."\nDo you want to clear all loot?", - button1 = YES, - button2 = NO, - OnAccept = function() - app.WeaponLoot = {} - app.ArmourLoot = {} - app.UpdateWindow() - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - showAlert = true, - } - StaticPopup_Show("CLEAR_LOOT") + if IsShiftKeyDown() == true then + app.Clear() + else + StaticPopupDialogs["CLEAR_LOOT"] = { + text = app.NameLong.."\nDo you want to clear all loot?", + button1 = YES, + button2 = NO, + OnAccept = function() + app.Clear() + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + showAlert = true, + } + StaticPopup_Show("CLEAR_LOOT") + end end) app.ClearButton:SetScript("OnEnter", function() app.WindowTooltipShow(app.ClearButtonTooltip) @@ -744,7 +746,7 @@ function app.CreateGeneralAssets() app.CloseButtonTooltip = app.WindowTooltip("Close the window.") -- Create Clear button tooltip - app.ClearButtonTooltip = app.WindowTooltip("Clear all items.") + app.ClearButtonTooltip = app.WindowTooltip("Clear all items. Shift+click to skip the confirmation.") -- Create corner button tooltip app.CornerButtonTooltip = app.WindowTooltip("Double-click|cffFFFFFF: Autosize to fit the window.") @@ -771,6 +773,12 @@ function app.Toggle() end end +function app.Clear() + app.WeaponLoot = {} + app.ArmourLoot = {} + app.UpdateWindow() +end + -- Open settings function app.OpenSettings() Settings.OpenToCategory(app.Category:GetID())