Files
coa-bartender/Bartender4/MultiCastBar.lua
T
florian.berthold f8cfedfc06 fix(MultiCast): let CoA custom classes (Witchdoctor) get the totem bar
Both MultiCastBar.lua and Options/MultiCastBar.lua hard-coded a class-mask
gate of SHAMAN|HERO, which doesn't know about CoA custom classes. As a
result, Witchdoctor (and any other CoA class the engine produces a totem
bar for) never had Bartender's wrapper module register, leaving the totem
bar un-skinned / un-configurable.

Keep the original mask check as the fast path, but fall through and load
the module when MultiCastActionBarFrame already exists — the engine only
creates that frame for classes that actually use the totem bar, so it's a
reliable class-agnostic test.
2026-05-23 16:01:06 +02:00

80 lines
2.3 KiB
Lua

--[[
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
All rights reserved.
]]
if not HasMultiCastActionBar then return end
local classMask = UnitClassMask("player")
-- CoA: the SHAMAN/HERO mask check doesn't know about CoA custom classes
-- (e.g. Witchdoctor, which also uses the totem bar). Fall back to the
-- game-created MultiCastActionBarFrame: if the engine produced it for this
-- player, we wrap it regardless of class.
if not bit.contains(EnumUtil.CombineMasks(Enum.ClassMask.SHAMAN, Enum.ClassMask.HERO), classMask)
and not MultiCastActionBarFrame then
return
end
-- fetch upvalues
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local Bar = Bartender4.Bar.prototype
local defaults = { profile = Bartender4:Merge({
enabled = true,
}, Bartender4.Bar.defaults) }
-- register module
local MultiCastMod = Bartender4:NewModule("MultiCast")
-- create prototype information
local MultiCastBar = setmetatable({}, {__index = Bar})
local function OnShowMultiCastActionBar()
if MultiCastMod:IsEnabled() then
MultiCastMod:ApplyConfig()
end
end
function MultiCastMod:OnInitialize()
hooksecurefunc("ShowMultiCastActionBar", OnShowMultiCastActionBar)
self.db = Bartender4.db:RegisterNamespace("MultiCast", defaults)
self:SetEnabledState(self.db.profile.enabled)
end
function MultiCastMod:OnEnable()
if not self.bar then
self.bar = setmetatable(Bartender4.Bar:Create("MultiCast", self.db.profile, L["Totem Bar"]), {__index = MultiCastBar})
self.bar.content = MultiCastActionBarFrame
self.bar.content:SetScript("OnShow", nil)
self.bar.content:SetScript("OnHide", nil)
self.bar.content:SetScript("OnUpdate", nil)
self.bar.content.ignoreFramePositionManager = true
self.bar.content:SetParent(self.bar)
self.bar.content:Show()
self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)
end
self.bar:Enable()
self:ToggleOptions()
self:ApplyConfig()
end
function MultiCastMod:ApplyConfig()
if not self:IsEnabled() then return end
self.bar:ApplyConfig(self.db.profile)
end
function MultiCastBar:ApplyConfig(config)
Bar.ApplyConfig(self, config)
self:PerformLayout()
end
function MultiCastBar:PerformLayout()
self:SetSize(230, 40)
local bar = self.content
bar:ClearAllPoints()
bar:SetPoint("TOPLEFT", self, "TOPLEFT", 3, 1)
end