Skip to content

Commit 4129003

Browse files
committed
Disable the custom castbar shown when changing talents, since it causes errors
1 parent 2c7b7a6 commit 4129003

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

modules/reduceTaint.lua

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function Module:BuildConfig(configBuilder, db)
4646
local defaults = {
4747
alwaysReplaceShareButton = false,
4848
disableMultiActionBarShowHide = true,
49+
disableCastbar = true,
4950
};
5051
self.db.replaceDropDown = nil;
5152
configBuilder:SetDefaults(defaults, true);
@@ -64,6 +65,17 @@ function Module:BuildConfig(configBuilder, db)
6465
self:HandleMultiActionBarTaint();
6566
end
6667
);
68+
configBuilder:MakeCheckbox(
69+
L['Disable Custom Castbar'],
70+
'disableCastbar',
71+
L['Midnight introduced some changes that cause the custom castbar to throw errors when switching talents.'],
72+
function()
73+
local talentsTab = Util:GetTalentFrameIfLoaded()
74+
if talentsTab then
75+
self:HandleCastbarTaint(talentsTab);
76+
end
77+
end
78+
);
6779
end
6880

6981
function Module:SetupHook()
@@ -82,6 +94,7 @@ function Module:SetupHook()
8294
self:ReplaceCopyLoadoutButton(talentsTab);
8395

8496
self:HandleMultiActionBarTaint();
97+
self:HandleCastbarTaint(talentsTab);
8598
end
8699

87100
function Module:HandleOnBarHighlightMarkTaint()
@@ -199,8 +212,11 @@ function Module:ReplaceCopyLoadoutButton(talentsTab)
199212
end);
200213
end
201214

202-
local function purgeKey(table, key)
203-
TextureLoadingGroupMixin.RemoveTexture({textures = table}, key);
215+
local function setTrue(table, key)
216+
TextureLoadingGroupMixin.AddTexture({ textures = table }, key);
217+
end
218+
local function setNil(table, key)
219+
TextureLoadingGroupMixin.RemoveTexture({ textures = table }, key);
204220
end
205221
local function makeFEnvReplacement(original, replacement)
206222
local fEnv = {};
@@ -247,32 +263,41 @@ function Module:HandleMultiActionBarTaint()
247263
and not self:IsHooked(microButton, 'HasTalentAlertToShow')
248264
then
249265
self:SecureHook(microButton, 'HasTalentAlertToShow', function()
250-
purgeKey(microButton, 'canUseTalentUI');
251-
purgeKey(microButton, 'canUseTalentSpecUI');
266+
setNil(microButton, 'canUseTalentUI');
267+
setNil(microButton, 'canUseTalentSpecUI');
252268
end);
253269
end
254270
end
255271

272+
--- @param talentsTab PlayerSpellsFrame_TalentsFrame
273+
function Module:HandleCastbarTaint(talentsTab)
274+
if self.db.disableCastbar then
275+
setNil(talentsTab, 'enableCommitCastBar');
276+
else
277+
setTrue(talentsTab, 'enableCommitCastBar');
278+
end
279+
end
280+
256281
function Module:MakeOnHideSafe()
257282
local talentContainerFrame = Util:GetTalentContainerFrame();
258283
if not issecurevariable(talentContainerFrame, 'lockInspect') then
259284
if not talentContainerFrame.lockInspect then
260-
purgeKey(talentContainerFrame, 'lockInspect');
285+
setNil(talentContainerFrame, 'lockInspect');
261286
else
262287
-- get blizzard to set the value to true
263288
TextureLoadingGroupMixin.AddTexture({textures = talentContainerFrame}, 'lockInspect');
264289
end
265290
end
266291
local isInspecting = talentContainerFrame:IsInspecting();
267292
if not issecurevariable(talentContainerFrame, 'inspectUnit') then
268-
purgeKey(talentContainerFrame, 'inspectUnit');
293+
setNil(talentContainerFrame, 'inspectUnit');
269294
end
270295
if not issecurevariable(talentContainerFrame, 'inspectString') then
271-
purgeKey(talentContainerFrame, 'inspectString');
296+
setNil(talentContainerFrame, 'inspectString');
272297
end
273298
if isInspecting then
274-
purgeKey(talentContainerFrame, 'inspectString');
275-
purgeKey(talentContainerFrame, 'inspectUnit');
299+
setNil(talentContainerFrame, 'inspectString');
300+
setNil(talentContainerFrame, 'inspectUnit');
276301
RunNextFrame(function()
277302
-- Addons like NoAutoClose will allow calling this in combat, but otherwise we're screwed :/
278303
if InCombatLockdown() and UIPanelWindows[talentContainerFrame:GetName()] then return; end

0 commit comments

Comments
 (0)