mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added basic implementation of Druid Eclipse bar for balance druids
This commit is contained in:
@ -44,11 +44,11 @@ function IceBarElement.prototype:Enable()
|
|||||||
-- fixup for the new 'invert' option
|
-- fixup for the new 'invert' option
|
||||||
if not self.moduleSettings.updatedReverseInverse then
|
if not self.moduleSettings.updatedReverseInverse then
|
||||||
self.moduleSettings.updatedReverseInverse = true
|
self.moduleSettings.updatedReverseInverse = true
|
||||||
|
|
||||||
if self.moduleSettings.reverse then
|
if self.moduleSettings.reverse then
|
||||||
self.moduleSettings.reverse = false
|
self.moduleSettings.reverse = false
|
||||||
self.moduleSettings.inverse = true
|
self.moduleSettings.inverse = true
|
||||||
|
|
||||||
self:SetBarFramePoints()
|
self:SetBarFramePoints()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -72,7 +72,7 @@ end
|
|||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function IceBarElement.prototype:GetDefaultSettings()
|
function IceBarElement.prototype:GetDefaultSettings()
|
||||||
local settings = IceBarElement.super.prototype.GetDefaultSettings(self)
|
local settings = IceBarElement.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
settings["side"] = IceCore.Side.Left
|
settings["side"] = IceCore.Side.Left
|
||||||
settings["offset"] = 1
|
settings["offset"] = 1
|
||||||
settings["scale"] = 1
|
settings["scale"] = 1
|
||||||
@ -109,7 +109,7 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
name = 'Look and Feel',
|
name = 'Look and Feel',
|
||||||
order = 29.9
|
order = 29.9
|
||||||
}
|
}
|
||||||
opts["side"] =
|
opts["side"] =
|
||||||
{
|
{
|
||||||
type = 'select',
|
type = 'select',
|
||||||
name = '|c' .. self.configColor .. 'Side|r',
|
name = '|c' .. self.configColor .. 'Side|r',
|
||||||
@ -135,8 +135,8 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 30
|
order = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["offset"] =
|
opts["offset"] =
|
||||||
{
|
{
|
||||||
type = 'range',
|
type = 'range',
|
||||||
name = '|c' .. self.configColor .. 'Offset|r',
|
name = '|c' .. self.configColor .. 'Offset|r',
|
||||||
@ -156,8 +156,8 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 31
|
order = 31
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["scale"] =
|
opts["scale"] =
|
||||||
{
|
{
|
||||||
type = 'range',
|
type = 'range',
|
||||||
name = '|c' .. self.configColor .. 'Scale|r',
|
name = '|c' .. self.configColor .. 'Scale|r',
|
||||||
@ -179,7 +179,7 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
order = 32
|
order = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["inverse"] =
|
opts["inverse"] =
|
||||||
{
|
{
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = 'Invert bar',
|
name = 'Invert bar',
|
||||||
@ -198,7 +198,7 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
order = 32
|
order = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["reverse"] =
|
opts["reverse"] =
|
||||||
{
|
{
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = 'Reverse direction',
|
name = 'Reverse direction',
|
||||||
@ -242,7 +242,7 @@ function IceBarElement.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 28
|
order = 28
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["bgVisible"] = {
|
opts["bgVisible"] = {
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = 'Bar background visible',
|
name = 'Bar background visible',
|
||||||
@ -308,7 +308,7 @@ if not self.moduleSettings.hideAnimationSettings then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
opts["widthModifier"] =
|
opts["widthModifier"] =
|
||||||
{
|
{
|
||||||
type = 'range',
|
type = 'range',
|
||||||
name = '|c' .. self.configColor .. 'Bar width modifier|r',
|
name = '|c' .. self.configColor .. 'Bar width modifier|r',
|
||||||
@ -329,7 +329,7 @@ end
|
|||||||
order = 33
|
order = 33
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["barVerticalOffset"] =
|
opts["barVerticalOffset"] =
|
||||||
{
|
{
|
||||||
type='range',
|
type='range',
|
||||||
name = '|c' .. self.configColor .. 'Bar vertical offset|r',
|
name = '|c' .. self.configColor .. 'Bar vertical offset|r',
|
||||||
@ -456,7 +456,7 @@ end
|
|||||||
end,
|
end,
|
||||||
order = 14
|
order = 14
|
||||||
},
|
},
|
||||||
|
|
||||||
lowerTextVisible = {
|
lowerTextVisible = {
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = 'Lower text visible',
|
name = 'Lower text visible',
|
||||||
@ -619,60 +619,64 @@ function IceBarElement.prototype:CreateFrame()
|
|||||||
self:CreateBackground()
|
self:CreateBackground()
|
||||||
self:CreateBar()
|
self:CreateBar()
|
||||||
self:CreateTexts()
|
self:CreateTexts()
|
||||||
|
|
||||||
self.frame:SetScale(self.moduleSettings.scale)
|
self.frame:SetScale(self.moduleSettings.scale)
|
||||||
-- never register the OnUpdate for the mirror bar since it's handled internally
|
-- 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
|
-- 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")
|
if not string.find(self.elementName, "MirrorBar")
|
||||||
and ((IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")) or (not string.find(self.elementName, "PlayerMana")))
|
and ((IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")) or (not string.find(self.elementName, "PlayerMana")))
|
||||||
and not self.moduleSettings.isCustomBar then
|
and not self.moduleSettings.isCustomBar and self:RegisterOnUpdate() then
|
||||||
self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end)
|
self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function IceBarElement.prototype:RegisterOnUpdate()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Creates background for the bar
|
-- Creates background for the bar
|
||||||
function IceBarElement.prototype:CreateBackground()
|
function IceBarElement.prototype:CreateBackground()
|
||||||
if not (self.frame) then
|
if not (self.frame) then
|
||||||
self.frame = CreateFrame("Frame", "IceHUD_"..self.elementName, self.parent)
|
self.frame = CreateFrame("Frame", "IceHUD_"..self.elementName, self.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.frame:SetFrameStrata("BACKGROUND")
|
self.frame:SetFrameStrata("BACKGROUND")
|
||||||
self.frame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
self.frame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
||||||
self.frame:SetHeight(self.settings.barHeight)
|
self.frame:SetHeight(self.settings.barHeight)
|
||||||
|
|
||||||
if not (self.frame.bg) then
|
if not (self.frame.bg) then
|
||||||
self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND")
|
self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND")
|
||||||
end
|
end
|
||||||
|
|
||||||
self.frame.bg:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture() .."BG")
|
self.frame.bg:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture() .."BG")
|
||||||
self.frame.bg:SetBlendMode(self.settings.barBgBlendMode)
|
self.frame.bg:SetBlendMode(self.settings.barBgBlendMode)
|
||||||
|
|
||||||
self.frame.bg:ClearAllPoints()
|
self.frame.bg:ClearAllPoints()
|
||||||
self.frame.bg:SetPoint("BOTTOMLEFT",self.frame,"BOTTOMLEFT")
|
self.frame.bg:SetPoint("BOTTOMLEFT",self.frame,"BOTTOMLEFT")
|
||||||
self.frame.bg:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT")
|
self.frame.bg:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT")
|
||||||
self.frame.bg:SetHeight(self.settings.barHeight)
|
self.frame.bg:SetHeight(self.settings.barHeight)
|
||||||
|
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
self.frame.bg:SetTexCoord(1, 0, 0, 1)
|
self.frame.bg:SetTexCoord(1, 0, 0, 1)
|
||||||
else
|
else
|
||||||
self.frame.bg:SetTexCoord(0, 1, 0, 1)
|
self.frame.bg:SetTexCoord(0, 1, 0, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.frame.bg:SetVertexColor(self:GetColor("undef", self.settings.alphabg))
|
self.frame.bg:SetVertexColor(self:GetColor("undef", self.settings.alphabg))
|
||||||
|
|
||||||
local ownPoint = "LEFT"
|
local ownPoint = "LEFT"
|
||||||
if (self.moduleSettings.side == ownPoint) then
|
if (self.moduleSettings.side == ownPoint) then
|
||||||
ownPoint = "RIGHT"
|
ownPoint = "RIGHT"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ofxx = (bar width) + (extra space in between the bars)
|
-- ofxx = (bar width) + (extra space in between the bars)
|
||||||
local offx = (self.settings.barProportion * self.settings.barWidth * self.moduleSettings.offset)
|
local offx = (self.settings.barProportion * self.settings.barWidth * self.moduleSettings.offset)
|
||||||
+ (self.moduleSettings.offset * self.settings.barSpace)
|
+ (self.moduleSettings.offset * self.settings.barSpace)
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
offx = offx * -1
|
offx = offx * -1
|
||||||
end
|
end
|
||||||
|
|
||||||
self.frame:ClearAllPoints()
|
self.frame:ClearAllPoints()
|
||||||
self.frame:SetPoint("BOTTOM"..ownPoint, self.parent, "BOTTOM"..self.moduleSettings.side, offx, self.moduleSettings.barVerticalOffset)
|
self.frame:SetPoint("BOTTOM"..ownPoint, self.parent, "BOTTOM"..self.moduleSettings.side, offx, self.moduleSettings.barVerticalOffset)
|
||||||
end
|
end
|
||||||
@ -683,7 +687,7 @@ function IceBarElement.prototype:CreateBar()
|
|||||||
if not (self.barFrame) then
|
if not (self.barFrame) then
|
||||||
self.barFrame = CreateFrame("Frame", nil, self.frame)
|
self.barFrame = CreateFrame("Frame", nil, self.frame)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.barFrame:SetFrameStrata("LOW")
|
self.barFrame:SetFrameStrata("LOW")
|
||||||
self:SetBarFramePoints()
|
self:SetBarFramePoints()
|
||||||
self.barFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
self.barFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
||||||
@ -692,7 +696,7 @@ function IceBarElement.prototype:CreateBar()
|
|||||||
if not (self.barFrame.bar) then
|
if not (self.barFrame.bar) then
|
||||||
self.barFrame.bar = self.barFrame:CreateTexture(nil, "LOW")
|
self.barFrame.bar = self.barFrame:CreateTexture(nil, "LOW")
|
||||||
end
|
end
|
||||||
|
|
||||||
self.barFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
|
self.barFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
|
||||||
self.barFrame.bar:SetBlendMode(self.settings.barBlendMode)
|
self.barFrame.bar:SetBlendMode(self.settings.barBlendMode)
|
||||||
self.barFrame.bar:SetAllPoints(self.barFrame)
|
self.barFrame.bar:SetAllPoints(self.barFrame)
|
||||||
@ -718,7 +722,7 @@ function IceBarElement.prototype:CreateTexts()
|
|||||||
-- Parnic - commented these out so that they conform to whatever width the string is set to
|
-- Parnic - commented these out so that they conform to whatever width the string is set to
|
||||||
-- self.frame.bottomUpperText:SetWidth(80)
|
-- self.frame.bottomUpperText:SetWidth(80)
|
||||||
-- self.frame.bottomLowerText:SetWidth(120)
|
-- self.frame.bottomLowerText:SetWidth(120)
|
||||||
|
|
||||||
self.frame.bottomUpperText:SetHeight(14)
|
self.frame.bottomUpperText:SetHeight(14)
|
||||||
self.frame.bottomLowerText:SetHeight(14)
|
self.frame.bottomLowerText:SetHeight(14)
|
||||||
|
|
||||||
@ -729,7 +733,7 @@ function IceBarElement.prototype:CreateTexts()
|
|||||||
|
|
||||||
local justify = "RIGHT"
|
local justify = "RIGHT"
|
||||||
if ((self.moduleSettings.side == "LEFT" and self.moduleSettings.offset <= 1) or
|
if ((self.moduleSettings.side == "LEFT" and self.moduleSettings.offset <= 1) or
|
||||||
(self.moduleSettings.side == "RIGHT" and self.moduleSettings.offset > 1))
|
(self.moduleSettings.side == "RIGHT" and self.moduleSettings.offset > 1))
|
||||||
then
|
then
|
||||||
justify = "LEFT"
|
justify = "LEFT"
|
||||||
end
|
end
|
||||||
@ -751,8 +755,8 @@ function IceBarElement.prototype:CreateTexts()
|
|||||||
if (self.moduleSettings.offset <= 1) then
|
if (self.moduleSettings.offset <= 1) then
|
||||||
offx = self.settings.barProportion * self.settings.barWidth - offx
|
offx = self.settings.barProportion * self.settings.barWidth - offx
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||||
offx = offx * -1
|
offx = offx * -1
|
||||||
end
|
end
|
||||||
@ -771,13 +775,13 @@ function IceBarElement.prototype:CreateTexts()
|
|||||||
|
|
||||||
self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, offy)
|
self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, offy)
|
||||||
self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, offy - 14)
|
self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, offy - 14)
|
||||||
|
|
||||||
if (self.moduleSettings.textVisible["upper"]) then
|
if (self.moduleSettings.textVisible["upper"]) then
|
||||||
self.frame.bottomUpperText:Show()
|
self.frame.bottomUpperText:Show()
|
||||||
else
|
else
|
||||||
self.frame.bottomUpperText:Hide()
|
self.frame.bottomUpperText:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.moduleSettings.textVisible["lower"]) then
|
if (self.moduleSettings.textVisible["lower"]) then
|
||||||
self.frame.bottomLowerText:Show()
|
self.frame.bottomLowerText:Show()
|
||||||
else
|
else
|
||||||
@ -926,16 +930,16 @@ function IceBarElement.prototype:SetBottomText1(text, color)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local alpha = self.alpha
|
local alpha = self.alpha
|
||||||
|
|
||||||
if (self.alpha > 0) then
|
if (self.alpha > 0) then
|
||||||
-- boost text alpha a bit to make it easier to see
|
-- boost text alpha a bit to make it easier to see
|
||||||
alpha = self.alpha + 0.1
|
alpha = self.alpha + 0.1
|
||||||
|
|
||||||
if (alpha > 1) then
|
if (alpha > 1) then
|
||||||
alpha = 1
|
alpha = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.moduleSettings.lockUpperTextAlpha and (self.alpha > 0)) then
|
if (self.moduleSettings.lockUpperTextAlpha and (self.alpha > 0)) then
|
||||||
alpha = 1
|
alpha = 1
|
||||||
end
|
end
|
||||||
@ -950,7 +954,7 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
|
|||||||
if not (self.moduleSettings.textVisible["lower"]) then
|
if not (self.moduleSettings.textVisible["lower"]) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (color) then
|
if not (color) then
|
||||||
color = "Text"
|
color = "Text"
|
||||||
end
|
end
|
||||||
@ -958,7 +962,7 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
|
|||||||
-- boost text alpha a bit to make it easier to see
|
-- boost text alpha a bit to make it easier to see
|
||||||
if (self.alpha > 0) then
|
if (self.alpha > 0) then
|
||||||
alpha = self.alpha + 0.1
|
alpha = self.alpha + 0.1
|
||||||
|
|
||||||
if (alpha > 1) then
|
if (alpha > 1) then
|
||||||
alpha = 1
|
alpha = 1
|
||||||
end
|
end
|
||||||
@ -987,16 +991,16 @@ end
|
|||||||
|
|
||||||
function IceBarElement.prototype:GetFormattedText(value1, value2)
|
function IceBarElement.prototype:GetFormattedText(value1, value2)
|
||||||
local color = "ffcccccc"
|
local color = "ffcccccc"
|
||||||
|
|
||||||
local bLeft = ""
|
local bLeft = ""
|
||||||
local bRight = ""
|
local bRight = ""
|
||||||
|
|
||||||
if (self.moduleSettings.brackets) then
|
if (self.moduleSettings.brackets) then
|
||||||
bLeft = "["
|
bLeft = "["
|
||||||
bRight = "]"
|
bRight = "]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if not (value2) then
|
if not (value2) then
|
||||||
return string.format("|c%s%s|r%s|c%s%s|r", color, bLeft, value1, color, bRight)
|
return string.format("|c%s%s|r%s|c%s%s|r", color, bLeft, value1, color, bRight)
|
||||||
end
|
end
|
||||||
|
39
IceHUD.lua
39
IceHUD.lua
@ -923,21 +923,44 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, 40 do
|
local i = 1
|
||||||
local name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or ""))
|
local name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or ""))
|
||||||
|
while name do
|
||||||
if (not matchByName and not texture) or (matchByName and not name) then
|
if (not matchByName and string.match(texture:upper(), ability:upper()))
|
||||||
break
|
or (matchByName and string.match(name:upper(), ability:upper())) then
|
||||||
end
|
|
||||||
|
|
||||||
if (not matchByName and string.match(texture:upper(), ability:upper())) or (matchByName and string.match(name:upper(), ability:upper())) then
|
|
||||||
return applications
|
return applications
|
||||||
end
|
end
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
|
name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or ""))
|
||||||
end
|
end
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function IceHUD:HasBuffs(unit, spellIDs)
|
||||||
|
local retval = {}
|
||||||
|
for i=1, #spellIDs do
|
||||||
|
retval[i] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local i = 1
|
||||||
|
local name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i)
|
||||||
|
while name do
|
||||||
|
for i=1, #spellIDs do
|
||||||
|
if spellIDs[i] == auraID then
|
||||||
|
retval[i] = applications == 0 and true or applications
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
|
name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i)
|
||||||
|
end
|
||||||
|
|
||||||
|
return retval
|
||||||
|
end
|
||||||
|
|
||||||
function IceHUD:OnDisable()
|
function IceHUD:OnDisable()
|
||||||
IceHUD.IceCore:Disable()
|
IceHUD.IceCore:Disable()
|
||||||
end
|
end
|
||||||
|
@ -75,3 +75,4 @@ modules\CustomMana.lua
|
|||||||
modules\ClassPowerCounter.lua
|
modules\ClassPowerCounter.lua
|
||||||
modules\HolyPower.lua
|
modules\HolyPower.lua
|
||||||
modules\Shards.lua
|
modules\Shards.lua
|
||||||
|
modules\EclipseBar.lua
|
||||||
|
216
modules/EclipseBar.lua
Normal file
216
modules/EclipseBar.lua
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
local AceOO = AceLibrary("AceOO-2.0")
|
||||||
|
|
||||||
|
local EclipseBar = AceOO.Class(IceBarElement)
|
||||||
|
EclipseBar.prototype.markerHeight = 6
|
||||||
|
EclipseBar.prototype.barUpdateColor = "EclipseLunar"
|
||||||
|
|
||||||
|
function EclipseBar.prototype:init()
|
||||||
|
EclipseBar.super.prototype.init(self, "EclipseBar")
|
||||||
|
|
||||||
|
self:SetDefaultColor("EclipseLunar", 31, 31, 231)
|
||||||
|
self:SetDefaultColor("EclipseLunarActive", 0, 0, 255)
|
||||||
|
self:SetDefaultColor("EclipseSolar", 190, 210, 31)
|
||||||
|
self:SetDefaultColor("EclipseSolarActive", 238, 251, 31)
|
||||||
|
self:SetDefaultColor("EclipseMarker", 255, 0, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:GetOptions()
|
||||||
|
local opts = EclipseBar.super.prototype.GetOptions(self)
|
||||||
|
opts.reverse.hidden = true
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:GetDefaultSettings()
|
||||||
|
local defaults = EclipseBar.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
|
defaults.textVisible.lower = false
|
||||||
|
defaults.offset = -1
|
||||||
|
defaults.enabled = true
|
||||||
|
defaults.usesDogTagStrings = false
|
||||||
|
defaults.textVerticalOffset = 13
|
||||||
|
defaults.textHorizontalOffset = 12
|
||||||
|
defaults.shouldAnimate = false
|
||||||
|
defaults.hideAnimationSettings = true
|
||||||
|
defaults.lockUpperTextAlpha = false
|
||||||
|
|
||||||
|
return defaults
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:Enable(core)
|
||||||
|
EclipseBar.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
|
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "UpdateShown")
|
||||||
|
self:RegisterEvent("PLAYER_TALENT_UPDATE", "UpdateShown")
|
||||||
|
self:RegisterEvent("MASTERY_UPDATE", "UpdateShown")
|
||||||
|
self:RegisterEvent("UNIT_AURA", "UpdateEclipseBuffs")
|
||||||
|
|
||||||
|
self.frame:SetScript("OnUpdate", function() self:Update() end)
|
||||||
|
|
||||||
|
self:UpdateShown()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:Disable(core)
|
||||||
|
EclipseBar.super.prototype.Disable(self, core)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:CreateFrame()
|
||||||
|
EclipseBar.super.prototype.CreateFrame(self)
|
||||||
|
|
||||||
|
self:CreateSolarBar()
|
||||||
|
self:CreateMarker()
|
||||||
|
self:UpdateShown()
|
||||||
|
self:UpdateAlpha()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:RegisterOnUpdate()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:CreateSolarBar()
|
||||||
|
if not (self.solarBar) then
|
||||||
|
self.solarBar = CreateFrame("Frame", nil, self.frame)
|
||||||
|
end
|
||||||
|
|
||||||
|
local solarTop = not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse)
|
||||||
|
|
||||||
|
self.solarBar:SetFrameStrata("BACKGROUND")
|
||||||
|
self.solarBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
||||||
|
self.solarBar:SetHeight(self.settings.barHeight)
|
||||||
|
self.solarBar:ClearAllPoints()
|
||||||
|
if solarTop then
|
||||||
|
self.solarBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
|
||||||
|
else
|
||||||
|
self.solarBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (self.solarBar.bar) then
|
||||||
|
self.solarBar.bar = self.solarBar:CreateTexture(nil, "LOW")
|
||||||
|
end
|
||||||
|
|
||||||
|
self.solarBar.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
|
||||||
|
self.solarBar.bar:SetAllPoints(self.solarBar)
|
||||||
|
|
||||||
|
self.solarBar.bar:SetVertexColor(self:GetColor("EclipseSolar", 1))
|
||||||
|
|
||||||
|
local pos = 0.5
|
||||||
|
local min_y = 0
|
||||||
|
local max_y = pos
|
||||||
|
if not solarTop then
|
||||||
|
min_y = 1-pos
|
||||||
|
max_y = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.moduleSettings.side == IceCore.Side.Left then
|
||||||
|
self.solarBar.bar:SetTexCoord(1, 0, min_y, max_y)
|
||||||
|
else
|
||||||
|
self.solarBar.bar:SetTexCoord(0, 1, min_y, max_y)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.solarBar.bar:Show()
|
||||||
|
self.solarBar:SetHeight(self.settings.barHeight * pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:CreateMarker()
|
||||||
|
local bIsNewBar = false
|
||||||
|
if not (self.markerBar) then
|
||||||
|
self.markerBar = CreateFrame("Frame", nil, self.frame)
|
||||||
|
bIsNewBar = true
|
||||||
|
end
|
||||||
|
|
||||||
|
self.markerBar:SetFrameStrata("LOW")
|
||||||
|
self.markerBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
|
||||||
|
self.markerBar:SetHeight(self.markerHeight)
|
||||||
|
self.markerBar:ClearAllPoints()
|
||||||
|
|
||||||
|
if not (self.markerBar.bar) then
|
||||||
|
self.markerBar.bar = self.markerBar:CreateTexture(nil, "LOW")
|
||||||
|
end
|
||||||
|
|
||||||
|
self.markerBar.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
|
||||||
|
self.markerBar.bar:SetAllPoints(self.markerBar)
|
||||||
|
|
||||||
|
self.markerBar.bar:SetVertexColor(self:GetColor("EclipseMarker", 1))
|
||||||
|
|
||||||
|
if bIsNewBar then
|
||||||
|
self:PositionMarker(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:PositionMarker(pos)
|
||||||
|
if self.moduleSettings.inverse then
|
||||||
|
pos = pos * -1
|
||||||
|
end
|
||||||
|
local coordPos = 0.5 + pos
|
||||||
|
local adjustedBarHeight = self.settings.barHeight - (self.markerHeight)
|
||||||
|
local heightScale = (self.markerHeight / self.settings.barHeight) / 2
|
||||||
|
|
||||||
|
local min_y = 1-coordPos-heightScale
|
||||||
|
local max_y = 1-coordPos+heightScale
|
||||||
|
|
||||||
|
if self.moduleSettings.side == IceCore.Side.Left then
|
||||||
|
self.markerBar.bar:SetTexCoord(1, 0, min_y, max_y)
|
||||||
|
else
|
||||||
|
self.markerBar.bar:SetTexCoord(0, 1, min_y, max_y)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.markerBar.bar:Show()
|
||||||
|
self.markerBar:SetPoint("CENTER", self.frame, "CENTER", 0, (self.settings.barHeight * pos))
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:UpdateShown()
|
||||||
|
local form = GetShapeshiftFormID();
|
||||||
|
|
||||||
|
if form == MOONKIN_FORM or not form then
|
||||||
|
if GetMasteryIndex(GetActiveTalentGroup(false, false)) == 1 then
|
||||||
|
self:Show(true)
|
||||||
|
else
|
||||||
|
self:Show(false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:Show(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:UseTargetAlpha(scale)
|
||||||
|
return UnitPower("player", SPELL_POWER_ECLIPSE) ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:UpdateEclipseBuffs()
|
||||||
|
local buffStatus = IceHUD:HasBuffs("player", {ECLIPSE_BAR_SOLAR_BUFF_ID, ECLIPSE_BAR_LUNAR_BUFF_ID})
|
||||||
|
local hasSolar = buffStatus[1]
|
||||||
|
local hasLunar = buffStatus[2]
|
||||||
|
|
||||||
|
if hasSolar then
|
||||||
|
self.barUpdateColor = "EclipseSolarActive"
|
||||||
|
self.solarBar.bar:SetVertexColor(self:GetColor("EclipseSolarActive", 1))
|
||||||
|
elseif hasLunar then
|
||||||
|
self.barUpdateColor = "EclipseLunarActive"
|
||||||
|
self.solarBar.bar:SetVertexColor(self:GetColor("EclipseLunarActive", 1))
|
||||||
|
else
|
||||||
|
self.barUpdateColor = "EclipseLunar"
|
||||||
|
self.solarBar.bar:SetVertexColor(self:GetColor("EclipseSolar", 1))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:UpdateEclipsePower()
|
||||||
|
local power = UnitPower("player", SPELL_POWER_ECLIPSE)
|
||||||
|
local maxPower = UnitPowerMax("player", SPELL_POWER_ECLIPSE)
|
||||||
|
|
||||||
|
self:SetBottomText1(abs((power/maxPower) * 100))
|
||||||
|
|
||||||
|
local pos = (power/maxPower) / 2
|
||||||
|
self:PositionMarker(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EclipseBar.prototype:Update()
|
||||||
|
EclipseBar.super.prototype.Update(self)
|
||||||
|
|
||||||
|
self:UpdateEclipsePower()
|
||||||
|
self:UpdateBar(0.5, self.barUpdateColor)
|
||||||
|
self:UpdateAlpha()
|
||||||
|
end
|
||||||
|
|
||||||
|
local _, unitClass = UnitClass("player")
|
||||||
|
if (unitClass == "DRUID" and IceHUD.WowVer >= 40000) then
|
||||||
|
IceHUD.EclipseBar = EclipseBar:new()
|
||||||
|
end
|
Reference in New Issue
Block a user