grouping auras, interrupts, classicon, racial, trinket

This commit is contained in:
Sumsebrum 2022-03-25 15:59:43 +01:00
parent 10caa05e31
commit 5b32b8c793
6 changed files with 222 additions and 20 deletions

View File

@ -1,5 +1,5 @@
local pairs, ipairs, select, tinsert, tbl_sort, tostring, tonumber, rand = pairs, ipairs, select, tinsert, table.sort, tostring, tonumber, math.random
local str_gsub = string.gsub
local GetSpellInfo = GetSpellInfo
local GetSpellDescription = GetSpellDescription
local CreateFrame, GetTime = CreateFrame, GetTime
@ -56,6 +56,10 @@ local Auras = Gladdy:NewModule("Auras", nil, {
auraFrameLevel = 5,
auraInterruptFrameStrata = "MEDIUM",
auraInterruptFrameLevel = 5,
auraGroup = false,
auraGroupDirection = "DOWN",
auraInterruptGroup = false,
auraInterruptGroupDirection = "DOWN",
})
function Auras:Initialize()
@ -239,6 +243,23 @@ function Auras:UpdateFrame(unit)
auraFrame:ClearAllPoints()
Gladdy:SetPosition(auraFrame, unit, "auraXOffset", "auraYOffset", true, Auras)
if (Gladdy.db.auraGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
if Gladdy.db.auraGroupDirection == "RIGHT" then
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
elseif Gladdy.db.auraGroupDirection == "LEFT" then
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
elseif Gladdy.db.auraGroupDirection == "UP" then
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
elseif Gladdy.db.auraGroupDirection == "DOWN" then
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
end
end
end
if (unit == "arena1") then
Gladdy:CreateMover(auraFrame, "auraXOffset", "auraYOffset", L["Auras"],
{"TOPLEFT", "TOPLEFT"},
@ -321,6 +342,23 @@ function Auras:UpdateInterruptFrame(unit)
interruptFrame:ClearAllPoints()
Gladdy:SetPosition(interruptFrame, unit, "auraInterruptXOffset", "auraInterruptYOffset", true, Auras)
if (Gladdy.db.auraInterruptGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit].interruptFrame:ClearAllPoints()
if Gladdy.db.auraInterruptGroupDirection == "RIGHT" then
self.frames[unit].interruptFrame:SetPoint("LEFT", self.frames[previousUnit].interruptFrame, "RIGHT", 0, 0)
elseif Gladdy.db.auraInterruptGroupDirection == "LEFT" then
self.frames[unit].interruptFrame:SetPoint("RIGHT", self.frames[previousUnit].interruptFrame, "LEFT", 0, 0)
elseif Gladdy.db.auraInterruptGroupDirection == "UP" then
self.frames[unit].interruptFrame:SetPoint("BOTTOM", self.frames[previousUnit].interruptFrame, "TOP", 0, 0)
elseif Gladdy.db.auraInterruptGroupDirection == "DOWN" then
self.frames[unit].interruptFrame:SetPoint("TOP", self.frames[previousUnit].interruptFrame, "BOTTOM", 0, 0)
end
end
end
if (unit == "arena1") then
Gladdy:CreateMover(interruptFrame, "auraInterruptXOffset", "auraInterruptYOffset", L["Interrupts"],
{"TOPLEFT", "TOPLEFT"},
@ -682,10 +720,63 @@ function Auras:GetOptions()
name = L["Frame"],
order = 3,
args = {
groupOptions = {
type = "group",
name = L["Group"],
order = 4,
args = {
headerAuras = {
type = "header",
name = L["Auras"],
order = 1,
},
auraGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Auras"],
order = 2,
disabled = function() return not Gladdy.db.auraDetached end,
}),
auraGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 3,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function() return not Gladdy.db.auraGroup or not Gladdy.db.auraDetached end,
}),
headerInterrupts = {
type = "header",
name = L["Interrupts"],
order = 4,
},
auraInterruptGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Interrupts"],
order = 5,
disabled = function() return not Gladdy.db.auraInterruptDetached end,
}),
auraInterruptGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 6,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function() return not Gladdy.db.auraInterruptGroup or not Gladdy.db.auraInterruptDetached end,
}),
}
},
detachedAuraMode = {
type = "group",
name = L["Detached Aura"],
order = 4,
order = 5,
args = {
headerDetachedMode = {
type = "header",
@ -789,7 +880,7 @@ function Auras:GetOptions()
detachedInterruptMode = {
type = "group",
name = L["Detached Interrupt"],
order = 5,
order = 6,
args = {
headerDetachedMode = {
type = "header",

View File

@ -1,4 +1,4 @@
local select = select
local select, str_gsub = select, string.gsub
local Gladdy = LibStub("Gladdy")
local CreateFrame = CreateFrame
@ -16,7 +16,7 @@ local Classicon = Gladdy:NewModule("Class Icon", 81, {
classIconFrameStrata = "MEDIUM",
classIconFrameLevel = 5,
classIconGroup = false,
classIconGroupDirection = "RIGHT"
classIconGroupDirection = "DOWN"
})
local classIconPath = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
@ -137,9 +137,17 @@ function Classicon:UpdateFrame(unit)
if (Gladdy.db.classIconGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. string.gsub(unit, "arena", "") - 1
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
if Gladdy.db.classIconGroupDirection == "RIGHT" then
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "LEFT" then
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "UP" then
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "DOWN" then
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
end
end
end
@ -228,11 +236,31 @@ function Classicon:GetOptions()
end
end
},
classIconGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Class Icon"],
order = 5,
disabled = function() return not Gladdy.db.classIconEnabled end,
}),
classIconGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 6,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function()
return not Gladdy.db.classIconGroup or not Gladdy.db.classIconEnabled
end,
}),
group = {
type = "group",
childGroups = "tree",
name = L["Frame"],
order = 4,
order = 7,
disabled = function() return not Gladdy.db.classIconEnabled end,
args = {
size = {

View File

@ -236,6 +236,7 @@ function Cooldowns:UpdateFrame(unit)
end
if (Gladdy.db.cooldownGroup) then
--TODO fix overlapping
if (unit ~= "arena1") then
local previousUnit = "arena" .. string.gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
@ -552,6 +553,12 @@ function Cooldowns:GetOptions()
desc = L["Enabled cooldown module"],
order = 2,
}),
cooldownGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Cooldown"],
order = 3,
disabled = function() return not Gladdy.db.cooldown end,
}),
group = {
type = "group",
childGroups = "tree",
@ -858,8 +865,8 @@ function Cooldowns:GetCooldownOptions()
order = 2,
width = 0.1,
image = "Interface\\Addons\\Gladdy\\Images\\uparrow",
imageWidth = 20,
imageHeight = 20,
imageWidth = 15,
imageHeight = 15,
func = function()
if (Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] > 1) then
local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)]
@ -883,8 +890,8 @@ function Cooldowns:GetCooldownOptions()
order = 3,
width = 0.1,
image = "Interface\\Addons\\Gladdy\\Images\\downarrow",
imageWidth = 20,
imageHeight = 20,
imageWidth = 15,
imageHeight = 15,
func = function()
if (Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] < tblLength) then
local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)]

View File

@ -389,6 +389,11 @@ function Pets:GetOptions()
desc = L["Enables Pets module"],
order = 3,
}),
petGroup = option({
type = "toggle",
name = L["Group Pets"],
order = 4,
}),
group = {
type = "group",
childGroups = "tree",
@ -426,11 +431,6 @@ function Pets:GetOptions()
step = 1,
width = "full",
}),
petGroup = option({
type = "toggle",
name = L["Group Pets"],
order = 5,
}),
petMargin = option({
type = "range",
name = L["Margin"],

View File

@ -1,4 +1,4 @@
local ceil = ceil
local ceil, str_gsub = ceil, string.gsub
local CreateFrame = CreateFrame
local GetTime = GetTime
@ -20,6 +20,8 @@ local Racial = Gladdy:NewModule("Racial", 79, {
racialCooldownNumberAlpha = 1,
racialFrameStrata = "MEDIUM",
racialFrameLevel = 5,
racialGroup = false,
racialGroupDirection = "DOWN",
})
@ -153,6 +155,22 @@ function Racial:UpdateFrame(unit)
Gladdy:SetPosition(racial, unit, "racialXOffset", "racialYOffset", Racial:LegacySetPosition(racial, unit), Racial)
if (Gladdy.db.racialGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
if Gladdy.db.racialGroupDirection == "RIGHT" then
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
elseif Gladdy.db.racialGroupDirection == "LEFT" then
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
elseif Gladdy.db.racialGroupDirection == "UP" then
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
elseif Gladdy.db.racialGroupDirection == "DOWN" then
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
end
end
end
if (unit == "arena1") then
Gladdy:CreateMover(racial,"racialXOffset", "racialYOffset", L["Racial"],
{"TOPLEFT", "TOPLEFT"},
@ -241,11 +259,31 @@ function Racial:GetOptions()
desc = L["Enable racial icon"],
order = 3,
}),
racialGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Racial"],
order = 4,
disabled = function() return not Gladdy.db.racialEnabled end,
}),
racialGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 5,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function()
return not Gladdy.db.racialGroup or not Gladdy.db.racialEnabled
end,
}),
group = {
type = "group",
childGroups = "tree",
name = L["Frame"],
order = 4,
order = 6,
disabled = function() return not Gladdy.db.racialEnabled end,
args = {
general = {

View File

@ -1,4 +1,4 @@
local ceil = ceil
local ceil, str_gsub = ceil, string.gsub
local C_PvP = C_PvP
local CreateFrame = CreateFrame
@ -25,6 +25,8 @@ local Trinket = Gladdy:NewModule("Trinket", 80, {
trinketColored = false,
trinketColoredCd = { r = 1, g = 0, b = 0, a = 1 },
trinketColoredNoCd = { r = 0, g = 1, b = 0, a = 1 },
trinketGroup = false,
trinketGroupDirection = "DOWN",
})
function Trinket:Initialize()
@ -175,6 +177,22 @@ function Trinket:UpdateFrame(unit)
Gladdy:SetPosition(trinket, unit, "trinketXOffset", "trinketYOffset", Trinket:LegacySetPosition(trinket, unit), Trinket)
if (Gladdy.db.trinketGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
if Gladdy.db.trinketGroupDirection == "RIGHT" then
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
elseif Gladdy.db.trinketGroupDirection == "LEFT" then
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
elseif Gladdy.db.trinketGroupDirection == "UP" then
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
elseif Gladdy.db.trinketGroupDirection == "DOWN" then
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
end
end
end
if (unit == "arena1") then
Gladdy:CreateMover(trinket,"trinketXOffset", "trinketYOffset", L["Trinket"],
{"TOPLEFT", "TOPLEFT"},
@ -299,6 +317,26 @@ function Trinket:GetOptions()
hasAlpha = true,
disabled = function() return not Gladdy.db.trinketEnabled end,
}),
trinketGroup = Gladdy:option({
type = "toggle",
name = L["Group Class Icons"],
order = 7,
disabled = function() return not Gladdy.db.trinketEnabled end,
}),
trinketGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 8,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function()
return not Gladdy.db.trinketGroup or not Gladdy.db.trinketEnabled
end,
}),
group = {
type = "group",
childGroups = "tree",