Implement enabling/disabling commands
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
---@param str string
|
||||
---@return table<string, boolean>
|
||||
local function StringToMap(str)
|
||||
local function StringToMap(str, deliminer)
|
||||
if not str then return {} end
|
||||
local map = {}
|
||||
local parts = { strsplit("\n", str) }
|
||||
local parts = { strsplit(deliminer, str) }
|
||||
for _, line in ipairs(parts) do
|
||||
line = strtrim(line)
|
||||
if line ~= "" then
|
||||
if line ~= "" then
|
||||
map[line] = true
|
||||
end
|
||||
end
|
||||
@@ -15,10 +15,10 @@ end
|
||||
|
||||
---@param str string
|
||||
---@return string[]
|
||||
local function StringToArray(str)
|
||||
local function StringToArray(str, deliminer)
|
||||
if not str then return {} end
|
||||
local ret = {}
|
||||
local array = { strsplit("\n", str) }
|
||||
local array = { strsplit(deliminer, str) }
|
||||
for i, line in ipairs(array) do
|
||||
line = strtrim(line)
|
||||
if line ~= "" then
|
||||
@@ -43,11 +43,11 @@ local config = {
|
||||
},
|
||||
who = {
|
||||
enabled = aura_env.config.who.enabled,
|
||||
ignored = StringToMap(aura_env.config.who.ignored),
|
||||
ignored = StringToMap(aura_env.config.who.ignored, "\n"),
|
||||
notifyChannel = aura_env.config.who.notifyChannel,
|
||||
ttl = aura_env.config.who.ttl,
|
||||
doWhisper = aura_env.config.who.doWhisper,
|
||||
zoneNotifyFor = StringToMap(aura_env.config.who.zoneNotifyFor),
|
||||
zoneNotifyFor = StringToMap(aura_env.config.who.zoneNotifyFor, "\n"),
|
||||
},
|
||||
messenger = {
|
||||
enabled = aura_env.config.messenger.enabled,
|
||||
@@ -61,8 +61,8 @@ local config = {
|
||||
zoneOverride = aura_env.config.deathReporter.zoneOverride,
|
||||
duelThrottle = aura_env.config.deathReporter.duelThrottle,
|
||||
},
|
||||
whisperNotify = StringToArray(aura_env.config.whisperNotify),
|
||||
stinkies = StringToMap(aura_env.config.stinkies),
|
||||
whisperNotify = StringToArray(aura_env.config.whisperNotify, "\n"),
|
||||
stinkies = StringToMap(aura_env.config.stinkies, "\n"),
|
||||
inviter = {
|
||||
enabled = aura_env.config.inviter.enabled,
|
||||
listeningChannel = aura_env.config.inviter.listeningChannel,
|
||||
@@ -94,12 +94,13 @@ local config = {
|
||||
},
|
||||
macroer = {
|
||||
enabled = aura_env.config.macroer.enabled,
|
||||
priority = StringToArray(aura_env.config.macroer.priority),
|
||||
priority = StringToArray(aura_env.config.macroer.priority, "\n"),
|
||||
},
|
||||
commander = {
|
||||
enabled = aura_env.config.commander.enabled,
|
||||
masterChannel = aura_env.config.commander.masterChannel,
|
||||
commander = aura_env.config.commander.commander,
|
||||
commands = StringToMap(aura_env.config.commander.commands, ","),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -158,6 +159,7 @@ Heimdall_Data.config.macroer.priority = config.macroer.priority
|
||||
Heimdall_Data.config.commander.enabled = config.commander.enabled
|
||||
Heimdall_Data.config.commander.masterChannel = config.commander.masterChannel
|
||||
Heimdall_Data.config.commander.commander = config.commander.commander
|
||||
Heimdall_Data.config.commander.commands = config.commander.commands
|
||||
|
||||
Heimdall_Data.config.whisperNotify = config.whisperNotify
|
||||
Heimdall_Data.config.stinkies = config.stinkies
|
||||
|
||||
Reference in New Issue
Block a user