From 4aaefdd3851b4c0ae6c1afac22521016576d661f Mon Sep 17 00:00:00 2001 From: Bjarke Istrup Pedersen Date: Tue, 10 Sep 2024 11:04:27 +0200 Subject: [PATCH 1/2] Whitespace cleanup --- Modules/QuestFrame/QuestFrameModule.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/QuestFrame/QuestFrameModule.lua b/Modules/QuestFrame/QuestFrameModule.lua index 53f0605..d290d77 100644 --- a/Modules/QuestFrame/QuestFrameModule.lua +++ b/Modules/QuestFrame/QuestFrameModule.lua @@ -903,31 +903,31 @@ do if self:IsQuestSuppressed(info.questId) then return false; end - + if self.focusedQuestID then return C_QuestLog.IsQuestCalling(self.focusedQuestID) and self:ShouldSupertrackHighlightInfo(info.questId); end - + local mapID = self:GetMap():GetMapID() - + if ConfigModule:Get("showHoveredPOI") and hoveredQuestID == info.questId then return true end - + if ConfigModule:Get("hideFilteredPOI") then if DataModule:IsQuestFiltered(info, mapID) then return false end end - + if ConfigModule:Get("hideUntrackedPOI") then if not (WorldMap_IsWorldQuestEffectivelyTracked(info.questId)) then return false end end - + local mapInfo = C_Map.GetMapInfo(mapID) - + if ConfigModule:Get("showContinentPOI") and mapInfo.mapType == Enum.UIMapType.Continent then return mapID == info.mapID or (DataModule:GetContentMapIDFromMapID(info.mapID) == mapID) else @@ -973,4 +973,4 @@ do self:RegisterCallbacks() end end ---endregion \ No newline at end of file +--endregion From c3431e20d5ac7e8e617fd72e27f58b140afe95de Mon Sep 17 00:00:00 2001 From: Bjarke Istrup Pedersen Date: Tue, 10 Sep 2024 11:49:26 +0200 Subject: [PATCH 2/2] Added workarounds for World Map taints --- CHANGELOG.md | 4 + Modules/Config/ConfigModule.lua | 1 + Modules/DB/DBModule.lua | 1 + Modules/Workarounds/WorkaroundsModule.lua | 125 ++++++++++++++++++++++ Modules/Workarounds/WorkaroundsModule.xml | 3 + Modules/modules.xml | 1 + 6 files changed, 135 insertions(+) create mode 100644 Modules/Workarounds/WorkaroundsModule.lua create mode 100644 Modules/Workarounds/WorkaroundsModule.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e66032..1e8c773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 11.0.2-20240910-2 + +* Added workarounds for World Map taints. + ## 11.0.2-20240910-1 * Complete refactor and code cleanup. diff --git a/Modules/Config/ConfigModule.lua b/Modules/Config/ConfigModule.lua index 96658d8..29156f0 100644 --- a/Modules/Config/ConfigModule.lua +++ b/Modules/Config/ConfigModule.lua @@ -375,6 +375,7 @@ do "hideQuestList", "showHoveredPOI", "lootFilterUpgrades", + "enableTaintWorkarounds", "enableDebugging" } diff --git a/Modules/DB/DBModule.lua b/Modules/DB/DBModule.lua index 39f9472..a389c8c 100644 --- a/Modules/DB/DBModule.lua +++ b/Modules/DB/DBModule.lua @@ -53,6 +53,7 @@ local defaultOptions = { hideQuestList = false, showContinentPOI = true, enableDebugging = false, + enableTaintWorkarounds = false, sortMethod = 2, extendedInfo = false, saveFilters = false diff --git a/Modules/Workarounds/WorkaroundsModule.lua b/Modules/Workarounds/WorkaroundsModule.lua new file mode 100644 index 0000000..0c7ed5f --- /dev/null +++ b/Modules/Workarounds/WorkaroundsModule.lua @@ -0,0 +1,125 @@ +--[[ + Copyright (C) 2024 GurliGebis + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1: Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2: Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3: Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE +]] + +local addonName, _ = ... +local AngrierWorldQuests = LibStub("AceAddon-3.0"):GetAddon(addonName) +local WorkaroundsModule = AngrierWorldQuests:NewModule("WorkaroundsModule") +local ConfigModule = AngrierWorldQuests:GetModule("ConfigModule") + +local function WorkaroundMapTaints() + -- Code copied from hack from Kalies Tracker, which is based on the original Blizzard_MapCanvas.lua code. + local function OnPinReleased(pinPool, pin) + Pool_HideAndClearAnchors(pinPool, pin); + pin:OnReleased(); + pin.pinTemplate = nil; + pin.owningMap = nil; + end + + local function OnPinMouseUp(pin, button, upInside) + pin:OnMouseUp(button, upInside); + if upInside then + pin:OnClick(button); + end + end + + function WorldMapFrame:AcquirePin(pinTemplate, ...) + if not self.pinPools[pinTemplate] then + local pinTemplateType = self.pinTemplateTypes[pinTemplate] or "FRAME"; + self.pinPools[pinTemplate] = CreateFramePool(pinTemplateType, self:GetCanvas(), pinTemplate, OnPinReleased); + end + + local pin, newPin = self.pinPools[pinTemplate]:Acquire(); + + pin.pinTemplate = pinTemplate; + pin.owningMap = self; + + if newPin then + local isMouseClickEnabled = pin:IsMouseClickEnabled(); + local isMouseMotionEnabled = pin:IsMouseMotionEnabled(); + + if isMouseClickEnabled then + pin:SetScript("OnMouseUp", OnPinMouseUp); + pin:SetScript("OnMouseDown", pin.OnMouseDown); + + -- Prevent OnClick handlers from being run twice, once a frame is in the mapCanvas ecosystem it needs + -- to process mouse events only via the map system. + if pin:IsObjectType("Button") then + pin:SetScript("OnClick", nil); + end + end + + if isMouseMotionEnabled then + if newPin and not pin:DisableInheritedMotionScriptsWarning() then + -- These will never be called, just define a OnMouseEnter and OnMouseLeave on the pin mixin and it'll be called when appropriate + assert(pin:GetScript("OnEnter") == nil); + assert(pin:GetScript("OnLeave") == nil); + end + pin:SetScript("OnEnter", pin.OnMouseEnter); + pin:SetScript("OnLeave", pin.OnMouseLeave); + end + + pin:SetMouseClickEnabled(isMouseClickEnabled); + pin:SetMouseMotionEnabled(isMouseMotionEnabled); + end + + if newPin then + pin:OnLoad(); + pin.CheckMouseButtonPassthrough = function() end + pin.UpdateMousePropagation = function() end + end + + self.ScrollContainer:MarkCanvasDirty(); + pin:Show(); + pin:OnAcquired(...); + + return pin; + end +end + +function WorkaroundsModule:LoadWorkarounds(callback) + if ConfigModule:Get("enableTaintWorkarounds") then + WorkaroundMapTaints() + end + + if callback then + ReloadUI() + end +end + +function WorkaroundsModule:RegisterCallbacks() + ConfigModule:RegisterCallback("enableTaintWorkarounds", function() + self:LoadWorkarounds(true) + end) +end + +function WorkaroundsModule:OnEnable() + self:RegisterCallbacks() + + self:LoadWorkarounds(false) +end \ No newline at end of file diff --git a/Modules/Workarounds/WorkaroundsModule.xml b/Modules/Workarounds/WorkaroundsModule.xml new file mode 100644 index 0000000..edfe67f --- /dev/null +++ b/Modules/Workarounds/WorkaroundsModule.xml @@ -0,0 +1,3 @@ + +