Files
wow-Heimdall/Weakauras/Config/init.lua

117 lines
4.2 KiB
Lua

---@param str string
---@return table<string, boolean>
local function StringToMap(str)
if not str then return {} end
local map = {}
local parts = { strsplit("\n", str) }
for _, line in ipairs(parts) do
line = strtrim(line)
if line ~= "" then
map[line] = true
end
end
return map
end
---@param str string
---@return string[]
local function StringToArray(str)
if not str then return {} end
local ret = {}
local array = { strsplit("\n", str) }
for i, line in ipairs(array) do
line = strtrim(line)
if line ~= "" then
ret[i] = line
end
end
return ret
end
if not Heimdall_Data then Heimdall_Data = {} end
local config = {
spotter = {
enabled = aura_env.config.spotter.enabled,
everyone = aura_env.config.spotter.everyone,
hostile = aura_env.config.spotter.hostile,
alliance = aura_env.config.spotter.alliance,
stinky = aura_env.config.spotter.stinky,
notifyChannel = aura_env.config.spotter.notifyChannel,
zoneOverride = aura_env.config.spotter.zoneOverride,
throttleTime = aura_env.config.spotter.throttleTime
},
who = {
enabled = aura_env.config.who.enabled,
ignored = StringToMap(aura_env.config.who.ignored),
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),
},
messenger = {
enabled = aura_env.config.messenger.enabled,
interval = aura_env.config.messenger.interval,
},
deathReporter = {
enabled = aura_env.config.deathReporter.enabled,
throttle = aura_env.config.deathReporter.throttle,
doWhisper = aura_env.config.deathReporter.doWhisper,
notifyChannel = aura_env.config.deathReporter.notifyChannel,
zoneOverride = aura_env.config.deathReporter.zoneOverride,
duelThrottle = aura_env.config.deathReporter.duelThrottle,
},
whisperNotify = StringToArray(aura_env.config.whisperNotify),
stinkies = StringToMap(aura_env.config.stinkies),
inviter = {
enabled = aura_env.config.inviter.enabled,
listeningChannel = aura_env.config.inviter.listeningChannel,
keyword = aura_env.config.inviter.keyword,
},
dueler = {
enabled = aura_env.config.dueler.enabled,
declineOther = aura_env.config.dueler.declineOther,
},
bully = {
enabled = aura_env.config.bully.enabled,
},
}
Heimdall_Data.config.spotter.enabled = config.spotter.enabled
Heimdall_Data.config.spotter.everyone = config.spotter.everyone
Heimdall_Data.config.spotter.hostile = config.spotter.hostile
Heimdall_Data.config.spotter.alliance = config.spotter.alliance
Heimdall_Data.config.spotter.stinky = config.spotter.stinky
Heimdall_Data.config.spotter.notifyChannel = config.spotter.notifyChannel
Heimdall_Data.config.spotter.zoneOverride = config.spotter.zoneOverride
Heimdall_Data.config.spotter.throttleTime = config.spotter.throttleTime
Heimdall_Data.config.who.enabled = config.who.enabled
Heimdall_Data.config.who.ignored = config.who.ignored
Heimdall_Data.config.who.notifyChannel = config.who.notifyChannel
Heimdall_Data.config.who.ttl = config.who.ttl
Heimdall_Data.config.who.doWhisper = config.who.doWhisper
Heimdall_Data.config.who.zoneNotifyFor = config.who.zoneNotifyFor
Heimdall_Data.config.messenger.enabled = config.messenger.enabled
Heimdall_Data.config.messenger.interval = config.messenger.interval
Heimdall_Data.config.deathReporter.enabled = config.deathReporter.enabled
Heimdall_Data.config.deathReporter.throttle = config.deathReporter.throttle
Heimdall_Data.config.deathReporter.doWhisper = config.deathReporter.doWhisper
Heimdall_Data.config.deathReporter.notifyChannel = config.deathReporter.notifyChannel
Heimdall_Data.config.deathReporter.zoneOverride = config.deathReporter.zoneOverride
Heimdall_Data.config.deathReporter.duelThrottle = config.deathReporter.duelThrottle
Heimdall_Data.config.inviter.enabled = config.inviter.enabled
Heimdall_Data.config.inviter.listeningChannel = config.inviter.listeningChannel
Heimdall_Data.config.inviter.keyword = config.inviter.keyword
Heimdall_Data.config.dueler.enabled = config.dueler.enabled
Heimdall_Data.config.dueler.declineOther = config.dueler.declineOther
Heimdall_Data.config.bully.enabled = config.bully.enabled
Heimdall_Data.config.whisperNotify = config.whisperNotify
Heimdall_Data.config.stinkies = config.stinkies