Skip to content

Commit a6cae11

Browse files
committed
Fix the "Open Mythic+ UI" button in the settings not working in certain situations
1 parent c0ebf52 commit a6cae11

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

SharedUtil.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ local scoreRarityColors = {
1616
dungeonOverallScore = { 0, 125, 188, 225, 275 },
1717
};
1818

19+
function Util:ToggleMythicPlusFrame()
20+
local shouldShow = not (ChallengesFrame and ChallengesFrame:IsVisible());
21+
PVEFrame_ToggleFrame('ChallengesFrame');
22+
if shouldShow == ChallengesFrame:IsVisible() then return; end
23+
24+
PVEFrame:SetShown(shouldShow);
25+
if PVEFrame:GetNumPoints() == 0 then
26+
PVEFrame:SetPoint('TOPLEFT', 16, -116); -- roughly where it would normally open
27+
end
28+
if not tIndexOf(UISpecialFrames, 'PVEFrame') then
29+
table.insert(UISpecialFrames, 'PVEFrame');
30+
end
31+
end
32+
1933
--- @return ColorMixin
2034
function Util:GetRarityColorOverallScore(score)
2135
return C_ChallengeMode.GetDungeonScoreRarityColor(score) or self:GetRarityColor(score, 'overallScore');

modules/alwaysShowAffixes.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ function Module:GetOptions(defaultOptionsTable)
2727
type = 'execute',
2828
name = 'Open Mythic+ UI',
2929
desc = 'Open the Mythic+ UI and the affixes are on the top of the UI.',
30-
func = function()
31-
PVEFrame_ToggleFrame('ChallengesFrame');
32-
end,
30+
func = function() Util:ToggleMythicPlusFrame(); end,
3331
};
3432

3533
return defaultOptionsTable;

modules/dungeonIconText.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ function Module:GetOptions(defaultOptionsTable, db)
162162
type = 'execute',
163163
name = 'Open Mythic+ UI',
164164
desc = 'Open the Mythic+ UI and the icons are on the bottom of the UI.',
165-
func = function()
166-
PVEFrame_ToggleFrame('ChallengesFrame');
167-
end,
165+
func = function() Util:ToggleMythicPlusFrame(); end,
168166
order = increment(),
169167
};
170168
defaultOptionsTable.args.dash = {

modules/dungeonIconTooltip.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ function Module:GetOptions(defaultOptionsTable, db, increment)
7171
order = increment(),
7272
name = 'Open Mythic+ UI',
7373
desc = 'Open the Mythic+ UI and hover over a dungeon icon to see an example.',
74-
func = function()
75-
PVEFrame_ToggleFrame('ChallengesFrame');
76-
end,
74+
func = function() Util:ToggleMythicPlusFrame(); end,
7775
};
7876

7977
return defaultOptionsTable;

modules/partyRating.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ function Module:GetOptions(defaultOptionsTable, db, increment)
7979
order = increment(),
8080
name = 'Open Mythic+ UI',
8181
desc = 'Open the Mythic+ UI and hover over a dungeon icon to see an example.',
82-
func = function()
83-
PVEFrame_ToggleFrame('ChallengesFrame');
84-
end,
82+
func = function() Util:ToggleMythicPlusFrame(); end,
8583
};
8684

8785
return defaultOptionsTable;

modules/sortDungeonIcons.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ function Module:GetOptions(defaultOptionsTable, db)
6767
type = 'execute',
6868
name = 'Open Mythic+ UI',
6969
desc = 'Open the Mythic+ UI and the icons are on the bottom of the UI.',
70-
func = function()
71-
PVEFrame_ToggleFrame('ChallengesFrame');
72-
end,
70+
func = function() Util:ToggleMythicPlusFrame(); end,
7371
order = increment(),
7472
};
7573
defaultOptionsTable.args.sortStyle = {

0 commit comments

Comments
 (0)