Bug fixes and a lag indicator for CastBar

This commit is contained in:
iceroth
2006-12-18 14:52:42 +00:00
parent 7e88da3a25
commit 3b93a47442
7 changed files with 111 additions and 12 deletions

View File

@ -305,13 +305,8 @@ function IceBarElement.prototype:CreateBar()
self:UpdateBar(1, "undef") self:UpdateBar(1, "undef")
local point = "LEFT"
if (self.moduleSettings.side == point) then
point = "RIGHT"
end
self.barFrame:ClearAllPoints() 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 end

View File

@ -37,7 +37,7 @@ function IceCore.prototype:init()
local defaultPreset = "RoundBar" local defaultPreset = "RoundBar"
local defaults = { local defaults = {
gap = 150, gap = 150,
verticalPos = -50, verticalPos = -110,
scale = 0.9, scale = 0.9,
alphaooc = 0.3, alphaooc = 0.3,

View File

@ -30,8 +30,8 @@ IceHUD.options =
set = function(v) set = function(v)
IceHUD.IceCore:SetVerticalPos(v) IceHUD.IceCore:SetVerticalPos(v)
end, end,
min = -300, min = -200,
max = 300, max = 200,
step = 10, step = 10,
order = 11 order = 11
}, },

View File

@ -3,7 +3,7 @@
## Name: IceHUD ## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r ## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD addon ## Notes: Another HUD addon
## Version: 0.8.2 ($Revision$) ## Version: 0.8.3 ($Revision$)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: Ace2, DewdropLib, DruidBar, SoleManax, MobHealth ## OptionalDeps: Ace2, DewdropLib, DruidBar, SoleManax, MobHealth
## X-Embeds: Ace2, DewdropLib ## X-Embeds: Ace2, DewdropLib

View File

@ -2,6 +2,10 @@ local AceOO = AceLibrary("AceOO-2.0")
local CastBar = AceOO.Class(IceCastBar) local CastBar = AceOO.Class(IceCastBar)
CastBar.prototype.lagBar = nil
CastBar.prototype.spellCastSent = nil
-- Constructor -- -- Constructor --
function CastBar.prototype:init() function CastBar.prototype:init()
CastBar.super.prototype.init(self, "CastBar") CastBar.super.prototype.init(self, "CastBar")
@ -19,6 +23,7 @@ function CastBar.prototype:GetDefaultSettings()
settings["offset"] = 0 settings["offset"] = 0
settings["flashInstants"] = "Caster" settings["flashInstants"] = "Caster"
settings["flashFailures"] = "Caster" settings["flashFailures"] = "Caster"
settings["lagAlpha"] = 0.7
return settings return settings
end end
@ -59,6 +64,27 @@ function CastBar.prototype:GetOptions()
validate = { "Always", "Caster", "Never" }, validate = { "Always", "Caster", "Never" },
order = 41 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 return opts
end end
@ -91,8 +117,83 @@ function CastBar.prototype:Disable(core)
end 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 -- Load us up
CastBar:new() CastBar:new()

View File

@ -92,6 +92,10 @@ function DruidMana.prototype:Update()
self.frame:Show() self.frame:Show()
end end
if (not self.druidMana or not self.druidMaxMana) then
return
end
self:UpdateBar(self.druidMana / self.druidMaxMana, "DruidMana") self:UpdateBar(self.druidMana / self.druidMaxMana, "DruidMana")
local percentage = (self.druidMana / self.druidMaxMana) * 100 local percentage = (self.druidMana / self.druidMaxMana) * 100

View File

@ -102,7 +102,6 @@ function PetMana.prototype:Update(unit)
if not (self.alive) then if not (self.alive) then
color = "Dead" color = "Dead"
else else
local color = "PetMana"
if (self.manaType == 1) then if (self.manaType == 1) then
color = "PetRage" color = "PetRage"
elseif (self.manaType == 2) then elseif (self.manaType == 2) then