Thread Tools Display Modes
07-23-17, 10:40 PM   #1
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
Need some documentation of alternate power bar

I searched and this stuff isn't documented on places like wowpedia
I want to add a simple version of the alt power bar to my mod. But things I don't care about.
Other players alt power bar, Just my own. Things i'm confused on. Counters and timers. Are they always paired or they seperate?
Also been looking at blizzards code for alt power bar, but cant figure out how they get the text. or is that powername?

So what does all this stuff below mean?
Code:
duration, expiration, barID, auraID = UnitPowerBarTimerInfo(unit, index)
useFactional, animNumbers = UnitAlternatePowerCounterInfo(unit)
barType, minPower, startInset, endInset, smooth, hideFromOthers, showOnRaid, opaqueSpark, opaqueFlash, anchorTop, powerName, powerTooltip, costString, barID = UnitAlternatePowerInfo(unit)
barType, minPower, startInset, endInset, smooth, hideFromOthers, showOnRaid, opaqueSpark, opaqueFlash, anchorTop, powerName, powerTooltip, costString = GetAlternatePowerInfoByID(barID)
  Reply With Quote
07-23-17, 11:05 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
The alt power bar is the one that shows up when you do things like the Ley Mana race. Is that what you are talking about?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-23-17, 11:15 PM   #3
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
Yes
The main thing I need to know is if timer is only paired with a counter. Or timer is by its self or counter is. This way in my mod I can make a timer/counter option, then anything else can show as a normal status bar.
  Reply With Quote
07-24-17, 11:10 AM   #4
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Blizzard's Alt Power has a status bar and a counter as two separate widgets. The one place I know of that uses both at the same time is the tonk commander game at the Darkmoon Faire. For that game they use the bar to display time left, and the counter shows current number of kills.

Garrison Invasions also use the counter, but not the bar.
__________________
Knowledge = Power; Be OP

  Reply With Quote
07-24-17, 11:47 PM   #5
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
So no one know what the different return values mean?

Like this?
duration, expiration, barID, auraID = UnitPowerBarTimerInfo(unit, index)

What does the index mean, and auraID, is auraID related to buffs and debuffs in anyway?
  Reply With Quote
07-25-17, 09:28 AM   #6
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
There are two use cases in Blizzard's implementation: alternate power and buff timers

Alternate Power can be visually represented as pills, circle, counter or a vertical or horizontal bar. See the barType return of UnitAlternatePowerInfo (reference). BTW there are enough boss encounters where you should be interested in the alternate power of your raid members.

For an example of how you could handle this see oUF's alternativepower element. It uses the StatusBar widget but layouts could easily provide their own.

The second use case are buff timers, but just for special buffs that are tied to this system. Here comes the UnitPowerBarTimerInfo API. The returns are as follows:
duration - full duration of the buff in seconds (e.g. 60)
expiration - the time when the buff expires (use expiration - GetTime() to get the remaining time of the buff)
barID - the alternate power id of the timer (you could use GetAlternatePowerInfoByID with this)
auraID - the spellID of the timer buff (you could use GetSpellInfo with this)

For an example implementation of this see oUF's not yet included playerbufftimers element.

The player buff timers are currently only used for Darkmoon Fair quests (at least to my knowledge) and they all have normal buffs you can use to track duration (whose IDs are different than the above auraID btw), so currently the system is just visual clutter.

The index argument for UnitPowerBarTimerInfo is like the aura index in UnitAura. It is the position of the timer, starting at 1. Currently at most 1 timer is used, but this may change.

Last edited by Rainrider : 07-25-17 at 09:30 AM.
  Reply With Quote
07-25-17, 11:07 AM   #7
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
I've never had to worry about others, the raid leader may. And boss mods take care of that. What I'm doing is making a alt power bar for the player only. I've been using simplepowerbar for years and that's what it does.

So the timer aura may be found at different positions each time? So that's why you have to loop and search for it I take it.

Thanks for the info, that was really helpful
  Reply With Quote
07-25-17, 02:56 PM   #8
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Originally Posted by Rainrider View Post
The index argument for UnitPowerBarTimerInfo is like the aura index in UnitAura. It is the position of the timer, starting at 1. Currently at most 1 timer is used, but this may change.
Read the code. The index is incremented after each loop and breaks if the API call returns nothing. This means they start at 1 and are gap-free. This is exactly how UnitAura(unit, index) works.
  Reply With Quote
07-31-17, 08:50 PM   #9
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
So when I hid the alt power bar frame during flowers game in Hillsbrad it would give an error when i exit the game.
But when I hid the frame like below instead of unregistering the 3 events, it didn't give error. But i'm not sure if im breaking something else when I register those 3 events again. So is this good?

Code:
  if Hide then
 -- Hide the frame 
        PlayerPowerBarAlt:UnregisterAllEvents()
        PlayerPowerBarAlt:Hide()
  else
 -- Show the frame
        PlayerPowerBarAlt:RegisterEvent("UNIT_POWER_BAR_SHOW")
        PlayerPowerBarAlt:RegisterEvent("UNIT_POWER_BAR_HIDE")
        PlayerPowerBarAlt:RegisterEvent("PLAYER_ENTERING_WORLD")
        PlayerPowerBarAlt:Show()
  end
Update: think I know the problem, forgot to add back the unit power and unit power max events, after looking at blizzards code.

Last edited by galvin : 08-01-17 at 12:49 AM.
  Reply With Quote
08-02-17, 10:36 PM   #10
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
The first value returned by UnitAlternatePowerCounterInfo()
After looking at blizzards code this looks like its for counters that have the format ##/##

if the first value is nil or false then its a counter without a maxvalue?

And these counters just use UnitPower and UnitPowerMax

That correct on all?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need some documentation of alternate power bar


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