From faf704dc537815afde05fde730097883fd56f824 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 14 Oct 2024 19:54:15 +0200 Subject: [PATCH] Move stinkkies and notifies out to options --- FreshShit/StinkyDetector/init.lua | 73 ++++++++++++------------------- 1 file changed, 27 insertions(+), 46 deletions(-) diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index 791c422..0af3cb5 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -7,9 +7,34 @@ aura_env.separator = "ž" aura_env.addonprefix = "STINKY_DETECTOR" RegisterAddonMessagePrefix(aura_env.addonprefix) +---@param string string +---@param deliminer string +---@return string[] +local function StrSplit(input, deliminer) + local parts = {} + for part in string.gmatch(input, "([^" .. deliminer .. "]+)") do + table.insert(parts, strtrim(part)) + end + return parts +end + ---@type string[] -local toNotify = { "Succpotato", "Extazyk", "Smokefire", "Smokemantra", "Хихихантер", "Муркот", "Растафаркрай" } -local toNotify = { "Deathleta" } +local toNotify = StrSplit(msg, ",") +for i, part in ipairs(toNotify) do + toNotify[i] = strtrim(part) +end +-- local toNotify = { "Deathleta" } + +---@type Stinky[] +aura_env.stinkies = {} +local stinkies = StrSplit(msg, ",") +for i, part in ipairs(stinkies) do + local datum = StrSplit(part, ":") + local name = strtrim(datum[1]) + local threat = tonumber(strtrim(datum[2] or "0")) + aura_env.stinkies[name] = Stinky.new(name, threat) +end + ---@class Message ---@field message string @@ -168,49 +193,6 @@ Stinky = { end, } -if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end -if not WeakAurasSaved.Cyka.PlayerFactionCache then WeakAurasSaved.Cyka.PlayerFactionCache = {} end -WeakAurasSaved.Cyka.Stinkies = { - ["Totleta"] = nil, - ["Deathleta"] = Stinky.new("Deathleta", 1), - - ["Redbulka"] = Stinky.new("Redbulka", 5), - ["Курлык"] = Stinky.new("Курлык", 5), - ["Riener"] = Stinky.new("Riener", 5), - ["Unwashed"] = Stinky.new("Unwashed", 5), - ["Ловилуну"] = Stinky.new("Ловилуну", 5), - ["Фоська"] = Stinky.new("Фоська", 5, - "if she comes here to orgrimmar. then she will be with 1 or 2 friends. they can be killed. but it may be difficult"), - ["Korovadura"] = Stinky.new("Korovadura", 5), - ["Pizdosorkam"] = Stinky.new("Pizdosorkam", 3, "Horde"), - ["Неонанируй"] = Stinky.new("Неонанируй", 5), - ["Bunkkeer"] = Stinky.new("Bunkkeer", 5), - ["Dewdew"] = Stinky.new("Dewdew", 4), - ["Психопаточка"] = Stinky.new("Психопаточка", 5), - ["Empanao"] = Stinky.new("Empanao", 3, "Horde"), - ["Стелсон"] = Stinky.new("Стелсон", 1, "Apyr"), - ["Trafik"] = Stinky.new("Trafik", 1, "Has agreed to behave, is french (also horde)"), - ["Aye"] = Stinky.new("Aye", 8, "Actually a pretty good player, sadly... Part of DNF, says murkot"), - ["Paskoo"] = Stinky.new("Paskoo", 2, "Really stinky but he's horde..."), - ["Армагид"] = Stinky.new("Армагид", 3), - ["Паладийпал"] = Stinky.new("Паладийпал", 5, "Possibly related to Oakskin"), - ["Hmor"] = Stinky.new("Hmor", 4, "Horde"), - ["Oakskin"] = Stinky.new("Oakskin", 5), - ["Шпек"] = Stinky.new("Шпек", 5), - ["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"), - ["Joule"] = Stinky.new("Joule", 5), - ["Rattenfenger"] = Stinky.new("Rattenfenger", 8, "Possibly related to DNF, he is a sign of trouble"), - ["Blessly"] = Stinky.new("Blessly", 8, "Possibly related to DNF, he is a sign of trouble"), - ["Ramáladni"] = Stinky.new("Ramáladni", 7, - "Does not cause trouble and the guy is a behemoth... It is a lot of effort to remove him"), - ["Асталабиста"] = Stinky.new("Асталабиста", 5), - ["Srakonyh"] = Stinky.new("Srakonyh", 5, "Agreed to leave him alone until he kills someone again"), - ["Залупотряс"] = Stinky.new("Залупотряс", 2, - "Муркот: 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, - "Муркот: 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 = { ["Orc"] = "Horde", ["Undead"] = "Horde", @@ -251,7 +233,6 @@ aura_env.RegisterKill = function(source, destination, spellName, overkill) recentlyKilled[source] = GetTime() end -aura_env.stinkies = WeakAurasSaved.Cyka.Stinkies aura_env.localStinkies = {} ---@param name string