Rework to send addon messages
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
---@param e string
|
---@param e string
|
||||||
function(allstates, e, ...)
|
function(allstates, e, ...)
|
||||||
if e == "TICKER_1000" then
|
if e == "TICKER_1000" then
|
||||||
local ttl = 120
|
local ttl = aura_env.config.ttl or 120
|
||||||
for _, state in pairs(allstates) do
|
for _, state in pairs(allstates) do
|
||||||
if state.progress then
|
if state.progress then
|
||||||
local elapsedTime = GetTime() - state.index
|
local elapsedTime = GetTime() - state.index
|
||||||
|
@@ -1,8 +1,16 @@
|
|||||||
-- TICKER_200
|
-- TICKER_100
|
||||||
function()
|
function()
|
||||||
local whisper = aura_env.whisperQueue[1]
|
---@type Message
|
||||||
if whisper == nil then return end
|
local message = aura_env.messageQueue[1]
|
||||||
SendChatMessage(whisper.msg, "WHISPER", nil, whisper.to)
|
if message == nil then return end
|
||||||
print(string.format("Whispering %s, %d remaining in queue", whisper.to, #aura_env.whisperQueue))
|
print(string.format("Processing message; %d in queue", #aura_env.messageQueue))
|
||||||
table.remove(aura_env.whisperQueue, 1)
|
DevTools_Dump(message)
|
||||||
|
|
||||||
|
if message.addon then
|
||||||
|
SendAddonMessage("STINKY_DETECTED", message.message, message.channel, nil, message.to)
|
||||||
|
else
|
||||||
|
SendChatMessage(message.message, message.channel, nil, message.to)
|
||||||
|
end
|
||||||
|
|
||||||
|
table.remove(aura_env.messageQueue, 1)
|
||||||
end
|
end
|
4
FreshShit/StinkyDetector/event3.lua
Normal file
4
FreshShit/StinkyDetector/event3.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-- CHAT_MSG_ADDON
|
||||||
|
function(e, msg)
|
||||||
|
print(e, msg)
|
||||||
|
end
|
File diff suppressed because one or more lines are too long
@@ -1,40 +1,153 @@
|
|||||||
|
---@type Message[]
|
||||||
|
aura_env.messageQueue = {}
|
||||||
|
|
||||||
|
---@type number
|
||||||
|
local threatNotifyLevel = aura_env.config.threatNotifyLevel or 5
|
||||||
|
local stinkyNotifyGuild = aura_env.config.stinkyNotifyGuild or true
|
||||||
|
local stinkyNotifyWhisper = aura_env.config.stinkyNotifyWhisper or true
|
||||||
|
local stinkyNotifyAddonGuild = aura_env.config.stinkyNotifyAddonGuild or true
|
||||||
|
local stinkyNotifyAddonWhisper = aura_env.config.stinkyNotifyAddonWhisper or true
|
||||||
|
local killNotifyGuild = aura_env.config.killNotifyGuild or true
|
||||||
|
local killNotifyWhisper = aura_env.config.killNotifyWhisper or true
|
||||||
|
local killNotifyAddonGuild = aura_env.config.killNotifyAddonGuild or true
|
||||||
|
local killNotifyAddonWhisper = aura_env.config.killNotifyAddonWhisper or true
|
||||||
|
|
||||||
|
---@type string[]
|
||||||
|
local toNotify = { "Succpotato", "Extazyk", "Smokefire", "Smokemantra", "Хихихантер", "Муркот", "Растафаркрай" }
|
||||||
|
local toNotify = { "Succpotato" }
|
||||||
|
|
||||||
|
---@class Message
|
||||||
|
---@field message string
|
||||||
|
---@field to string
|
||||||
|
---@field channel string
|
||||||
|
---@field addon boolean
|
||||||
|
Message = {
|
||||||
|
---@param message string
|
||||||
|
---@param to string
|
||||||
|
---@param channel string
|
||||||
|
---@param addon? boolean
|
||||||
|
---@return Message
|
||||||
|
new = function(message, to, channel, addon)
|
||||||
|
local self = setmetatable({}, {
|
||||||
|
__index = Message
|
||||||
|
})
|
||||||
|
self.message = message
|
||||||
|
self.to = to
|
||||||
|
self.channel = channel
|
||||||
|
self.addon = addon or false
|
||||||
|
return self
|
||||||
|
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)
|
||||||
|
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()
|
||||||
|
for _, to in ipairs(toNotify) do
|
||||||
|
local message = Message.new(text, to, "WHISPER", true)
|
||||||
|
table.insert(aura_env.messageQueue, 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")
|
||||||
|
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()
|
||||||
|
for _, to in ipairs(toNotify) do
|
||||||
|
local message = Message.new(text, to, "WHISPER")
|
||||||
|
table.insert(aura_env.messageQueue, message)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
---@class Stinky
|
||||||
|
---@field name string
|
||||||
|
---@field threat number 1-10 10 being maxima threat
|
||||||
|
---@field note string|nil
|
||||||
|
Stinky = {
|
||||||
|
name = "",
|
||||||
|
threat = 0,
|
||||||
|
note = "",
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param threat number
|
||||||
|
---@param note string|nil
|
||||||
|
---@return Stinky
|
||||||
|
new = function(name, threat, note)
|
||||||
|
local self = setmetatable({}, {
|
||||||
|
__index = Stinky
|
||||||
|
})
|
||||||
|
self.name = name
|
||||||
|
self.threat = threat
|
||||||
|
self.note = note
|
||||||
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
|
---@param self Stinky
|
||||||
|
---@return string
|
||||||
|
FormMessage = function(self)
|
||||||
|
return string.format("%s в Оргриммаре!", self.name)
|
||||||
|
end,
|
||||||
|
---@param self Stinky
|
||||||
|
---@return string
|
||||||
|
FormAddonMessage = function(self)
|
||||||
|
return string.format("%s|%s|%s", self.name, self.threat, self.note)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
||||||
if not WeakAurasSaved.Cyka.PlayerFactionCache then WeakAurasSaved.Cyka.PlayerFactionCache = {} end
|
if not WeakAurasSaved.Cyka.PlayerFactionCache then WeakAurasSaved.Cyka.PlayerFactionCache = {} end
|
||||||
WeakAurasSaved.Cyka.Stinkies = {
|
WeakAurasSaved.Cyka.Stinkies = {
|
||||||
["Redbulka"] = true,
|
["Redbulka"] = Stinky.new("Redbulka", 5),
|
||||||
["Курлык"] = true,
|
["Курлык"] = Stinky.new("Курлык", 5),
|
||||||
["Riener"] = true,
|
["Riener"] = Stinky.new("Riener", 5),
|
||||||
["Unwashed"] = true,
|
["Unwashed"] = Stinky.new("Unwashed", 5),
|
||||||
["Ловилуну"] = true,
|
["Ловилуну"] = Stinky.new("Ловилуну", 5),
|
||||||
["Фоська"] = true, -- if she comes here to orgrimmar. then she will be with 1 or 2 friends. they can be killed. but it may be difficult
|
["Фоська"] = Stinky.new("Фоська", 5,
|
||||||
["Korovadura"] = true,
|
"if she comes here to orgrimmar. then she will be with 1 or 2 friends. they can be killed. but it may be difficult"),
|
||||||
["Pizdosorkam"] = true,
|
["Korovadura"] = Stinky.new("Korovadura", 5),
|
||||||
["Неонанируй"] = true,
|
["Pizdosorkam"] = Stinky.new("Pizdosorkam", 3, "Horde"),
|
||||||
["Bunkkeer"] = true,
|
["Неонанируй"] = Stinky.new("Неонанируй", 5),
|
||||||
["Dewdew"] = true,
|
["Bunkkeer"] = Stinky.new("Bunkkeer", 5),
|
||||||
["Empanao"] = true,
|
["Dewdew"] = Stinky.new("Dewdew", 4),
|
||||||
["Стелсон"] = false, -- Apyr
|
["Психопаточка"] = Stinky.new("Психопаточка", 5),
|
||||||
["Trafik"] = false, -- Has agreed to behave, is french (also horde)
|
["Empanao"] = Stinky.new("Empanao", 3, "Horde"),
|
||||||
["Aye"] = true, -- Actually a pretty good player, sadly... Part of DNF, says murkot
|
["Стелсон"] = Stinky.new("Стелсон", 1, "Apyr"),
|
||||||
["Paskoo"] = false, -- Really stinky but he's horde... Many false alarms
|
["Trafik"] = Stinky.new("Trafik", 1, "Has agreed to behave, is french (also horde)"),
|
||||||
["Армагид"] = true,
|
["Aye"] = Stinky.new("Aye", 8, "Actually a pretty good player, sadly... Part of DNF, says murkot"),
|
||||||
["Психопаточка"] = true,
|
["Paskoo"] = Stinky.new("Paskoo", 2, "Really stinky but he's horde..."),
|
||||||
["Hmor"] = false,
|
["Армагид"] = Stinky.new("Армагид", 3),
|
||||||
["Паладийпал"] = true, -- Possibly related to Oakskin
|
["Паладийпал"] = Stinky.new("Паладийпал", 5, "Possibly related to Oakskin"),
|
||||||
["Oakskin"] = true,
|
["Hmor"] = Stinky.new("Hmor", 4, "Horde"),
|
||||||
["Шпека"] = true,
|
["Oakskin"] = Stinky.new("Oakskin", 5),
|
||||||
["Yunami"] = false, -- He is a loser but he's also horde... So I can't kill him even if I wanted to
|
["Шпек"] = Stinky.new("Шпек", 5),
|
||||||
["Joule"] = true,
|
["Yunami"] = Stinky.new("Yunami", 5, "He is a loser but he's also horde... So I can't kill him even if I wanted to"),
|
||||||
["Rattenfenger"] = true,
|
["Joule"] = Stinky.new("Joule", 5),
|
||||||
["Blessly"] = true,
|
["Rattenfenger"] = Stinky.new("Rattenfenger", 8, "Possibly related to DNF, he is a sign of trouble"),
|
||||||
["Ramáladni"] = false, -- Does not cause trouble and the guy is a behemoth... It is a lot of effort to remove him
|
["Blessly"] = Stinky.new("Blessly", 8, "Possibly related to DNF, he is a sign of trouble"),
|
||||||
["Асталабиста"] = true,
|
["Ramáladni"] = Stinky.new("Ramáladni", 7,
|
||||||
["Srakonyh"] = false, -- Agreed to leave him alone until he kills someone again
|
"Does not cause trouble and the guy is a behemoth... It is a lot of effort to remove him"),
|
||||||
["Залупотряс"] = false, -- Муркот: I understand if one of them killed the newbies. then you did everything right. they seem friendly but I also warned them not to hit the newbies
|
["Асталабиста"] = Stinky.new("Асталабиста", 5),
|
||||||
["Чмодвенк"] = false, -- Муркот: I understand if one of them killed the newbies. then you did everything right. they seem friendly but I also warned them not to hit the newbies
|
["Srakonyh"] = Stinky.new("Srakonyh", 5, "Agreed to leave him alone until he kills someone again"),
|
||||||
|
["Залупотряс"] = Stinky.new("Залупотряс", 2,
|
||||||
["Zawaz"] = nil,
|
"Муркот: I understand if one of them killed the newbies. then you did everything right. they seem friendly but I also warned them not to hit the newbies"),
|
||||||
["Totleta"] = nil,
|
["Чмодвенк"] = Stinky.new("Чмодвенк", 5,
|
||||||
|
"Муркот: I understand if one of them killed the newbies. then you did everything right. they seem friendly but I also warned them not to hit the newbies"),
|
||||||
}
|
}
|
||||||
|
|
||||||
aura_env.raceFactions = {
|
aura_env.raceFactions = {
|
||||||
@@ -52,10 +165,6 @@ aura_env.raceFactions = {
|
|||||||
["Worgen"] = "Alliance",
|
["Worgen"] = "Alliance",
|
||||||
}
|
}
|
||||||
|
|
||||||
local toNotify = { "Succpotato", "Extazyk", "Smokefire", "Smokemantra", "Хихихантер", "Муркот", "Растафаркрай" }
|
|
||||||
-- local toNotify = { "Succpotato" }
|
|
||||||
aura_env.whisperQueue = {}
|
|
||||||
|
|
||||||
local killSpamTime = 30
|
local killSpamTime = 30
|
||||||
local recentlyKilled = {}
|
local recentlyKilled = {}
|
||||||
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
||||||
@@ -71,11 +180,13 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
|||||||
|
|
||||||
local msg = string.format("%s %s убил %s с помощью %s с переполнением %d",
|
local msg = string.format("%s %s убил %s с помощью %s с переполнением %d",
|
||||||
faction, source, destination, spellName, overkill)
|
faction, source, destination, spellName, overkill)
|
||||||
for k, v in pairs(toNotify) do
|
|
||||||
-- SendChatMessage(msg, "WHISPER", nil, v)
|
if killNotifyWhisper then
|
||||||
table.insert(aura_env.whisperQueue, { to = v, msg = msg })
|
for k, v in pairs(toNotify) do
|
||||||
|
table.insert(aura_env.messageQueue, Message.new(msg, v, "WHISPER"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
SendChatMessage(msg, "GUILD", "Orcish")
|
table.insert(aura_env.messageQueue, Message.new(msg, source, "GUILD"))
|
||||||
recentlyKilled[source] = GetTime()
|
recentlyKilled[source] = GetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -90,9 +201,9 @@ aura_env.StinkyDetected = function(name)
|
|||||||
local msg = string.format("%s в Оргриммаре!", name)
|
local msg = string.format("%s в Оргриммаре!", name)
|
||||||
for k, v in pairs(toNotify) do
|
for k, v in pairs(toNotify) do
|
||||||
-- SendChatMessage(msg, "WHISPER", nil, v)
|
-- SendChatMessage(msg, "WHISPER", nil, v)
|
||||||
table.insert(aura_env.whisperQueue, { to = v, msg = msg })
|
table.insert(aura_env.messageQueue, { to = v, msg = msg, channel = "WHISPER" })
|
||||||
end
|
end
|
||||||
SendChatMessage(msg, "GUILD", "Orcish")
|
table.insert(aura_env.messageQueue, { to = name, msg = msg, channel = "GUILD" })
|
||||||
end
|
end
|
||||||
aura_env.localStinkies[name] = GetTime()
|
aura_env.localStinkies[name] = GetTime()
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user