Originally Posted by Rainrider
I did some testing on Zombies vs Plants and thats what I got
All the altPower infos are reported for player and not for vehicle
/run print(UnitAlternatePowerInfo("player")) -- returns the normal bunch of values
/run print(UnitPower("player", ALTERNATE_POWER_INDEX)) -- returns 0
/run print(UnitPowerMax("player", ALTERNATE_POWER_INDEX)) -- returns 4
The three above return nothing, 0, 0 respectevely when I use vehicle as unit.
Thus in oUF/elements/altpowerbar.lua Toggler would be called when unit == "vehicle" and self.unit == "vehicle" and will fail as UnitPowerMax(unit, ALTERNATE_POWER_INDEX) would return 0. UpdatePower fails then because powerType for unit vehicle is always ENERGY.
I then commented out in Toggler
Code:
if(unit ~= self.unit) then return end
and changed in UpdatePower
Code:
if(self.unit ~= unit or powerType ~= 'ALTERNATE') then return end
to
Code:
if(powerType ~= 'ALTERNATE') then return end
Toggler calls then UpdatePower on every UNIT_POWER for all units (initially failing to show the altpowerbar as min and max are both 0 because at UNIT_POWER_BAR_SHOW it gets unit == "pet" and unit == "vehicle"). After some zombies die, the altpowerbar changes to 25% for unit == "player" and self.unit == "vehicle". It fails again to show the bar because of
Code:
local cur = UnitPower(unit, ALTERNATE_POWER_INDEX)
local max = UnitPowerMax(self.unit, ALTERNATE_POWER_INDEX)
in UpdatePower. Changing this to local max = UnitPowerMax(unit, ALTERNATE_POWER_INDEX) updates and shows the powerbar.
I hope this helps somehow.
|
Thanks for further investigation. Someone should open a ticket over at github. *cough*