From 86d03baa224a912d42e5e8828d1ec2c15d50108d Mon Sep 17 00:00:00 2001 From: iceroth Date: Mon, 2 Oct 2006 23:47:15 +0000 Subject: [PATCH] Reverted back to my latest revision. If you want to make changes to IceHUD, make a branch - don't touch this unless it's a clear bug fix and I'm nowhere to be found --- modules/CastBar.lua | 109 ++++--------------------------------- modules/TargetOfTarget.lua | 76 +------------------------- 2 files changed, 13 insertions(+), 172 deletions(-) diff --git a/modules/CastBar.lua b/modules/CastBar.lua index 0502fc2..989c759 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -5,13 +5,13 @@ local SpellCache = AceLibrary("SpellCache-1.0") local CastBar = AceOO.Class(IceBarElement) -CastBar.Actions = { None = 0, Cast = 1, Channel = 2, Instant = 3, Success = 4, Failure = 5, AutoShot =6 } +CastBar.Actions = { None = 0, Cast = 1, Channel = 2, Instant = 3, Success = 4, Failure = 5 } CastBar.prototype.action = nil CastBar.prototype.actionStartTime = nil CastBar.prototype.actionMessage = nil -IceHUDAutoCastLastStart = nil; + -- Constructor -- function CastBar.prototype:init() @@ -21,7 +21,6 @@ function CastBar.prototype:init() self:SetDefaultColor("CastChanneling", 117, 113, 161) self:SetDefaultColor("CastSuccess", 242, 242, 70) self:SetDefaultColor("CastFail", 1, 0, 0) - self:SetDefaultColor("CastAutoshot", 0, 0, 1) self.delay = 0 self.action = CastBar.Actions.None @@ -38,10 +37,6 @@ function CastBar.prototype:GetDefaultSettings() settings["offset"] = 0 settings["flashInstants"] = "Caster" settings["flashFailures"] = "Caster" - settings["lastInstant"] = nil; - settings["lastStart"] = nil; - settings["useLast"] = nil; - settings["showAutoCast"] = 1; return settings end @@ -82,23 +77,6 @@ function CastBar.prototype:GetOptions() validate = { "Always", "Caster", "Never" }, order = 41 } - - opts["showAutoCast"] = { - type = "toggle", - name = "Show Autocasts", - desc = "Show the your autoshots in cast bar", - get = function() - return self.moduleSettings.showAutoCast - end, - set = function(value) - self.moduleSettings.showAutoCast = value - self:Update(self.unit) - end, - disabled = function() - return not self.moduleSettings.enabled - end, - order = 42 - } return opts end @@ -153,44 +131,12 @@ end -- OnUpdate handler function CastBar.prototype:OnUpdate() - -- safety catch if (self.action == CastBar.Actions.None) then IceHUD:Debug("Stopping action ", self.action) - self:StopBar() + self:StopBar() return end - - if (self.action == CastBar.Actions.AutoShot) then - if (SpellStatus:IsAutoRepeating() == false) then - self:StopBar() - return - end - - local spellCastDuration = UnitRangedDamage("player"); - if (not self.moduleSettings.useLast) then - self.moduleSettings.lastStart = self.actionStartTime; - end - - local remainingTime = self.moduleSettings.lastStart + spellCastDuration - GetTime(); - local scale = 1 - (remainingTime / (spellCastDuration)) - - IceHUDAutoCastLastStart = self.moduleSettings.lastStart; - - --DEFAULT_CHAT_FRAME:AddMessage("autoshot "..spellCastDuration.." - "..remainingTime); - - if (remainingTime < 0 and remainingTime > -1.5) then -- lag compensation - remainingTime = 0 - end - - -- sanity check to make sure the bar doesn't over/underfill - scale = scale > 1 and 1 or scale - scale = scale < 0 and 0 or scale - - self:UpdateBar(scale, "CastCasting") - self:SetBottomText1(string.format("%.1fs AutoShot", remainingTime)) - return - end local spellId, spellName, spellRank, spellFullName, spellCastStartTime, spellCastStopTime, spellCastDuration, spellAction = SpellStatus:GetActiveSpellData() local time = GetTime() @@ -242,9 +188,7 @@ function CastBar.prototype:OnUpdate() return end - if (spellName) then - self:FlashBar("CastSuccess", 1-instanting, spellName .. spellRankShort) - end + self:FlashBar("CastSuccess", 1-instanting, (spellName or '') .. spellRankShort) return end @@ -285,8 +229,6 @@ end function CastBar.prototype:FlashBar(color, alpha, text, textColor) self.frame:SetAlpha(alpha) - - --DEFAULT_CHAT_FRAME:AddMessage("flash"); local r, g, b = self.settings.backgroundColor.r, self.settings.backgroundColor.g, self.settings.backgroundColor.b if (self.settings.backgroundToggle) then @@ -306,31 +248,23 @@ function CastBar.prototype:StartBar(action, message) self.action = action self.actionStartTime = GetTime() self.actionMessage = message - + self.frame:Show() self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) end -function CastBar.prototype:CastAuto() - self.action = CastBar.Actions.AutoShot - self.actionStartTime = GetTime() - - self.frame:Show() - self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) - --DEFAULT_CHAT_FRAME:AddMessage("autocast now"); -end function CastBar.prototype:StopBar() self.action = CastBar.Actions.None - self.actionStartTime = nil - + self.actionStartTime = nil + self.frame:Hide() self.frame:SetScript("OnUpdate", nil) - - self.moduleSettings.lastInstant = nil; - IceHUDAutoCastLastStart = nil; end + + + ------------------------------------------------------------------------------- -- INSTANT SPELLS -- ------------------------------------------------------------------------------- @@ -346,22 +280,8 @@ function CastBar.prototype:SpellStatus_SpellCastInstant(sId, sName, sRank, sFull return end end - - if (self.moduleSettings.showAutoCast) and (SpellStatus:IsAutoRepeating() == true) and (sName) then - if (self.moduleSettings.lastInstant) and (self.moduleSettings.lastInstant ~= sName) then --instant spell in between autshots - self.moduleSettings.useLast = 1; - else - self.moduleSettings.useLast = nil; - end - self.moduleSettings.lastInstant = sName; - --DEFAULT_CHAT_FRAME:AddMessage("start inst "..sName); - self:CastAuto(); - else - --if (sName) then - --DEFAULT_CHAT_FRAME:AddMessage("start inst "..sName); - --end - self:StartBar(CastBar.Actions.Instant) - end + + self:StartBar(CastBar.Actions.Instant) end @@ -373,13 +293,11 @@ end function CastBar.prototype:SpellStatus_SpellCastCastingStart(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration) IceHUD:Debug("SpellStatus_SpellCastCastingStart", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration) self:StartBar(CastBar.Actions.Cast) - --DEFAULT_CHAT_FRAME:AddMessage("start cast"); 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) self:StartBar(CastBar.Actions.Success) - --DEFAULT_CHAT_FRAME:AddMessage("start finish"); end function CastBar.prototype:SpellStatus_SpellCastFailure(sId, sName, sRank, sFullName, isActiveSpell, UIEM_Message, CMSFLP_SpellName, CMSFLP_Message) @@ -402,8 +320,6 @@ function CastBar.prototype:SpellStatus_SpellCastFailure(sId, sName, sRank, sFull self:StartBar(CastBar.Actions.Fail, UIEM_Message) - - --DEFAULT_CHAT_FRAME:AddMessage("start fail"); end function CastBar.prototype:SpellStatus_SpellCastCastingChange(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelay, sCastDelayTotal) @@ -419,7 +335,6 @@ end 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:StartBar(CastBar.Actions.Channel) - --DEFAULT_CHAT_FRAME:AddMessage("start channel"); end function CastBar.prototype:SpellStatus_SpellCastChannelingFinish(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruptionTotal) diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 90b5a83..3ab9724 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -6,8 +6,6 @@ TargetOfTarget.prototype.stackedDebuffs = nil TargetOfTarget.prototype.buffSize = nil TargetOfTarget.prototype.height = nil TargetOfTarget.prototype.unit = nil -TargetOfTarget.prototype.soundPlayed = nil -TargetOfTarget.prototype.lastTarget = nil -- Constructor -- @@ -101,57 +99,6 @@ function TargetOfTarget.prototype:GetOptions() order = 34 } - opts["showClass"] = { - order = 35, - type = 'toggle', - name = 'Show Class', - desc = 'Show the class of the targets target in brackets', - get = function() - return self.moduleSettings.showClass - end, - set = function(v) - self.moduleSettings.showClass = v - self:Redraw() - end, - disabled = function() - return not self.moduleSettings.enabled - end - } - - opts["aggroGainSound"] = { - order = 36, - type = 'toggle', - name = 'Aggro Sound', - desc = 'Play a sound when you get aggro', - get = function() - return self.moduleSettings.aggro - end, - set = function(v) - self.moduleSettings.aggro = v - self:Redraw() - end, - disabled = function() - return not self.moduleSettings.enabled - end - } - - opts["optionalSound"] = { - order = 37, - type = 'toggle', - name = 'Other Sound', - desc = 'Play a different sound on aggro gain', - get = function() - return self.moduleSettings.otherSound - end, - set = function(v) - self.moduleSettings.otherSound = v - self:Redraw() - end, - disabled = function() - return not self.moduleSettings.enabled - end - } - return opts end @@ -163,9 +110,6 @@ function TargetOfTarget.prototype:GetDefaultSettings() defaults["showDebuffs"] = true defaults["fontSize"] = 12 defaults["mouse"] = true - defaults["aggro"] = true - defaults["otherSound"] = false - defaults["showClass"] = false return defaults end @@ -379,16 +323,12 @@ function TargetOfTarget.prototype:Update() self.frame.totName:SetText() self.frame.totHealth:SetText() self.frame:Hide() - self.lastTarget = nil; return end self.frame:Show() - local lUnitClass, unitClass = UnitClass(self.unit) - local friendly = UnitIsFriend("player", "target"); - --DEFAULT_CHAT_FRAME:AddMessage(unitClass.." - "..lUnitClass); - + local _, unitClass = UnitClass(self.unit) local name = UnitName(self.unit) local reaction = UnitReaction(self.unit, "player") @@ -399,9 +339,6 @@ function TargetOfTarget.prototype:Update() local rColor = UnitReactionColor[reaction or 5] self.frame.totName:SetTextColor(rColor.r, rColor.g, rColor.b, 0.9) - if (self.moduleSettings.showClass) then - name = name.." ("..lUnitClass..")"; - end self.frame.totName:SetText(name) self.frame.totHealth:SetTextColor(rColor.r, rColor.g, rColor.b, 0.9) @@ -410,17 +347,6 @@ function TargetOfTarget.prototype:Update() self.frame.bar.texture:SetVertexColor(self:GetColor(unitClass, 0.7)) self.frame.bar:SetMinMaxValues(0, maxHealth) self.frame.bar:SetValue(health) - - if (self.moduleSettings.aggro) and (not friendly) and ((not self.lastTarget) or (self.lastTarget ~= UnitName("target"))) then - if (name == UnitName("player")) then - if (self.moduleSettings.otherSound) then - PlaySoundFile("Sound\\Doodad\\BellTollAlliance.wav"); - else - PlaySoundFile("Sound\\Doodad\\BellTollHorde.wav"); - end - self.lastTarget = UnitName("target"); - end - end end