tullamods / Dominos

A main actionbar replacement
https://tullamods.com/dominos
BSD 3-Clause "New" or "Revised" License
79 stars 27 forks source link

[Cata Classic] Encounter Bar position - part 2 #864

Closed Road-block closed 1 week ago

Road-block commented 1 week ago

When reporting an issue, please try to reproduce the issue with just Dominos and Dominos_Config running. Dominos reuses a good chunk of the stock UI, and other popular addons, like Move Anything, like to take control of those parts, too.

Addon Version 10.2.33

World of Warcraft Version Cataclysm Classic

https://github.com/tullamods/Dominos/issues/858#issuecomment-2161393209 and following discussion in the now closed ticket.

The previous change/fix seems to work for initial positioning but the game appears to reset to default after a death and Dominos doesn't catch it.

Needing a /reloadui to recover the saved position is further indication of that. Useful troubleshooting information is that alternate power bar can be tested outside raiding at the Darkmoon Fair Island

Road-block commented 1 week ago

Ok so I went to DMF and spent a few game tokens on the Tonk Commander quest.

More as a means of troubleshooting I added this to

function EncounterBar:InitPlayerPowerBarAlt()
    if not self.__PlayerPowerBarAlt then
        local bar = PlayerPowerBarAlt

        if bar:GetScript('OnSizeChanged') then
            bar:HookScript('OnSizeChanged', function() self:Layout() end)
        else
            bar:SetScript('OnSizeChanged', function() self:Layout() end)
        end
        hooksecurefunc("UnitPowerBarAlt_SetUp", function(barFrame, barID)
            if barFrame.unit and UnitIsUnit(barFrame.unit, "player") then
                self:Layout()
            end
        end)

        self.__PlayerPowerBarAlt = bar
    end
end

Just to see when the game calls UnitPowerBarAlt_SetUp which repositions the AltPowerBar. This ended up fixing my issue with bar reverting to defaults after a "death" (or a tonk death in this scenario which is rather convenient for testing)

Now I have no idea how this would work where combat status is involved, I'll have to wait for next raid. I also do not know if OnSizeChanged is superfluous when using a secure hook on the client's altpower setup function.

Road-block commented 1 week ago

I should probably do the Layout only if UnitIsUnit(barFrame.unit, "player"), I'll play around with it.

Tuller commented 1 week ago

Good research :) I think this is what I'm looking at at the final version of the hook:

hooksecurefunc("UnitPowerBarAlt_SetUp", function(bar)
  if bar.isPlayerBar and bar:GetParent() ~= self then
    bar:SetParent(self)
    bar:ClearAllPoints()
    bar:SetPoint('CENTER', self)
  end
end)
Road-block commented 1 week ago

Tested .34 at DMF sadly it didn't work. My queue popped so I wasn't able to trace and see why, the new code looks like it should

Road-block commented 1 week ago

Oh I know why 😋

if type("UnitPowerBarAlt_SetUp") == "function" then

You'll have a chuckle with yourself when you read this a second time 😆

I'm sure you meant to do

if type(UnitPowerBarAlt_SetUp) == "function" then

Edit: I can verify this works at least in DMF testing when the existence check passes and the hook is actually installed 👍🏻

Tuller commented 1 week ago

Yup, that was an error from me adding the guard after the fact from copying the line with the hook.

Road-block commented 1 week ago

Had a chance to raid with this tonight, everything looks good.