mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added some protection against error messages that were popping up related to SetTexCoord
- added some protection against a nil access in the player's cast bar under certain circumstances
This commit is contained in:
@ -695,6 +695,8 @@ end
|
|||||||
function IceBarElement.prototype:SetScale(texture, scale)
|
function IceBarElement.prototype:SetScale(texture, scale)
|
||||||
local oldScale = self.CurrScale
|
local oldScale = self.CurrScale
|
||||||
|
|
||||||
|
scale = IceHUD:Clamp(scale, 0, 1)
|
||||||
|
|
||||||
self.CurrScale = self:LerpScale(scale)
|
self.CurrScale = self:LerpScale(scale)
|
||||||
|
|
||||||
if oldScale ~= self.CurrScale then
|
if oldScale ~= self.CurrScale then
|
||||||
|
@ -207,15 +207,18 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function IceCastBar.prototype:StartBar(action, message)
|
function IceCastBar.prototype:StartBar(action, message)
|
||||||
self.action = action
|
|
||||||
self.actionStartTime = GetTime()
|
|
||||||
self.actionMessage = message
|
|
||||||
|
|
||||||
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo(self.unit)
|
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo(self.unit)
|
||||||
if not (spell) then
|
if not (spell) then
|
||||||
spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit)
|
spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not spell then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.action = action
|
||||||
|
self.actionStartTime = GetTime()
|
||||||
|
self.actionMessage = message
|
||||||
|
|
||||||
if (startTime and endTime) then
|
if (startTime and endTime) then
|
||||||
self.actionDuration = (endTime - startTime) / 1000
|
self.actionDuration = (endTime - startTime) / 1000
|
||||||
|
10
IceHUD.lua
10
IceHUD.lua
@ -805,3 +805,13 @@ function IceHUD:OnProfileEnable(oldName, oldData)
|
|||||||
self.IceCore:SetModuleDatabases()
|
self.IceCore:SetModuleDatabases()
|
||||||
self.IceCore:Enable()
|
self.IceCore:Enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function IceHUD:Clamp(value, min, max)
|
||||||
|
if value < min then
|
||||||
|
value = min
|
||||||
|
elseif value > max then
|
||||||
|
value = max
|
||||||
|
end
|
||||||
|
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
@ -380,7 +380,7 @@ function CastBar.prototype:SpellCastStart(unit, spell, rank)
|
|||||||
|
|
||||||
local lag = GetTime() - (self.spellCastSent or 0)
|
local lag = GetTime() - (self.spellCastSent or 0)
|
||||||
|
|
||||||
local pos = lag / self.actionDuration
|
local pos = IceHUD:Clamp(lag / self.actionDuration, 0, 1)
|
||||||
local y = self.settings.barHeight - (pos * self.settings.barHeight)
|
local y = self.settings.barHeight - (pos * self.settings.barHeight)
|
||||||
|
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
@ -400,9 +400,9 @@ function CastBar.prototype:SpellCastChannelStart(unit)
|
|||||||
|
|
||||||
local lag = GetTime() - (self.spellCastSent or 0)
|
local lag = GetTime() - (self.spellCastSent or 0)
|
||||||
|
|
||||||
local pos = lag / self.actionDuration
|
local pos = IceHUD:Clamp(lag / self.actionDuration, 0, 1)
|
||||||
local y = self.settings.barHeight - (pos * self.settings.barHeight)
|
local y = self.settings.barHeight - (pos * self.settings.barHeight)
|
||||||
|
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
self.lagBar.bar:SetTexCoord(1, 0, 1-pos, 1)
|
self.lagBar.bar:SetTexCoord(1, 0, 1-pos, 1)
|
||||||
else
|
else
|
||||||
|
@ -903,6 +903,8 @@ function PlayerHealth.prototype:Update(unit)
|
|||||||
barValue = 1
|
barValue = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
barValue = IceHUD:Clamp(barValue, 0, 1)
|
||||||
|
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
self.healFrame.bar:SetTexCoord(1, 0, barValue, 1)
|
self.healFrame.bar:SetTexCoord(1, 0, barValue, 1)
|
||||||
else
|
else
|
||||||
|
@ -275,7 +275,7 @@ function SliceAndDice.prototype:UpdateDurationBar(unit)
|
|||||||
PotentialSnDDuration = self:GetMaxBuffTime(points)
|
PotentialSnDDuration = self:GetMaxBuffTime(points)
|
||||||
|
|
||||||
-- compute the scale from the current number of combo points
|
-- compute the scale from the current number of combo points
|
||||||
scale = PotentialSnDDuration / CurrMaxSnDDuration
|
scale = IceHUD:Clamp(PotentialSnDDuration / CurrMaxSnDDuration, 0, 1)
|
||||||
|
|
||||||
-- sadly, animation uses bar-local variables so we can't use the animation for 2 bar textures on the same bar element
|
-- sadly, animation uses bar-local variables so we can't use the animation for 2 bar textures on the same bar element
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
|
@ -271,7 +271,7 @@ function IHUD_Threat.prototype:Update(unit)
|
|||||||
if ( self.aggroBarMulti ~= threatMulti ) then
|
if ( self.aggroBarMulti ~= threatMulti ) then
|
||||||
self.aggroBarMulti = threatMulti
|
self.aggroBarMulti = threatMulti
|
||||||
|
|
||||||
local pos = 1 - (1 / threatMulti)
|
local pos = IceHUD:Clamp(1 - (1 / threatMulti), 0, 1)
|
||||||
local y = self.settings.barHeight - ( pos * self.settings.barHeight )
|
local y = self.settings.barHeight - ( pos * self.settings.barHeight )
|
||||||
|
|
||||||
if ( self.moduleSettings.side == IceCore.Side.Left ) then
|
if ( self.moduleSettings.side == IceCore.Side.Left ) then
|
||||||
|
Reference in New Issue
Block a user