This commit is contained in:
Bunny67
2017-12-18 18:23:34 +03:00
parent ab0bcb8e91
commit 4622a32145
4 changed files with 90 additions and 61 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ for k, v in next, {
--]] --]]
EnableElement = function(self, name, unit) EnableElement = function(self, name, unit)
argcheck(name, 2, 'string') argcheck(name, 2, 'string')
argcheck(unit, 3, 'string', 'nil') argcheck(unit or self.unit, 3, 'string', 'nil')
local element = elements[name] local element = elements[name]
if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end
@@ -1,8 +1,10 @@
local E, L, V, P, G = unpack(ElvUI) local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames") local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local random = random local random = random
--WoW API / Variables
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local UnitIsTapped = UnitIsTapped local UnitIsTapped = UnitIsTapped
local UnitIsTappedByPlayer = UnitIsTappedByPlayer local UnitIsTappedByPlayer = UnitIsTappedByPlayer
@@ -19,7 +21,7 @@ function UF:Construct_HealthBar(frame, bg, text, textPos)
local health = CreateFrame("StatusBar", nil, frame) local health = CreateFrame("StatusBar", nil, frame)
UF["statusbars"][health] = true UF["statusbars"][health] = true
health:SetFrameLevel(10) health:SetFrameLevel(10) --Make room for Portrait and Power which should be lower by default
health.PostUpdate = self.PostUpdateHealth health.PostUpdate = self.PostUpdateHealth
CreateStatusBarTexturePointer(health) CreateStatusBarTexturePointer(health)
@@ -52,24 +54,26 @@ end
function UF:Configure_HealthBar(frame) function UF:Configure_HealthBar(frame)
if not frame.VARIABLES_SET then return end if not frame.VARIABLES_SET then return end
local db = frame.db local db = frame.db
local health = frame.Health local health = frame.Health
health.Smooth = self.db.smoothbars health.Smooth = self.db.smoothbars
health.SmoothSpeed = self.db.smoothSpeed * 10 health.SmoothSpeed = self.db.smoothSpeed * 10
if health.value then --Text
if db.health and health.value then
local attachPoint = self:GetObjectAnchorPoint(frame, db.health.attachTextTo) local attachPoint = self:GetObjectAnchorPoint(frame, db.health.attachTextTo)
health.value:ClearAllPoints() health.value:ClearAllPoints()
health.value:SetPoint(db.health.position, attachPoint, db.health.position, db.health.xOffset, db.health.yOffset) health.value:SetPoint(db.health.position, attachPoint, db.health.position, db.health.xOffset, db.health.yOffset)
frame:Tag(health.value, db.health.text_format) frame:Tag(health.value, db.health.text_format)
end end
--Colors
health.colorSmooth = nil health.colorSmooth = nil
health.colorHealth = nil health.colorHealth = nil
health.colorClass = nil health.colorClass = nil
health.colorReaction = nil health.colorReaction = nil
if db.colorOverride and db.colorOverride == "FORCE_ON" then if db.colorOverride and db.colorOverride == "FORCE_ON" then
health.colorClass = true health.colorClass = true
health.colorReaction = true health.colorReaction = true
@@ -92,46 +96,55 @@ function UF:Configure_HealthBar(frame)
end end
end end
--Position
health:ClearAllPoints() health:ClearAllPoints()
if frame.ORIENTATION == "LEFT" then if frame.ORIENTATION == "LEFT" then
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.HAPPINESS_WIDTH or 0)) health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetHeight(frame.UNIT_HEIGHT - frame.POWERBAR_HEIGHT - (frame.BORDER + frame.SPACING) - frame.CLASSBAR_YOFFSET) health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET - (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET)
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
elseif frame.USE_MINI_POWERBAR then
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.SPACING + (frame.POWERBAR_HEIGHT/2))
else
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
end
elseif frame.ORIENTATION == "RIGHT" then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET + (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET)
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
elseif frame.USE_MINI_POWERBAR then
health:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.SPACING + (frame.POWERBAR_HEIGHT/2))
else
health:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
end
elseif frame.ORIENTATION == "MIDDLE" then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET) health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET, frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET) health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
elseif frame.USE_MINI_POWERBAR then elseif frame.USE_MINI_POWERBAR then
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.SPACING + (frame.POWERBAR_HEIGHT/2)) health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
else else
health:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET) health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
end
elseif frame.ORIENTATION == "RIGHT" then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
elseif frame.USE_MINI_POWERBAR then
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
else
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
end
elseif frame.ORIENTATION == "MIDDLE" then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + (frame.POWERBAR_OFFSET*2)))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
elseif frame.USE_MINI_POWERBAR then
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
else
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
end end
end end
@@ -146,15 +159,18 @@ function UF:Configure_HealthBar(frame)
end end
if db.health then if db.health then
--Party/Raid Frames allow to change statusbar orientation
if db.health.orientation then if db.health.orientation then
health:SetOrientation(db.health.orientation) health:SetOrientation(db.health.orientation)
end end
--Party/Raid Frames can toggle frequent updates
if db.health.frequentUpdates then if db.health.frequentUpdates then
health.frequentUpdates = db.health.frequentUpdates health.frequentUpdates = db.health.frequentUpdates
end end
end end
--Transparency Settings
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, (frame.USE_PORTRAIT and frame.USE_PORTRAIT_OVERLAY) ~= true) UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, (frame.USE_PORTRAIT and frame.USE_PORTRAIT_OVERLAY) ~= true)
frame:UpdateElement("Health") frame:UpdateElement("Health")
@@ -206,6 +222,7 @@ function UF:PostUpdateHealth(unit, min, max)
end end
end end
--Backdrop
if colors.customhealthbackdrop then if colors.customhealthbackdrop then
local backdrop = colors.health_backdrop local backdrop = colors.health_backdrop
self.bg:SetVertexColor(backdrop.r, backdrop.g, backdrop.b) self.bg:SetVertexColor(backdrop.r, backdrop.g, backdrop.b)
@@ -1,8 +1,10 @@
local E, L, V, P, G = unpack(ElvUI) local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames") local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local random = random local random = random
--WoW API / Variables
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local ns = oUF local ns = oUF
@@ -49,17 +51,18 @@ function UF:Configure_Power(frame)
if not frame.VARIABLES_SET then return end if not frame.VARIABLES_SET then return end
local db = frame.db local db = frame.db
local power = frame.Power local power = frame.Power
power.origParent = frame
if frame.USE_POWERBAR then if frame.USE_POWERBAR then
if not frame:IsElementEnabled("Power") then if not frame:IsElementEnabled("Power") then
frame:EnableElement("Power", frame.unit) frame:EnableElement("Power")
power:Show() power:Show()
end end
power.Smooth = self.db.smoothbars power.Smooth = self.db.smoothbars
power.SmoothSpeed = self.db.smoothSpeed * 10 power.SmoothSpeed = self.db.smoothSpeed * 10
--Text
local attachPoint = self:GetObjectAnchorPoint(frame, db.power.attachTextTo) local attachPoint = self:GetObjectAnchorPoint(frame, db.power.attachTextTo)
power.value:ClearAllPoints() power.value:ClearAllPoints()
power.value:SetPoint(db.power.position, attachPoint, db.power.position, db.power.xOffset, db.power.yOffset) power.value:SetPoint(db.power.position, attachPoint, db.power.position, db.power.xOffset, db.power.yOffset)
@@ -71,6 +74,7 @@ function UF:Configure_Power(frame)
power.value:SetParent(frame.RaisedElementParent) power.value:SetParent(frame.RaisedElementParent)
end end
--Colors
power.colorClass = nil power.colorClass = nil
power.colorReaction = nil power.colorReaction = nil
power.colorPower = nil power.colorPower = nil
@@ -81,17 +85,19 @@ function UF:Configure_Power(frame)
power.colorPower = true power.colorPower = true
end end
--Fix height in case it is lower than the theme allows
local heightChanged = false local heightChanged = false
if (not self.thinBorders and not E.PixelMode) and frame.POWERBAR_HEIGHT < 7 then if (not self.thinBorders and not E.PixelMode) and frame.POWERBAR_HEIGHT < 7 then --A height of 7 means 6px for borders and just 1px for the actual power statusbar
frame.POWERBAR_HEIGHT = 7 frame.POWERBAR_HEIGHT = 7
if(db.power) then db.power.height = 7 end if db.power then db.power.height = 7 end
heightChanged = true heightChanged = true
elseif (self.thinBorders or E.PixelMode) and frame.POWERBAR_HEIGHT < 3 then elseif (self.thinBorders or E.PixelMode) and frame.POWERBAR_HEIGHT < 3 then --A height of 3 means 2px for borders and just 1px for the actual power statusbar
frame.POWERBAR_HEIGHT = 3 frame.POWERBAR_HEIGHT = 3
if db.power then db.power.height = 3 end if db.power then db.power.height = 3 end
heightChanged = true heightChanged = true
end end
if heightChanged then if heightChanged then
--Update health size
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame) frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
UF:Configure_HealthBar(frame) UF:Configure_HealthBar(frame)
end end
@@ -122,47 +128,53 @@ function UF:Configure_Power(frame)
power.Holder.mover:SetAlpha(1) power.Holder.mover:SetAlpha(1)
end end
power:SetFrameLevel(50) power:SetFrameLevel(50) --RaisedElementParent uses 100, we want lower value to allow certain icons and texts to appear above power
power.backdrop:SetFrameLevel(49)
elseif frame.USE_POWERBAR_OFFSET then elseif frame.USE_POWERBAR_OFFSET then
if frame.ORIENTATION == "LEFT" then if frame.ORIENTATION == "LEFT" then
power:SetPoint("TOPRIGHT", frame.Health, "TOPRIGHT", frame.POWERBAR_OFFSET + frame.HAPPINESS_WIDTH, -frame.POWERBAR_OFFSET) power:SetPoint("TOPRIGHT", frame.Health, "TOPRIGHT", frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
power:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET) power:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
elseif frame.ORIENTATION == "MIDDLE" then elseif frame.ORIENTATION == "MIDDLE" then
power:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING, -frame.POWERBAR_OFFSET -frame.CLASSBAR_YOFFSET) power:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING, -frame.POWERBAR_OFFSET -frame.CLASSBAR_YOFFSET)
power:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.BORDER - frame.SPACING, frame.BORDER) power:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.BORDER - frame.SPACING, frame.BORDER)
else else
power:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", -frame.POWERBAR_OFFSET - frame.HAPPINESS_WIDTH, -frame.POWERBAR_OFFSET) power:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
power:SetPoint("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET) power:SetPoint("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
end end
power:SetFrameLevel(frame.Health:GetFrameLevel() -5) power:SetFrameLevel(frame.Health:GetFrameLevel() -5) --Health uses 10
power.backdrop:SetFrameLevel(frame.Health:GetFrameLevel() - 6)
elseif frame.USE_INSET_POWERBAR then elseif frame.USE_INSET_POWERBAR then
power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2)) power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
power:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.BORDER + (frame.BORDER*2), frame.BORDER + (frame.BORDER*2)) power:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.BORDER + (frame.BORDER*2), frame.BORDER + (frame.BORDER*2))
power:SetPoint("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -(frame.BORDER + (frame.BORDER*2)), frame.BORDER + (frame.BORDER*2)) power:SetPoint("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -(frame.BORDER + (frame.BORDER*2)), frame.BORDER + (frame.BORDER*2))
power:SetFrameLevel(50) power:SetFrameLevel(50)
power.backdrop:SetFrameLevel(49)
elseif frame.USE_MINI_POWERBAR then elseif frame.USE_MINI_POWERBAR then
power:SetWidth(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2)) power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
if frame.ORIENTATION == "LEFT" then if frame.ORIENTATION == "LEFT" then
power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2) power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2)
power:SetPoint("RIGHT", frame, "BOTTOMRIGHT", -(frame.BORDER*2 + 4) -frame.HAPPINESS_WIDTH, ((frame.POWERBAR_HEIGHT-frame.BORDER)/2)) power:SetPoint("RIGHT", frame, "BOTTOMRIGHT", -(frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
elseif frame.ORIENTATION == "RIGHT" then elseif frame.ORIENTATION == "RIGHT" then
power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2) power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2)
power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4) +frame.HAPPINESS_WIDTH, ((frame.POWERBAR_HEIGHT-frame.BORDER)/2)) power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
else else
power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2)) power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
power:SetPoint("RIGHT", frame, "BOTTOMRIGHT", -(frame.BORDER*2 + 4) -frame.HAPPINESS_WIDTH, ((frame.POWERBAR_HEIGHT-frame.BORDER)/2)) power:SetPoint("RIGHT", frame, "BOTTOMRIGHT", -(frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
end end
power:SetFrameLevel(50) power:SetFrameLevel(50)
power.backdrop:SetFrameLevel(49)
else else
power:SetPoint("TOPRIGHT", frame.Health.backdrop, "BOTTOMRIGHT", -frame.BORDER, -frame.SPACING*3) power:SetPoint("TOPRIGHT", frame.Health.backdrop, "BOTTOMRIGHT", -frame.BORDER, -frame.SPACING*3)
power:SetPoint("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER, -frame.SPACING*3) power:SetPoint("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER, -frame.SPACING*3)
power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2)) power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
power:SetFrameLevel(frame.Health:GetFrameLevel() - 5) power:SetFrameLevel(frame.Health:GetFrameLevel() - 5)
power.backdrop:SetFrameLevel(frame.Health:GetFrameLevel() - 6)
end end
--Hide mover until we detach again
if not frame.POWERBAR_DETACHED then if not frame.POWERBAR_DETACHED then
if power.Holder and power.Holder.mover then if power.Holder and power.Holder.mover then
power.Holder.mover:SetScale(0.0001) power.Holder.mover:SetScale(0.0001)
@@ -175,7 +187,6 @@ function UF:Configure_Power(frame)
else else
power:SetFrameStrata("LOW") power:SetFrameStrata("LOW")
end end
if db.power.strataAndLevel and db.power.strataAndLevel.useCustomLevel then if db.power.strataAndLevel and db.power.strataAndLevel.useCustomLevel then
power:SetFrameLevel(db.power.strataAndLevel.frameLevel) power:SetFrameLevel(db.power.strataAndLevel.frameLevel)
power.backdrop:SetFrameLevel(power:GetFrameLevel() - 1) power.backdrop:SetFrameLevel(power:GetFrameLevel() - 1)
@@ -189,10 +200,11 @@ function UF:Configure_Power(frame)
elseif frame:IsElementEnabled("Power") then elseif frame:IsElementEnabled("Power") then
frame:DisableElement("Power") frame:DisableElement("Power")
power:Hide() power:Hide()
frame:Tag(power.value, "")
end end
if frame.DruidAltMana then if frame.DruidAltMana then
if(db.power.druidMana) then if db.power.druidMana then
frame:EnableElement("DruidAltMana") frame:EnableElement("DruidAltMana")
else else
frame:DisableElement("DruidAltMana") frame:DisableElement("DruidAltMana")
@@ -200,9 +212,8 @@ function UF:Configure_Power(frame)
end end
end end
if frame.Power then --Transparency Settings
UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, frame.Power, frame.Power.bg) UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, frame.Power, frame.Power.bg)
end
end end
function UF:PostUpdatePower(unit, cur, max) function UF:PostUpdatePower(unit, cur, max)
@@ -213,6 +213,7 @@ function UF:Construct_UF(frame, unit)
frame.SHADOW_SPACING = 3 frame.SHADOW_SPACING = 3
frame.CLASSBAR_YOFFSET = 0 --placeholder frame.CLASSBAR_YOFFSET = 0 --placeholder
frame.BOTTOM_OFFSET = 0 --placeholder frame.BOTTOM_OFFSET = 0 --placeholder
frame:SetFrameStrata("LOW")
frame.RaisedElementParent = CreateFrame("Frame", nil, frame) frame.RaisedElementParent = CreateFrame("Frame", nil, frame)
frame.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, frame.RaisedElementParent) frame.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, frame.RaisedElementParent)