grouping of pets first step

This commit is contained in:
Sumsebrum 2021-09-24 16:40:36 +02:00
parent 3f28947b05
commit fabd9ae048

View File

@ -23,6 +23,8 @@ local Pets = Gladdy:NewModule("Pets", nil, {
petHealthPercentage = true, petHealthPercentage = true,
petXOffset = 1, petXOffset = 1,
petYOffset = -62, petYOffset = -62,
petGroup = false,
petMargin = 1,
}) })
function Pets:Initialize() function Pets:Initialize()
@ -251,6 +253,18 @@ function Pets:UpdateFrame(unitId)
self.frames[unit]:SetWidth(Gladdy.db.petWidth) self.frames[unit]:SetWidth(Gladdy.db.petWidth)
self.frames[unit]:SetHeight(Gladdy.db.petHeight) self.frames[unit]:SetHeight(Gladdy.db.petHeight)
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset) self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
if (Gladdy.db.petGroup) then
if (unit == "arenapet1") then
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
else
local previousPet = "arenapet" .. string_gsub(unit, "arenapet", "") - 1
self.frames[unit]:ClearAllPoints()
self.frames[unit]:SetPoint("TOPLEFT", self.frames[previousPet], "BOTTOMLEFT", 0, - Gladdy.db.petMargin)
end
else
self.frames[unit]:ClearAllPoints()
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
end
healthBar.portrait:SetHeight(Gladdy.db.petHeight) healthBar.portrait:SetHeight(Gladdy.db.petHeight)
healthBar.portrait:SetWidth(Gladdy.db.petHeight) healthBar.portrait:SetWidth(Gladdy.db.petHeight)
@ -384,11 +398,28 @@ function Pets:GetOptions()
step = 1, step = 1,
width = "full", width = "full",
}), }),
petGroup = option({
type = "toggle",
name = L["Group Pets"],
order = 5,
}),
petMargin = option({
type = "range",
name = L["Margin"],
desc = L["Height of the bar"],
order = 6,
disabled = function()
return not Gladdy.db.petGroup
end,
min = 0,
max = 50,
step = .1,
}),
petHealthBarTexture = option({ petHealthBarTexture = option({
type = "select", type = "select",
name = L["Bar texture"], name = L["Bar texture"],
desc = L["Texture of the bar"], desc = L["Texture of the bar"],
order = 5, order = 7,
dialogControl = "LSM30_Statusbar", dialogControl = "LSM30_Statusbar",
values = AceGUIWidgetLSMlists.statusbar, values = AceGUIWidgetLSMlists.statusbar,
}), }),
@ -396,14 +427,14 @@ function Pets:GetOptions()
type = "color", type = "color",
name = L["Health color"], name = L["Health color"],
desc = L["Color of the status bar"], desc = L["Color of the status bar"],
order = 6, order = 8,
hasAlpha = true, hasAlpha = true,
}), }),
petHealthBarBgColor = Gladdy:colorOption({ petHealthBarBgColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Background color"], name = L["Background color"],
desc = L["Color of the status bar background"], desc = L["Color of the status bar background"],
order = 7, order = 9,
hasAlpha = true, hasAlpha = true,
}), }),
}, },