Files
wow-Heimdall/Weakauras/Config/init.lua
2025-01-01 13:59:58 +01:00

82 lines
2.5 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 = 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,
},
deathReporter = {
enabled = aura_env.config.deathReporter.enabled,
throttle = aura_env.config.deathReporter.throttle,
doWhisper = aura_env.config.deathReporter.doWhisper,
notifyChannel = aura_env.config.deathReporter.notifyChannel2,
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,
updateInterval = aura_env.config.inviter.updateInterval,
whitelist = StringToArray(aura_env.config.inviter.whitelist),
}
}
DevTools_Dump(config)
--Heimdall_Data.config.spotter = config.spotter
--Heimdall_Data.config.who = config.who
--Heimdall_Data.config.messenger = config.messenger
--Heimdall_Data.config.deathReporter = config.deathReporter
--Heimdall_Data.config.inviter = config.inviter
--Heimdall_Data.config.whisperNotify = config.whisperNotify
--Heimdall_Data.config.stinkies = config.stinkies