diff --git a/Modules/Config.lua b/Modules/Config.lua index 3c34606..3afe045 100644 --- a/Modules/Config.lua +++ b/Modules/Config.lua @@ -312,13 +312,18 @@ 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 colors = { +local colors = { { 1, 0, 0, 1 }, { 0, 1, 0, 1 }, { 0, 0, 1, 1 }, @@ -345,7 +350,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 }, @@ -480,7 +485,7 @@ function shared.Config.Init() do local spotterConfigFrame = GridFrame.new("HeimdallSpotterConfig", UIParent, 12, 20) - configFrame:Add(spotterConfigFrame, 4, 3) + configFrame:Add(spotterConfigFrame, 5, 3) local title = spotterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") title:SetText("Spotter") @@ -574,7 +579,7 @@ function shared.Config.Init() do local whoerConfigFrame = GridFrame.new("HeimdallWhoerConfig", UIParent, 12, 20) - configFrame:Add(whoerConfigFrame, 8, 3) + configFrame:Add(whoerConfigFrame, 9, 3) local title = whoerConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") title:SetText("Whoer") @@ -645,6 +650,239 @@ function shared.Config.Init() whoerConfigFrame:Add(zoneNotifyFor, 6, 6) end + do + local messengerConfigFrame = GridFrame.new("HeimdallMessengerConfig", + UIParent, 12, 20) + configFrame:Add(messengerConfigFrame, 3, 3) + + local title = messengerConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") + title:SetText("Messenger") + messengerConfigFrame:Add(title, 1, 12) + + local enableButton = BasicButton("HeimdallMessengerConfigEnableButton", + messengerConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.messenger.enabled = not Heimdall_Data.config.messenger.enabled + return Heimdall_Data.config.messenger.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.messenger.enabled) + messengerConfigFrame:Add(enableButton, 1, 6) + + local interval = CreateBasicSmallEditBox("HeimdallMessengerConfigInterval", + messengerConfigFrame.frame, "Interval", + Heimdall_Data.config.messenger.interval, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.messenger.interval = tonumber(text) + print("Interval set to", tostring(text)) + else + print("Invalid interval", tostring(text)) + self:SetText(Heimdall_Data.config.messenger.interval) + end + end) + messengerConfigFrame:Add(interval, 2, 6) + end + + do + local deathReporterConfigFrame = GridFrame.new("HeimdallDeathReporterConfig", + UIParent, 12, 20) + configFrame:Add(deathReporterConfigFrame, 6, 3) + + local title = deathReporterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") + title:SetText("Death Reporter") + deathReporterConfigFrame:Add(title, 1, 12) + + local enableButton = BasicButton("HeimdallDeathReporterConfigEnableButton", + deathReporterConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.deathReporter.enabled = not Heimdall_Data.config.deathReporter.enabled + return Heimdall_Data.config.deathReporter.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.deathReporter.enabled) + deathReporterConfigFrame:Add(enableButton, 1, 6) + + local doWhisperButton = BasicButton("HeimdallDeathReporterConfigDoWhisperButton", + deathReporterConfigFrame.frame, "Do Whisper", function() + Heimdall_Data.config.deathReporter.doWhisper = not Heimdall_Data.config.deathReporter.doWhisper + return Heimdall_Data.config.deathReporter.doWhisper + end) + doWhisperButton:UpdateColor(Heimdall_Data.config.deathReporter.doWhisper) + deathReporterConfigFrame:Add(doWhisperButton, 1, 6) + + local throttleTime = CreateBasicSmallEditBox("HeimdallDeathReporterConfigThrottleTime", + deathReporterConfigFrame.frame, "Throttle Time", + Heimdall_Data.config.deathReporter.throttle, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.deathReporter.throttle = tonumber(text) + print("Throttle time set to", tostring(text)) + else + print("Invalid throttle time", tostring(text)) + self:SetText(Heimdall_Data.config.deathReporter.throttle) + end + end) + deathReporterConfigFrame:Add(throttleTime, 2, 6) + + local duelThrottle = CreateBasicSmallEditBox("HeimdallDeathReporterConfigDuelThrottle", + deathReporterConfigFrame.frame, "Duel Throttle", + Heimdall_Data.config.deathReporter.duelThrottle, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.deathReporter.duelThrottle = tonumber(text) + print("Duel throttle set to", tostring(text)) + else + print("Invalid duel throttle", tostring(text)) + self:SetText(Heimdall_Data.config.deathReporter.duelThrottle) + end + end) + deathReporterConfigFrame:Add(duelThrottle, 2, 6) + + local notifyChannel = CreateBasicSmallEditBox("HeimdallDeathReporterConfigNotifyChannel", + deathReporterConfigFrame.frame, "Notify Channel", + Heimdall_Data.config.deathReporter.notifyChannel, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.deathReporter.notifyChannel = text + print("Notify channel set to", tostring(text)) + else + print("Invalid channel name", tostring(text)) + self:SetText(Heimdall_Data.config.deathReporter.notifyChannel) + end + end) + deathReporterConfigFrame:Add(notifyChannel, 2, 6) + + local zoneOverride = CreateBasicSmallEditBox("HeimdallDeathReporterConfigZoneOverride", + deathReporterConfigFrame.frame, "Zone Override", + Heimdall_Data.config.deathReporter.zoneOverride, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.deathReporter.zoneOverride = text + print("Zone override set to", tostring(text)) + else + print("Invalid zone override", tostring(text)) + self:SetText(Heimdall_Data.config.deathReporter.zoneOverride) + end + end) + deathReporterConfigFrame:Add(zoneOverride, 2, 6) + end + + do + local inviterConfigFrame = GridFrame.new("HeimdallInviterConfig", + UIParent, 12, 20) + configFrame:Add(inviterConfigFrame, 6, 3) + + local title = inviterConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") + title:SetText("Inviter") + inviterConfigFrame:Add(title, 1, 12) + + local enableButton = BasicButton("HeimdallInviterConfigEnableButton", + inviterConfigFrame.frame, "Enabled", function() + Heimdall_Data.config.inviter.enabled = not Heimdall_Data.config.inviter.enabled + return Heimdall_Data.config.inviter.enabled + end) + enableButton:UpdateColor(Heimdall_Data.config.inviter.enabled) + inviterConfigFrame:Add(enableButton, 1, 4) + + local allAssistButton = BasicButton("HeimdallInviterConfigAllAssistButton", + inviterConfigFrame.frame, "All Assist", function() + Heimdall_Data.config.inviter.allAssist = not Heimdall_Data.config.inviter.allAssist + return Heimdall_Data.config.inviter.allAssist + end) + allAssistButton:UpdateColor(Heimdall_Data.config.inviter.allAssist) + inviterConfigFrame:Add(allAssistButton, 1, 4) + + local agentsAssist = BasicButton("HeimdallInviterConfigAgentsAssistButton", + inviterConfigFrame.frame, "Agents Assist", function() + Heimdall_Data.config.inviter.agentsAssist = not Heimdall_Data.config.inviter.agentsAssist + return Heimdall_Data.config.inviter.agentsAssist + end) + agentsAssist:UpdateColor(Heimdall_Data.config.inviter.agentsAssist) + inviterConfigFrame:Add(agentsAssist, 1, 4) + + local throttle = CreateBasicSmallEditBox("HeimdallInviterConfigThrottle", + inviterConfigFrame.frame, "Throttle", + Heimdall_Data.config.inviter.throttle, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.inviter.throttle = tonumber(text) + print("Throttle time set to", tostring(text)) + else + print("Invalid throttle time", tostring(text)) + self:SetText(Heimdall_Data.config.inviter.throttle) + end + end) + inviterConfigFrame:Add(throttle, 2, 6) + + local listeningChannel = CreateBasicSmallEditBox("HeimdallInviterConfigListeningChannel", + inviterConfigFrame.frame, "Listening Channel", + Heimdall_Data.config.inviter.listeningChannel, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.inviter.listeningChannel = text + print("Listening channel set to", tostring(text)) + else + print("Invalid listening channel", tostring(text)) + self:SetText(Heimdall_Data.config.inviter.listeningChannel) + end + end) + inviterConfigFrame:Add(listeningChannel, 2, 6) + + local keyword = CreateBasicSmallEditBox("HeimdallInviterConfigKeywords", + inviterConfigFrame.frame, "Keyword", + Heimdall_Data.config.inviter.keyword, + function(self) + local text = self:GetText() + if string.match(text, "%S+") then + Heimdall_Data.config.inviter.keyword = text + print("Keyword set to", tostring(text)) + else + print("Invalid keyword", tostring(text)) + self:SetText(Heimdall_Data.config.inviter.keyword) + end + end) + inviterConfigFrame:Add(keyword, 2, 6) + + local cleanupInterval = CreateBasicSmallEditBox("HeimdallInviterConfigCleanupInterval", + inviterConfigFrame.frame, "Cleanup Interval", + Heimdall_Data.config.inviter.cleanupInterval, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.inviter.cleanupInterval = tonumber(text) + print("Cleanup interval set to", tostring(text)) + else + print("Invalid cleanup interval", tostring(text)) + self:SetText(Heimdall_Data.config.inviter.cleanupInterval) + end + end) + inviterConfigFrame:Add(cleanupInterval, 2, 6) + + local afkThreshold = CreateBasicSmallEditBox("HeimdallInviterConfigAfkThreshold", + inviterConfigFrame.frame, "Afk Threshold", + Heimdall_Data.config.inviter.afkThreshold, + function(self) + local text = self:GetText() + if string.match(text, "%d+") then + Heimdall_Data.config.inviter.afkThreshold = tonumber(text) + print("Afk threshold set to", tostring(text)) + end + end) + inviterConfigFrame:Add(afkThreshold, 2, 6) + + local kickOffline = BasicButton("HeimdallInviterConfigKickOfflineButton", + inviterConfigFrame.frame, "Kick Offline", function() + Heimdall_Data.config.inviter.kickOffline = not Heimdall_Data.config.inviter.kickOffline + return Heimdall_Data.config.inviter.kickOffline + end) + kickOffline:UpdateColor(Heimdall_Data.config.inviter.kickOffline) + inviterConfigFrame:Add(kickOffline, 1, 4) + end + print("Heimdall - Config loaded") end