From b024be5d8aab853eba8603596c4384bca887a1c3 Mon Sep 17 00:00:00 2001 From: iceroth Date: Fri, 18 Aug 2006 16:29:06 +0000 Subject: [PATCH] Dropped SpellStatus. Third alpha stage applies to nonempty bars as well now. --- IceBarElement.lua | 44 +++++---- IceHUD.lua | 8 +- IceHUD.toc | 7 +- modules/CastBar.lua | 212 +++++++++++------------------------------- modules/MirrorBar.lua | 2 + modules/TimerBar.lua | 3 +- 6 files changed, 84 insertions(+), 192 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index 4ebca46..8bc0635 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -13,7 +13,6 @@ IceBarElement.prototype.combat = nil IceBarElement.prototype.target = nil - -- Constructor -- function IceBarElement.prototype:init(name) IceBarElement.super.prototype.init(self, name) @@ -368,6 +367,8 @@ function IceBarElement.prototype:SetScale(texture, scale) else texture:SetTexCoord(0, 1, 1-scale, 1) end + + self.full = (scale == 1) end @@ -380,6 +381,17 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha) r, g, b = self:GetColor(color) end + if (self.combat) then + self.alpha = self.settings.alphaic + self.backgroundAlpha = self.settings.alphaicbg + elseif (self.target or (scale < 1)) then + self.alpha = self.settings.alphaTarget + self.backgroundAlpha = self.settings.alphaTargetbg + else + self.alpha = self.settings.alphaooc + self.backgroundAlpha = self.settings.alphaoocbg + end + self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha) self.barFrame:SetStatusBarColor(self:GetColor(color)) @@ -399,20 +411,22 @@ function IceBarElement.prototype:SetBottomText1(text, color) color = "text" end - local alpha = 1 - if not (self.moduleSettings.lockTextAlpha) then + + local alpha = self.alpha + + if (self.alpha > 0) then -- boost text alpha a bit to make it easier to see - if (self.alpha > 0) then - alpha = self.alpha + 0.1 + alpha = self.alpha + 0.1 - if (alpha > 1) then - alpha = 1 - end - else - alpha = 0 + if (alpha > 1) then + alpha = 1 end end + if (self.moduleSettings.lockTextAlpha and (self.alpha > 0)) then + alpha = 1 + end + self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha)) self.frame.bottomUpperText:SetText(text) end @@ -454,16 +468,6 @@ end -- To be overridden function IceBarElement.prototype:Update() - if (self.combat) then - self.alpha = self.settings.alphaic - self.backgroundAlpha = self.settings.alphaicbg - elseif (self.target) then - self.alpha = self.settings.alphaTarget - self.backgroundAlpha = self.settings.alphaTargetbg - else - self.alpha = self.settings.alphaooc - self.backgroundAlpha = self.settings.alphaoocbg - end end diff --git a/IceHUD.lua b/IceHUD.lua index 125bdb7..0155f17 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -120,8 +120,8 @@ IceHUD.options = alphaTarget = { type = 'range', - name = 'Alpha OOC and Target', - desc = 'Bar alpha Out Of Combat with target accuired', + name = 'Alpha OOC and Target or not Full', + desc = 'Bar alpha Out Of Combat with target accuired or bar not full', get = function() return IceHUD.IceCore:GetAlpha("Target") end, @@ -180,8 +180,8 @@ IceHUD.options = alphaTargetbg = { type = 'range', - name = 'BG Alpha OOC and Target', - desc = 'Background alpha for bars OOC and target accuired', + name = 'BG Alpha OOC and Target or not Full', + desc = 'Background alpha for bars OOC and target accuired or bar not full', get = function() return IceHUD.IceCore:GetAlphaBG("Target") end, diff --git a/IceHUD.toc b/IceHUD.toc index 6762cf3..40d1f1c 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -3,7 +3,7 @@ ## Name: IceHUD ## Title: IceHUD |cff7fff7f -Ace2-|r ## Notes: Another HUD mod -## Version: 0.4.2 ($Revision$) +## Version: 0.4.3 ($Revision$) ## SavedVariables: IceCoreDB ## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth ## X-Category: UnitFrame @@ -21,13 +21,8 @@ libs\AceDebug-2.0\AceDebug-2.0.lua libs\AceLocale-2.0\AceLocale-2.0.lua libs\AceConsole-2.0\AceConsole-2.0.lua libs\AceAddon-2.0\AceAddon-2.0.lua -libs\Compost-2.0\Compost-2.0.lua libs\Metrognome-2.0\Metrognome-2.0.lua libs\Dewdrop-2.0\Dewdrop-2.0.lua -libs\Deformat-2.0\Deformat-2.0.lua -libs\Gratuity-2.0\Gratuity-2.0.lua -libs\SpellCache-1.0\SpellCache-1.0.lua -libs\SpellStatus-1.0\SpellStatus-1.0.lua # IceHUD core functionality diff --git a/modules/CastBar.lua b/modules/CastBar.lua index c18e49f..5a1d87a 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -1,5 +1,4 @@ local AceOO = AceLibrary("AceOO-2.0") -local SpellCache = AceLibrary("SpellCache-1.0") local CastBar = AceOO.Class(IceBarElement) @@ -7,10 +6,8 @@ CastBar.prototype.casting = nil CastBar.prototype.channeling = nil CastBar.prototype.failing = nil CastBar.prototype.succeeding = nil -CastBar.prototype.instanting = nil CastBar.prototype.spellName = nil -CastBar.prototype.spellRank = nil CastBar.prototype.startTime = nil CastBar.prototype.castTime = nil @@ -38,47 +35,25 @@ function CastBar.prototype:GetDefaultSettings() local settings = CastBar.super.prototype.GetDefaultSettings(self) settings["side"] = IceCore.Side.Left settings["offset"] = 0 - settings["showInstants"] = true return settings end --- OVERRIDE -function CastBar.prototype:GetOptions() - local opts = CastBar.super.prototype.GetOptions(self) - - opts["showInstants"] = - { - type = 'toggle', - name = 'Show Instant Casts', - desc = 'Toggles showing instant spell names', - get = function() - return self.moduleSettings.showInstants - end, - set = function(value) - self.moduleSettings.showInstants = value - end, - order = 50 - } - - return opts -end - function CastBar.prototype:Enable() CastBar.super.prototype.Enable(self) - self:RegisterEvent("SpellStatus_SpellCastInstant") - self:RegisterEvent("SpellStatus_SpellCastCastingStart") - self:RegisterEvent("SpellStatus_SpellCastCastingChange") - self:RegisterEvent("SpellStatus_SpellCastCastingFinish") - self:RegisterEvent("SpellStatus_SpellCastFailure") + self:RegisterEvent("SPELLCAST_START", "CastStart") + self:RegisterEvent("SPELLCAST_STOP", "CastStop") + self:RegisterEvent("SPELLCAST_FAILED", "CastFailed") + self:RegisterEvent("SPELLCAST_INTERRUPTED", "CastInterrupted") + + self:RegisterEvent("SPELLCAST_DELAYED", "CastDelayed") + + self:RegisterEvent("SPELLCAST_CHANNEL_START", "ChannelingStart") + self:RegisterEvent("SPELLCAST_CHANNEL_STOP", "ChannelingStop") + self:RegisterEvent("SPELLCAST_CHANNEL_UPDATE", "ChannelingUpdate") - self:RegisterEvent("SpellStatus_SpellCastChannelingStart") - self:RegisterEvent("SpellStatus_SpellCastChannelingChange") - self:RegisterEvent("SpellStatus_SpellCastChannelingFinish") - - self.frame:Hide() -- remove blizz cast bar @@ -100,16 +75,9 @@ function CastBar.prototype:Disable() end --- OVERRIDE -function CastBar.prototype:Redraw() - CastBar.super.prototype.Redraw(self) -end - - -- 'Protected' methods -------------------------------------------------------- - -- OVERRIDE function CastBar.prototype:CreateFrame() CastBar.super.prototype.CreateFrame(self) @@ -140,9 +108,7 @@ function CastBar.prototype:OnUpdate() end self:UpdateBar(scale, "castCasting") - - self.spellName = self.spellName or '' - self:SetBottomText1(remaining .. "s " .. self.spellName .. self:FormatRank(self.spellRank)) + self:SetBottomText1(remaining .. "s " .. self.spellName) elseif (self.failing) then self.alpha = 0.7 @@ -167,22 +133,6 @@ function CastBar.prototype:OnUpdate() self.frame:Hide() self.frame:SetScript("OnUpdate", nil) end - - elseif (self.instanting) then - self:UpdateBar(1, "castSuccess", 1-scale) - self.frame.bg:Hide() - self.barFrame:Hide() - - self.spellName = self.spellName or '' - self:SetBottomText1(self.spellName .. self:FormatRank(self.spellRank)) - - if (scale >= 1) then - self.frame.bg:Show() - self.barFrame:Show() - - self:CleanUp() - self.frame:SetScript("OnUpdate", nil) - end else -- shouldn't be needed self:CleanUp() @@ -193,83 +143,26 @@ end -function CastBar.prototype:CleanUp() - self.spellName = nil - self.spellRank = nil - self.castTime = nil - self.startTime = nil - self.delay = 0 - self.casting = false - self.channeling = false - self.failing = false - self.succeeding = false - self.instanting = false - self:SetBottomText1() - self.alpha = self.settings.alphaooc -end - - -function CastBar.prototype:FormatRank(rank) - if (rank) then - return " (" .. rank .. ")" - else - return "" - end -end - - - -------------------------------------------------------------------------------- --- INSTANT SPELLS -- -------------------------------------------------------------------------------- - -function CastBar.prototype:SpellStatus_SpellCastInstant(sId, sName, sRank, sFullName, sCastTime) - IceHUD:Debug("SpellStatus_SpellCastInstant", sId, sName, sRank, sFullName, sCastTime) - - if not (self.moduleSettings.showInstants) then - return - end - - self:CleanUp() - - self.spellName = sName - self.spellRank = SpellCache:GetRankNumber(sRank or '') - self.castTime = 1 +function CastBar.prototype:CastStart(name, castTime) + self.spellName = name + self.castTime = castTime / 1000 self.startTime = GetTime() - self.instanting = true - - self.frame:Show() - self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) -end - - - - -------------------------------------------------------------------------------- --- NORMAL SPELLS -- -------------------------------------------------------------------------------- - -function CastBar.prototype:SpellStatus_SpellCastCastingStart(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration) - IceHUD:Debug("SpellStatus_SpellCastCastingStart", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration) - - self.spellName = sName - self.spellRank = SpellCache:GetRankNumber(sRank or '') - - self.castTime = sCastDuration / 1000 - self.startTime = sCastStartTime self.delay = 0 self.casting = true self.frame:Show() + self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) end -function CastBar.prototype:SpellStatus_SpellCastCastingFinish (sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelayTotal) - IceHUD:Debug("SpellStatus_SpellCastCastingFinish ", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelayTotal) - +function CastBar.prototype:CastStop() + if not (self.casting) then + return + end self:CleanUp() + self.spellName = nil self.castTime = 1 self.startTime = GetTime() self.succeeding = true @@ -278,22 +171,23 @@ function CastBar.prototype:SpellStatus_SpellCastCastingFinish (sId, sName, sRank end -function CastBar.prototype:SpellStatus_SpellCastCastingChange(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelay, sCastDelayTotal) - IceHUD:Debug("SpellStatus_SpellCastCastingChange", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelay, sCastDelayTotal) - self.delay = sCastDelayTotal +function CastBar.prototype:CastFailed() + self:CastTerminated("Failed") end -function CastBar.prototype:SpellStatus_SpellCastFailure(sId, sName, sRank, sFullName, isActiveSpell, UIEM_Message, CMSFLP_SpellName, CMSFLP_Message) - IceHUD:Debug("SpellStatus_SpellCastFailure", sId, sName, sRank, sFullName, isActiveSpell, UIEM_Message, CMSFLP_SpellName, CMSFLP_Message) - - if (not (isActiveSpell) or not (self.casting or self.channeling)) then +function CastBar.prototype:CastInterrupted() + self:CastTerminated("Interrupted") +end + + +function CastBar.prototype:CastTerminated(reason) + if not (self.casting or self.channeling or self.succeeding) then return end - self:CleanUp() - self.spellName = UIEM_Message + self.spellName = reason self.castTime = 1 self.startTime = GetTime() self.failing = true @@ -302,22 +196,17 @@ function CastBar.prototype:SpellStatus_SpellCastFailure(sId, sName, sRank, sFull end +function CastBar.prototype:CastDelayed(delay) + self.delay = self.delay + (delay / 1000) +end - -------------------------------------------------------------------------------- --- CHANNELING SPELLS -- -------------------------------------------------------------------------------- - -function CastBar.prototype:SpellStatus_SpellCastChannelingStart(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction) - IceHUD:Debug("SpellStatus_SpellCastChannelingStart", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction) - - self.spellName = sName - self.spellRank = SpellCache:GetRankNumber(sRank or '') - self.castTime = sCastDuration - self.startTime = sCastStartTime +function CastBar.prototype:ChannelingStart(duration, spell) + self.spellName = spell + self.castTime = duration / 1000 + self.startTime = GetTime() self.delay = 0 self.channeling = true @@ -327,27 +216,30 @@ function CastBar.prototype:SpellStatus_SpellCastChannelingStart(sId, sName, sRan end -function CastBar.prototype:SpellStatus_SpellCastChannelingFinish(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruptionTotal) - IceHUD:Debug("SpellStatus_SpellCastChannelingFinish", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruptionTotal) - +function CastBar.prototype:ChannelingStop() self:CleanUp() self.frame:Hide() end -function CastBar.prototype:SpellStatus_SpellCastChannelingChange(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruption, sCastDisruptionTotal) - IceHUD:Debug("SpellStatus_SpellCastChannelingChange", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruption, sCastDisruptionTotal) - self.castTime = sCastDuration / 1000 +function CastBar.prototype:ChannelingUpdate(duration) + self.castTime = duration / 1000 end - - - - - - +function CastBar.prototype:CleanUp() + self.spellName = nil + self.castTime = nil + self.startTime = nil + self.delay = 0 + self.casting = false + self.channeling = false + self.failing = false + self.succeeding = false + self:SetBottomText1() + self.alpha = self.settings.alphaooc +end -- Load us up diff --git a/modules/MirrorBar.lua b/modules/MirrorBar.lua index 33aef7a..8bc1102 100644 --- a/modules/MirrorBar.lua +++ b/modules/MirrorBar.lua @@ -62,6 +62,8 @@ function MirrorBar.prototype:OnUpdate(elapsed) if (self.paused) then return end + + self:Update() self.value = self.value + (self.scale * elapsed * 1000) diff --git a/modules/TimerBar.lua b/modules/TimerBar.lua index e22cc20..bf31dce 100644 --- a/modules/TimerBar.lua +++ b/modules/TimerBar.lua @@ -29,8 +29,6 @@ function TimerBar.prototype:Enable() self.frame:Hide() self:Hook(ToFu, "OnTextUpdate") - - self:HookReport() end @@ -53,6 +51,7 @@ function TimerBar.prototype:OnTextUpdate(object) self.frame:Show() self:UpdateBar(timeRemaining / ToFu.timeAvg, "timerFlight") + self:Update() local text = abacus:FormatDurationCondensed(timeRemaining, true) self:SetBottomText1(text)