Implement player faction cache
This commit is contained in:
@@ -35,13 +35,10 @@ 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 == "Alliance" then
|
WeakAurasSaved.Cyka.PlayerFactionCache[name] = faction
|
||||||
aura_env.RegisterAlly(name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
aura_env.CleanAlliance()
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
|||||||
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
|
||||||
WeakAurasSaved.Cyka.Stinkies = {
|
WeakAurasSaved.Cyka.Stinkies = {
|
||||||
["Redbulka"] = true,
|
["Redbulka"] = true,
|
||||||
["Курлык"] = true,
|
["Курлык"] = true,
|
||||||
@@ -21,20 +22,6 @@ local toNotify = { "Succpotato", "Extazyk", "Smokefire", "Smokemantra", "Хих
|
|||||||
-- local toNotify = { "Succpotato" }
|
-- local toNotify = { "Succpotato" }
|
||||||
aura_env.whisperQueue = {}
|
aura_env.whisperQueue = {}
|
||||||
|
|
||||||
aura_env.alliancettl = 120
|
|
||||||
aura_env.alliance = {}
|
|
||||||
aura_env.CleanAlliance = function()
|
|
||||||
for k, v in pairs(aura_env.alliance) do
|
|
||||||
if v < GetTime() - aura_env.alliancettl then
|
|
||||||
aura_env.alliance[k] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
aura_env.RegisterAlly = function(name)
|
|
||||||
-- print("Spotted ally: " .. name)
|
|
||||||
aura_env.alliance[name] = GetTime()
|
|
||||||
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)
|
||||||
@@ -47,11 +34,13 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
|||||||
print("Death already reported")
|
print("Death already reported")
|
||||||
end
|
end
|
||||||
|
|
||||||
local msg = string.format("Alliance %s убил %s с помощью %s с переполнением %d", source, destination, spellName, overkill)
|
local faction = "Неизвестная фракция"
|
||||||
if not aura_env.alliance[source] then
|
if WeakAurasSaved.Cyka.PlayerFactionCache[source] then
|
||||||
local msg = string.format("Неизвестная фракция %s убил %s с помощью %s с переполнением %d", source, destination, spellName, overkill)
|
faction = WeakAurasSaved.Cyka.PlayerFactionCache[source]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local msg = string.format("%s %s убил %s с помощью %s с переполнением %d",
|
||||||
|
faction, source, destination, spellName, overkill)
|
||||||
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 })
|
||||||
|
|||||||
Reference in New Issue
Block a user