Now look for alliance and fix issue with overkill alawys being 0

This commit is contained in:
2024-10-05 01:47:05 +02:00
parent 8bb7e7642a
commit db31b934ed
2 changed files with 8 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ function(allstates, e, ...)
if UnitIsPlayer("nameplate" .. i) then if UnitIsPlayer("nameplate" .. i) then
local name = UnitName("nameplate" .. i) local name = UnitName("nameplate" .. i)
local faction = UnitFactionGroup("nameplate" .. i) local faction = UnitFactionGroup("nameplate" .. i)
if faction and faction == "Horde" then if faction and faction == "Alliance" then
aura_env.RegisterAlly(name) aura_env.RegisterAlly(name)
end end
end end

View File

@@ -30,12 +30,18 @@ aura_env.CleanAlliance = function()
end end
end end
aura_env.RegisterAlly = function(name) aura_env.RegisterAlly = function(name)
-- print("Spotted ally: " .. name)
aura_env.alliance[name] = GetTime() aura_env.alliance[name] = GetTime()
end end
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)
if not overkill or overkill <= 0 then
print("No overkill, 'death' not reported (probably not dead...)")
return
end
if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then
print("Death already reported") print("Death already reported")
end end
@@ -44,10 +50,7 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill)
print("lol alliance died idiot") print("lol alliance died idiot")
end end
local msg = string.format("%s убил %s с помощью %s", source, destination, spellName) local msg = string.format("%s убил %s с помощью %s с переполнением %d", source, destination, spellName, overkill)
if overkill then
msg = string.format("%s убил %s с помощью %s с переполнением %d", source, destination, spellName, overkill)
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 }) table.insert(aura_env.whisperQueue, { to = v, msg = msg })