From 2adff362ffe236a00942bbe7a01f072bef68302a Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 30 Apr 2025 00:52:25 +0200 Subject: [PATCH] raid: switch to flat config format --- mods/raid-compact-layout.lua | 6 +++--- mods/raid-party.lua | 4 ++-- mods/raid.lua | 26 ++++++++++++++------------ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/mods/raid-compact-layout.lua b/mods/raid-compact-layout.lua index 459bb37..8b81837 100644 --- a/mods/raid-compact-layout.lua +++ b/mods/raid-compact-layout.lua @@ -12,9 +12,9 @@ local module = ShaguTweaks:register({ module.enable = function(self) -- overwrite config - ShaguTweaksRaidCluster.config.width = 64 - ShaguTweaksRaidCluster.config.height = 12 - ShaguTweaksRaidCluster.config.rows = 40 + ShaguTweaksRaidCluster.config["raid.width"] = 64 + ShaguTweaksRaidCluster.config["raid.height"] = 12 + ShaguTweaksRaidCluster.config["raid.rows"] = 40 -- disable mana bars ShaguTweaks.UnitFrame_NewComponent('compact layout', { diff --git a/mods/raid-party.lua b/mods/raid-party.lua index c21639a..4f385d3 100644 --- a/mods/raid-party.lua +++ b/mods/raid-party.lua @@ -52,8 +52,8 @@ module.enable = function(self) end -- set raid frame size - raid.cluster:SetWidth(x * (raid.cluster.config.width+2) + 6) - raid.cluster:SetHeight(y * (raid.cluster.config.height+1) + 7) + raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6) + raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7) raid:Show() else raid:Hide() diff --git a/mods/raid.lua b/mods/raid.lua index dcb5192..d13adbc 100644 --- a/mods/raid.lua +++ b/mods/raid.lua @@ -10,11 +10,10 @@ local module = ShaguTweaks:register({ maintainer = "@shagu (GitHub)", enabled = true, config = { - raid = { - width = 64, - height = 32, - rows = 10 - } + ["raid.width"] = 64, + ["raid.height"] = 32, + ["raid.rows"] = 10, + ["raid.scale"] = 1, } }) @@ -156,11 +155,11 @@ end local CreateUnitFrame = function(parent, i) local frame = parent.frames[i] or CreateFrame("Button", "ShaguTweaksRaidUnitFrame"..i, parent) - local left, top = GetFramePosition(i, parent.config.rows) + local left, top = GetFramePosition(i, parent.config["raid.rows"]) - frame:SetPoint("TOPLEFT", (left-1)*(parent.config.width+2) + 4, -(top-1)*(parent.config.height + 1) - 4) - frame:SetWidth(parent.config.width) - frame:SetHeight(parent.config.height) + frame:SetPoint("TOPLEFT", (left-1)*(parent.config["raid.width"]+2) + 4, -(top-1)*(parent.config["raid.height"] + 1) - 4) + frame:SetWidth(parent.config["raid.width"]) + frame:SetHeight(parent.config["raid.height"]) frame.unitstr = "raid"..i frame.left = left @@ -504,14 +503,17 @@ module.enable = function(self) end -- set raid frame size - raid.cluster:SetWidth(x * (raid.cluster.config.width+2) + 6) - raid.cluster:SetHeight(y * (raid.cluster.config.height+1) + 7) + raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6) + raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7) raid:Show() else raid:Hide() end end) + -- assign defaul scale + raid:SetScale(module.config["raid.scale"]) + do -- toggle button -- create toggle button raid.toggle = CreateFrame("Button", "ShaguTweaksRaidToggle", raid) @@ -604,6 +606,6 @@ module.enable = function(self) ShaguTweaks.DarkenFrame(raid.cluster) -- assign default config - raid.cluster.config = module.config.raid + raid.cluster.config = module.config end end