Skip to content

Commit

Permalink
Options re-org added ColorClass - Closes #166
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed May 5, 2019
1 parent e38cd02 commit b0cd242
Showing 1 changed file with 169 additions and 109 deletions.
278 changes: 169 additions & 109 deletions Components/Nameplates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function module:Flash(self)
end

local PostCastStart = function(self, unit, name)
if self.notInterruptible == false and SUI.DBMod.NamePlates.FlashOnInterruptibleCast and UnitIsEnemy('player', unit) then
if self.notInterruptible == false and SUI.DBMod.NamePlates.Castbar.FlashOnInterruptible and UnitIsEnemy('player', unit) then
_G[self.PName].Castbar:SetStatusBarColor(0, 0, 0)
module:ScheduleTimer('Flash', .1, _G[self.PName])
else
Expand All @@ -71,7 +71,7 @@ local PostCastStart = function(self, unit, name)
end

local PostCastStop = function(self)
if SUI.DBMod.NamePlates.FlashOnInterruptibleCast then
if SUI.DBMod.NamePlates.Castbar.FlashOnInterruptible then
module:CancelTimer(Timers[self:GetName()])
end
end
Expand All @@ -88,8 +88,9 @@ local NamePlateFactory = function(frame, unit)
health:SetStatusBarTexture(BarTexture)
-- health.colorHealth = true
health.frequentUpdates = true
health.colorTapping = true
health.colorReaction = true
health.colorTapping = SUI.DBMod.NamePlates.Health.colorTapping
health.colorReaction = SUI.DBMod.NamePlates.Health.colorReaction
health.colorClass = SUI.DBMod.NamePlates.Health.colorClass
frame.Health = health

frame.bgHealth = frame:CreateTexture(nil, 'BACKGROUND', frame)
Expand All @@ -115,7 +116,7 @@ local NamePlateFactory = function(frame, unit)
end

-- Mana/Energy
if SUI.DBMod.NamePlates.ShowPlayerPower then
if SUI.DBMod.NamePlates.Power.show then
local power = CreateFrame('StatusBar', nil, frame)
power:SetPoint('TOP', frame.Health, 'BOTTOM', 0, 0)
power:SetSize(frame:GetWidth(), SUI.DBMod.NamePlates.Power.height)
Expand All @@ -127,18 +128,18 @@ local NamePlateFactory = function(frame, unit)
end

-- Castbar
if SUI.DBMod.NamePlates.ShowCastbar then
if SUI.DBMod.NamePlates.Castbar.show then
local cast = CreateFrame('StatusBar', nil, frame)
if SUI.DBMod.NamePlates.ShowPlayerPower then
if SUI.DBMod.NamePlates.Power.show then
cast:SetPoint('TOP', frame.Power, 'BOTTOM', 0, 0)
else
cast:SetPoint('TOP', frame.Health, 'BOTTOM', 0, 0)
end

cast:SetSize(frame:GetWidth(), SUI.DBMod.NamePlates.Castbar.height)
cast:SetStatusBarTexture(BarTexture)
cast:SetStatusBarColor(1, 0.7, 0)
if SUI.DBMod.NamePlates.ShowCastbarText then
if SUI.DBMod.NamePlates.Castbar.Text then
cast.Text = cast:CreateFontString()
SUI:FormatFont(cast.Text, 7, 'Player')
cast.Text:SetJustifyH('CENTER')
Expand All @@ -160,7 +161,6 @@ local NamePlateFactory = function(frame, unit)
frame.Castbar = cast
frame.Castbar:SetParent(frame)
end


-- Hots/Dots
local Auras = CreateFrame('Frame', nil, frame)
Expand Down Expand Up @@ -243,14 +243,14 @@ local NamePlateFactory = function(frame, unit)
-- Setup Player Icons
if SUI.DBMod.NamePlates.ShowPlayerPowerIcons then
local attachPoint = 'Castbar'
if not SUI.DBMod.NamePlates.ShowCastbar then
if SUI.DBMod.NamePlates.ShowPlayerPower then
if not SUI.DBMod.NamePlates.Castbar.show then
if SUI.DBMod.NamePlates.Power.show then
attachPoint = 'Power'
else
attachPoint = 'Health'
end
end

SUI:PlayerPowerIcons(frame, attachPoint)
end

Expand Down Expand Up @@ -306,24 +306,27 @@ function module:OnInitialize()
ShowThreat = true,
ShowName = true,
ShowLevel = true,
ShowCastbar = true,
ShowCastbarText = true,
ShowTarget = true,
ShowRareElite = true,
ShowQuestIndicator = true,
ShowRaidTargetIndicator = true,
ShowPlayerPower = true,
ShowPlayerPowerIcons = true,
FlashOnInterruptibleCast = true,
Scale = 1,
Health = {
height = 5
height = 5,
colorTapping = true,
colorReaction = true,
colorClass = true
},
Power = {
show = true,
ShowPlayerPowerIcons = true,
height = 3
},
Castbar = {
height = 5
show = true,
height = 5,
Text = true,
FlashOnInterruptible = true
}
}
if not SUI.DBMod.NamePlates then
Expand All @@ -349,11 +352,11 @@ function module:OnEnable()

-- oUF is not hiding the mana bar. So we need to hide it.
ClassNameplateManaBarFrame:HookScript(
'OnShow',
function()
ClassNameplateManaBarFrame:Hide()
end)

'OnShow',
function()
ClassNameplateManaBarFrame:Hide()
end
)
end

