diff --git a/FreshShit/StinkyDetector/event.lua b/FreshShit/StinkyDetector/event.lua index cd7e248..1fe4e3b 100644 --- a/FreshShit/StinkyDetector/event.lua +++ b/FreshShit/StinkyDetector/event.lua @@ -30,6 +30,18 @@ function(allstates, e, ...) end end end + + for i = 1, 40 do + if UnitIsPlayer("nameplate" .. i) then + local name = UnitName("nameplate" .. i) + local faction = UnitFactionGroup("nameplate" .. i) + if faction and faction == "Horde" then + aura_env.RegisterAlly(name) + end + end + end + + aura_env.CleanAlliance() return true end @@ -68,5 +80,37 @@ function(allstates, e, ...) progress = string.format("%20s", "0s"), } end + + local overkill, err = CLEUParser.GetOverkill(...) + if err == nil then + local source, err = CLEUParser.GetSourceName(...) + if err ~= nil then source = "unknown" end + local destination, err = CLEUParser.GetDestName(...) + if err ~= nil then destination = "unknown" end + local spellName, err = CLEUParser.GetSpellName(...) + if err ~= nil then spellName = "unknown" end + local sourceid, err = CLEUParser.GetSourceGUID(...) + if err then + print("Could not get source id for " .. source) + print(...) + return true + end + local destid, err = CLEUParser.GetDestGUID(...) + if err then + print("Could not get destination id for " .. destination) + print(...) + return true + end + if not string.match(sourceid, "Player") then + -- print("Source is not a player, nevermind...") + return true + end + if not string.match(destid, "Player") then + -- print("Destination is not a player, nevermind...") + return true + end + aura_env.RegisterKill(source, destination, spellName, overkill) + end + return true end \ No newline at end of file diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index 71c7e91..6d81415 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -10,10 +10,48 @@ WeakAurasSaved.Cyka.Stinkies = { ["Joule"] = true, ["Rattenfenger"] = true, ["Асталабиста"] = true, + ["Srakonyh"] = false, -- Agreed to leave him alone until he kills someone again ["Залупотряс"] = 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 ["Чмодвенк"] = 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 -} + ["Totleta"] = true, +} +local toNotify = {"Муркот", "Succpotato"} +-- local toNotify = { "Succpotato" } + +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) + aura_env.alliance[name] = GetTime() +end + +local killSpamTime = 30 +local recentlyKilled = {} +aura_env.RegisterKill = function(source, destination, spellName, overkill) + if recentlyKilled[source] and recentlyKilled[source] > GetTime() - killSpamTime then + print("Death already reported") + end + + if not aura_env.alliance[source] then + print("lol alliance died idiot") + end + + local msg = string.format("%s убил %s с помощью %s", source, destination, spellName) + if overkill then + msg = string.format("%s убил %s с помощью %s с переполнением", source, destination, spellName) + end + for k, v in pairs(toNotify) do + SendChatMessage(msg, "WHISPER", nil, v) + end + recentlyKilled[source] = GetTime() +end aura_env.stinkies = WeakAurasSaved.Cyka.Stinkies aura_env.localStinkies = {} @@ -23,6 +61,9 @@ aura_env.StinkyDetected = function(name) if not aura_env.localStinkies[name] or aura_env.localStinkies[name] < GetTime() - 60 then PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") + for k, v in pairs(toNotify) do + SendChatMessage(name .. " в Оргриммаре!", "WHISPER", nil, v) + end end aura_env.localStinkies[name] = GetTime() end @@ -53,4 +94,5 @@ for i = 1, numfriends do end end +--/run WeakAurasSaved.Cyka.Stinkies["Totleta"] = true -- /dump WeakAurasSaved.Cyka.Stinkies