Thread Tools Display Modes
01-11-10, 06:14 PM   #1
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 27
Originally Posted by Phanx View Post
Don't get me started.

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?
What's broken? >_>
  Reply With Quote
01-12-10, 12:06 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.

There's comment on the download page with a Pastey URL to a fixed version that alleviates the problem.
  Reply With Quote
01-22-10, 01:03 PM   #3
juyanith
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1
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)
	if(self.unit ~= unit) then return end

	self.Castbar.sentTime = GetTime()
end
Don't forget to register and unregister for the event in Enable and Disable:

Code:
	object:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT)
	-- or --
	object:UnregisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT)

Then I updated UNIT_SPELLCAST_START to calculate and store the latency:

Code:
	if (castbar.sentTime) then
		castbar.latency = GetTime() - castbar.sentTime
	else
		castbar.latency = 0
	end
And finally, I modified onUpdate to use the latency value:

Code:
	if self.SafeZone then
		local width = self:GetWidth() * self.latency / self.max
		if (width < 1) then width = 1 end
		self.SafeZone:SetWidth(width);
	end
This seems to be working for me but it's hardly extensively tested. Do with it as you will.

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.
Attached Files
File Type: lua castbar.lua (10.5 KB, 1008 views)

Last edited by juyanith : 01-22-10 at 07:52 PM. Reason: Attached modified castbar.lua
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Adding latency to cast bars, like Quartz?


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