- removed most of the rest of the garbage that was being generated during combat or when changing targets

- reduced cpu usage by 33%-50% across the board (and more in some cases) by changing how updates are registered and how often they run. now the 'update period' slider actually matters. it defaults to 0.033 meaning that frames update about 30 times a second instead of every frame
- fixed the "always" display mode for cooldown bars to respect alpha settings (ooc/with target/in combat/etc.)
This commit is contained in:
Parnic
2010-10-25 02:05:58 +00:00
parent d0be3b42a7
commit e003fab854
20 changed files with 324 additions and 187 deletions

View File

@ -15,6 +15,7 @@ IceBarElement.prototype.DesiredScale = 1
IceBarElement.prototype.CurrScale = 1 IceBarElement.prototype.CurrScale = 1
IceBarElement.prototype.Markers = {} IceBarElement.prototype.Markers = {}
IceBarElement.prototype.IsBarElement = true -- cheating to avoid crawling up the 'super' references looking for this class. see IceCore.lua IceBarElement.prototype.IsBarElement = true -- cheating to avoid crawling up the 'super' references looking for this class. see IceCore.lua
IceBarElement.prototype.bTreatEmptyAsFull = false
local lastMarkerPosConfig = 50 local lastMarkerPosConfig = 50
local lastMarkerColorConfig = {r=1, b=0, g=0, a=1} local lastMarkerColorConfig = {r=1, b=0, g=0, a=1}
@ -34,6 +35,10 @@ end
function IceBarElement.prototype:Enable() function IceBarElement.prototype:Enable()
IceBarElement.super.prototype.Enable(self) IceBarElement.super.prototype.Enable(self)
-- never register the OnUpdate for the mirror bar since it's handled internally
-- in addition, do not register OnUpdate if predictedPower is set and this is the player mana or target mana bar
self:ConditionalSetupUpdate()
if IceHUD.IceCore:ShouldUseDogTags() then if IceHUD.IceCore:ShouldUseDogTags() then
DogTag = LibStub("LibDogTag-3.0", true) DogTag = LibStub("LibDogTag-3.0", true)
if DogTag then if DogTag then
@ -71,6 +76,7 @@ function IceBarElement.prototype:Enable()
if self.moduleSettings.textVisible["lower"] then if self.moduleSettings.textVisible["lower"] then
self.frame.bottomLowerText:Hide() self.frame.bottomLowerText:Hide()
end end
self:OnHide()
end) end)
self.frame:SetScript("OnShow", function() self.frame:SetScript("OnShow", function()
if self.moduleSettings.textVisible["upper"] then if self.moduleSettings.textVisible["upper"] then
@ -79,13 +85,21 @@ function IceBarElement.prototype:Enable()
if self.moduleSettings.textVisible["lower"] then if self.moduleSettings.textVisible["lower"] then
self.frame.bottomLowerText:Show() self.frame.bottomLowerText:Show()
end end
self:OnShow()
end) end)
end end
function IceBarElement.prototype:OnHide()
IceHUD.IceCore:RequestUpdates(self, nil)
end
function IceBarElement.prototype:OnShow()
end
function IceBarElement.prototype:Disable(core) function IceBarElement.prototype:Disable(core)
IceBarElement.super.prototype.Disable(self, core) IceBarElement.super.prototype.Disable(self, core)
self.frame:SetScript("OnUpdate", nil) IceHUD.IceCore:RequestUpdates(self, nil)
self.frame:SetScript("OnHide", nil) self.frame:SetScript("OnHide", nil)
self.frame:SetScript("OnShow", nil) self.frame:SetScript("OnShow", nil)
end end
@ -823,20 +837,29 @@ function IceBarElement.prototype:CreateFrame()
end end
self.masterFrame:SetScale(self.moduleSettings.scale) self.masterFrame:SetScale(self.moduleSettings.scale)
-- never register the OnUpdate for the mirror bar since it's handled internally
-- in addition, do not register OnUpdate if predictedPower is set and this is the player mana or target mana bar
if not string.find(self.elementName, "MirrorBar")
and ((IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")) or (not string.find(self.elementName, "PlayerMana")))
and not self.moduleSettings.isCustomBar and self:RegisterOnUpdate() then
self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end)
end
if self.moduleSettings.rotateBar then if self.moduleSettings.rotateBar then
self:RotateHorizontal() self:RotateHorizontal()
end end
end end
function IceBarElement.prototype:RegisterOnUpdate() function IceBarElement.prototype:ConditionalSetupUpdate()
if not self.MyOnUpdateFunc then
self.MyOnUpdateFunc = function() self:MyOnUpdate() end
end
if IceHUD.IceCore:IsUpdateSubscribed(self) then
return
end
if not string.find(self.elementName, "MirrorBar")
and ((IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")) or (not string.find(self.elementName, "PlayerMana")))
and self:ShouldRegisterOnUpdate() then
IceHUD.IceCore:RequestUpdates(self, self.MyOnUpdateFunc)
end
end
function IceBarElement.prototype:ShouldRegisterOnUpdate()
return true return true
end end
@ -1038,6 +1061,14 @@ function IceBarElement.prototype:SetScale(inScale, force)
self.barFrame.bar:Show() self.barFrame.bar:Show()
end end
end end
if not self:IsFull(self.CurrScale) or not self:IsFull(inScale) then
self:ConditionalSetupUpdate()
else
if self.CurrScale == self.DesiredScale then
IceHUD.IceCore:RequestUpdates(self, nil)
end
end
end end
@ -1046,19 +1077,21 @@ function IceBarElement.prototype:LerpScale(scale)
return scale return scale
end end
local now = GetTime()
if self.CurrLerpTime < self.moduleSettings.desiredLerpTime then if self.CurrLerpTime < self.moduleSettings.desiredLerpTime then
self.CurrLerpTime = self.CurrLerpTime + (1 / GetFramerate()); self.CurrLerpTime = self.CurrLerpTime + (now - (self.lastLerpTime or now))
end end
self.lastLerpTime = GetTime()
if self.CurrLerpTime > self.moduleSettings.desiredLerpTime then if self.CurrLerpTime > self.moduleSettings.desiredLerpTime then
self.CurrLerpTime = self.moduleSettings.desiredLerpTime self.CurrLerpTime = self.moduleSettings.desiredLerpTime
elseif self.CurrLerpTime < self.moduleSettings.desiredLerpTime then
return self.LastScale + ((self.DesiredScale - self.LastScale) * (self.CurrLerpTime / self.moduleSettings.desiredLerpTime))
end end
if self.CurrLerpTime < self.moduleSettings.desiredLerpTime then return scale
return self.LastScale + ((self.DesiredScale - self.LastScale) * (self.CurrLerpTime / self.moduleSettings.desiredLerpTime))
else
return scale
end
end end
@ -1102,6 +1135,7 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
if self.DesiredScale ~= scale then if self.DesiredScale ~= scale then
self.DesiredScale = scale self.DesiredScale = scale
self.CurrLerpTime = 0 self.CurrLerpTime = 0
self.lastLerpTime = GetTime()
self.LastScale = self.CurrScale self.LastScale = self.CurrScale
end end
@ -1124,7 +1158,19 @@ end
function IceBarElement.prototype:UseTargetAlpha(scale) function IceBarElement.prototype:UseTargetAlpha(scale)
return (scale and (scale < 1)) return not self:IsFull(scale)
end
function IceBarElement.prototype:IsFull(scale)
if self.reverse then
scale = 1 - scale
end
if not self.bTreatEmptyAsFull then
return scale and scale == 1
else
return scale and scale == 0
end
end end
@ -1228,9 +1274,6 @@ function IceBarElement.prototype:Update()
end end
function IceBarElement.prototype:MyOnUpdate() function IceBarElement.prototype:MyOnUpdate()
if not self:IsVisible() then
return
end
self:SetScale(self.DesiredScale) self:SetScale(self.DesiredScale)
end end
@ -1386,3 +1429,13 @@ function IceBarElement.prototype:LoadMarkers()
self:CreateMarker(i) self:CreateMarker(i)
end end
end end
function IceBarElement.prototype:Show(bShouldShow)
if IceBarElement.super.prototype.Show(self, bShouldShow) then
if self.bIsVisible then
self:ConditionalSetupUpdate()
else
IceHUD.IceCore:RequestUpdates(self, nil)
end
end
end

View File

@ -245,7 +245,7 @@ end
-- OnUpdate handler -- OnUpdate handler
function IceCastBar.prototype:OnUpdate() function IceCastBar.prototype:MyOnUpdate()
-- safety catch -- safety catch
if (self.action == IceCastBar.Actions.None) then if (self.action == IceCastBar.Actions.None) then
IceHUD:Debug("Stopping action ", self.action) IceHUD:Debug("Stopping action ", self.action)
@ -370,7 +370,7 @@ function IceCastBar.prototype:StartBar(action, message)
end end
self:Show(true) self:Show(true)
self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) self:ConditionalSetupUpdate()
end end
@ -380,16 +380,6 @@ function IceCastBar.prototype:StopBar()
self.actionDuration = nil self.actionDuration = nil
self:Show(false) self:Show(false)
self.frame:SetScript("OnUpdate", nil)
end
-- make sure that our custom OnUpdate is restored whenever a Redraw happens
function IceCastBar.prototype:Redraw()
IceCastBar.super.prototype.Redraw(self)
if self.action ~= IceCastBar.Actions.None then
self.frame:SetScript("OnUpdate", function() self:OnUpdate() end)
end
end end
function IceCastBar.prototype:GetShortRank(rank) function IceCastBar.prototype:GetShortRank(rank)

View File

@ -17,6 +17,8 @@ function IceCore_CreateClass(parent)
return class return class
end end
local DogTag = LibStub("LibDogTag-3.0", true)
IceCore = IceCore_CreateClass() IceCore = IceCore_CreateClass()
IceCore.Side = { Left = "LEFT", Right = "RIGHT" } IceCore.Side = { Left = "LEFT", Right = "RIGHT" }
@ -73,7 +75,7 @@ function IceCore.prototype:SetupDefaults()
bShouldUseDogTags = true, bShouldUseDogTags = true,
updatePeriod = 0.1, updatePeriod = 0.033,
minimap = {}, minimap = {},
}, },
global = { global = {
@ -108,6 +110,15 @@ StaticPopupDialogs["ICEHUD_CONVERTED_TO_ACE3"] =
hideOnEscape = 0, hideOnEscape = 0,
} }
StaticPopupDialogs["ICEHUD_UPDATE_PERIOD_MATTERS"] =
{
text = L["Since the last time you updated IceHUD, many significant CPU and memory optimizations have been made. If bar animation looks jumpy to you, open the /icehud configuration page and lower the 'Update Period' slider. This will cause higher CPU usage but will look nicer. Enjoy IceHUD!"],
button1 = OKAY,
timeout = 0,
whileDead = 1,
hideOnEscape = 0,
}
function IceCore.prototype:CheckDisplayUpdateMessage() function IceCore.prototype:CheckDisplayUpdateMessage()
local thisVersion local thisVersion
--[===[@non-debug@ --[===[@non-debug@
@ -120,6 +131,14 @@ function IceCore.prototype:CheckDisplayUpdateMessage()
if self.accountSettings.lastRunVersion < 549 then if self.accountSettings.lastRunVersion < 549 then
StaticPopup_Show("ICEHUD_CONVERTED_TO_ACE3") StaticPopup_Show("ICEHUD_CONVERTED_TO_ACE3")
end end
if self.accountSettings.lastRunVersion < 707 and self.accountSettings.lastRunVersion > 0 then
-- update from the old default that may have been saved with the user's settings
if self.settings.updatePeriod == 0.1 then
self.settings.updatePeriod = 0.033
end
StaticPopup_Show("ICEHUD_UPDATE_PERIOD_MATTERS")
end
self.accountSettings.lastRunVersion = thisVersion self.accountSettings.lastRunVersion = thisVersion
end end
end end
@ -185,7 +204,7 @@ function IceCore.prototype:Enable(userToggle)
end end
if self.settings.updatePeriod == nil then if self.settings.updatePeriod == nil then
self.settings.updatePeriod = 0.1 self.settings.updatePeriod = 0.033
end end
-- make sure the module options are re-generated. if we switched profiles, we don't want the old elements hanging around -- make sure the module options are re-generated. if we switched profiles, we don't want the old elements hanging around
@ -359,24 +378,23 @@ end
function IceCore.prototype:GetColorOptions() function IceCore.prototype:GetColorOptions()
assert(table.getn(IceHUD.IceCore.elements) > 0, "Unable to get color options, no elements found!")
local options = {} local options = {}
for k, v in pairs(self.elements[1]:GetColors()) do if #self.elements > 0 then
local kk, vv = k, v for k, v in pairs(self.elements[1]:GetColors()) do
options[k] = { options[k] = {
type = 'color', type = 'color',
desc = k, desc = k,
name = k, name = k,
get = function() get = function()
return IceHUD.IceCore:GetColor(kk) return IceHUD.IceCore:GetColor(k)
end, end,
set = function(info, r, g, b) set = function(info, r, g, b)
local color = k local color = k
IceHUD.IceCore:SetColor(kk, r, g, b) IceHUD.IceCore:SetColor(k, r, g, b)
end end
} }
end
end end
return options return options
@ -658,7 +676,7 @@ function IceCore.prototype:ConfigModeToggle(bWantConfig)
end end
function IceCore.prototype:ShouldUseDogTags() function IceCore.prototype:ShouldUseDogTags()
return LibStub("LibDogTag-3.0", true) and self.settings.bShouldUseDogTags return DogTag and self.settings.bShouldUseDogTags
end end
function IceCore.prototype:SetShouldUseDogTags(should) function IceCore.prototype:SetShouldUseDogTags(should)
@ -678,22 +696,18 @@ function IceCore.prototype:HandleUpdates()
local update_period = self:UpdatePeriod() local update_period = self:UpdatePeriod()
local elapsed = 1 / GetFramerate() local elapsed = 1 / GetFramerate()
self.update_elapsed = self.update_elapsed + elapsed self.update_elapsed = self.update_elapsed + elapsed
if (self.update_elapsed > update_period) then if (self.update_elapsed >= update_period) then
for frame, func in pairs(self.updatees) for module, func in pairs(self.updatees) do
do
func() func()
end end
if (elapsed > update_period) then
self.update_elapsed = 0 self.update_elapsed = self.update_elapsed - update_period
else
self.update_elapsed = self.update_elapsed - update_period
end
end end
end end
function IceCore.prototype:RequestUpdates(frame, func) function IceCore.prototype:RequestUpdates(module, func)
if self.updatees[frame] ~= func then if self.updatees[module] ~= func then
self.updatees[frame] = func self.updatees[module] = func
end end
local count = 0 local count = 0
@ -704,12 +718,18 @@ function IceCore.prototype:RequestUpdates(frame, func)
if (count == 0) then if (count == 0) then
self.IceHUDFrame:SetScript("OnUpdate", nil) self.IceHUDFrame:SetScript("OnUpdate", nil)
else else
self.IceHUDFrame:SetScript("OnUpdate", function() self:HandleUpdates() end) if not self.UpdateFunc then
self.UpdateFunc = function() self:HandleUpdates() end
end
if self.IceHUDFrame:GetScript("OnUpdate") ~= self.UpdateFunc then
self.IceHUDFrame:SetScript("OnUpdate", self.UpdateFunc)
end
end end
end end
function IceCore.prototype:IsUpdateSubscribed(frame) function IceCore.prototype:IsUpdateSubscribed(module)
return self.updatees[frame] ~= nil return self.updatees[module] ~= nil
end end
function IceCore.prototype:EmptyUpdates() function IceCore.prototype:EmptyUpdates()

View File

@ -407,7 +407,7 @@ end
function IceElement.prototype:Show(bShouldShow) function IceElement.prototype:Show(bShouldShow)
if self.bIsVisible == bShouldShow then if self.bIsVisible == bShouldShow then
return return nil
end end
self.bIsVisible = bShouldShow self.bIsVisible = bShouldShow
@ -419,6 +419,8 @@ function IceElement.prototype:Show(bShouldShow)
self.masterFrame:Show() self.masterFrame:Show()
self.frame:Show() self.frame:Show()
end end
return true
end end

View File

@ -651,9 +651,9 @@ Expand "|cffffdc42Module Settings|r", expand PlayerInfo (or TargetInfo for targe
set = function(info, v) set = function(info, v)
IceHUD.IceCore:SetUpdatePeriod(v) IceHUD.IceCore:SetUpdatePeriod(v)
end, end,
min = 0.01, min = 0,
max = 1.0, max = 1,
step = 0.01, step = 0.001,
order = 97 order = 97
}, },

View File

@ -285,31 +285,39 @@ function IceUnitBar.prototype:UpdateBar(scale, color, alpha)
return return
end end
self.flashFrame.flash:SetVertexColor(self:GetColor(color))
if (self.moduleSettings.lowThreshold > 0 and if (self.moduleSettings.lowThreshold > 0 and
self.moduleSettings.lowThresholdFlash and self.moduleSettings.lowThresholdFlash and
self.moduleSettings.lowThreshold >= scale and self.alive and self.moduleSettings.lowThreshold >= scale and self.alive and
not self.noFlash) then not self.noFlash) then
self.flashFrame:SetScript("OnUpdate", function() self:OnFlashUpdate() end) self.bUpdateFlash = true
self.flashFrame.flash:SetVertexColor(self:GetColor(color))
else else
self.flashFrame:SetScript("OnUpdate", nil) self.bUpdateFlash = nil
self.flashFrame:SetAlpha(0) self.flashFrame:SetAlpha(0)
end end
end end
function IceUnitBar.prototype:OnFlashUpdate() function IceUnitBar.prototype:MyOnUpdate()
local time = GetTime() IceUnitBar.super.prototype.MyOnUpdate(self)
local decimals = time - math.floor(time)
if (decimals > 0.5) then self:ConditionalUpdateFlash()
decimals = 1 - decimals end
function IceUnitBar.prototype:ConditionalUpdateFlash()
if self.bUpdateFlash then
local time = GetTime()
local decimals = time - math.floor(time)
if (decimals > 0.5) then
decimals = 1 - decimals
end
decimals = decimals*1.1 -- add more dynamic to the color change
self.flashFrame:SetAlpha(decimals)
end end
decimals = decimals*1.1 -- add more dynamic to the color change
self.flashFrame:SetAlpha(decimals)
end end

View File

@ -6,6 +6,8 @@ function ComboPointsBar.prototype:init()
self:SetDefaultColor("ComboPointsBarMin", 1, 1, 0) self:SetDefaultColor("ComboPointsBarMin", 1, 1, 0)
self:SetDefaultColor("ComboPointsBarMax", 0, 1, 0) self:SetDefaultColor("ComboPointsBarMax", 0, 1, 0)
self.bTreatEmptyAsFull = true
end end
function ComboPointsBar.prototype:GetOptions() function ComboPointsBar.prototype:GetOptions()
@ -37,6 +39,7 @@ function ComboPointsBar.prototype:GetDefaultSettings()
defaults.offset = 8 defaults.offset = 8
defaults.enabled = false defaults.enabled = false
defaults.alwaysDisplay = false defaults.alwaysDisplay = false
defaults.desiredLerpTime = 0.05
return defaults return defaults
end end

View File

@ -50,11 +50,15 @@ end
function IceCustomBar.prototype:ConditionalSubscribe() function IceCustomBar.prototype:ConditionalSubscribe()
if self:ShouldAlwaysSubscribe() then if self:ShouldAlwaysSubscribe() then
if not IceHUD.IceCore:IsUpdateSubscribed(self.frame) then if not IceHUD.IceCore:IsUpdateSubscribed(self) then
IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar() end) if not self.CustomBarUpdateFunc then
self.CustomBarUpdateFunc = function() self:UpdateCustomBar() end
end
IceHUD.IceCore:RequestUpdates(self, self.CustomBarUpdateFunc)
end end
else else
IceHUD.IceCore:RequestUpdates(self.frame, nil) IceHUD.IceCore:RequestUpdates(self, nil)
end end
end end
@ -69,7 +73,7 @@ function IceCustomBar.prototype:TargetChanged()
end end
function IceCustomBar.prototype:Disable(core) function IceCustomBar.prototype:Disable(core)
IceHUD.IceCore:RequestUpdates(self.frame, nil) IceHUD.IceCore:RequestUpdates(self, nil)
IceCustomBar.super.prototype.Disable(self, core) IceCustomBar.super.prototype.Disable(self, core)
end end
@ -571,8 +575,12 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
end end
if self.auraEndTime ~= nil and (self.auraEndTime == 0 or self.auraEndTime >= now) then if self.auraEndTime ~= nil and (self.auraEndTime == 0 or self.auraEndTime >= now) then
if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self.frame) then if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self) then
IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar(self.unit, true) end) if not self.UpdateCustomBarFunc then
self.UpdateCustomBarFunc = function() self:UpdateCustomBar(self.unit, true) end
end
IceHUD.IceCore:RequestUpdates(self, self.UpdateCustomBarFunc)
end end
self:Show(true) self:Show(true)
@ -590,7 +598,7 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
self:UpdateBar(0, "undef") self:UpdateBar(0, "undef")
self:Show(false) self:Show(false)
if not self:ShouldAlwaysSubscribe() then if not self:ShouldAlwaysSubscribe() then
IceHUD.IceCore:RequestUpdates(self.frame, nil) IceHUD.IceCore:RequestUpdates(self, nil)
end end
end end

