I was listening to ventrilo after the guild raided tonight, and even though I am not currently playing the game, I am still "that guy in our guild who writes addons." Naturally, someone made a request, and I can't currently think of an addon that fits.
The request was a mana regen meter, similar in display to threat or damage meters. Some sort of graph over the course of a fight, rather than instant feedback like combat text. Presumably it would be something you could look back and analyse later.
Recount has a "Mana Gained" entry that you can look at, along with all the usual stuff you look at such as "Damage Done" and "Healing Done". While it doesn't provide a graph view over the whole fight, it will tell you how much mana each player gained, and from what sources that mana came from (judgement, evocation, mana tide, etc).
I will dig though Recount to see what how it is coded, then remove anything not pertaining to the player.
As for LibGraph-2.0, its internal location for the docs is outdated ( http://www.wowace.com/wiki/GraphLib -- which doesn't exist) so I will have to do some digging through that as well.
Both good suggestions, thank you.
There are no documentation apart from the small section of "sample test code" that you can view and test at the end of the file in LibGraph-2.0.lua. Those 4 examples are usually adequate enough for anyone that wants to use the library.
GraphLib --> LibGraph-2.0 actually has no code functionality changes apart from internal minor optimizations (global math.blah calls -> local function calls), and changing the upgrade path to be LibStub compatible. Oh and uh compressing the TGA files with RLE so its like 100 kb smaller.
First, if some admin wants to move this thread to the Lua help forum, go for it, because now I need some coding help.
What I am being asked to do is a few things.
Graph current Mana. With LibGraph-2.0 that is easy, and I don't think I will need help with that.
Using the PvP flag capture texture (or the addon Halion Helper) create a display for Mana efficiency. Right side would be not casting, left side is hard core nuking. The slider would move left or right depending on your efficiency percentage. I realize you can never get to 0% because of combat regen, and it will speed up to the right if you stop casting after 5 seconds. It goes full right side if your current Mana equals your maximum Mana.
#2 should update on a user selectable interval. I would like the default to be one second.
After the fight, or if you die, whichever happens first, it calculates your overall efficiency for the duration.
The PvP flag capture bar needs to be able to be displayed between 1-3 times showing different user selected update intervals. Once I have the how for the calculation, I think I can manage this part.
The whole addon (which I don't expect anyone to write for me) will be Ace3, if that matters, mainly because I want to use AceConfig, LibGraph and LibSharedMedia for the graph, etc, etc.
I do understand how to use the texture for the efficiency, but I can't wrap my head around how to calculate the update and overall. That is what I am asking for help with, the two calculations.
You are basically asking for "how to calculate mana regen", which is the same problem as "how to calculate DPS". Ever noticed that every combat log parser counts DPS differently? DPS is Damage divided by Time but...
A) Should "time" only start counting when you enter combat or when you actually start casting your first spell?
B) What about stopping to cast halfway and continuing later? (Such as getting ressurected)
C) When should "time" end? When you exit combat? At the end of your last spell? How should DPS be affected if dots continue to tick after you die?
There is no consistent definition. You will need to come up with your definition of "mana regen over time".
My name is Jixx and I am Myrroddin's roommate and I thought I would try to explain a bit about what our guildmate is really looking for.
What he wants, is an addon that can show him how quickly he is losing mana vs how quickly he is gaining mana. To be more specific, this guild mate is a healer, and he knows that at some points in a raid fight, there will be massive healing going on and his mana usage will be very high. At other times in a fight he will be able to go into mana conservation mode and slowly gain back some mana, or at least slow down the rate at which he is losing that mana.
So he would like a visual representation of that "Rate of Loss" vs "Rate of Gain".
To that end, he suggested using a bar similar to the PvP Alliance vs Horde control points. Where the bar would slowing move over to the right or the left until one side captures the location.
In said mana tracking addon, if his mana loss was low, the bar would only be slightly to the left of center, but if his mana loss was high the bar would be far to the left of center. And on the flip, if his mana gain was low the bar would be slightly to the right of center, but if his mana gain was high the bar would be far to the right of center.
So with this in mind this is how I would imagine the addon would need to work:
1) It would need to create a rolling average gain/loss over a set amount of time.
For example, let's say that we use 10 seconds. And lets assume that we measure current mana every second and compare it to the previous value from the previous second. This would give us a positive or negative value depending on if the mana total was higher or lower than the previous measured value.
This would give us 10 gain/loss values which we could then average together to get a "Average mana change per second over the past 10 seconds"
2) Plot our Average number on our pendulum bar.
First we would need to set the range of values. Let's use for an example that our far right side of the bar will be 10,000 mana gained. And the left side of our bar will be 10,000 mana lost.
So let's imagine that our current Average mana change is -2500/sec. This would mean our bar would swing to the left of center, 25% of the way between our center point and our far left point.
3) Recalculate our average and Re-plot at each measurement check.
Since we are taking a new measurement each second, we would need to recalculate our Average change/sec based on our last 10 values (since we are using 10 seconds), and then re-plot on the bar that new Average.
So let's imagine that the next second we gain some mana, and this changes our 10sec Average Mana change to -2200/sec. This would re-plot our bar to move slightly to the right, towards the center.
Then the next second we gain some more mana, changing our 10sec Average mana change to -2000/sec. We are still at an overall average loss of mana, but our bar is moving slightly closer to center each second.
If he keeps gaining mana long enough, eventually his 10sec Average mana change will become a postive number, and the bar will pass over to the right side of center and he will know that his average is a gain of mana.
Our user can thus see his Average 10second Rate of Loss or Rate of Gain, and can see how successful he is being at slowing down his rate of mana consumption. He can then make judgment calls on if he needs to ask for help from other healers, or even other dps'ers to use mana regen spells like totems or innervates, or if he is fine and can use his own mana regen spells to help other healers out.
4) The addon would also need to have options to allow the user to set his own Time, Iterations, and Pendulum Swing range.
For example, perhaps the user wants to show average mana change per 0.5 sec over the past 20 seconds. And he wants his high and low points on the bar to be only 5,000 mana gained or lost.
So the addon would then be checking current mana every 0.5 seconds and using the past 40 measurements to calculate the average.
You would need to set limits of course, as the server only updates mana every 0.2 seconds, so you couldn't go lower than that on your iteration frequency. And if you were checking that frequently the average values would be much smaller, and if your pendulum range was set really high at like 50,000, then the bar would always be very close to center, and the changes would be so slight that you wouldn't be able to see the differences at a glance.
5) As an added bonus it would be nice if the addon, at the end of combat, was able to calculate an overall average mana loss rate for the entire fight and display that data in the chat log or optionally say it in raid chat.
Healers would then be able to compare notes on their mana loss rates for various fights and thus make plans for future attempts to help deal with this. Such as planning who gets innervates and such.
Anyway... that's how I forsee it working. Since I don't code, I'll leave it to Myrroddin and the rest of you to determine how to do that part :-).
From that addon description, it sounds like you already have everything worked out, so the only thing that remains is to actually code the addon.
I don't see anything in the description that is undoable, and you have even gone to the extent of defining limits (the lower limit of 0.2s updates) and optional user-setting behaviors.
Basically, like you said, you just need to record the user's difference in mana every X seconds into a table, and take the average of the last M values stored in the table for the pendulum display. Sounds simple? It is.
The entire saved data could be used for graphing after the fight, or you could just ditch the oldest value as you record the newest value if you don't intend to do that.
Alright, first question regarding code. Given this paste, what I want to do is segment the frame ManaDisplay, with a variable number of segments. Low level characters should have many fewer segments than high level characters, because mana gain/loss/current/maximums change radically.
Originally, I segmented the frame into 10 parts, but then realized that was incorrect, and the above is true.
If the segment numbers were to be shown (they are not supposed to be) then far left would be negative value, 0 would be dead center, and the positive values would go right. All the segments should be the same width and evenly spaced, and I am not sure if I got that correct. The segments are not percentage, but integers.
Then it gets complex, sort of. Using LibBackDrop-1.0 to enhance the frame with some color, my goal is, starting from far left, paint dark red to light red (1 - 0.1 or so) until about -10%, then -10% to +10% (whatever the segment numbers are for those percents) go 0.1 blue to 1.0 blue back to 0.1 blue. The rest of the right side goes from 0.1 green to 1.0 green.
Yeah, I know, headache. Anyone brave enough to help tackle this, please?
Woohoo, dry coded and no errors in the commit. I still need to localize several globals, and test in game.
The addon is called Average Combat Mana and can be found here if anyone wants to give it a whirl. Bug reports appreciated, but please use the tracker. I will still answer questions here, but I plan on creating a dedicated forum eventually.
What it does: every 2 seconds ACM compares your current Mana to the last value, subtracts, and stores the difference. It does this five times and averages the result. Using the PvP capture frame, (I didn't overwrite it, just borrowed the texture) it moves the indicator plus or minus depending on the result.
After combat is done, it averages all the sum differences and prints that result to chat.
There are several options for customization. Lots more info on the project page.