Commit bb63ed44 authored by Azilroka's avatar Azilroka
Browse files

UF: Power Prediction

parent 354aea24
......@@ -15,6 +15,7 @@
<Script file='phaseindicator.lua'/>
<Script file='portrait.lua'/>
<Script file='power.lua'/>
<Script file='powerprediction.lua'/>
<Script file='PvPIcon.lua'/>
<Script file='pvpindicator.lua'/>
<Script file='pvpspecicon.lua'/>
......
......@@ -7,7 +7,6 @@ local CreateFrame = CreateFrame
function UF:Construct_PowerPrediction(frame)
local mainBar = CreateFrame('StatusBar', nil, frame.Power)
mainBar:SetReverseFill(true)
mainBar:SetStatusBarTexture(E["media"].blankTex)
mainBar:Hide()
......@@ -18,7 +17,6 @@ function UF:Construct_PowerPrediction(frame)
if frame.AdditionalPower then
local altBar = CreateFrame('StatusBar', nil, frame.AdditionalPower)
altBar:SetReverseFill(true)
altBar:SetStatusBarTexture(E["media"].blankTex)
altBar:Hide()
......@@ -30,30 +28,43 @@ end
function UF:Configure_PowerPrediction(frame)
local powerPrediction = frame.PowerPrediction
local c = self.db.colors.powerPrediction
if frame.db.powerPrediction then
if frame.db.power.powerPrediction then
if not frame:IsElementEnabled('PowerPrediction') then
frame:EnableElement('PowerPrediction')
end
local mainBar, altBar = powerPrediction.mainBar, powerPrediction.altBar
local reverseFill = not not frame.db.power.reverseFill
local reverseFill = frame.db.power.reverseFill
local r, g, b = frame.Power:GetStatusBarColor()
mainBar:SetPoint('TOP')
mainBar:SetPoint('BOTTOM')
mainBar:SetWidth(200)
mainBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a)
mainBar:SetWidth(frame.Power:GetWidth())
mainBar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
mainBar:SetPoint('RIGHT', self.Power:GetStatusBarTexture(), 'RIGHT')
if reverseFill then
mainBar:SetReverseFill(false)
mainBar:SetPoint('LEFT', frame.Power:GetStatusBarTexture(), 'LEFT')
else
mainBar:SetReverseFill(true)
mainBar:SetPoint('RIGHT', frame.Power:GetStatusBarTexture(), 'RIGHT')
end
if altBar then
r, g, b = frame.AdditionalPower:GetStatusBarColor()
altBar:SetPoint('TOP')
altBar:SetPoint('BOTTOM')
altBar:SetWidth(200)
altBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.a)
altBar:SetWidth(frame.AdditionalPower:GetWidth())
altBar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
altBar:SetPoint('RIGHT', self.AdditionalPower:GetStatusBarTexture(), 'RIGHT')
if reverseFill then
altBar:SetReverseFill(false)
altBar:SetPoint('LEFT', frame.AdditionalPower:GetStatusBarTexture(), 'LEFT')
else
altBar:SetReverseFill(true)
altBar:SetPoint('RIGHT', frame.AdditionalPower:GetStatusBarTexture(), 'RIGHT')
end
end
else
if frame:IsElementEnabled('PowerPrediction') then
......
......@@ -70,6 +70,7 @@ function UF:Construct_ArenaFrames(frame)
if not frame.isChild then
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
frame.Portrait2D = self:Construct_Portrait(frame, 'texture')
......@@ -163,6 +164,9 @@ function UF:Update_ArenaFrames(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -24,6 +24,8 @@ function UF:Construct_BossFrames(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -105,6 +107,9 @@ function UF:Update_BossFrames(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -44,6 +44,7 @@ function UF:Construct_PartyFrames()
self.Health = UF:Construct_HealthBar(self, true, true, 'RIGHT')
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.Power.frequentUpdates = false;
self.PowerPrediction = self:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
......
......@@ -30,6 +30,8 @@ function UF:Construct_RaidFrames()
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.Power.frequentUpdates = false;
self.PowerPrediction = self:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
......@@ -186,6 +188,9 @@ function UF:Update_RaidFrames(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -30,6 +30,8 @@ function UF:Construct_Raid40Frames()
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.Power.frequentUpdates = false;
self.PowerPrediction = self:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
......@@ -185,6 +187,9 @@ function UF:Update_Raid40Frames(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -18,6 +18,8 @@ function UF:Construct_FocusFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -91,6 +93,9 @@ function UF:Update_FocusFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -17,6 +17,8 @@ function UF:Construct_FocusTargetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -83,6 +85,9 @@ function UF:Update_FocusTargetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -20,6 +20,8 @@ function UF:Construct_PetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -93,6 +95,9 @@ function UF:Update_PetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -17,6 +17,8 @@ function UF:Construct_PetTargetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -80,6 +82,9 @@ function UF:Update_PetTargetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -25,6 +25,8 @@ function UF:Construct_PlayerFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true;
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -150,6 +152,9 @@ function UF:Update_PlayerFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -18,6 +18,8 @@ function UF:Construct_TargetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true;
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -102,6 +104,9 @@ function UF:Update_TargetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -14,6 +14,8 @@ function UF:Construct_TargetTargetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -81,6 +83,9 @@ function UF:Update_TargetTargetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -14,6 +14,8 @@ function UF:Construct_TargetTargetTargetFrame(frame)
frame.Power = self:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = self:Construct_PowerPrediction(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, 'model')
......@@ -79,6 +81,9 @@ function UF:Update_TargetTargetTargetFrame(frame, db)
--Power
UF:Configure_Power(frame)
-- Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
......
......@@ -1231,6 +1231,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '[powercolor][power:current]',
['width'] = 'fill',
......@@ -1439,6 +1440,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '[powercolor][power:current]',
['width'] = 'fill',
......@@ -1589,6 +1591,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -1682,6 +1685,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -1780,6 +1784,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -1907,6 +1912,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = false,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -2004,6 +2010,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -2126,6 +2133,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = false,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -2212,6 +2220,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '[powercolor][power:current]',
['width'] = 'fill',
......@@ -2333,6 +2342,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '[powercolor][power:current]',
['width'] = 'fill',
......@@ -2465,6 +2475,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '[powercolor][power:current]',
['attachTextTo'] = 'Health',
......@@ -2692,6 +2703,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = true,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......@@ -2872,6 +2884,7 @@ P['unitframe'] = {
},
['power'] = {
['enable'] = false,
['powerPrediction'] = false,
['reverseFill'] = false,
['text_format'] = '',
['width'] = 'fill',
......
......@@ -1411,6 +1411,11 @@ local function GetOptionsTable_Power(hasDetatchOption, updateFunc, groupName, nu
order = 1,
name = L["Enable"],
},
powerPrediction = {
type = 'toggle',
order = 2,
name = L["Power Prediction"],
},
text_format = {
order = 100,
name = L["Text Format"],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment