altpowerbar issue with tonk commander game in darkmoon faire
gagou opened this issue · 14 comments
When playing the darkmoon faire game in DMF the altpower bar show then hide very quickly.
Looking at the calls to the Toggler function, it's called two times:
- first time by the UNIT_POWER_BAR_SHOW event and player unit, this result => alt power bar frame is shown.
- second time a few ms later by RefreshUnit with vehicle unit (so triggered by PLAYER_ENTER_VEHICLE), UnitAlternatePowerInfo return nil for vehicle in this case => alt power bar frame is hidden.
Create AltPowerBar on the pet in the layout. Sorry if this message comes through multiple times.
On Tue, 4 Oct 2016, 12:01 Val Voronov, [email protected] wrote:
Any suggestions? o_O
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#293 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAWNZKsq2uUpmZMlHn1wmL25ctdkXlYrks5qwiQOgaJpZM4Jeew4
.
@Rainrider
Imo that won't help. The toggle event starts with unit player but some time later the unit_power event will tell you about vehicle. Will experiment with it in the next days. A really good quest do test it is the flower zombie game quest in Hillsbrad (south of old Dalaran).
@zorker, it actually works, however, I have a feeling that in some cases it may cause alt power bar duplicates, cuz same thingy often happens to player and pet castbars, when player is in some sort of vehicle.
Will try. Sounds wierd though and currently I do not have room for that bar in my layout.
Hmmm. But I think I remember. I did this for oUF_Diablo and got double AltPower bars in some Darkmoon games. Either way. Will test it.
You can try placing them on top of each other, cuz they're supposed to do same thing...
I checked alt power bars over the weekend and all I can say is fuck that. When the bar unit is player only no problems occur.
But oh boy...better let not vehicle interfere. You get all kinds of results. Depending on how fast you click on the vehicle exit (or whatever).
The culprit is
if unit ~= self.unit then return end
It is either true for player or vehicle.
I set up my own module and played around with it a bit.
https://github.com/zorker/rothui/blob/master/wow7.0/oUF_Simple/modules/rAltPowerBar.lua
Added a bad unit function.
Some crap was here, I should never assume and/or suggest anything until I get my first cup of coffee
I need some coffee and do more research T_T
K, my current workaround is this:
diff --git a/elements/altpowerbar.lua b/elements/altpowerbar.lua
index e95e93b..4bd5a35 100644
--- a/elements/altpowerbar.lua
+++ b/elements/altpowerbar.lua
@@ -65,7 +65,7 @@ local OnLeave = function()
end
local UpdatePower = function(self, event, unit, powerType)
- if(self.unit ~= unit or powerType ~= 'ALTERNATE') then return end
+ if(not (self.realUnit and unit == self.realUnit or unit == self.unit) or powerType ~= 'ALTERNATE') then return end
local altpowerbar = self.AltPowerBar
@@ -132,7 +132,8 @@ local ForceUpdate = function(element)
end
local Toggler = function(self, event, unit)
- if(unit ~= self.unit) then return end
+ if(self.realUnit and unit ~= self.realUnit or unit ~= self.unit) then return end
+
local altpowerbar = self.AltPowerBar
local barType, _, _, _, _, hideFromOthers, showOnRaid = UnitAlternatePowerInfo(unit)
But using realUnit
is ghetto...
What do @p3lim and @Rainrider think about it? O_o
Tested it. Rainrider is totally correct. Adding the altpower bar to the pet aswell fixed all issues. Now I need to adjust my layout a tad bid. Overlaying is no option.
if self.cfg.template == "pet" then
local af = _G[A.."PlayerFrame"]
if af then
if af.AltPowerBar:IsShown() then af = af.AltPowerBar end
self.AltPowerBar:ClearAllPoints()
self.AltPowerBar:SetPoint("BOTTOMLEFT",af,"TOPLEFT",0,5)
end
end
@zorker They can share the same position. When you are in a vehicle only the one for the pet frame is shown.