Neuron

Neuron

98.2k Downloads

[bug] [fix] Hidden bars are displayed after exitting a pet battle

zeroderef opened this issue ยท 2 comments

commented

Bars that are marked as Hidden are displayed after exitting a pet battle.

The problem is that you need to check self:GetParent():GetAttribute("vishide") and self:GetParent():GetAttribute("concealed") as both can be combinations of nil and true from what I have seen.

My fix for Neuron-Bars.lua around line 1045:

function NeuronBar:CreateWatcher(bar)
    local watcher = CreateFrame("Frame", "NeuronBarWatcher"..bar:GetID(), bar.handler, "SecureHandlerStateTemplate")

    setmetatable(watcher, { __index = handlerMT })

    watcher:SetID(bar:GetID())

    watcher:SetAttribute("_onattributechanged", [[ ]])

    watcher:SetAttribute("_onstate-petbattle", [[
    
            if (self:GetAttribute("state-petbattle") == "hide") then
                self:GetParent():Hide()
            else
                if (not self:GetParent():IsShown()) then
                    if (not self:GetParent():GetAttribute("vishide") and not self:GetParent():GetAttribute("concealed")) then
                        self:GetParent():Show()
                    end
                end
            end
    ]])

    RegisterStateDriver(watcher, "petbattle", "[petbattle] hide; [nopetbattle] show")

end
commented

Cool I have roped in your change! I don't really do pet battles, so I'm trusting you to thoroughly test this fix :-)

commented

Confirmed fixed in 0.9.31.
Thanks brittyazel!