From e8a2ec12ac01829f5d880692cfacf3f8854329bb Mon Sep 17 00:00:00 2001 From: funkydude Date: Wed, 10 Jul 2024 05:50:22 +0100 Subject: [PATCH] Compat code for WoW 11, closes #368 --- Borders.lua | 5 +++++ Borders_Classic.lua | 5 +++++ Buttons.lua | 2 +- Buttons_TBC.lua | 2 +- Buttons_Vanilla.lua | 2 +- Buttons_Wrath.lua | 2 +- SexyMap.lua | 11 +++++++---- ZoneText.lua | 4 ++-- 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Borders.lua b/Borders.lua index 140c41f..2d8bac7 100644 --- a/Borders.lua +++ b/Borders.lua @@ -5,6 +5,11 @@ sm.borders = {} local mod = sm.borders local L = sm.L +local EnableAddOn = C_AddOns.EnableAddOn or EnableAddOn +local GetAddOnInfo = C_AddOns.GetAddOnInfo or GetAddOnInfo +local LoadAddOn = C_AddOns.LoadAddOn or LoadAddOn +local IsAddOnLoaded = C_AddOns.IsAddOnLoaded or IsAddOnLoaded + local textures = {} local texturePool = {} local rotateTextures = {} diff --git a/Borders_Classic.lua b/Borders_Classic.lua index 8f877e0..42630b4 100644 --- a/Borders_Classic.lua +++ b/Borders_Classic.lua @@ -5,6 +5,11 @@ sm.borders = {} local mod = sm.borders local L = sm.L +local EnableAddOn = C_AddOns.EnableAddOn or EnableAddOn +local GetAddOnInfo = C_AddOns.GetAddOnInfo or GetAddOnInfo +local LoadAddOn = C_AddOns.LoadAddOn or LoadAddOn +local IsAddOnLoaded = C_AddOns.IsAddOnLoaded or IsAddOnLoaded + local textures = {} local texturePool = {} local rotateTextures = {} diff --git a/Buttons.lua b/Buttons.lua index 17fe8f0..0581f1a 100644 --- a/Buttons.lua +++ b/Buttons.lua @@ -418,7 +418,7 @@ do function mod:HideAllButtons() if not mod.db.controlVisibility or moving then return end - local focus = GetMouseFocus() -- Minimap or Minimap icons including nil checks to compensate for other addons + local focus = GetMouseFocus and GetMouseFocus() or GetMouseFoci and GetMouseFoci()[1] -- Minimap or Minimap icons including nil checks to compensate for other addons if focus and not focus:IsForbidden() and ((focus:GetName() == "Minimap") or (focus:GetParent() and focus:GetParent():GetName() and focus:GetParent():GetName():find("Mini[Mm]ap"))) then fadeStop = true return diff --git a/Buttons_TBC.lua b/Buttons_TBC.lua index ef3a9a2..14b1f57 100644 --- a/Buttons_TBC.lua +++ b/Buttons_TBC.lua @@ -314,7 +314,7 @@ do end local OnLeave = function() if not mod.db.controlVisibility or moving then return end - local focus = GetMouseFocus() -- Minimap or Minimap icons including nil checks to compensate for other addons + local focus = GetMouseFocus and GetMouseFocus() or GetMouseFoci and GetMouseFoci()[1] -- Minimap or Minimap icons including nil checks to compensate for other addons if focus and not focus:IsForbidden() and ((focus:GetName() == "Minimap") or (focus:GetParent() and focus:GetParent():GetName() and focus:GetParent():GetName():find("Mini[Mm]ap"))) then fadeStop = true return diff --git a/Buttons_Vanilla.lua b/Buttons_Vanilla.lua index 77c16b6..d8cbf4d 100644 --- a/Buttons_Vanilla.lua +++ b/Buttons_Vanilla.lua @@ -325,7 +325,7 @@ do end local OnLeave = function() if not mod.db.controlVisibility or moving then return end - local focus = GetMouseFocus() -- Minimap or Minimap icons including nil checks to compensate for other addons + local focus = GetMouseFocus and GetMouseFocus() or GetMouseFoci and GetMouseFoci()[1] -- Minimap or Minimap icons including nil checks to compensate for other addons if focus and not focus:IsForbidden() and ((focus:GetName() == "Minimap") or (focus:GetParent() and focus:GetParent():GetName() and focus:GetParent():GetName():find("Mini[Mm]ap"))) then fadeStop = true return diff --git a/Buttons_Wrath.lua b/Buttons_Wrath.lua index 56bcde2..e28896b 100644 --- a/Buttons_Wrath.lua +++ b/Buttons_Wrath.lua @@ -317,7 +317,7 @@ do end local OnLeave = function() if not mod.db.controlVisibility or moving then return end - local focus = GetMouseFocus() -- Minimap or Minimap icons including nil checks to compensate for other addons + local focus = GetMouseFocus and GetMouseFocus() or GetMouseFoci and GetMouseFoci()[1] -- Minimap or Minimap icons including nil checks to compensate for other addons if focus and not focus:IsForbidden() and ((focus:GetName() == "Minimap") or (focus:GetParent() and focus:GetParent():GetName() and focus:GetParent():GetName():find("Mini[Mm]ap"))) then fadeStop = true return diff --git a/SexyMap.lua b/SexyMap.lua index b144931..06064ec 100644 --- a/SexyMap.lua +++ b/SexyMap.lua @@ -397,13 +397,16 @@ function mod:PLAYER_LOGIN() -- Setup config LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable(name, mod.options, true) - LibStub("AceConfigDialog-3.0"):AddToBlizOptions(name) + local _, categoryID = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(name) -- Configure slash handler SlashCmdList.SexyMap = function() - -- Twice to work around a Blizz bug, opens to wrong panel on first try - InterfaceOptionsFrame_OpenToCategory(name) - InterfaceOptionsFrame_OpenToCategory(name) + if InterfaceOptionsFrame_OpenToCategory then -- XXX compat + InterfaceOptionsFrame_OpenToCategory(name) -- Twice to work around a Blizz bug, opens to wrong panel on first try + InterfaceOptionsFrame_OpenToCategory(name) + else + Settings.OpenToCategory(categoryID) + end end SLASH_SexyMap1 = "/minimap" SLASH_SexyMap2 = "/sexymap" diff --git a/ZoneText.lua b/ZoneText.lua index 04bca5b..21e0522 100644 --- a/ZoneText.lua +++ b/ZoneText.lua @@ -299,7 +299,7 @@ function mod:OnEnable() do local tt = CreateFrame("GameTooltip", "SexyMapZoneTextTooltip", zoneTextButton, "GameTooltipTemplate") - local GetZonePVPInfo, GetZoneText, GetSubZoneText = GetZonePVPInfo, GetZoneText, GetSubZoneText + local GetZonePVPInfo, GetZoneText, GetSubZoneText = C_PvP and C_PvP.GetZonePVPInfo or GetZonePVPInfo, GetZoneText, GetSubZoneText zoneTextButton:SetScript("OnEnter", function(self) -- Minimap.lua line 68 function "Minimap_SetTooltip" as of wow 9.0.1 tt:SetOwner(self, "ANCHOR_LEFT") local pvpType, _, factionName = GetZonePVPInfo() @@ -380,7 +380,7 @@ function mod:UpdateLayout() end do - local GetMinimapZoneText, GetZonePVPInfo = GetMinimapZoneText, GetZonePVPInfo + local GetMinimapZoneText, GetZonePVPInfo = GetMinimapZoneText, C_PvP and C_PvP.GetZonePVPInfo or GetZonePVPInfo function mod:ZoneChanged() local text = GetMinimapZoneText() zoneTextFont:SetText(text)