Dominos

Dominos

19M Downloads

[Cata Classic] Encounter Bar position - part 2

Road-block opened this issue ยท 7 comments

commented

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

#858 (comment) 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

commented

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.

commented

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

commented

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)
commented

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

commented

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 ๐Ÿ‘๐Ÿป

commented

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

commented

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