Adding latency to cast bars, like Quartz?
I have P3lim's oUF layout, and I was wondering if there was I bit of code I could add to give my cast bar the latency function, like Quartz does.
|
Nope
...but then I'm lazy and haven't found it anywhere in the forums. |
It does include it, though it may not be as exact.
The Castbar element supports the .SafeZone sub element, which can be added and will give an approximate "safe zone" based on current latency. I added it to my layout with this: Code:
if(unit == 'player') then |
You'll have to figure it out for yourself, the particulars anyway, but it's pretty simple.
Hook UNIT_SPELLCAST_START on your castbar and watch for player cast starts, then use the postCastStart hook to set a spark or something to the point at which you can start casting another spell, determined by measuring the time the spell of that id was sent and that point. The safezone works alright for predictable latency, but for varying, it's worthless. It might be helpful to check out Quartz's latency module for tips. It may end up being simpler for you to use your own OnCastbarUpdate (based on the default one), I had to to add the latency-friendly things (Showing bar when cast actually starts, fading it out, showing instant casts, etc) to my layout that way. |
Do note that the latency average is only updated every 30 sec, as oUF uses GetNetStats() to fetch it. That being said; WoW does a much finer job at handling casting with high latency in 3.x than any human could be. :)
|
Quote:
It still goes a bit to hell if your latency is hugely unpredictable. I regularly run with a baseline of 250ms with areas where it rides up to 600ms+. Having a visual indicator can cut down on RSI a bit, when you're mashing chain heal repeatedly. |
Quote:
Also, the "real" latency code in Castbars is easier to read through than the code in Quartz, since it isn't full of checks for various options. Oh, and Xuerian, when are you going to update oUF Smooth Update so I can quit embedding a fixed copy in my layout? :o |
Quote:
|
Bars with smaller max-values (under 150-200ish) don't ever fill completely with it enabled, leaving a 5-10 pixel gap at the end. If you haven't leveled any characters recently and don't play a rogue, warrior, death knight, or feral druid, you probably wouldn't notice. :p
There's comment on the download page with a Pastey URL to a fixed version that alleviates the problem. |
1 Attachment(s)
Just to help anyone else out that is interested in this, I modified castbar.lua to calculate the latency. Basically, I added a function for UNIT_SPELLCAST_SENT that simply stores the send time:
Code:
local UNIT_SPELLCAST_SENT = function(self, event, unit, spell, spellrank) Code:
object:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT) Then I updated UNIT_SPELLCAST_START to calculate and store the latency: Code:
if (castbar.sentTime) then Code:
if self.SafeZone then EDIT: I updated the code because I was getting errors some of the time when sentTime didn't get set. I'm not sure why this would happen so I just added a check around the latency calculation. Otherwise it worked fine for me while I played for a couple of hours. |
All times are GMT -6. The time now is 03:52 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI