diff --git a/IceBarElement.lua b/IceBarElement.lua index 4cb84f8..1fd2639 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -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 diff --git a/IceCore.lua b/IceCore.lua index 678ca20..0b540c3 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -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, diff --git a/IceHUD.lua b/IceHUD.lua index f5a7bbd..5c172b9 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -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 }, diff --git a/IceHUD.toc b/IceHUD.toc index 3929249..59c764a 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -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 diff --git a/modules/CastBar.lua b/modules/CastBar.lua index d160b12..41c9c89 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -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() diff --git a/modules/DruidMana.lua b/modules/DruidMana.lua index 3f70d35..6a30306 100644 --- a/modules/DruidMana.lua +++ b/modules/DruidMana.lua @@ -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 diff --git a/modules/PetMana.lua b/modules/PetMana.lua index e50cfd5..029a1aa 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -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