Refactor separator and addon prefix out of options

This commit is contained in:
2024-10-14 15:46:44 +02:00
parent 2ca86e0944
commit 34c76b7087
4 changed files with 15 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ function()
print(string.format("Processing message; %d in queue", #aura_env.messageQueue))
if message.addon then
SendAddonMessage("STINKY_DETECTED", message.message, message.channel, nil, message.to)
SendAddonMessage(aura_env.addonprefix, message.message, message.channel, nil, message.to)
else
SendChatMessage(message.message, message.channel, nil, message.to)
end

View File

@@ -1,4 +1,9 @@
-- CHAT_MSG_ADDON
function(e, ...)
print(e, ...)
function(e, prefix, msg, ...)
print(string.format("e = %s", e))
print(string.format("prefix = %s", prefix))
print(string.format("msg = %s", msg))
for i = 1, select("#", ...) do
print(string.format("arg %d = %s", i, select(i, ...)))
end
end

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,8 @@
---@type Message[]
aura_env.messageQueue = {}
aura_env.separator = "\\"
aura_env.addonprefix = "STINKY_DETECTOR"
RegisterAddonMessagePrefix(aura_env.addonprefix)
---@type string[]
local toNotify = { "Succpotato", "Extazyk", "Smokefire", "Smokemantra", "Хихихантер", "Муркот", "Растафаркрай" }
@@ -79,7 +82,7 @@ Message = {
QueueNotifyKilledAddonGuild = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyAddonGuild then return end
if aura_env.config.debug then print("Queueing notify addon guild:") end
local text = string.format("%s|%s|%s|%s", faction, source, destination, spellName)
local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, aura_env.separator, spellName)
local message = Message.new(text, nil, "GUILD", true)
if aura_env.config.debug then DevTools_Dump(message) end
table.insert(aura_env.messageQueue, message)
@@ -91,7 +94,7 @@ Message = {
QueueNotifyKilledAddonWhisper = function(faction, source, destination, spellName)
if not aura_env.config.killNotifyAddonWhisper then return end
if aura_env.config.debug then print("Queueing notify addon whisper:") end
local text = string.format("%s|%s|%s|%s", faction, source, destination, spellName)
local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, aura_env.separator, spellName)
for _, to in ipairs(toNotify) do
local message = Message.new(text, to, "WHISPER", true)
if aura_env.config.debug then DevTools_Dump(message) end
@@ -158,7 +161,7 @@ Stinky = {
---@param self Stinky
---@return string
FormAddonMessage = function(self)
return string.format("%s|%s|%s", self.name, self.threat, self.note)
return string.format("%s%s%s%s%s", self.name, aura_env.separator, self.threat, aura_env.separator, self.note)
end,
}