diff --git a/Modules/Config.lua b/Modules/Config.lua index e101f23..0092eef 100644 --- a/Modules/Config.lua +++ b/Modules/Config.lua @@ -534,9 +534,9 @@ function shared.Config.Init() local debug = CreateBasicButton("HeimdallConfigDebug", configFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() - Heimdall_Data.config.debug = not Heimdall_Data.config.debug - return Heimdall_Data.config.debug - end) + Heimdall_Data.config.debug = not Heimdall_Data.config.debug + return Heimdall_Data.config.debug + end) debug:UpdateColor(Heimdall_Data.config.debug) configFrame:Add(debug, 2, 1) @@ -615,20 +615,16 @@ function shared.Config.Init() stinkyButton:UpdateColor(Heimdall_Data.config.spotter.stinky) spotterConfigFrame:Add(stinkyButton, 1, 4) - local notifyChannel = CreateBasicSmallEditBox("HeimdallSpotterConfigNotifyChannel", - spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, - Heimdall_Data.config.spotter.notifyChannel, + local channels = CreateBasicSmallEditBox("HeimdallSpotterConfigChannels", + spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.spotter.channels or {}, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.spotter.notifyChannel = text - print("Notify channel set to", tostring(text)) - else - print("Invalid channel name", tostring(text)) - self:SetText(Heimdall_Data.config.spotter.notifyChannel) - end + Heimdall_Data.config.spotter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.spotter.channels) end) - spotterConfigFrame:Add(notifyChannel, 2, 4) + spotterConfigFrame:Add(channels, 2, 4) local zoneOverride = CreateBasicSmallEditBox("HeimdallSpotterConfigZoneOverride", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.zoneOverride, @@ -695,20 +691,16 @@ function shared.Config.Init() doWhisperButton:UpdateColor(Heimdall_Data.config.who.doWhisper) whoerConfigFrame:Add(doWhisperButton, 2, 3) - local notifyChannel = CreateBasicSmallEditBox("HeimdallWhoerConfigNotifyChannel", - whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, - Heimdall_Data.config.who.notifyChannel, + local channels = CreateBasicSmallEditBox("HeimdallWhoerConfigChannels", + whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.who.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.who.notifyChannel = text - print("Notify channel set to", tostring(text)) - else - print("Invalid channel name", tostring(text)) - self:SetText(Heimdall_Data.config.who.notifyChannel) - end + Heimdall_Data.config.who.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.who.channels) end) - whoerConfigFrame:Add(notifyChannel, 2, 3) + whoerConfigFrame:Add(channels, 2, 3) local ttl = CreateBasicSmallEditBox("HeimdallWhoerConfigTTL", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, @@ -871,20 +863,16 @@ function shared.Config.Init() end) deathReporterConfigFrame:Add(duelThrottle, 2, 6) - local masterChannel = CreateBasicSmallEditBox("HeimdallDeathReporterConfigMasterChannel", - deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.deathReporter.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallDeathReporterConfigChannels", + deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.deathReporter.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.deathReporter.masterChannel = text - print("Master channel set to", tostring(text)) - else - print("Invalid channel name", tostring(text)) - self:SetText(Heimdall_Data.config.deathReporter.masterChannel) - end + Heimdall_Data.config.deathReporter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.deathReporter.channels) end) - deathReporterConfigFrame:Add(masterChannel, 2, 6) + deathReporterConfigFrame:Add(channels, 2, 6) local zoneOverride = CreateBasicSmallEditBox("HeimdallDeathReporterConfigZoneOverride", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.zoneOverride, @@ -968,20 +956,16 @@ function shared.Config.Init() end) inviterConfigFrame:Add(throttle, 2, 6) - local listeningChannel = CreateBasicSmallEditBox("HeimdallInviterConfigListeningChannel", - inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - MapKeyToString(Heimdall_Data.config.inviter.listeningChannel, ","), + local channels = CreateBasicSmallEditBox("HeimdallInviterConfigChannels", + inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.inviter.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%D+") then - Heimdall_Data.config.inviter.listeningChannel = StringToMap(text, ",") - print("Listening channel set to", tostring(text)) - else - print("Invalid listening channel", tostring(text)) - self:SetText(MapKeyToString(Heimdall_Data.config.inviter.listeningChannel, ",")) - end + Heimdall_Data.config.inviter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.inviter.channels) end) - inviterConfigFrame:Add(listeningChannel, 2, 6) + inviterConfigFrame:Add(channels, 2, 6) local keyword = CreateBasicSmallEditBox("HeimdallInviterConfigKeywords", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.keyword, @@ -1091,20 +1075,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.agentTracker.enabled) agentTrackerConfigFrame:Add(enableButton, 2, 6) - local masterChannel = CreateBasicSmallEditBox("HeimdallAgentTrackerConfigMasterChannel", - agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.agentTracker.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallAgentTrackerConfigChannels", + agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.agentTracker.channels, ","), 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 + Heimdall_Data.config.agentTracker.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.agentTracker.channels) end) - agentTrackerConfigFrame:Add(masterChannel, 2, 6) + agentTrackerConfigFrame:Add(channels, 2, 6) end -- Stinky Tracker @@ -1134,20 +1114,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.stinkyTracker.enabled) stinkyTrackerConfigFrame:Add(enableButton, 2, 6) - local masterChannel = CreateBasicSmallEditBox("HeimdallStinkyTrackerConfigMasterChannel", - stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.stinkyTracker.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallStinkyTrackerConfigChannels", + stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.stinkyTracker.channels, ","), 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 + Heimdall_Data.config.stinkyTracker.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.stinkyTracker.channels) end) - stinkyTrackerConfigFrame:Add(masterChannel, 2, 6) + stinkyTrackerConfigFrame:Add(channels, 2, 6) end -- Emoter @@ -1178,20 +1154,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.emoter.enabled) emoterConfigFrame:Add(enableButton, 1, 12) - local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", - emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.emoter.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallEmoterConfigChannels", + emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.emoter.channels, ","), 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 + Heimdall_Data.config.emoter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.emoter.channels) end) - emoterConfigFrame:Add(masterChannel, 2, 6) + emoterConfigFrame:Add(channels, 2, 6) local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.prefix, @@ -1237,20 +1209,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.echoer.enabled) echoerConfigFrame:Add(enableButton, 1, 12) - local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", - echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.echoer.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallEmoterConfigChannels", + echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.echoer.channels, ","), 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 + Heimdall_Data.config.echoer.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.echoer.channels) end) - echoerConfigFrame:Add(masterChannel, 2, 6) + echoerConfigFrame:Add(channels, 2, 6) local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.prefix, @@ -1296,20 +1264,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.commander.enabled) commanderConfigFrame:Add(enableButton, 1, 12) - local masterChannel = CreateBasicSmallEditBox("HeimdallCommanderConfigMasterChannel", - commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.commander.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallCommanderConfigChannels", + commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.commander.channels, ","), 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 + Heimdall_Data.config.commander.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.commander.channels) end) - commanderConfigFrame:Add(masterChannel, 2, 6) + commanderConfigFrame:Add(channels, 2, 6) local commander = CreateBasicSmallEditBox("HeimdallCommanderConfigCommander", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.commander, @@ -1402,20 +1366,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.combatAlerter.enabled) combatAlerterConfigFrame:Add(enableButton, 2, 6) - local masterChannel = CreateBasicSmallEditBox("HeimdallCombatAlerterConfigMasterChannel", - combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.combatAlerter.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallCombatAlerterConfigChannels", + combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.combatAlerter.channels, ","), 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 + Heimdall_Data.config.combatAlerter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.combatAlerter.channels) end) - combatAlerterConfigFrame:Add(masterChannel, 2, 6) + combatAlerterConfigFrame:Add(channels, 2, 6) end -- Sniffer @@ -1454,20 +1414,16 @@ function shared.Config.Init() stinkyButton:UpdateColor(Heimdall_Data.config.sniffer.stinky) snifferConfigFrame:Add(stinkyButton, 2, 3) - local notifyChannel = CreateBasicSmallEditBox("HeimdallSnifferConfigNotifyChannel", - snifferConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, - Heimdall_Data.config.sniffer.notifyChannel, + local channels = CreateBasicSmallEditBox("HeimdallSnifferConfigChannels", + snifferConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.sniffer.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.sniffer.notifyChannel = text - print("Notify channel set to", tostring(text)) - else - print("Invalid notify channel", tostring(text)) - self:SetText(Heimdall_Data.config.sniffer.notifyChannel) - end + Heimdall_Data.config.sniffer.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.sniffer.channels) end) - snifferConfigFrame:Add(notifyChannel, 2, 6) + snifferConfigFrame:Add(channels, 2, 6) local throttle = CreateBasicSmallEditBox("HeimdallSnifferConfigThrottle", snifferConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.throttle, @@ -1529,20 +1485,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.bonkDetector.enabled) bonkDetectorConfigFrame:Add(enableButton, 1, 12) - local notifyChannel = CreateBasicSmallEditBox("HeimdallBonkDetectorConfigNotifyChannel", - bonkDetectorConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, - Heimdall_Data.config.bonkDetector.notifyChannel, + local channels = CreateBasicSmallEditBox("HeimdallBonkDetectorConfigChannels", + bonkDetectorConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.bonkDetector.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.bonkDetector.notifyChannel = text - print("Notify channel set to", tostring(text)) - else - print("Invalid notify channel", tostring(text)) - self:SetText(Heimdall_Data.config.bonkDetector.notifyChannel) - end + Heimdall_Data.config.bonkDetector.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.bonkDetector.channels) end) - bonkDetectorConfigFrame:Add(notifyChannel, 2, 6) + bonkDetectorConfigFrame:Add(channels, 2, 6) local throttle = CreateBasicSmallEditBox("HeimdallBonkDetectorConfigThrottle", bonkDetectorConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.throttle, @@ -1588,20 +1540,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.minimapTagger.enabled) minimapTaggerConfigFrame:Add(enableButton, 2, 6) - local masterChannel = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigMasterChannel", - minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.minimapTagger.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigChannels", + minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.minimapTagger.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.minimapTagger.masterChannel = text - print("Master channel set to", tostring(text)) - else - print("Invalid master channel", tostring(text)) - self:SetText(Heimdall_Data.config.minimapTagger.masterChannel) - end + Heimdall_Data.config.minimapTagger.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.minimapTagger.channels) end) - minimapTaggerConfigFrame:Add(masterChannel, 2, 3) + minimapTaggerConfigFrame:Add(channels, 2, 3) local scale = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigScale", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.scale, @@ -1883,20 +1831,16 @@ function shared.Config.Init() enableButton:UpdateColor(Heimdall_Data.config.noter.enabled) noterConfigFrame:Add(enableButton, 1, 12) - local masterChannel = CreateBasicSmallEditBox("HeimdallNoterConfigMasterChannel", - noterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, - Heimdall_Data.config.noter.masterChannel, + local channels = CreateBasicSmallEditBox("HeimdallNoterConfigChannels", + noterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.channels, + table.concat(Heimdall_Data.config.noter.channels, ","), function(self) local text = self:GetText() - if string.match(text, "%S+") then - Heimdall_Data.config.noter.masterChannel = text - print("Master channel set to", tostring(text)) - else - print("Invalid master channel", tostring(text)) - self:SetText(Heimdall_Data.config.noter.masterChannel) - end + Heimdall_Data.config.noter.channels = StringToArray(text, ",") + print("Channels set to") + shared.dumpTable(Heimdall_Data.config.noter.channels) end) - noterConfigFrame:Add(masterChannel, 2, 6) + noterConfigFrame:Add(channels, 2, 6) local lastNotes = CreateBasicSmallEditBox("HeimdallNoterConfigLastNotes", noterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.lastNotes,