View File

@ -1,5 +1,5 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
IceCustomCDBar = IceCore_CreateClass(IceUnitBar) IceCustomCDBar = IceCore_CreateClass(IceBarElement)
local IceHUD = _G.IceHUD local IceHUD = _G.IceHUD
@ -18,7 +18,7 @@ table.insert(brokenSpellsNameToId, {"Holy Word: Aspire",88682})
-- Constructor -- -- Constructor --
function IceCustomCDBar.prototype:init() function IceCustomCDBar.prototype:init()
IceCustomCDBar.super.prototype.init(self, "MyCustomCDBar", "player") IceCustomCDBar.super.prototype.init(self, "MyCustomCDBar")
end end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
@ -59,7 +59,7 @@ end
function IceCustomCDBar.prototype:Disable(core) function IceCustomCDBar.prototype:Disable(core)
IceHUD.IceCore:RequestUpdates(self.frame, nil) IceHUD.IceCore:RequestUpdates(self, nil)
IceCustomCDBar.super.prototype.Disable(self, core) IceCustomCDBar.super.prototype.Disable(self, core)
end end
@ -79,7 +79,6 @@ function IceCustomCDBar.prototype:GetDefaultSettings()
settings["lockLowerFontAlpha"] = false settings["lockLowerFontAlpha"] = false
settings["lowerText"] = "" settings["lowerText"] = ""
settings["lowerTextVisible"] = false settings["lowerTextVisible"] = false
settings["isCustomBar"] = false
settings["cooldownToTrack"] = "" settings["cooldownToTrack"] = ""
settings["barColor"] = {r=1, g=0, b=0, a=1} settings["barColor"] = {r=1, g=0, b=0, a=1}
settings["displayMode"] = "When cooling down" settings["displayMode"] = "When cooling down"
@ -447,11 +446,15 @@ function IceCustomCDBar.prototype:EnableUpdates(enable_update)
end end
if enable_update then if enable_update then
if not IceHUD.IceCore:IsUpdateSubscribed(self.frame) then if not IceHUD.IceCore:IsUpdateSubscribed(self) then
IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar(true) end) if not self.CustomUpdateFunc then
self.CustomUpdateFunc = function() self:UpdateCustomBar(true) end
end
IceHUD.IceCore:RequestUpdates(self, self.CustomUpdateFunc)
end end
else else
IceHUD.IceCore:RequestUpdates(self.frame, nil) IceHUD.IceCore:RequestUpdates(self, nil)
end end
end end
@ -533,6 +536,8 @@ function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate)
self:SetBottomText1(self.moduleSettings.upperText) self:SetBottomText1(self.moduleSettings.upperText)
end end
self:UpdateAlpha()
self.barFrame.bar:SetVertexColor(self:GetBarColor()) self.barFrame.bar:SetVertexColor(self:GetBarColor())
self.coolingDown = remaining ~= nil and remaining > 0 self.coolingDown = remaining ~= nil and remaining > 0
@ -548,7 +553,7 @@ function IceCustomCDBar.prototype:TargetChanged()
IceCustomCDBar.super.prototype.TargetChanged(self) IceCustomCDBar.super.prototype.TargetChanged(self)
-- Target changing only affects us if we want to show the bar as soon as it is ready. -- Target changing only affects us if we want to show the bar as soon as it is ready.
if (self.moduleSettings.displayMode == "When ready") then if (self.moduleSettings.displayMode == "When ready" or self.moduleSettings.displayMode == "Always") then
self:UpdateCustomBar() self:UpdateCustomBar()
end end
end end
@ -584,11 +589,13 @@ end
function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide) function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide)
if self.moduleSettings.enabled and not bForceHide then if self.moduleSettings.enabled and not bForceHide then
if (self.moduleSettings.displayMode == "Always") then if self.moduleSettings.displayMode == "Always" then
if not self.bIsVisible then if self.target then
IceCustomCDBar.super.prototype.Show(self, true) IceCustomCDBar.super.prototype.Show(self, true)
else
IceCustomCDBar.super.prototype.Show(self, bShouldShow)
end end
elseif (self.moduleSettings.displayMode == "When ready") then elseif self.moduleSettings.displayMode == "When ready" then
if not self.coolingDown and self:IsReady() then if not self.coolingDown and self:IsReady() then
IceCustomCDBar.super.prototype.Show(self, true) IceCustomCDBar.super.prototype.Show(self, true)
else else
@ -603,9 +610,10 @@ function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide)
end end
function IceCustomCDBar.prototype:UseTargetAlpha(scale) function IceCustomCDBar.prototype:UseTargetAlpha(scale)
if self.moduleSettings.displayMode == "When ready" and scale == 0 then if (self.moduleSettings.displayMode == "When ready" or self.moduleSettings.displayMode == "Always")
and scale == 0 then
return false return false
end end
return true return IceCustomCDBar.super.prototype:UseTargetAlpha(self, scale)
end end

View File

@ -1,6 +1,5 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
IceCustomHealth = IceCore_CreateClass(IceTargetHealth) IceCustomHealth = IceCore_CreateClass(IceTargetHealth)
IceCustomHealth.prototype.scheduledEvent = nil
-- Constructor -- -- Constructor --
function IceCustomHealth.prototype:init() function IceCustomHealth.prototype:init()
@ -113,21 +112,19 @@ end
function IceCustomHealth.prototype:Enable(core) function IceCustomHealth.prototype:Enable(core)
self.registerEvents = false --self.registerEvents = false
IceCustomHealth.super.prototype.Enable(self, core) IceCustomHealth.super.prototype.Enable(self, core)
self:SetUnit(self.moduleSettings.unitToTrack) self:SetUnit(self.moduleSettings.unitToTrack)
self:CreateFrame() self:CreateFrame()
self.scheduledEvent = self:ScheduleRepeatingTimer("Update", IceHUD.IceCore:UpdatePeriod())
end end
function IceCustomHealth.prototype:Disable(core) function IceCustomHealth.prototype:MyOnUpdate()
IceCustomHealth.super.prototype.Disable(self, core) IceCustomHealth.super.prototype.MyOnUpdate(self)
UnregisterUnitWatch(self.frame) if UnitExists(self.unit) then
self:Update()
self:CancelTimer(self.scheduledEvent, true) end
end end
function IceCustomHealth.prototype:Update(unit) function IceCustomHealth.prototype:Update(unit)
@ -153,12 +150,8 @@ function IceCustomHealth.prototype:Update(unit)
self.color = "Tapped" self.color = "Tapped"
end end
if not self:IsVisible() then
RegisterUnitWatch(self.frame)
end
--self.determineColor = false --self.determineColor = false
IceCustomHealth.super.prototype.Update(self, unit) IceCustomHealth.super.prototype.Update(self, self.unit)
end end
function IceCustomHealth.prototype:SetUnit(unit) function IceCustomHealth.prototype:SetUnit(unit)
@ -168,3 +161,7 @@ function IceCustomHealth.prototype:SetUnit(unit)
end end
self:RegisterFontStrings() self:RegisterFontStrings()
end end
function IceCustomHealth.prototype:OnShow()
self:Update(self.unit)
end

View File

@ -58,8 +58,6 @@ function EclipseBar.prototype:Enable(core)
self:RegisterEvent("UNIT_AURA", "UpdateEclipseBuffs") self:RegisterEvent("UNIT_AURA", "UpdateEclipseBuffs")
self:RegisterEvent("ECLIPSE_DIRECTION_CHANGE", "UpdateEclipseDirection") self:RegisterEvent("ECLIPSE_DIRECTION_CHANGE", "UpdateEclipseDirection")
self.frame:SetScript("OnUpdate", function() self:Update() end)
self:UpdateEclipseDirection(nil, GetEclipseDirection() == "sun", GetEclipseDirection() == "none") self:UpdateEclipseDirection(nil, GetEclipseDirection() == "sun", GetEclipseDirection() == "none")
self:UpdateEclipseBuffs() self:UpdateEclipseBuffs()
self:UpdateShown() self:UpdateShown()
@ -97,7 +95,7 @@ function EclipseBar.prototype:CreateFrame()
self:UpdateAlpha() self:UpdateAlpha()
end end
function EclipseBar.prototype:RegisterOnUpdate() function EclipseBar.prototype:ShouldRegisterOnUpdate()
return false return false
end end
@ -146,7 +144,7 @@ function EclipseBar.prototype:CreateSolarBar()
end end
function EclipseBar.prototype:UpdateShown() function EclipseBar.prototype:UpdateShown()
local form = GetShapeshiftFormID(); local form = GetShapeshiftFormID()
if form == MOONKIN_FORM or not form then if form == MOONKIN_FORM or not form then
if GetPrimaryTalentTree() == 1 then if GetPrimaryTalentTree() == 1 then
@ -206,8 +204,8 @@ function EclipseBar.prototype:UpdateEclipsePower()
self:PositionMarker(1, pos) self:PositionMarker(1, pos)
end end
function EclipseBar.prototype:Update() function EclipseBar.prototype:MyOnUpdate()
EclipseBar.super.prototype.Update(self) self:Update()
self:UpdateEclipsePower() self:UpdateEclipsePower()
self:UpdateBar(0.5, self.barUpdateColor, 1) self:UpdateBar(0.5, self.barUpdateColor, 1)

View File

@ -102,13 +102,17 @@ end
function PetMana.prototype:SetupOnUpdate(enable) function PetMana.prototype:SetupOnUpdate(enable)
if enable then if enable then
self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end) if not self.CustomOnUpdate then
self.CustomOnUpdate = function() self:Update(self.unit) end
end
IceHUD.IceCore:RequestUpdates(self, self.CustomOnUpdate)
else else
-- make sure the animation has a chance to finish filling up the bar before we cut it off completely -- make sure the animation has a chance to finish filling up the bar before we cut it off completely
if self.CurrScale ~= self.DesiredScale then if self.CurrScale ~= self.DesiredScale then
self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end) IceHUD.IceCore:RequestUpdates(self, self.MyOnUpdateFunc)
else else
self.frame:SetScript("OnUpdate", nil) IceHUD.IceCore:RequestUpdates(self, nil)
end end
end end
end end

View File

@ -54,8 +54,10 @@ end
function PlayerInfo.prototype:CreateFrame(redraw) function PlayerInfo.prototype:CreateFrame(redraw)
PlayerInfo.super.prototype.CreateFrame(self, redraw) PlayerInfo.super.prototype.CreateFrame(self, redraw)
self.frame.menu = function() if not self.frame.menu then
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor") self.frame.menu = function()
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor")
end
end end
end end
@ -68,26 +70,28 @@ StaticPopupDialogs["ICEHUD_BUFF_DISMISS_UNAVAILABLE"] =
hideOnEscape = 0, hideOnEscape = 0,
} }
local function OnBuffMouseUp(frame, button)
if IceHUD.WowVer >= 40000 then
StaticPopup_Show("ICEHUD_BUFF_DISMISS_UNAVAILABLE")
else
--[[ if( button == "RightButton" ) then
if buffs[i].type == "mh" then
CancelItemTempEnchantment(1)
elseif buffs[i].type == "oh" then
CancelItemTempEnchantment(2)
else
CancelUnitBuff("player", i)
end
end]]
end
end
function PlayerInfo.prototype:CreateIconFrames(parent, direction, buffs, type) function PlayerInfo.prototype:CreateIconFrames(parent, direction, buffs, type)
local buffs = PlayerInfo.super.prototype.CreateIconFrames(self, parent, direction, buffs, type) local buffs = PlayerInfo.super.prototype.CreateIconFrames(self, parent, direction, buffs, type)
for i = 1, IceCore.BuffLimit do for i = 1, IceCore.BuffLimit do
if (self.moduleSettings.mouseBuff) then if (self.moduleSettings.mouseBuff) then
buffs[i]:SetScript("OnMouseUp", function( self, button) buffs[i]:SetScript("OnMouseUp", OnBuffMouseUp)
if IceHUD.WowVer >= 40000 then
StaticPopup_Show("ICEHUD_BUFF_DISMISS_UNAVAILABLE")
else
if( button == "RightButton" ) then
if buffs[i].type == "mh" then
CancelItemTempEnchantment(1)
elseif buffs[i].type == "oh" then
CancelItemTempEnchantment(2)
else
CancelUnitBuff("player", i)
end
end
end
end)
else else
buffs[i]:SetScript("OnMouseUp", nil) buffs[i]:SetScript("OnMouseUp", nil)
end end

View File

@ -121,6 +121,10 @@ function PlayerMana.prototype:Enable(core)
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle")
self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle")
if not self.CustomOnUpdate then
self.CustomOnUpdate = function() self:Update(self.unit) end
end
-- allow new 'predicted power' stuff to show the power updates constantly instead of ticking -- allow new 'predicted power' stuff to show the power updates constantly instead of ticking
if GetCVarBool("predictedPower") then if GetCVarBool("predictedPower") then
self:SetupOnUpdate(true) self:SetupOnUpdate(true)
@ -137,13 +141,13 @@ end
function PlayerMana.prototype:SetupOnUpdate(enable) function PlayerMana.prototype:SetupOnUpdate(enable)
if enable then if enable then
self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end) IceHUD.IceCore:RequestUpdates(self, self.CustomOnUpdate)
else else
-- make sure the animation has a chance to finish filling up the bar before we cut it off completely -- make sure the animation has a chance to finish filling up the bar before we cut it off completely
if self.CurrScale ~= self.DesiredScale then if self.CurrScale ~= self.DesiredScale then
self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end) IceHUD.IceCore:RequestUpdates(self, self.MyOnUpdateFunc)
else else
self.frame:SetScript("OnUpdate", nil) IceHUD.IceCore:RequestUpdates(self, nil)
end end
end end
end end
@ -186,16 +190,6 @@ function PlayerMana.prototype:Redraw()
end end
-- OVERRIDE
function PlayerMana.prototype:UseTargetAlpha(scale)
if (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER) then
return (scale and (scale > 0))
else
return PlayerMana.super.prototype.UseTargetAlpha(self, scale)
end
end
function PlayerMana.prototype:ManaType(event, unit) function PlayerMana.prototype:ManaType(event, unit)
if (unit ~= self.unit) then if (unit ~= self.unit) then
return return
@ -214,6 +208,12 @@ function PlayerMana.prototype:ManaType(event, unit)
end end
end end
if self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER then
self.bTreatEmptyAsFull = true
else
self.bTreatEmptyAsFull = false
end
self:Update(self.unit) self:Update(self.unit)
end end
@ -239,12 +239,13 @@ function PlayerMana.prototype:Update(unit, powertype)
self:Show(true) self:Show(true)
end end
local useTicker = self:ShouldUseTicker()
-- the user can toggle the predictedPower cvar at any time and the addon will not get notified. handle it. -- the user can toggle the predictedPower cvar at any time and the addon will not get notified. handle it.
if not self.tickerFrame and self:ShouldUseTicker() then if not self.tickerFrame and useTicker then
self:CreateTickerFrame() self:CreateTickerFrame()
end end
if (self.manaType ~= SPELL_POWER_ENERGY and self:ShouldUseTicker()) then if (self.manaType ~= SPELL_POWER_ENERGY and useTicker) then
self.tickerFrame:Hide() self.tickerFrame:Hide()
end end
@ -268,15 +269,16 @@ function PlayerMana.prototype:Update(unit, powertype)
self:UpdateBar(self.manaPercentage, color) self:UpdateBar(self.manaPercentage, color)
local powerType = UnitPowerType(self.unit) self:ConditionalUpdateFlash()
if (self.manaPercentage == 1 and powerType ~= 1 and powerType ~= 6)
or (self.manaPercentage == 0 and (powerType == 1 or powerType == 6)) then if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER)
or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then
self:SetupOnUpdate(false) self:SetupOnUpdate(false)
elseif GetCVarBool("predictedPower") then elseif GetCVarBool("predictedPower") then
self:SetupOnUpdate(true) self:SetupOnUpdate(true)
end end
if self:ShouldUseTicker() then if useTicker then
-- hide ticker if rest of the bar is not visible -- hide ticker if rest of the bar is not visible
if (self.alpha == 0) then if (self.alpha == 0) then
self.tickerFrame.spark:SetVertexColor(self:GetColor("PlayerEnergy", 0)) self.tickerFrame.spark:SetVertexColor(self:GetColor("PlayerEnergy", 0))
@ -315,7 +317,6 @@ function PlayerMana.prototype:UpdateBar(scale, color, alpha)
end end
function PlayerMana.prototype:UpdateEnergy(event, unit) function PlayerMana.prototype:UpdateEnergy(event, unit)
if (unit and (unit ~= self.unit)) then if (unit and (unit ~= self.unit)) then
return return

View File

@ -33,6 +33,8 @@ function SliceAndDice.prototype:init()
self:SetDefaultColor("SliceAndDice", 0.75, 1, 0.2) self:SetDefaultColor("SliceAndDice", 0.75, 1, 0.2)
self:SetDefaultColor("SliceAndDicePotential", 1, 1, 1) self:SetDefaultColor("SliceAndDicePotential", 1, 1, 1)
self.bTreatEmptyAsFull = true
end end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
@ -208,6 +210,13 @@ function SliceAndDice.prototype:GetBuffDuration(unitName, buffName)
return nil, nil return nil, nil
end end
function SliceAndDice.prototype:MyOnUpdate()
SliceAndDice.super.prototype.MyOnUpdate(self)
if self.bUpdateSnd then
self:UpdateSliceAndDice(nil, self.unit, true)
end
end
function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate) function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
if unit and unit ~= self.unit then if unit and unit ~= self.unit then
return return
@ -228,7 +237,7 @@ function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
if sndEndTime and sndEndTime >= now then if sndEndTime and sndEndTime >= now then
if not fromUpdate then if not fromUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateSliceAndDice(nil, self.unit, true) end) self.bUpdateSnd = true
end end
self:Show(true) self:Show(true)
@ -244,7 +253,7 @@ function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
if ((IceHUD.WowVer >= 30000 and GetComboPoints(self.unit, "target") == 0) or (IceHUD.WowVer < 30000 and GetComboPoints() == 0)) or not UnitExists("target") then if ((IceHUD.WowVer >= 30000 and GetComboPoints(self.unit, "target") == 0) or (IceHUD.WowVer < 30000 and GetComboPoints() == 0)) or not UnitExists("target") then
if self.bIsVisible then if self.bIsVisible then
self.frame:SetScript("OnUpdate", nil) self.bUpdateSnd = nil
end end
if not self.moduleSettings.alwaysFullAlpha then if not self.moduleSettings.alwaysFullAlpha then

View File

@ -316,18 +316,23 @@ function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames)
return unpack(result) return unpack(result)
end end
function TargetCC.prototype:MyOnUpdate()
TargetCC.super.prototype.MyOnUpdate(self)
self:UpdateTargetDebuffs(nil, self.unit, true)
end
function TargetCC.prototype:UpdateTargetDebuffs(event, unit, isUpdate) function TargetCC.prototype:UpdateTargetDebuffs(event, unit, isUpdate)
local name, duration, remaining local name, duration, remaining
if not isUpdate then if not isUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateTargetDebuffs(nil, self.unit, true) end)
self.debuffName, self.debuffDuration, self.debuffRemaining = self:GetMaxDebuffDuration(self.unit, self.debuffList) self.debuffName, self.debuffDuration, self.debuffRemaining = self:GetMaxDebuffDuration(self.unit, self.debuffList)
else else
self.debuffRemaining = math.max(0, self.debuffRemaining - (1.0 / GetFramerate())) self.debuffRemaining = math.max(0, self.debuffRemaining - (GetTime() - self.lastUpdateTime))
if self.debuffRemaining <= 0 then if self.debuffRemaining <= 0 then
self.debuffName = nil self.debuffName = nil
self.frame:SetScript("OnUpdate", nil)
end end
end end
self.lastUpdateTime = GetTime()
name = self.debuffName name = self.debuffName
duration = self.debuffDuration duration = self.debuffDuration

View File

@ -899,8 +899,10 @@ function IceTargetInfo.prototype:CreateFrame(redraw)
self.frame:SetAttribute("unit", self.unit) self.frame:SetAttribute("unit", self.unit)
self.frame.menu = function() if not self.frame.menu then
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor") self.frame.menu = function()
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor")
end
end end
@ -1058,6 +1060,13 @@ function IceTargetInfo.prototype:CreateIconFrames(parent, direction, buffs, type
local lastX = 0 local lastX = 0
local lastBuffSize = 0 local lastBuffSize = 0
if not self.MyOnEnterBuffFunc then
self.MyOnEnterBuffFunc = function(this) self:BuffOnEnter(this) end
end
if not self.MyOnLeaveBuffFunc then
self.MyOnLeaveBuffFunc = function() GameTooltip:Hide() end
end
for i = 1, IceCore.BuffLimit do for i = 1, IceCore.BuffLimit do
if (not buffs[i]) then if (not buffs[i]) then
buffs[i] = CreateFrame("Frame", nil, parent) buffs[i] = CreateFrame("Frame", nil, parent)
@ -1149,8 +1158,8 @@ function IceTargetInfo.prototype:CreateIconFrames(parent, direction, buffs, type
buffs[i].id = i buffs[i].id = i
if (self.moduleSettings.mouseBuff) then if (self.moduleSettings.mouseBuff) then
buffs[i]:EnableMouse(true) buffs[i]:EnableMouse(true)
buffs[i]:SetScript("OnEnter", function(this, ...) self:BuffOnEnter(this, buffs[i].type or type) end) buffs[i]:SetScript("OnEnter", self.MyOnEnterBuffFunc)
buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end) buffs[i]:SetScript("OnLeave", self.MyOnLeaveBuffFunc)
else else
buffs[i]:EnableMouse(false) buffs[i]:EnableMouse(false)
buffs[i]:SetScript("OnEnter", nil) buffs[i]:SetScript("OnEnter", nil)
@ -1532,11 +1541,32 @@ function IceTargetInfo.prototype:OnLeave(frame)
end end
function IceTargetInfo.prototype:BuffOnEnter(this, type) function IceTargetInfo.prototype:BuffOnEnter(this)
if (not self:IsVisible()) then if (not self:IsVisible()) then
return return
end end
local type = nil
for i = 1, IceCore.BuffLimit do
if self.frame.buffFrame.buffs[i] and self.frame.buffFrame.buffs[i] == this then
type = self.frame.buffFrame.buffs[i].type
break
end
end
if not type then
for i = 1, IceCore.BuffLimit do
if self.frame.debuffFrame.buffs[i] and self.frame.debuffFrame.buffs[i] == this then
type = self.frame.debuffFrame.buffs[i].type
break
end
end
end
if not type then
return
end
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT") GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
if (type == "buff") then if (type == "buff") then
GameTooltip:SetUnitBuff(self.unit, this.id) GameTooltip:SetUnitBuff(self.unit, this.id)

View File

@ -174,20 +174,24 @@ function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames)
return unpack(result) return unpack(result)
end end
function TargetInvuln.prototype:MyOnUpdate()
TargetInvuln.super.prototype.MyOnUpdate(self)
self:UpdateTargetBuffs(nil, self.unit, true)
end
function TargetInvuln.prototype:UpdateTargetBuffs(event, unit, isUpdate) function TargetInvuln.prototype:UpdateTargetBuffs(event, unit, isUpdate)
local name, duration, remaining local name, duration, remaining
if not isUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateTargetBuffs(nil, self.unit, true) end)
self.buffName, self.buffDuration, self.buffRemaining = self:GetMaxbuffDuration(self.unit, self.buffList)
if not isUpdate then
self.buffName, self.buffDuration, self.buffRemaining = self:GetMaxbuffDuration(self.unit, self.buffList)
else else
self.buffRemaining = math.max(0, self.buffRemaining - (1.0 / GetFramerate())) self.buffRemaining = math.max(0, self.buffRemaining - (GetTime() - self.lastUpdateTime))
if self.buffRemaining <= 0 then if self.buffRemaining <= 0 then
self.buffName = nil self.buffName = nil
self.frame:SetScript("OnUpdate", nil)
end end
end end
self.lastUpdateTime = GetTime()
name = self.buffName name = self.buffName
duration = self.buffDuration duration = self.buffDuration

View File

@ -32,6 +32,8 @@ function IceThreat.prototype:init(name, unit)
self:SetDefaultColor("ThreatCustom", 255, 255, 0) self:SetDefaultColor("ThreatCustom", 255, 255, 0)
self:SetDefaultColor("ThreatPullAggro", 255, 0, 0) self:SetDefaultColor("ThreatPullAggro", 255, 0, 0)
self:SetDefaultColor("ThreatSecondPlace", 255, 255, 0) self:SetDefaultColor("ThreatSecondPlace", 255, 255, 0)
self.bTreatEmptyAsFull = true
end end
-- default settings -- default settings
@ -191,11 +193,6 @@ function IceThreat.prototype:CreateFrame()
self:CreateSecondThreatBar() self:CreateSecondThreatBar()
end end
-- needs to be inverted for threat bar
function IceThreat.prototype:UseTargetAlpha(scale)
return (scale and (scale > 0))
end
-- create the aggro range indicator bar -- create the aggro range indicator bar
function IceThreat.prototype:CreateAggroBar() function IceThreat.prototype:CreateAggroBar()
if not (self.aggroBar) then if not (self.aggroBar) then

View File

@ -12,11 +12,12 @@ function Vengeance.prototype:init()
Vengeance.super.prototype.init(self, "Vengeance", "player") Vengeance.super.prototype.init(self, "Vengeance", "player")
self.current = 0 self.current = 0
self.max = floor(0.1*UnitHealthMax(self.unit))
self.tooltipBuffer = CreateFrame("GameTooltip","tooltipBuffer",nil,"GameTooltipTemplate") self.tooltipBuffer = CreateFrame("GameTooltip","tooltipBuffer",nil,"GameTooltipTemplate")
self.tooltipBuffer:SetOwner(WorldFrame, "ANCHOR_NONE") self.tooltipBuffer:SetOwner(WorldFrame, "ANCHOR_NONE")
self:SetDefaultColor("Vengeance", 200, 45, 45) self:SetDefaultColor("Vengeance", 200, 45, 45)
self.bTreatEmptyAsFull = true
end end
-- default settings -- default settings
@ -50,11 +51,6 @@ function Vengeance.prototype:Disable(core)
self:UnregisterAllEvents() self:UnregisterAllEvents()
end end
-- OVERRIDE
function Vengeance.prototype:UseTargetAlpha(scale)
return (scale and (scale > 0))
end
function Vengeance.prototype:UpdateCurrent(event, unit) function Vengeance.prototype:UpdateCurrent(event, unit)
if (unit and (unit ~= self.unit)) then if (unit and (unit ~= self.unit)) then
return return