function module:BuildOptions()
Expand Down Expand Up @@ -383,39 +386,6 @@ function module:BuildOptions()
SUI.DBMod.NamePlates.ShowLevel = val
end
},
ShowPlayerPower = {
name = L['Show mana/energy'],
type = 'toggle',
order = 3,
get = function(info)
return SUI.DBMod.NamePlates.ShowPlayerPower
end,
set = function(info, val)
SUI.DBMod.NamePlates.ShowPlayerPower = val
end
},
ShowCastbar = {
name = L['Show castbar'],
type = 'toggle',
order = 3,
get = function(info)
return SUI.DBMod.NamePlates.ShowCastbar
end,
set = function(info, val)
SUI.DBMod.NamePlates.ShowCastbar = val
end
},
ShowCastbarText = {
name = L['Show castbar text'],
type = 'toggle',
order = 3,
get = function(info)
return SUI.DBMod.NamePlates.ShowCastbarText
end,
set = function(info, val)
SUI.DBMod.NamePlates.ShowCastbarText = val
end
},
ShowQuestIndicator = {
name = L['Show quest indicator'],
type = 'toggle',
Expand Down Expand Up @@ -449,21 +419,10 @@ function module:BuildOptions()
SUI.DBMod.NamePlates.ShowTarget = val
end
},
FlashOnInterruptibleCast = {
name = L['Flash on interruptible cast'],
type = 'toggle',
order = 5,
get = function(info)
return SUI.DBMod.NamePlates.FlashOnInterruptibleCast
end,
set = function(info, val)
SUI.DBMod.NamePlates.FlashOnInterruptibleCast = val
end
},
Scale = {
name = L['Nameplate scale'],
type = 'range',
width = 'double',
width = 'full',
min = .01,
max = 3,
step = .01,
Expand All @@ -475,47 +434,148 @@ function module:BuildOptions()
SUI.DBMod.NamePlates.Scale = val
end
},
HealthbarHeight = {
name = L['Health bar height'],
type = 'range',
min = 1,
max = 30,
step = 1,
order = 101,
get = function(info)
return SUI.DBMod.NamePlates.Health.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Health.height = val
end
HealthOptions = {
name = L['Health bar'],
type = 'group',
inline = true,
order = 200,
args = {
height = {
name = L['Height'],
type = 'range',
min = 1,
max = 30,
step = 1,
order = 10,
get = function(info)
return SUI.DBMod.NamePlates.Health.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Health.height = val
end
},
colorTapping = {
name = L['Grey out tapped targets'],
type = 'toggle',
order = 20,
get = function(info)
return SUI.DBMod.NamePlates.Health.colorTapping
end,
set = function(info, val)
SUI.DBMod.NamePlates.Health.colorTapping = val
end
},
colorReaction = {
name = L['Color based on reaction'],
type = 'toggle',
order = 30,
get = function(info)
return SUI.DBMod.NamePlates.Health.colorReaction
end,
set = function(info, val)
SUI.DBMod.NamePlates.Health.colorReaction = val
end
},
colorClass = {
name = L['Color based on class'],
type = 'toggle',
order = 40,
get = function(info)
return SUI.DBMod.NamePlates.Health.colorClass
end,
set = function(info, val)
SUI.DBMod.NamePlates.Health.colorClass = val
end
}
}
},
PowerbarHeight = {
name = L['Power bar height'],
type = 'range',
min = 1,
max = 15,
step = 1,
order = 101,
get = function(info)
return SUI.DBMod.NamePlates.Power.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Power.height = val
end
PowerOptions = {
name = L['Power bar'],
type = 'group',
inline = true,
order = 300,
args = {
show = {
name = L['Enabled'],
type = 'toggle',
order = 1,
get = function(info)
return SUI.DBMod.NamePlates.Power.show
end,
set = function(info, val)
SUI.DBMod.NamePlates.Power.show = val
end
},
height = {
name = L['Height'],
type = 'range',
min = 1,
max = 15,
step = 1,
order = 10,
get = function(info)
return SUI.DBMod.NamePlates.Power.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Power.height = val
end
}
}
},
CastbarHeight = {
name = L['Cast bar height'],
type = 'range',
min = 1,
max = 15,
step = 1,
order = 102,
get = function(info)
return SUI.DBMod.NamePlates.Castbar.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Castbar.height = val
end
CastOptions = {
name = L['Cast bar'],
type = 'group',
inline = true,
order = 400,
args = {
show = {
name = L['Enabled'],
type = 'toggle',
order = 1,
get = function(info)
return SUI.DBMod.NamePlates.Castbar.show
end,
set = function(info, val)
SUI.DBMod.NamePlates.Castbar.show = val
end
},
Height = {
name = L['Height'],
type = 'range',
min = 1,
max = 15,
step = 1,
order = 10,
get = function(info)
return SUI.DBMod.NamePlates.Castbar.height
end,
set = function(info, val)
SUI.DBMod.NamePlates.Castbar.height = val
end
},
Text = {
name = L['Show text'],
type = 'toggle',
order = 20,
get = function(info)
return SUI.DBMod.NamePlates.Castbar.Text
end,
set = function(info, val)
SUI.DBMod.NamePlates.Castbar.Text = val
end
},
FlashOnInterruptible = {
name = L['Flash on interruptible cast'],
type = 'toggle',
order = 30,
get = function(info)
return SUI.DBMod.NamePlates.Castbar.FlashOnInterruptible
end,
set = function(info, val)
SUI.DBMod.NamePlates.Castbar.FlashOnInterruptible = val
end
}
}
}
}
}
Expand Down

0 comments on commit b0cd242

Please sign in to comment.