Commit 7bbc605a authored by Azilroka's avatar Azilroka

More Cleanup

parent bec2199b
...@@ -397,315 +397,74 @@ local function profile(db) ...@@ -397,315 +397,74 @@ local function profile(db)
end end
local function group(order, db, label) local function group(order, db, label)
PA.Options.args.cooldown.args[db] = { local main = PA.ACH:Group(label, nil, order, nil, function(info) local t = (profile(db))[info[#info]] return t.r, t.g, t.b, t.a end, function(info, r, g, b) local t = (profile(db))[info[#info]] t.r, t.g, t.b = r, g, b; PA:UpdateCooldownSettings(db); end)
type = "group", PA.Options.args.Cooldown.args[db] = main
order = order,
name = label, local mainArgs = main.args
get = function(info) mainArgs.reverse = PA.ACH:Toggle(PA.ACL["Reverse Toggle"], PA.ACL["Reverse Toggle will enable Cooldown Text on this module when the global setting is disabled and disable them when the global setting is enabled."], 1, nil, nil, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end)
local t = (profile(db))[info[#info]] mainArgs.hideBlizzard = PA.ACH:Toggle(PA.ACL["Force Hide Blizzard Text"], PA.ACL["This option will force hide Blizzard's cooldown text if it is enabled at [Interface > ActionBars > Show Numbers on Cooldown]."], 2, nil, nil, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, nil, function() if db == 'global' then return PA.db.Cooldown.Enable else return (PA.db.Cooldown.Enable and not profile(db).reverse) or (not PA.db.Cooldown.Enable and profile(db).reverse) end end)
return t.r, t.g, t.b, t.a
end, local seconds = PA.ACH:Group(PA.ACL["Text Threshold"], nil, 3, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, function() return not (profile(db)).checkSeconds end)
set = function(info, r, g, b) seconds.inline = true
local t = (profile(db))[info[#info]] seconds.args.checkSeconds = PA.ACH:Toggle(PA.ACL["Enable"], PA.ACL["This will override the global cooldown settings."], 1, nil, nil, nil, nil, nil, false)
t.r, t.g, t.b = r, g, b; seconds.args.mmssThreshold = PA.ACH:Range(PA.ACL["MM:SS Threshold"], PA.ACL["Threshold (in seconds) before text is shown in the MM:SS format. Set to -1 to never change to this format."], 2, { min = -1, max = 10800, step = 1 })
PA:UpdateCooldownSettings(db); seconds.args.hhmmThreshold = PA.ACH:Range(PA.ACL["HH:MM Threshold"], PA.ACL["Threshold (in minutes) before text is shown in the HH:MM format. Set to -1 to never change to this format."], 3, { min = -1, max = 1440, step = 1 })
end, mainArgs.secondsGroup = seconds
args = {
header = { local fonts = PA.ACH:Group(PA.ACL["Fonts"], nil, 4, nil, function(info) return (profile(db)).fonts[info[#info]] end, function(info, value) (profile(db)).fonts[info[#info]] = value; PA:UpdateCooldownSettings(db); end, function() return not (profile(db)).fonts.enable end)
order = 1, fonts.inline = true
type = "header", fonts.args.enable = PA.ACH:Toggle(PA.ACL["Enable"], PA.ACL["This will override the global cooldown settings."], 1, nil, nil, nil, nil, nil, false)
name = label, fonts.args.font = PA.ACH:SharedMediaFont(PA.ACL["Font"], nil, 2)
}, fonts.args.fontSize = PA.ACH:Range(PA.ACL["Font Size"], nil, 3, { min = 10, max = 50, step = 1 })
reverse = { fonts.args.fontOutline = PA.ACH:FontFlags(PA.ACL["Font Outline"], nil, 4)
type = "toggle", mainArgs.fontGroup = fonts
order = 2,
name = PA.ACL["Reverse Toggle"], local colors = PA.ACH:Group(PA.ACL["Color Override"], nil, 5, nil, nil, nil, function() return not (profile(db)).override end)
desc = PA.ACL["Reverse Toggle will enable Cooldown Text on this module when the global setting is disabled and disable them when the global setting is enabled."], colors.inline = true
get = function(info) return (profile(db))[info[#info]] end, colors.args.override = PA.ACH:Toggle(PA.ACL["Enable"], PA.ACL["This will override the global cooldown settings."], 1, nil, nil, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, false)
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, colors.args.threshold = PA.ACH:Range(PA.ACL["Low Threshold"], PA.ACL["Threshold before text turns red and is in decimal form. Set to -1 for it to never turn red"], 2, { min = -1, max = 20, step = 1 }, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end)
}, mainArgs.colorGroup = colors
hideBlizzard = {
type = "toggle", local tColors = PA.ACH:Group(PA.ACL["Threshold Colors"], nil, 3)
order = 3, tColors.args.expiringColor = PA.ACH:Color(PA.ACL["Expiring"], PA.ACL["Color when the text is about to expire"], 1)
name = PA.ACL["Force Hide Blizzard Text"], tColors.args.secondsColor = PA.ACH:Color(PA.ACL["Seconds"], PA.ACL["Color when the text is in the seconds format."], 2)
desc = PA.ACL["This option will force hide Blizzard's cooldown text if it is enabled at [Interface > ActionBars > Show Numbers on Cooldown]."], tColors.args.minutesColor = PA.ACH:Color(PA.ACL["Minutes"], PA.ACL["Color when the text is in the minutes format."], 3)
get = function(info) return (profile(db))[info[#info]] end, tColors.args.hoursColor = PA.ACH:Color(PA.ACL["Hours"], PA.ACL["Color when the text is in the hours format."], 4)
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, tColors.args.daysColor = PA.ACH:Color(PA.ACL["Days"], PA.ACL["Color when the text is in the days format."], 5)
disabled = function() tColors.args.mmssColor = PA.ACH:Color(PA.ACL["MM:SS"], nil, 6)
if db == "global" then tColors.args.hhmmColor = PA.ACH:Color(PA.ACL["HH:MM"], nil, 7)
return PA.db.Cooldown.Enable mainArgs.colorGroup.args.timeColors = tColors
else
return (PA.db.Cooldown.Enable and not profile(db).reverse) or (not PA.db.Cooldown.Enable and profile(db).reverse) local iColors = PA.ACH:Group(PA.ACL["Time Indicator Colors"], nil, 4, nil, nil, nil, function() return not (profile(db)).useIndicatorColor end)
end iColors.args.useIndicatorColor = PA.ACH:Toggle(PA.ACL["Use Indicator Color"], nil, 0, nil, nil, nil, function(info) return (profile(db))[info[#info]] end, function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end, false)
end, iColors.args.expireIndicator = PA.ACH:Color(PA.ACL["Expiring"], PA.ACL["Color when the text is about to expire"], 1)
}, iColors.args.secondsIndicator = PA.ACH:Color(PA.ACL["Seconds"], PA.ACL["Color when the text is in the seconds format."], 2)
secondsGroup = { iColors.args.minutesIndicator = PA.ACH:Color(PA.ACL["Minutes"], PA.ACL["Color when the text is in the minutes format."], 3)
order = 5, iColors.args.hoursIndicator = PA.ACH:Color(PA.ACL["Hours"], PA.ACL["Color when the text is in the hours format."], 4)
type = "group", iColors.args.daysIndicator = PA.ACH:Color(PA.ACL["Days"], PA.ACL["Color when the text is in the days format."], 5)
name = PA.ACL["Text Threshold"], iColors.args.hhmmColorIndicator = PA.ACH:Color(PA.ACL["MM:SS"], nil, 6)
inline = true, iColors.args.mmssColorIndicator = PA.ACH:Color(PA.ACL["HH:MM"], nil, 7)
get = function(info) return (profile(db))[info[#info]] end, mainArgs.colorGroup.args.indicatorColors = iColors
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end,
disabled = function() return not (profile(db)).checkSeconds end,
args = {
checkSeconds = {
type = "toggle",
order = 1,
name = PA.ACL["Enable"],
desc = PA.ACL["This will override the global cooldown settings."],
disabled = false,
},
mmssThreshold = {
order = 2,
type = 'range',
name = PA.ACL["MM:SS Threshold"],
desc = PA.ACL["Threshold (in seconds) before text is shown in the MM:SS format. Set to -1 to never change to this format."],
min = -1, max = 10800, step = 1,
},
hhmmThreshold = {
order = 3,
type = 'range',
name = PA.ACL["HH:MM Threshold"],
desc = PA.ACL["Threshold (in minutes) before text is shown in the HH:MM format. Set to -1 to never change to this format."],
min = -1, max = 1440, step = 1,
},
}
},
colorGroup = {
order = 10,
type = "group",
name = PA.ACL["Color Override"],
inline = true,
args = {
override = {
type = "toggle",
order = 1,
name = PA.ACL["Enable"],
desc = PA.ACL["This will override the global cooldown settings."],
get = function(info) return (profile(db))[info[#info]] end,
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end,
},
threshold = {
type = 'range',
order = 2,
name = PA.ACL["Low Threshold"],
desc = PA.ACL["Threshold before text turns red and is in decimal form. Set to -1 for it to never turn red"],
min = -1, max = 20, step = 1,
disabled = function() return not (profile(db)).override end,
get = function(info) return (profile(db))[info[#info]] end,
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end,
},
spacer1 = {
order = 3,
type = "header",
name = PA.ACL["Threshold Colors"]
},
spacer2 = {
order = 4,
type = "description",
name = " "
},
expiringColor = {
type = 'color',
order = 5,
name = PA.ACL["Expiring"],
desc = PA.ACL["Color when the text is about to expire"],
disabled = function() return not (profile(db)).override end,
},
secondsColor = {
type = 'color',
order = 6,
name = PA.ACL["Seconds"],
desc = PA.ACL["Color when the text is in the seconds format."],
disabled = function() return not (profile(db)).override end,
},
minutesColor = {
type = 'color',
order = 7,
name = PA.ACL["Minutes"],
desc = PA.ACL["Color when the text is in the minutes format."],
disabled = function() return not (profile(db)).override end,
},
hoursColor = {
type = 'color',
order = 8,
name = PA.ACL["Hours"],
desc = PA.ACL["Color when the text is in the hours format."],
disabled = function() return not (profile(db)).override end,
},
daysColor = {
type = 'color',
order = 9,
name = PA.ACL["Days"],
desc = PA.ACL["Color when the text is in the days format."],
disabled = function() return not (profile(db)).override end,
},
mmssColor = {
type = 'color',
order = 10,
name = PA.ACL["MM:SS"],
disabled = function() return not (profile(db)).override end,
},
hhmmColor = {
type = 'color',
order = 11,
name = PA.ACL["HH:MM"],
disabled = function() return not (profile(db)).override end,
},
spacer3 = {
order = 12,
type = "header",
name = PA.ACL["Time Indicator Colors"]
},
useIndicatorColor = {
type = "toggle",
order = 13,
name = PA.ACL["Use Indicator Color"],
get = function(info) return (profile(db))[info[#info]] end,
set = function(info, value) (profile(db))[info[#info]] = value; PA:UpdateCooldownSettings(db); end,
disabled = function() return not (profile(db)).override end,
},
spacer4 = {
order = 14,
type = "description",
name = ''
},
expireIndicator = {
type = 'color',
order = 15,
name = PA.ACL["Expiring"],
desc = PA.ACL["Color when the text is about to expire"],
disabled = function() return not (profile(db)).override end,
},
secondsIndicator = {
type = 'color',
order = 16,
name = PA.ACL["Seconds"],
desc = PA.ACL["Color when the text is in the seconds format."],
disabled = function() return not (profile(db)).override end,
},
minutesIndicator = {
type = 'color',
order = 17,
name = PA.ACL["Minutes"],
desc = PA.ACL["Color when the text is in the minutes format."],
disabled = function() return not (profile(db)).override end,
},
hoursIndicator = {
type = 'color',
order = 18,
name = PA.ACL["Hours"],
desc = PA.ACL["Color when the text is in the hours format."],
disabled = function() return not (profile(db)).override end,
},
daysIndicator = {
type = 'color',
order = 19,
name = PA.ACL["Days"],
desc = PA.ACL["Color when the text is in the days format."],
disabled = function() return not (profile(db)).override end,
},
hhmmColorIndicator = {
type = 'color',
order = 20,
name = PA.ACL["MM:SS"],
disabled = function() return not (profile(db)).override end,
},
mmssColorIndicator = {
type = 'color',
order = 21,
name = PA.ACL["HH:MM"],
disabled = function() return not (profile(db)).override end,
},
}
},
fontGroup = {
order = 20, -- keep this at the bottom
type = "group",
name = PA.ACL["Fonts"],
inline = true,
get = function(info) return (profile(db)).fonts[info[#info]] end,
set = function(info, value) (profile(db)).fonts[info[#info]] = value; PA:UpdateCooldownSettings(db); end,
disabled = function() return not (profile(db)).fonts.enable end,
args = {
enable = {
type = "toggle",
order = 1,
name = PA.ACL["Enable"],
desc = PA.ACL["This will override the global cooldown settings."],
disabled = false,
},
spacer1 = {
order = 2,
type = "description",
name = " "
},
fontSize = {
order = 3,
type = 'range',
name = PA.ACL["Text Font Size"],
min = 10, max = 50, step = 1,
},
font = {
order = 4,
type = 'select',
name = PA.ACL["Font"],
dialogControl = 'LSM30_Font',
values = PA.LSM:HashTable('font'),
},
fontOutline = {
order = 5,
type = "select",
name = PA.ACL["Font Outline"],
values = PA.FontFlags,
},
}
}
},
}
if db == 'global' then if db == 'global' then
-- clean up the main one mainArgs.reverse = nil
PA.Options.args.cooldown.args[db].args.reverse = nil mainArgs.colorGroup.args.override = nil
PA.Options.args.cooldown.args[db].args.colorGroup.args.override = nil mainArgs.colorGroup.disabled = nil
mainArgs.colorGroup.name = PA.ACL["COLORS"]
-- remove disables
for _, x in pairs(PA.Options.args.cooldown.args[db].args.colorGroup.args) do -- keep these two in this order
if x.disabled then x.disabled = nil end PA.Options.args.Cooldown.args.hideBlizzard = mainArgs.hideBlizzard
end mainArgs.hideBlizzard = nil
-- rename the tab
PA.Options.args.cooldown.args[db].args.colorGroup.name = PA.ACL["COLORS"]
-- move hide blizzard option into the top toggles, keeping order 3 is fine and correct.
PA.Options.args.cooldown.args.hideBlizzard = PA.Options.args.cooldown.args[db].args.hideBlizzard
PA.Options.args.cooldown.args[db].args.hideBlizzard = nil
else else
PA.Options.args.cooldown.args[db].args.colorGroup.args.spacer2 = nil mainArgs.reverse = nil
mainArgs.hideBlizzard = nil
mainArgs.fontGroup = nil
end end
end end
PA.Options.args.cooldown = { PA.Options.args.Cooldown = PA.ACH:Group(PA.ACL["Cooldown Text"], nil, 2, 'tab', function(info) return PA.db.Cooldown[info[#info]] end, function(info, value) PA.db.Cooldown[info[#info]] = value; PA:UpdateCooldownSettings('global'); end)
type = 'group', PA.Options.args.Cooldown.args.intro = PA.ACH:Description(PA.ACL["COOLDOWN_DESC"], 0)
name = PA.ACL["Cooldown Text"], PA.Options.args.Cooldown.args.Enable = PA.ACH:Toggle(PA.ACL["Enable"], PA.ACL["Display cooldown text on anything with the cooldown spiral."], 1)
childGroups = "tab",
order = 3,
get = function(info) return PA.db.Cooldown[info[#info]] end,
set = function(info, value) PA.db.Cooldown[info[#info]] = value; PA:UpdateCooldownSettings('global'); end,
args = {
intro = {
order = 1,
type = 'description',
name = PA.ACL["COOLDOWN_DESC"],
},
Enable = {
type = "toggle",
order = 2,
name = PA.ACL["Enable"],
desc = PA.ACL["Display cooldown text on anything with the cooldown spiral."]
},
},
}
group(5, 'global', PA.ACL["Global"]) group(5, 'global', PA.ACL["Global"])
group(6, 'OzCooldowns', PA.ACL.OzCooldowns) group(6, 'OzCooldowns', PA.ACL.OzCooldowns)
......
...@@ -100,7 +100,6 @@ PA.Authors = GetAddOnMetadata('ProjectAzilroka', 'Author'):gsub(", ", " ") ...@@ -100,7 +100,6 @@ PA.Authors = GetAddOnMetadata('ProjectAzilroka', 'Author'):gsub(", ", " ")
local Color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[PA.MyClass] or RAID_CLASS_COLORS[PA.MyClass] local Color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[PA.MyClass] or RAID_CLASS_COLORS[PA.MyClass]
PA.ClassColor = { Color.r, Color.g, Color.b } PA.ClassColor = { Color.r, Color.g, Color.b }
PA.FontFlags = { MONOCHROME = 'MONOCHROME', MONOCHROMEOUTLINE = 'MONOCHROMEOUTLINE', NONE = 'None', OUTLINE = 'OUTLINE', THICKOUTLINE = 'THICKOUTLINE' }
PA.AllPoints = { CENTER = 'CENTER', BOTTOM = 'BOTTOM', TOP = 'TOP', LEFT = 'LEFT', RIGHT = 'RIGHT', BOTTOMLEFT = 'BOTTOMLEFT', BOTTOMRIGHT = 'BOTTOMRIGHT', TOPLEFT = 'TOPLEFT', TOPRIGHT = 'TOPRIGHT' } PA.AllPoints = { CENTER = 'CENTER', BOTTOM = 'BOTTOM', TOP = 'TOP', LEFT = 'LEFT', RIGHT = 'RIGHT', BOTTOMLEFT = 'BOTTOMLEFT', BOTTOMRIGHT = 'BOTTOMRIGHT', TOPLEFT = 'TOPLEFT', TOPRIGHT = 'TOPRIGHT' }
PA.ElvUI = PA:IsAddOnEnabled('ElvUI', PA.MyName) PA.ElvUI = PA:IsAddOnEnabled('ElvUI', PA.MyName)
...@@ -163,6 +162,16 @@ function PA:Print(...) ...@@ -163,6 +162,16 @@ function PA:Print(...)
print(PA:Color(PA.Title..':'), ...) print(PA:Color(PA.Title..':'), ...)
end end
function PA:ShortValue(value)
if (value >= 1e6) then
return gsub(format("%.1fm", value / 1e6), "%.?0+([km])$", "%1")
elseif (value >= 1e3 or value <= -1e3) then
return gsub(format("%.1fk", value / 1e3), "%.?0+([km])$", "%1")
else
return value
end
end
function PA:RGBToHex(r, g, b, header, ending) function PA:RGBToHex(r, g, b, header, ending)
r = r <= 1 and r >= 0 and r or 1 r = r <= 1 and r >= 0 and r or 1
g = g <= 1 and g >= 0 and g or 1 g = g <= 1 and g >= 0 and g or 1
......
...@@ -1350,12 +1350,7 @@ function EPB:GetOptions() ...@@ -1350,12 +1350,7 @@ function EPB:GetOptions()
max = 24, max = 24,
step = 1 step = 1
}, },
FontFlag = { FontFlag = PA.ACH:FontFlags(PA.ACL["Font Flag"], nil, 16),
name = "Font Flag",
order = 16,
type = "select",
values = PA.FontFlags
},
TextOffset = { TextOffset = {
order = 17, order = 17,
name = "Health/Experience Text Offset", name = "Health/Experience Text Offset",
......
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