Throttle whispers to 5/s

This commit is contained in:
2024-10-05 01:35:49 +02:00
parent b84eb896dd
commit e464a16c3b
2 changed files with 22 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
-- TICKER_200
function()
local whisper = aura_env.whisperQueue[1]
if whisper == nil then return end
SendChatMessage(whisper.msg, "WHISPER", nil, whisper.to)
print(string.format("Whispering %s, %d remaining in queue", whisper.to, #aura_env.whisperQueue))
table.remove(aura_env.whisperQueue, 1)
end

View File

@@ -16,8 +16,14 @@ WeakAurasSaved.Cyka.Stinkies = {
["Totleta"] = true, ["Totleta"] = true,
} }
local toNotify = {"Муркот", "Succpotato"} local toNotify = {"Succpotato"}
-- local toNotify = { "Succpotato" } -- Extazyk
-- Smokefire
-- Smokemantra
-- Хихихантер
-- Муркот
-- Растафаркрай
aura_env.whisperQueue = {}
aura_env.alliancettl = 120 aura_env.alliancettl = 120
aura_env.alliance = {} aura_env.alliance = {}
@@ -45,10 +51,11 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill)
local msg = string.format("%s убил %s с помощью %s", source, destination, spellName) local msg = string.format("%s убил %s с помощью %s", source, destination, spellName)
if overkill then if overkill then
msg = string.format("%s убил %s с помощью %s с переполнением", source, destination, spellName) msg = string.format("%s убил %s с помощью %s с переполнением %d", source, destination, spellName, overkill)
end end
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})
end end
recentlyKilled[source] = GetTime() recentlyKilled[source] = GetTime()
end end
@@ -62,7 +69,9 @@ aura_env.StinkyDetected = function(name)
GetTime() - 60 then GetTime() - 60 then
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
for k, v in pairs(toNotify) do for k, v in pairs(toNotify) do
SendChatMessage(name .. " в Оргриммаре!", "WHISPER", nil, v) local msg = string.format("%s в Оргриммаре!", name)
-- SendChatMessage(msg, "WHISPER", nil, v)
table.insert(aura_env.whisperQueue, {to=v, msg=msg})
end end
end end
aura_env.localStinkies[name] = GetTime() aura_env.localStinkies[name] = GetTime()