mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
Bug fixes and a lag indicator for CastBar
This commit is contained in:
@ -305,13 +305,8 @@ function IceBarElement.prototype:CreateBar()
|
||||
|
||||
self:UpdateBar(1, "undef")
|
||||
|
||||
local point = "LEFT"
|
||||
if (self.moduleSettings.side == point) then
|
||||
point = "RIGHT"
|
||||
end
|
||||
|
||||
self.barFrame:ClearAllPoints()
|
||||
self.barFrame:SetPoint("BOTTOM"..point, self.frame, "BOTTOM"..self.moduleSettings.side, 0, 0)
|
||||
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
|
||||
end
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ function IceCore.prototype:init()
|
||||
local defaultPreset = "RoundBar"
|
||||
local defaults = {
|
||||
gap = 150,
|
||||
verticalPos = -50,
|
||||
verticalPos = -110,
|
||||
scale = 0.9,
|
||||
|
||||
alphaooc = 0.3,
|
||||
|
@ -30,8 +30,8 @@ IceHUD.options =
|
||||
set = function(v)
|
||||
IceHUD.IceCore:SetVerticalPos(v)
|
||||
end,
|
||||
min = -300,
|
||||
max = 300,
|
||||
min = -200,
|
||||
max = 200,
|
||||
step = 10,
|
||||
order = 11
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Name: IceHUD
|
||||
## Title: IceHUD |cff7fff7f -Ace2-|r
|
||||
## Notes: Another HUD addon
|
||||
## Version: 0.8.2 ($Revision$)
|
||||
## Version: 0.8.3 ($Revision$)
|
||||
## SavedVariables: IceCoreDB
|
||||
## OptionalDeps: Ace2, DewdropLib, DruidBar, SoleManax, MobHealth
|
||||
## X-Embeds: Ace2, DewdropLib
|
||||
|
@ -2,6 +2,10 @@ local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local CastBar = AceOO.Class(IceCastBar)
|
||||
|
||||
CastBar.prototype.lagBar = nil
|
||||
CastBar.prototype.spellCastSent = nil
|
||||
|
||||
|
||||
-- Constructor --
|
||||
function CastBar.prototype:init()
|
||||
CastBar.super.prototype.init(self, "CastBar")
|
||||
@ -19,6 +23,7 @@ function CastBar.prototype:GetDefaultSettings()
|
||||
settings["offset"] = 0
|
||||
settings["flashInstants"] = "Caster"
|
||||
settings["flashFailures"] = "Caster"
|
||||
settings["lagAlpha"] = 0.7
|
||||
return settings
|
||||
end
|
||||
|
||||
@ -59,6 +64,27 @@ function CastBar.prototype:GetOptions()
|
||||
validate = { "Always", "Caster", "Never" },
|
||||
order = 41
|
||||
}
|
||||
|
||||
opts["lagAlpha"] =
|
||||
{
|
||||
type = 'range',
|
||||
name = 'Lag Indicator',
|
||||
desc = 'Lag indicator alpha (0 is disabled)',
|
||||
min = 0,
|
||||
max = 1,
|
||||
step = 0.1,
|
||||
get = function()
|
||||
return self.moduleSettings.lagAlpha
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.lagAlpha = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 42
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
@ -91,8 +117,83 @@ function CastBar.prototype:Disable(core)
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- OVERRIDE
|
||||
function CastBar.prototype:CreateFrame()
|
||||
CastBar.super.prototype.CreateFrame(self)
|
||||
|
||||
self:CreateLagBar()
|
||||
end
|
||||
|
||||
|
||||
function CastBar.prototype:CreateLagBar()
|
||||
if not (self.lagBar) then
|
||||
self.lagBar = CreateFrame("StatusBar", nil, self.frame)
|
||||
end
|
||||
|
||||
self.lagBar:SetFrameStrata("BACKGROUND")
|
||||
self.lagBar:SetWidth(self.settings.barWidth)
|
||||
self.lagBar:SetHeight(self.settings.barHeight)
|
||||
|
||||
|
||||
if not (self.lagBar.bar) then
|
||||
self.lagBar.bar = self.lagBar:CreateTexture(nil, "BACKGROUND")
|
||||
end
|
||||
|
||||
self.lagBar.bar:SetTexture(IceElement.TexturePath .. self.settings.barTexture .. "BG")
|
||||
self.lagBar.bar:SetAllPoints(self.lagBar)
|
||||
|
||||
self.lagBar:SetStatusBarTexture(self.lagBar.bar)
|
||||
|
||||
local r, g, b = self:GetColor("CastFail")
|
||||
self.lagBar:SetStatusBarColor(
|
||||
self.settings.backgroundColor.r,
|
||||
self.settings.backgroundColor.g,
|
||||
self.settings.backgroundColor.b,
|
||||
self.moduleSettings.lagAlpha)
|
||||
|
||||
|
||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||
self.lagBar.bar:SetTexCoord(1, 0, 1, 1)
|
||||
else
|
||||
self.lagBar.bar:SetTexCoord(0, 1, 1, 1)
|
||||
end
|
||||
|
||||
self.lagBar:ClearAllPoints()
|
||||
self.lagBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
|
||||
end
|
||||
|
||||
|
||||
-- OVERRIDE
|
||||
function CastBar.prototype:SpellCastSent(unit, spell, rank, target)
|
||||
CastBar.super.prototype.SpellCastSent(self, unit, spell, rank, target)
|
||||
if (unit ~= self.unit) then return end
|
||||
|
||||
self.spellCastSent = GetTime()
|
||||
end
|
||||
|
||||
|
||||
-- OVERRIDE
|
||||
function CastBar.prototype:SpellCastStart(unit)
|
||||
CastBar.super.prototype.SpellCastStart(self, unit)
|
||||
if (unit ~= self.unit) then return end
|
||||
|
||||
local lag = GetTime() - self.spellCastSent
|
||||
|
||||
local pos = lag / self.actionDuration
|
||||
local y = self.settings.barHeight - (pos * self.settings.barHeight)
|
||||
|
||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||
self.lagBar.bar:SetTexCoord(1, 0, 1, 1-pos)
|
||||
else
|
||||
self.lagBar.bar:SetTexCoord(0, 1, 1, 1-pos)
|
||||
end
|
||||
|
||||
self.lagBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, y)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-- Load us up
|
||||
CastBar:new()
|
||||
|
@ -92,6 +92,10 @@ function DruidMana.prototype:Update()
|
||||
self.frame:Show()
|
||||
end
|
||||
|
||||
if (not self.druidMana or not self.druidMaxMana) then
|
||||
return
|
||||
end
|
||||
|
||||
self:UpdateBar(self.druidMana / self.druidMaxMana, "DruidMana")
|
||||
|
||||
local percentage = (self.druidMana / self.druidMaxMana) * 100
|
||||
|
@ -102,7 +102,6 @@ function PetMana.prototype:Update(unit)
|
||||
if not (self.alive) then
|
||||
color = "Dead"
|
||||
else
|
||||
local color = "PetMana"
|
||||
if (self.manaType == 1) then
|
||||
color = "PetRage"
|
||||
elseif (self.manaType == 2) then
|
||||
|
Reference in New Issue
Block a user