Skip to content

Commit

Permalink
Buttons: Make some wrath specific adjustments (Fixes #255 & fixes #254)
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Sep 2, 2022
1 parent 1347f28 commit 677c31f
Showing 1 changed file with 37 additions and 33 deletions.
70 changes: 37 additions & 33 deletions Buttons_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local moving, ButtonFadeOut

local animFrames = {}
local blizzButtons = {
GameTimeFrame = L.dayNightButton,
GameTimeFrame = L["Calendar"],
MiniMapTracking = L["Tracking Button"],
SexyMapZoneTextButton = L["Zone Text"],
MinimapZoomIn = L["Zoom In Button"],
Expand All @@ -21,7 +21,7 @@ local blizzButtons = {
local dynamicButtons = {
--GuildInstanceDifficulty = L["Guild Dungeon Difficulty Indicator (When Available)"],
--MiniMapChallengeMode = L["Challenge Mode Button (When Available)"],
--MiniMapInstanceDifficulty = L["Dungeon Difficulty Indicator (When Available)"],
MiniMapInstanceDifficulty = L["Dungeon Difficulty Indicator (When Available)"],
MiniMapMailFrame = L["New Mail Indicator (When Available)"],
MiniMapBattlefieldFrame = L.classicPVPButton,
--GarrisonLandingPageMinimapButton = L["Garrison Button (When Available)"],
Expand Down Expand Up @@ -178,13 +178,13 @@ function mod:OnInitialize(profile)
radius = 10,
dragPositions = {},
visibilitySettings = {
GameTimeFrame = "never",
MinimapZoomIn = "never",
MinimapZoomOut = "never",
MiniMapWorldMapButton = "never",
SexyMapZoneTextButton = "always",
TimeManagerClockButton = "always",
MiniMapMailFrame = "always",
--QueueStatusMinimapButton = "always",
MiniMapBattlefieldFrame = "always",
MiniMapLFGFrame = "always",
GarrisonLandingPageMinimapButton = "always",
Expand All @@ -209,8 +209,9 @@ function mod:OnInitialize(profile)
if not self.db.visibilitySettings.MiniMapLFGFrame then
self.db.visibilitySettings.MiniMapLFGFrame = "always"
end
if not self.db.visibilitySettings.GameTimeFrame then
self.db.visibilitySettings.GameTimeFrame = "never"
if not self.db.tempWrathUpgrade then -- XXX launch of wrath prepatch, GameTimeFrame moves from day/night indicator (useless - hidden) to calendar (useful - show on hover)
self.db.visibilitySettings.GameTimeFrame = nil
self.db.tempWrathUpgrade = true
end
end

Expand Down Expand Up @@ -326,11 +327,11 @@ do
local n = f:GetName()

if not mod.db.visibilitySettings[n] or mod.db.visibilitySettings[n] == "hover" then
--if n ~= "GameTimeFrame" or (n == "GameTimeFrame" and C_Calendar.GetNumPendingInvites() < 1) then
if n ~= "GameTimeFrame" or (n == "GameTimeFrame" and C_Calendar.GetNumPendingInvites() < 1) then
f.sexyMapFadeOut:Play()

KillAnimation(n, f)
--end
end
end
end
end
Expand All @@ -356,11 +357,11 @@ do
-- f.sexyMapFadeOut:SetScript("OnFinished", OnFinished)
--end
---- These frames are parented to MinimapCluster, if the map scale is changed they won't drag properly, so we parent to Minimap
--if n == "MiniMapInstanceDifficulty" or n == "GuildInstanceDifficulty" or n == "MiniMapChallengeMode" then
-- f:ClearAllPoints()
-- f:SetParent(Minimap)
-- f:SetPoint("CENTER", Minimap, "CENTER", -60, 55)
--end
if n == "MiniMapInstanceDifficulty" then --or n == "GuildInstanceDifficulty" or n == "MiniMapChallengeMode" then
f:ClearAllPoints()
f:SetParent(Minimap)
f:SetPoint("CENTER", Minimap, "CENTER", -60, 55)
end

animFrames[#animFrames+1] = f

Expand Down Expand Up @@ -388,11 +389,11 @@ do
self:AddButtonOptions(n)

-- Configure dragging
--if n == "MiniMapTracking" then
-- self:MakeMovable(MiniMapTrackingButton, f)
--else
if n == "MiniMapTracking" then
self:MakeMovable(MiniMapTrackingButton, f)
else
self:MakeMovable(f)
--end
end
end
end
f:HookScript("OnEnter", OnEnter)
Expand Down Expand Up @@ -548,25 +549,28 @@ end

do
local tbl = {
Minimap, MiniMapTracking, TimeManagerClockButton, GameTimeFrame,
MinimapZoomIn, MinimapZoomOut, MiniMapWorldMapButton,
--Minimap, MiniMapTrackingButton, MiniMapTracking, TimeManagerClockButton, GameTimeFrame,
--MinimapZoomIn, MinimapZoomOut, MiniMapWorldMapButton, GuildInstanceDifficulty, MiniMapChallengeMode, MiniMapInstanceDifficulty,
--MiniMapMailFrame, QueueStatusMinimapButton, GarrisonLandingPageMinimapButton
Minimap, MiniMapTrackingButton, MiniMapTracking, TimeManagerClockButton, GameTimeFrame,
MinimapZoomIn, MinimapZoomOut, MiniMapWorldMapButton, MiniMapInstanceDifficulty,
MiniMapMailFrame, MiniMapBattlefieldFrame, MiniMapLFGFrame
}

function mod:AddButton(_, button)
self:NewFrame(button)
end

--local function CheckCalendar()
-- local vis = mod.db.visibilitySettings.GameTimeFrame
-- if not vis or vis == "hover" then
-- if C_Calendar.GetNumPendingInvites() < 1 then
-- mod:ChangeFrameVisibility(GameTimeFrame, "hover")
-- else
-- mod:ChangeFrameVisibility(GameTimeFrame, "always")
-- end
-- end
--end
local function CheckCalendar()
local vis = mod.db.visibilitySettings.GameTimeFrame
if not vis or vis == "hover" then
if C_Calendar.GetNumPendingInvites() < 1 then
mod:ChangeFrameVisibility(GameTimeFrame, "hover")
else
mod:ChangeFrameVisibility(GameTimeFrame, "always")
end
end
end

function mod:StartFrameGrab()
for i = 1, #tbl do
Expand All @@ -580,11 +584,11 @@ do
ldbi.RegisterCallback(mod, "LibDBIcon_IconCreated", "AddButton")

-- If calendar is set to "hover" and we have pending invites, force show it
--local frame = CreateFrame("Frame")
--frame:SetScript("OnEvent", CheckCalendar)
--frame:RegisterEvent("CALENDAR_UPDATE_PENDING_INVITES")
--frame:RegisterEvent("CALENDAR_ACTION_PENDING")
--CheckCalendar()
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", CheckCalendar)
frame:RegisterEvent("CALENDAR_UPDATE_PENDING_INVITES")
frame:RegisterEvent("CALENDAR_ACTION_PENDING")
CheckCalendar()

mod.StartFrameGrab = nil
end
Expand Down

0 comments on commit 677c31f

Please sign in to comment.