View Single Post
09-28-12, 05:53 AM   #2
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Paopao001 View Post
In some quests like Unyielding Fists: Trial of Bamboo,the player get into a vehicle but got altpower itself.
That is, UnitPower("player", ALTERNATE_POWER_INDEX) returns the value while UnitPower("vehicle", ALTERNATE_POWER_INDEX) returns nil.
But the unit of player frame is vehicle, not player. so the power bar alt don't show up in these cases.

Here's my solution. I wonder if anybody have a better solution.

https://github.com/Paojy/Altz-UI/com...dc836bd773df9b
A better solution would be something along these lines:
Lua Code:
  1. if powerType == "ALTERNATE" then
  2.     if self.unit ~= PlayerPowerBarAlt.unit then -- PlayerPowerBarAlt is the blizzard frame which will always have the correct unit associated with it.
  3.         self.unit = PlayerPowerBarAlt.unit
  4.     end
  5.     if self.unit ~= unit then
  6.         return
  7.     end
  8. else
  9.     return
  10. end

Last edited by suicidalkatt : 09-28-12 at 06:12 AM. Reason: Edited to check for 'unit' passed arg match.
  Reply With Quote