I’m reaching out for assistance with a Lua script addon that worked perfectly in patch 11.1.7 but is encountering issues in patch 11.2. The addon is designed to hide the player and target unit frames, along with class resource bars, when out of combat, and reposition class bars for specific classes.
In patch 11.1.7, the class resource bars (e.g., Rogue combo points, Mage arcane charges, etc.) hid correctly alongside the player and target unit frames when out of combat. However, in patch 11.2, the class bars sometimes disappear under certain conditions, such as:
Exiting a delve.
Arriving in a zone via a flight master.
Other unspecified triggers.
The bars reappear after using /reload, but this is not a practical solution during gameplay. The code also includes logic to suppress combat feedback text and UI error messages, which seems to work fine.
CODE
– HIDE PLAYERFRAME LOGIC
local ShowAlpha = 1
local HideAlpha = 0
local function UnitFrame_UpdateVisibility(self)
self:SetAlpha(
(
InCombatLockdown()
or UnitExists(“target”)
or self:IsMouseOver()
or UnitHealth(“player”) < UnitHealthMax(“player”)
) and ShowAlpha or HideAlpha
)
end
PlayerFrame:HookScript(“OnUpdate”, UnitFrame_UpdateVisibility)
TargetFrame:HookScript(“OnUpdate”, UnitFrame_UpdateVisibility)
– HIDE PORTRAIT COMBAT TEXT
local function CombatFeedback_OnCombatEvent_Hook(self, event, flags, amount, type)
if self.feedbackText then
self.feedbackText:SetText(“”)
end
end
hooksecurefunc(“CombatFeedback_OnCombatEvent”, CombatFeedback_OnCombatEvent_Hook)
local function HideCombatFeedbackText(self)
if self.feedbackText then
self.feedbackText:SetText(“”)
end
end
hooksecurefunc(“PlayerFrame_Update”, function()
HideCombatFeedbackText(PlayerFrame)
end)
– HIDE UI ERRORS
UIErrorsFrame:Hide()
– POSITION CLASS RESOURCE BARS
local classBars = {
ROGUE = { frame = RogueComboPointBarFrame, point = “TOP”, x = 190, y = 40 },
MAGE = { frame = MageArcaneChargesFrame, point = “CENTER”, x = 170, y = 40 },
PALADIN = { frame = PaladinPowerBarFrame, point = “CENTER”, x = 170, y = 40 },
WARLOCK = { frame = WarlockPowerFrame, point = “CENTER”, x = 168, y = 60 },
DEATHKNIGHT = { frame = RuneFrame, point = “CENTER”, x = 182, y = 40 },
MONK = { frame = MonkHarmonyBarFrame, point = “CENTER”, x = 171, y = 40 },
}
local function SetupClassBar()
local _, class = UnitClass(“player”)
class = class:upper()
local bar = classBars[class]
if bar and bar.frame then
bar.frame:ClearAllPoints()
bar.frame:SetPoint(bar.point, bar.x, bar.y)
bar.frame:Show()
bar.frame.SetPoint = function() end
end
for otherClass, otherBar in pairs(classBars) do
if otherClass ~= class and otherBar.frame then
otherBar.frame:Hide()
end
end
end
local frame = CreateFrame(“Frame”)
frame:RegisterEvent(“PLAYER_LOGIN”)
frame:RegisterEvent(“PLAYER_SPECIALIZATION_CHANGED”)
frame:SetScript(“OnEvent”, function(self, event, …)
if event == “PLAYER_LOGIN” or event == “PLAYER_SPECIALIZATION_CHANGED” then
C_Timer.After(1, SetupClassBar)
end
end)
Could anyone help identify why the class resource bars are disappearing in patch 11.2 under the described conditions? Is there a change in the WoW API or frame behavior that might be affecting this? Any suggestions for modifying the code to ensure the class bars remain visible when they should (i.e., following the same visibility rules as the player and target frames) would be greatly appreciated.
Thank you for your time and expertise!