- Added support for the "custom lag tolerance" setting to the castbar's lag display. (ticket #178 - Thanks slippycheeze!)

This commit is contained in:
Parnic
2014-04-27 06:03:20 +00:00
parent 8cd0d55b03
commit ea4e52174b

View File

@ -15,6 +15,8 @@ function CastBar.prototype:init()
self:SetDefaultColor("CastNotInRange", 200, 200, 200)
self.unit = "player"
self:CVarUpdate()
end
@ -300,6 +302,8 @@ function CastBar.prototype:Enable(core)
self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckVehicle")
self:RegisterEvent("CVAR_UPDATE", "CVarUpdate")
if self.moduleSettings.enabled and not self.moduleSettings.showBlizzCast then
self:ToggleBlizzCast(false)
end
@ -334,6 +338,10 @@ function CastBar.prototype:CheckVehicle()
end
end
function CastBar.prototype:CVarUpdate(...)
self.useFixedLatency = GetCVar("reducedLagTolerance") == "1"
self.fixedLatency = tonumber(GetCVar("maxSpellStartRecoveryoffset")) / 1000
end
function CastBar.prototype:Disable(core)
CastBar.super.prototype.Disable(self, core)
@ -398,6 +406,8 @@ function CastBar.prototype:SpellCastStart(event, unit, spell, rank)
local scale
if self.unit == "vehicle" then
scale = 0
elseif self.useFixedLatency then
scale = IceHUD:Clamp(self.fixedLatency / self.actionDuration, 0, 1)
else
local now = GetTime()
local lag = now - (self.spellCastSent or now)
@ -423,6 +433,8 @@ function CastBar.prototype:SpellCastChannelStart(event, unit)
local scale
if self.unit == "vehicle" then
scale = 0
elseif self.useFixedLatency then
scale = IceHUD:Clamp(self.fixedLatency / self.actionDuration, 0, 1)
else
local now = GetTime()
local lag = now - (self.spellCastSent or now)