From fbff094227dc7f7b49f20868a1bd3153c6f6360d Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 7 Jan 2025 01:12:18 +0100 Subject: [PATCH] Add every other config module --- Modules/Config.lua | 395 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 369 insertions(+), 26 deletions(-) diff --git a/Modules/Config.lua b/Modules/Config.lua index 3e0df54..6019dc8 100644 --- a/Modules/Config.lua +++ b/Modules/Config.lua @@ -312,27 +312,45 @@ local configFrame = StaticGridFrame.new("HeimdallConfig", 40, 12, { w = 1024 + 512, h = 1024 }) configFrame:MakeMovable() -local oldAdd = configFrame.Add -configFrame.Add = function(self, frame, rowspan, colspan) - print("Adding", frame, rowspan, colspan) - oldAdd(self, frame, rowspan, colspan) -end --configFrame.frame:SetScript("OnKeyUp", function(self, key) -- if key == "ESCAPE" then -- self:Hide() -- end --end) -local colorIndex = 1 -local colors = { - { 1, 0, 0, 1 }, - { 0, 1, 0, 1 }, - { 0, 0, 1, 1 }, - { 1, 1, 0, 1 }, - { 1, 0, 1, 1 }, - { 0, 1, 1, 1 }, - { 1, 1, 1, 1 }, +local colorIndex = 1 +local colors = { + { 1, 0, 0, 1 }, -- Red + { 0, 1, 0, 1 }, -- Green + { 0, 0, 1, 1 }, -- Blue + { 1, 1, 0, 1 }, -- Yellow + { 1, 0, 1, 1 }, -- Magenta + { 0, 1, 1, 1 }, -- Cyan + { 1, 1, 1, 1 }, -- White + { 1, 0.5, 0, 1 }, -- Orange + { 0.5, 0, 1, 1 }, -- Purple + { 1, 0.5, 0.5, 1 }, -- Pink + { 0.6, 0.4, 0.2, 1 }, -- Brown + { 0.5, 1, 0.5, 1 }, -- Light Green + { 1, 0.8, 0, 1 }, -- Dark Orange + { 0.8, 0, 1, 1 }, -- Dark Purple + { 0.13, 0.55, 0.13, 1 }, -- Olive Green + { 0, 0, 0.5, 1 }, -- Navy Blue + { 1, 0.5, 0.3, 1 }, -- Coral + { 0, 0.5, 0.5, 1 }, -- Teal + { 0.9, 0.7, 1, 1 }, -- Lavender + { 0.5, 0, 0, 1 }, -- Maroon + { 1, 0.84, 0, 1 }, -- Gold + { 0.44, 0.52, 0.57, 1 }, -- Slate Gray + { 1, 0.41, 0.71, 1 }, -- Hot Pink + { 0.91, 0.48, 0.2, 1 } -- Burnt Sienna } +local GetNextColor = function() + local color = colors[colorIndex] + colorIndex = colorIndex + 1 + if colorIndex > #colors then colorIndex = 1 end + return unpack(color) +end --HeimdallTestFrame = GridFrame.new("HeimdallPartyFrame", UIParent, 12, 20, { w = 1024, h = 1024 }) --for i = 1, 10 do @@ -351,7 +369,7 @@ local colors = { --configFrame:Add(HeimdallTestFrame, 20, 12) ---@diagnostic disable-next-line: missing-fields -shared.Config = {} +shared.Config = {} function shared.Config.Init() local buttonColors = { enabled = { 0, 1, 0, 1 }, @@ -503,8 +521,7 @@ function shared.Config.Init() -- Spotter do - local r, g, b, a = unpack(colors[colorIndex]) - colorIndex = colorIndex + 1 + local r, g, b, a = GetNextColor() local spotterConfigFrame = GridFrame.new("HeimdallSpotterConfig", UIParent, 12, 20) spotterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) @@ -600,8 +617,7 @@ function shared.Config.Init() -- Whoer do - local r, g, b, a = unpack(colors[colorIndex]) - colorIndex = colorIndex + 1 + local r, g, b, a = GetNextColor() local whoerConfigFrame = GridFrame.new("HeimdallWhoerConfig", UIParent, 12, 20) whoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) @@ -677,8 +693,7 @@ function shared.Config.Init() -- Messenger do - local r, g, b, a = unpack(colors[colorIndex]) - colorIndex = colorIndex + 1 + local r, g, b, a = GetNextColor() local messengerConfigFrame = GridFrame.new("HeimdallMessengerConfig", UIParent, 12, 20) messengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) @@ -714,8 +729,7 @@ function shared.Config.Init() -- Death Reporter do - local r, g, b, a = unpack(colors[colorIndex]) - colorIndex = colorIndex + 1 + local r, g, b, a = GetNextColor() local deathReporterConfigFrame = GridFrame.new("HeimdallDeathReporterConfig", UIParent, 12, 20) deathReporterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) @@ -805,12 +819,11 @@ function shared.Config.Init() -- Inviter do - local r, g, b, a = unpack(colors[colorIndex]) - colorIndex = colorIndex + 1 + local r, g, b, a = GetNextColor() local inviterConfigFrame = GridFrame.new("HeimdallInviterConfig", UIParent, 12, 20) inviterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) - configFrame:Add(inviterConfigFrame, 6, 3) + configFrame:Add(inviterConfigFrame, 7, 3) local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, "Inviter", { r, g, b, a }) inviterConfigFrame:Add(title, 1, 12) @@ -920,6 +933,336 @@ function shared.Config.Init() inviterConfigFrame:Add(afkThreshold, 2, 6) end + -- Dueler + do + local r, g, b, a = GetNextColor() + local duelerConfigFrame = GridFrame.new("HeimdallDuelerConfig", + UIParent, 12, 20) + duelerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(duelerConfigFrame, 2, 3) + + local title = CreateFancyText("HeimdallDuelerConfigTitle", duelerConfigFrame.frame, "Dueler", { r, g, b, a }) + duelerConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton", + duelerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.dueler.enabled = not Heimdall_Data.config.dueler.enabled + return Heimdall_Data.config.dueler.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.dueler.enabled) + duelerConfigFrame:Add(enableButton, 1, 6) + + local declineOther = CreateBasicButton("HeimdallDuelerConfigDeclineOtherButton", + duelerConfigFrame.frame, "Decline Other", function() + Heimdall_Data.config.dueler.declineOther = not Heimdall_Data.config.dueler.declineOther + return Heimdall_Data.config.dueler.declineOther + end) + declineOther:UpdateColor(Heimdall_Data.config.dueler.declineOther) + duelerConfigFrame:Add(declineOther, 1, 6) + end + + -- Agent Tracker + do + local r, g, b, a = GetNextColor() + local agentTrackerConfigFrame = GridFrame.new("HeimdallAgentTrackerConfig", + UIParent, 12, 20) + agentTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(agentTrackerConfigFrame, 3, 3) + + local title = CreateFancyText("HeimdallAgentTrackerConfigTitle", agentTrackerConfigFrame.frame, "Agent Tracker", + { r, g, b, a }) + agentTrackerConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallAgentTrackerConfigEnableButton", + agentTrackerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.agentTracker.enabled = not Heimdall_Data.config.agentTracker.enabled + return Heimdall_Data.config.agentTracker.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.agentTracker.enabled) + agentTrackerConfigFrame:Add(enableButton, 2, 6) + + local masterChannel = CreateBasicSmallEditBox("HeimdallAgentTrackerConfigMasterChannel", + agentTrackerConfigFrame.frame, "Master Channel", + Heimdall_Data.config.agentTracker.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.agentTracker.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.agentTracker.masterChannel) + end + end) + agentTrackerConfigFrame:Add(masterChannel, 2, 6) + end + + -- Stinky Tracker + do + local r, g, b, a = GetNextColor() + local stinkyTrackerConfigFrame = GridFrame.new("HeimdallStinkyTrackerConfig", + UIParent, 12, 20) + stinkyTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(stinkyTrackerConfigFrame, 3, 3) + + local title = CreateFancyText("HeimdallStinkyTrackerConfigTitle", stinkyTrackerConfigFrame.frame, + "Stinky Tracker", + { r, g, b, a }) + stinkyTrackerConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallStinkyTrackerConfigEnableButton", + stinkyTrackerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.stinkyTracker.enabled = not Heimdall_Data.config.stinkyTracker.enabled + return Heimdall_Data.config.stinkyTracker.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.stinkyTracker.enabled) + stinkyTrackerConfigFrame:Add(enableButton, 2, 6) + + local masterChannel = CreateBasicSmallEditBox("HeimdallStinkyTrackerConfigMasterChannel", + stinkyTrackerConfigFrame.frame, "Master Channel", + Heimdall_Data.config.stinkyTracker.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.stinkyTracker.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.stinkyTracker.masterChannel) + end + end) + stinkyTrackerConfigFrame:Add(masterChannel, 2, 6) + end + + -- Emoter + do + local r, g, b, a = GetNextColor() + local emoterConfigFrame = GridFrame.new("HeimdallEmoterConfig", + UIParent, 12, 20) + emoterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(emoterConfigFrame, 4, 3) + + local title = CreateFancyText("HeimdallEmoterConfigTitle", emoterConfigFrame.frame, "Emoter", + { r, g, b, a }) + emoterConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton", + emoterConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.emoter.enabled = not Heimdall_Data.config.emoter.enabled + return Heimdall_Data.config.emoter.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.emoter.enabled) + emoterConfigFrame:Add(enableButton, 1, 12) + + local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", + emoterConfigFrame.frame, "Master Channel", + Heimdall_Data.config.emoter.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.emoter.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.emoter.masterChannel) + end + end) + emoterConfigFrame:Add(masterChannel, 2, 6) + + local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", + emoterConfigFrame.frame, "Prefix", + Heimdall_Data.config.emoter.prefix, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.emoter.prefix = text + print("Prefix set to", tostring(text)) + else + print("Invalid prefix", tostring(text)) + self:SetText(Heimdall_Data.config.emoter.prefix) + end + end) + emoterConfigFrame:Add(prefix, 2, 6) + end + + -- Echoer + do + local r, g, b, a = GetNextColor() + local echoerConfigFrame = GridFrame.new("HeimdallEchoerConfig", + UIParent, 12, 20) + echoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(echoerConfigFrame, 4, 3) + + local title = CreateFancyText("HeimdallEchoerConfigTitle", echoerConfigFrame.frame, "Echoer", + { r, g, b, a }) + echoerConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton", + echoerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.echoer.enabled = not Heimdall_Data.config.echoer.enabled + return Heimdall_Data.config.echoer.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.echoer.enabled) + echoerConfigFrame:Add(enableButton, 1, 12) + + local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", + echoerConfigFrame.frame, "Master Channel", + Heimdall_Data.config.echoer.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.echoer.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.echoer.masterChannel) + end + end) + echoerConfigFrame:Add(masterChannel, 2, 6) + + local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", + echoerConfigFrame.frame, "Prefix", + Heimdall_Data.config.echoer.prefix, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.echoer.prefix = text + print("Prefix set to", tostring(text)) + else + print("Invalid prefix", tostring(text)) + self:SetText(Heimdall_Data.config.echoer.prefix) + end + end) + echoerConfigFrame:Add(prefix, 2, 6) + end + + -- Commander + do + local r, g, b, a = GetNextColor() + local commanderConfigFrame = GridFrame.new("HeimdallCommanderConfig", + UIParent, 12, 20) + commanderConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(commanderConfigFrame, 6, 3) + + local title = CreateFancyText("HeimdallCommanderConfigTitle", commanderConfigFrame.frame, "Commander", + { r, g, b, a }) + commanderConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton", + commanderConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.commander.enabled = not Heimdall_Data.config.commander.enabled + return Heimdall_Data.config.commander.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.commander.enabled) + commanderConfigFrame:Add(enableButton, 1, 12) + + local masterChannel = CreateBasicSmallEditBox("HeimdallCommanderConfigMasterChannel", + commanderConfigFrame.frame, "Master Channel", + Heimdall_Data.config.commander.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.commander.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.commander.masterChannel) + end + end) + commanderConfigFrame:Add(masterChannel, 2, 6) + + local commander = CreateBasicSmallEditBox("HeimdallCommanderConfigCommander", + commanderConfigFrame.frame, "Commander", + Heimdall_Data.config.commander.commander, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.commander.commander = text + print("Commander set to", tostring(text)) + else + print("Invalid commander", tostring(text)) + self:SetText(Heimdall_Data.config.commander.commander) + end + end) + commanderConfigFrame:Add(commander, 2, 6) + + local commands = CreateBasicSmallEditBox("HeimdallCommanderConfigCommands", + commanderConfigFrame.frame, "Commands", + table.concat(Heimdall_Data.config.commander.commands, ", "), + function(self) + local text = self:GetText() + Heimdall_Data.config.commander.commands = StringToMap(text, ",") + end) + commanderConfigFrame:Add(commands, 2, 12) + end + + -- Macroer + do + local r, g, b, a = GetNextColor() + local macroerConfigFrame = GridFrame.new("HeimdallMacroerConfig", + UIParent, 12, 20) + macroerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(macroerConfigFrame, 4, 3) + + local title = CreateFancyText("HeimdallMacroerConfigTitle", macroerConfigFrame.frame, "Macroer", + { r, g, b, a }) + macroerConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton", + macroerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.macroer.enabled = not Heimdall_Data.config.macroer.enabled + return Heimdall_Data.config.macroer.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.macroer.enabled) + macroerConfigFrame:Add(enableButton, 1, 12) + + local priority = CreateBasicSmallEditBox("HeimdallMacroerConfigPriority", + macroerConfigFrame.frame, "Priority", + table.concat(Heimdall_Data.config.macroer.priority, ", "), + function(self) + local text = self:GetText() + Heimdall_Data.config.macroer.priority = StringToArray(text, ",") + end) + macroerConfigFrame:Add(priority, 2, 12) + end + + -- Combat Alerter + do + local r, g, b, a = GetNextColor() + local combatAlerterConfigFrame = GridFrame.new("HeimdallCombatAlerterConfig", + UIParent, 12, 20) + combatAlerterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) + configFrame:Add(combatAlerterConfigFrame, 3, 3) + + local title = CreateFancyText("HeimdallCombatAlerterConfigTitle", combatAlerterConfigFrame.frame, + "Combat Alerter", + { r, g, b, a }) + combatAlerterConfigFrame:Add(title, 1, 12) + + local enableButton = CreateBasicButton("HeimdallCombatAlerterConfigEnableButton", + combatAlerterConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.combatAlerter.enabled = not Heimdall_Data.config.combatAlerter.enabled + return Heimdall_Data.config.combatAlerter.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.combatAlerter.enabled) + combatAlerterConfigFrame:Add(enableButton, 2, 6) + + local masterChannel = CreateBasicSmallEditBox("HeimdallCombatAlerterConfigMasterChannel", + combatAlerterConfigFrame.frame, "Master Channel", + Heimdall_Data.config.combatAlerter.masterChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.combatAlerter.masterChannel = text + print("Master channel set to", tostring(text)) + else + print("Invalid master channel", tostring(text)) + self:SetText(Heimdall_Data.config.combatAlerter.masterChannel) + end + end) + combatAlerterConfigFrame:Add(masterChannel, 2, 6) + end + print("Heimdall - Config loaded") end