diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index f8b5068..160bd9b 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -39,14 +39,28 @@ Message = { end, ---@param stinky Stinky - ---@return nil - QueueNotifyAddonGuild = function(stinky) - if not stinkyNotifyAddonGuild then return end - local message = Message.new(stinky:FormAddonMessage(), stinky.name, "GUILD", true) + QueueNotifyGuild = function(stinky) + if not stinkyNotifyGuild then return end + local message = Message.new(stinky:FormMessage(), nil, "GUILD") + table.insert(aura_env.messageQueue, message) + end, + ---@param stinky Stinky + QueueNotifyWhisper = function(stinky) + if not stinkyNotifyWhisper then return end + local text = stinky:FormMessage() + for _, to in ipairs(toNotify) do + local message = Message.new(text, to, "WHISPER") + table.insert(aura_env.messageQueue, message) + end + end, + + ---@param stinky Stinky + QueueNotifyAddonGuild = function(stinky) + if not stinkyNotifyAddonGuild then return end + local message = Message.new(stinky:FormAddonMessage(), nil, "GUILD", true) table.insert(aura_env.messageQueue, message) end, ---@param stinky Stinky - ---@return nil QueueNotifyAddonWhisper = function(stinky) if not stinkyNotifyAddonWhisper then return end local text = stinky:FormMessage() @@ -56,23 +70,51 @@ Message = { end end, - ---@param stinky Stinky - ---@return nil - QueueNotifyGuild = function(stinky) - if not stinkyNotifyGuild then return end - local message = Message.new(stinky:FormMessage(), stinky.name, "GUILD") + ---@param faction string + ---@param source string + ---@param destination string + ---@param spellName string + QueueNotifyKilledAddonGuild = function(faction, source, destination, spellName) + if not killNotifyAddonGuild then return end + local text = string.format("%s|%s|%s|%s", faction, source, destination, spellName) + local message = Message.new(text, nil, "GUILD", true) table.insert(aura_env.messageQueue, message) end, - ---@param stinky Stinky - ---@return nil - QueueNotifyWhisper = function(stinky) - if not stinkyNotifyWhisper then return end - local text = stinky:FormMessage() + ---@param faction string + ---@param source string + ---@param destination string + ---@param spellName string + QueueNotifyKilledAddonWhisper = function(faction, source, destination, spellName) + if not killNotifyAddonWhisper then return end + local text = string.format("%s|%s|%s|%s", faction, source, destination, spellName) for _, to in ipairs(toNotify) do - local message = Message.new(text, to, "WHISPER") + local message = Message.new(text, to, "WHISPER", true) table.insert(aura_env.messageQueue, message) end end, + + ---@param faction string + ---@param source string + ---@param destination string + ---@param spellName string + QueueNotifyKilledGuild = function(faction, source, destination, spellName) + if not killNotifyGuild then return end + local text = string.format("%s %s убил %s с помощью %s", faction, source, destination, spellName) + local message = Message.new(text, nil, "GUILD", true) + table.insert(aura_env.messageQueue, message) + end, + ---@param faction string + ---@param source string + ---@param destination string + ---@param spellName string + QueueNotifyKilledWhisper = function(faction, source, destination, spellName) + if not killNotifyWhisper then return end + local text = string.format("%s %s убил %s с помощью %s", faction, source, destination, spellName) + for _, to in ipairs(toNotify) do + local message = Message.new(text, to, "WHISPER", true) + table.insert(aura_env.messageQueue, message) + end + end } ---@class Stinky @@ -178,15 +220,11 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill) faction = WeakAurasSaved.Cyka.PlayerFactionCache[source] end - local msg = string.format("%s %s убил %s с помощью %s с переполнением %d", - faction, source, destination, spellName, overkill) - - if killNotifyWhisper then - for k, v in pairs(toNotify) do - table.insert(aura_env.messageQueue, Message.new(msg, v, "WHISPER")) - end - end - table.insert(aura_env.messageQueue, Message.new(msg, source, "GUILD")) + Message.QueueNotifyKilledGuild(faction, source, destination, spellName) + Message.QueueNotifyKilledWhisper(faction, source, destination, spellName) + Message.QueueNotifyKilledAddonGuild(faction, source, destination, spellName) + Message.QueueNotifyKilledAddonWhisper(faction, source, destination, spellName) + recentlyKilled[source] = GetTime() end