totemplates fix option to alter all colors/alphas
This commit is contained in:
parent
74753e327c
commit
720e5b63ec
@ -3,7 +3,7 @@ local UnitExists, UnitIsUnit, UnitName, UnitIsEnemy = UnitExists, UnitIsUnit, Un
|
|||||||
local C_NamePlate = C_NamePlate
|
local C_NamePlate = C_NamePlate
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local GetSpellInfo, CreateFrame, GetCVar = GetSpellInfo, CreateFrame, GetCVar
|
local GetSpellInfo, CreateFrame = GetSpellInfo, CreateFrame
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
@ -117,8 +117,8 @@ local function GetTotemColorDefaultOptions()
|
|||||||
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info) return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
|
get = function() return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled = value
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled = value
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end
|
end
|
||||||
@ -130,15 +130,13 @@ local function GetTotemColorDefaultOptions()
|
|||||||
order = 3,
|
order = 3,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info)
|
get = function()
|
||||||
local key = info.arg or info[#info]
|
|
||||||
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.a
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.a
|
||||||
end,
|
end,
|
||||||
set = function(info, r, g, b, a)
|
set = function(_, r, g, b, a)
|
||||||
local key = info.arg or info[#info]
|
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
||||||
@ -154,10 +152,10 @@ local function GetTotemColorDefaultOptions()
|
|||||||
max = 1,
|
max = 1,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info)
|
get = function()
|
||||||
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha
|
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha = value
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha = value
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end
|
end
|
||||||
@ -167,8 +165,8 @@ local function GetTotemColorDefaultOptions()
|
|||||||
name = L["Custom totem name"],
|
name = L["Custom totem name"],
|
||||||
order = 5,
|
order = 5,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info) return Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText end,
|
get = function() return Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText end,
|
||||||
set = function(info, value) Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText = value Gladdy:UpdateFrame() end
|
set = function(_, value) Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText = value Gladdy:UpdateFrame() end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,15 +174,6 @@ local function GetTotemColorDefaultOptions()
|
|||||||
return defaultDB, options, indexedList
|
return defaultDB, options, indexedList
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetTotemOptions()
|
|
||||||
local indexedList = select(3, GetTotemColorDefaultOptions())
|
|
||||||
local colorList = {}
|
|
||||||
for i=1, #indexedList do
|
|
||||||
tinsert(colorList, Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id])
|
|
||||||
end
|
|
||||||
return colorList
|
|
||||||
end
|
|
||||||
|
|
||||||
function Gladdy:GetTotemColors()
|
function Gladdy:GetTotemColors()
|
||||||
return GetTotemColorDefaultOptions()
|
return GetTotemColorDefaultOptions()
|
||||||
end
|
end
|
||||||
@ -394,11 +383,11 @@ function TotemPlates:ToggleAddon(nameplate, show)
|
|||||||
local addonFrames = { self:GetAddonFrame(nameplate) }
|
local addonFrames = { self:GetAddonFrame(nameplate) }
|
||||||
if addonFrames and #addonFrames > 0 then
|
if addonFrames and #addonFrames > 0 then
|
||||||
if show then
|
if show then
|
||||||
for i,v in ipairs(addonFrames) do
|
for _,v in ipairs(addonFrames) do
|
||||||
v:Show()
|
v:Show()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i,v in ipairs(addonFrames) do
|
for _,v in ipairs(addonFrames) do
|
||||||
v:Hide()
|
v:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -665,19 +654,23 @@ function TotemPlates:GetOptions()
|
|||||||
step = 0.1,
|
step = 0.1,
|
||||||
width = "full",
|
width = "full",
|
||||||
order = 23,
|
order = 23,
|
||||||
get = function(info)
|
get = function()
|
||||||
local alphas = GetTotemOptions()
|
local alpha, i = nil, 1
|
||||||
for i=2, #alphas do
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
if alphas[i].alpha ~= alphas[1].alpha then
|
if i == 1 then
|
||||||
|
alpha = v.alpha
|
||||||
|
i = i + 1
|
||||||
|
else
|
||||||
|
if v.alpha ~= alpha then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return alphas[1].alpha
|
end
|
||||||
|
return alpha
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
local alphas = GetTotemOptions()
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
for i=1, #alphas do
|
v.alpha = value
|
||||||
alphas[i].alpha = value
|
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
@ -705,23 +698,27 @@ function TotemPlates:GetOptions()
|
|||||||
name = L["All totem border color"],
|
name = L["All totem border color"],
|
||||||
order = 42,
|
order = 42,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
get = function(info)
|
get = function()
|
||||||
local colors = GetTotemOptions()
|
local color
|
||||||
local color = colors[1].color
|
local i = 1
|
||||||
for i=2, #colors do
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
if colors[i].r ~= color.r or colors[i].color.r ~= color.r or colors[i].color.r ~= color.r or colors[i].color.r ~= color.r then
|
if i == 1 then
|
||||||
|
color = v.color
|
||||||
|
i = i + 1
|
||||||
|
else
|
||||||
|
if v.color.r ~= color.r or v.color.g ~= color.g or v.color.b ~= color.b or v.color.a ~= color.a then
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return color.r, color.g, color.b, color.a
|
return color.r, color.g, color.b, color.a
|
||||||
end,
|
end,
|
||||||
set = function(info, r, g, b, a)
|
set = function(_, r, g, b, a)
|
||||||
local colors = GetTotemOptions()
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
for i=1, #colors do
|
v.color.r = r
|
||||||
colors[i].color.r = r
|
v.color.g = g
|
||||||
colors[i].color.g = g
|
v.color.b = b
|
||||||
colors[i].color.b = b
|
v.color.a = a
|
||||||
colors[i].color.a = a
|
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user