WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Power bat alt issue (https://www.wowinterface.com/forums/showthread.php?t=44544)

Paopao001 09-28-12 05:05 AM

Power bat alt issue
 
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

suicidalkatt 09-28-12 05:53 AM

Quote:

Originally Posted by Paopao001 (Post 265262)
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

Paopao001 09-28-12 06:11 AM

Would you please post all the code in altpowerbar.lua?:)

suicidalkatt 09-28-12 06:24 AM

Quote:

Originally Posted by Paopao001 (Post 265267)
Would you please post all the code in altpowerbar.lua?:)

I'm leaving for work right now, but oUF actually unregisters events with the blizzard frame's self updating which would ultimately break this.

Check out my coding for SimplePowerBar the full Lua for the blizzard frame is as follows:

http://pastebin.com/01q9PUQ8

Rainrider 09-28-12 08:21 AM

Just register oUF's AltPowerBar element for the pet frame too. You could test this with http://www.wowhead.com/quest=28733/basic-botany too, as it is more accessible.

When the player is in a vehicle, the pet frame holds the player unit:
For the pet frame then: self.unit = "player", self.realUnit = "pet"
For the player frame: self.unit = "vehicle", self.realUnit = "player"

zork 09-28-12 09:03 AM

Correct. I do the same thing in oUF_Diablo.

Paopao001 09-28-12 09:14 AM

Thanks a lot! :banana::banana:


All times are GMT -6. The time now is 11:15 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI