mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- now fully compatible with blizzard's "predicted power" system to constantly show energy/mana gains instead of ticking them
This commit is contained in:
@ -34,7 +34,8 @@ end
|
|||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function PlayerMana.prototype:GetOptions()
|
function PlayerMana.prototype:GetOptions()
|
||||||
local opts = PlayerMana.super.prototype.GetOptions(self)
|
local opts = PlayerMana.super.prototype.GetOptions(self)
|
||||||
|
|
||||||
|
if self:ShouldUseTicker() then
|
||||||
opts["tickerEnabled"] = {
|
opts["tickerEnabled"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Show rogue/cat energy ticker",
|
name = "Show rogue/cat energy ticker",
|
||||||
@ -72,7 +73,7 @@ function PlayerMana.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 52
|
order = 52
|
||||||
}
|
}
|
||||||
|
end
|
||||||
opts["scaleManaColor"] = {
|
opts["scaleManaColor"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Color bar by mana %",
|
name = "Color bar by mana %",
|
||||||
@ -99,20 +100,26 @@ function PlayerMana.prototype:Enable(core)
|
|||||||
|
|
||||||
self:CreateTickerFrame()
|
self:CreateTickerFrame()
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_MANA", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
||||||
self:RegisterEvent("UNIT_RAGE", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXRAGE", "Update")
|
self:RegisterEvent("UNIT_MAXRAGE", "Update")
|
||||||
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy")
|
|
||||||
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
||||||
-- DK rune stuff
|
-- DK rune / wotlk stuff
|
||||||
if IceHUD.WowVer >= 30000 then
|
if IceHUD.WowVer >= 30000 then
|
||||||
-- if GetCVarBool("predictedPower") and self.frame then
|
-- allow new 'predicted power' stuff to show the power updates constantly instead of ticking
|
||||||
-- self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end)
|
if GetCVarBool("predictedPower") and self.frame then
|
||||||
-- else
|
self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end)
|
||||||
|
else
|
||||||
|
self:RegisterEvent("UNIT_MANA", "Update")
|
||||||
|
self:RegisterEvent("UNIT_RAGE", "Update")
|
||||||
|
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy")
|
||||||
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
|
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
|
||||||
-- end
|
end
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
|
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
|
||||||
|
else
|
||||||
|
self:RegisterEvent("UNIT_MANA", "Update")
|
||||||
|
self:RegisterEvent("UNIT_RAGE", "Update")
|
||||||
|
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy")
|
||||||
end
|
end
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
|
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
|
||||||
@ -120,6 +127,10 @@ function PlayerMana.prototype:Enable(core)
|
|||||||
self:ManaType(self.unit)
|
self:ManaType(self.unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function PlayerMana.prototype:ShouldUseTicker()
|
||||||
|
return IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function PlayerMana.prototype:Redraw()
|
function PlayerMana.prototype:Redraw()
|
||||||
@ -148,15 +159,17 @@ function PlayerMana.prototype:ManaType(unit)
|
|||||||
|
|
||||||
self.manaType = UnitPowerType(self.unit)
|
self.manaType = UnitPowerType(self.unit)
|
||||||
|
|
||||||
-- register ticker for rogue energy
|
if self:ShouldUseTicker() then
|
||||||
if (self.moduleSettings.tickerEnabled and (self.manaType == 3) and self.alive) then
|
-- register ticker for rogue energy
|
||||||
self.tickerFrame:Show()
|
if (self.moduleSettings.tickerEnabled and (self.manaType == 3) and self.alive) then
|
||||||
self.tickerFrame:SetScript("OnUpdate", function() self:EnergyTick() end)
|
self.tickerFrame:Show()
|
||||||
else
|
self.tickerFrame:SetScript("OnUpdate", function() self:EnergyTick() end)
|
||||||
self.tickerFrame:Hide()
|
else
|
||||||
self.tickerFrame:SetScript("OnUpdate", nil)
|
self.tickerFrame:Hide()
|
||||||
|
self.tickerFrame:SetScript("OnUpdate", nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:Update(self.unit)
|
self:Update(self.unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -166,8 +179,8 @@ function PlayerMana.prototype:Update(unit)
|
|||||||
if (unit and (unit ~= "player")) then
|
if (unit and (unit ~= "player")) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.manaType ~= 3) then
|
if (self.manaType ~= 3 and self:ShouldUseTicker()) then
|
||||||
self.tickerFrame:Hide()
|
self.tickerFrame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -186,13 +199,15 @@ function PlayerMana.prototype:Update(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:UpdateBar(self.mana/self.maxMana, color)
|
self:UpdateBar(self.mana/self.maxMana, color)
|
||||||
|
|
||||||
-- hide ticker if rest of the bar is not visible
|
if self:ShouldUseTicker() then
|
||||||
if (self.alpha == 0) then
|
-- hide ticker if rest of the bar is not visible
|
||||||
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", 0))
|
if (self.alpha == 0) then
|
||||||
else
|
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", 0))
|
||||||
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", self.moduleSettings.tickerAlpha))
|
else
|
||||||
end
|
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", self.moduleSettings.tickerAlpha))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||||
-- extra hack for whiny rogues (are there other kind?)
|
-- extra hack for whiny rogues (are there other kind?)
|
||||||
@ -226,11 +241,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function PlayerMana.prototype:UpdateEnergy(unit)
|
function PlayerMana.prototype:UpdateEnergy(unit)
|
||||||
if (unit and (unit ~= "player")) then
|
if (unit and (unit ~= "player")) or (not self:ShouldUseTicker()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if ((not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) and
|
if ((not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) and
|
||||||
(self.moduleSettings.tickerEnabled)) then
|
(self.moduleSettings.tickerEnabled)) then
|
||||||
self.tickStart = GetTime()
|
self.tickStart = GetTime()
|
||||||
@ -243,6 +257,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function PlayerMana.prototype:EnergyTick()
|
function PlayerMana.prototype:EnergyTick()
|
||||||
|
if not self:ShouldUseTicker() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not (self.tickStart) then
|
if not (self.tickStart) then
|
||||||
self.tickerFrame:Hide()
|
self.tickerFrame:Hide()
|
||||||
return
|
return
|
||||||
@ -269,6 +287,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function PlayerMana.prototype:CreateTickerFrame()
|
function PlayerMana.prototype:CreateTickerFrame()
|
||||||
|
if not self:ShouldUseTicker() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not (self.tickerFrame) then
|
if not (self.tickerFrame) then
|
||||||
self.tickerFrame = CreateFrame("StatusBar", nil, self.barFrame)
|
self.tickerFrame = CreateFrame("StatusBar", nil, self.barFrame)
|
||||||
end
|
end
|
||||||
|
@ -29,24 +29,30 @@ end
|
|||||||
function TargetMana.prototype:Enable(core)
|
function TargetMana.prototype:Enable(core)
|
||||||
TargetMana.super.prototype.Enable(self, core)
|
TargetMana.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_MANA", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
||||||
self:RegisterEvent("UNIT_RAGE", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXRAGE", "Update")
|
self:RegisterEvent("UNIT_MAXRAGE", "Update")
|
||||||
self:RegisterEvent("UNIT_ENERGY", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
||||||
self:RegisterEvent("UNIT_FOCUS", "Update")
|
|
||||||
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
|
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
|
||||||
self:RegisterEvent("UNIT_AURA", "Update")
|
self:RegisterEvent("UNIT_AURA", "Update")
|
||||||
self:RegisterEvent("UNIT_FLAGS", "Update")
|
self:RegisterEvent("UNIT_FLAGS", "Update")
|
||||||
-- DK rune stuff
|
-- DK rune stuff
|
||||||
if IceHUD.WowVer >= 30000 then
|
if IceHUD.WowVer >= 30000 then
|
||||||
-- if GetCVarBool("predictedPower") and self.frame then
|
if GetCVarBool("predictedPower") and self.frame then
|
||||||
-- self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end)
|
self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end)
|
||||||
-- else
|
else
|
||||||
|
self:RegisterEvent("UNIT_MANA", "Update")
|
||||||
|
self:RegisterEvent("UNIT_RAGE", "Update")
|
||||||
|
self:RegisterEvent("UNIT_ENERGY", "Update")
|
||||||
|
self:RegisterEvent("UNIT_FOCUS", "Update")
|
||||||
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
|
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
|
||||||
-- end
|
end
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
|
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
|
||||||
|
else
|
||||||
|
self:RegisterEvent("UNIT_MANA", "Update")
|
||||||
|
self:RegisterEvent("UNIT_RAGE", "Update")
|
||||||
|
self:RegisterEvent("UNIT_ENERGY", "Update")
|
||||||
|
self:RegisterEvent("UNIT_FOCUS", "Update")
|
||||||
end
|
end
|
||||||
|
|
||||||
self:Update("target")
|
self:Update("target")
|
||||||
|
Reference in New Issue
Block a user