Reply
Thread Tools Display Modes
Unread 09-28-12, 05:05 AM   #1
Paopao001
A Deviate Faerie Dragon
 
Paopao001's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 18
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
__________________

I hope you could understand my broken English.
If I offended you it was unwitting.
Paopao001 is offline   Reply With Quote
Unread 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: 310
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.
suicidalkatt is offline   Reply With Quote
Unread 09-28-12, 06:11 AM   #3
Paopao001
A Deviate Faerie Dragon
 
Paopao001's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 18
Would you please post all the code in altpowerbar.lua?
__________________

I hope you could understand my broken English.
If I offended you it was unwitting.
Paopao001 is offline   Reply With Quote
Unread 09-28-12, 06:24 AM   #4
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 310
Originally Posted by Paopao001 View Post
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
suicidalkatt is offline   Reply With Quote
Unread 09-28-12, 08:21 AM   #5
Rainrider
A Rage Talon Dragon Guard
Join Date: Nov 2008
Posts: 314
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"

Last edited by Rainrider : 09-28-12 at 09:39 AM. Reason: not vehicle but a pet
Rainrider is offline   Reply With Quote
Unread 09-28-12, 09:03 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,343
Correct. I do the same thing in oUF_Diablo.
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
zork is offline   Reply With Quote
Unread 09-28-12, 09:14 AM   #7
Paopao001
A Deviate Faerie Dragon
 
Paopao001's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 18
Thanks a lot!
__________________

I hope you could understand my broken English.
If I offended you it was unwitting.
Paopao001 is offline   Reply With Quote
Reply

Go BackWoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Power bat alt issue

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off