diff --git a/FreshShit/WhoSniffer/allstates.lua b/FreshShit/WhoSniffer/allstates.lua new file mode 100644 index 0000000..f8a2af8 --- /dev/null +++ b/FreshShit/WhoSniffer/allstates.lua @@ -0,0 +1,22 @@ +---@meta + +---[Source](https://github.com/WeakAuras/WeakAuras2/wiki/Trigger-State-Updater-%28TSU%29) +---@class state +---@field changed boolean Informs WeakAuras that the states values have changed. Always set this to true for states that were changed. +---@field show boolean Controls whether the display is visible. Note, that states that have show set to false are automatically removed. +---@field name string The name, returned by %n +---@field icon number|string IconID or TexturePath, used in icons and progress bars +---@field texture number|string IconID or TexturePath, used in textures +---@field stacks number The stack count, returned by %s +---@field index number|string Sets the order the output will display in a dynamic group (if sorting is set to "none" on the group). Strings or numbers are fine but DO NOT MIX TYPES! +---@field progressType string "timed" or "static" +---@field expirationTime number Use with "timed" progressType; relative to GetTime() +---@field duration number Use with "timed" progressType; total duration of the bar in seconds +---@field value number Use with "static" progressType +---@field maxValue number Use with "static" progressType +---@field autoHide boolean Set to true to make the display automatically hide at the end of the "timed" progress. autoHide can also be used along with the "static" progressType by defining a duration and expirationTime along with the static value and total. While the static values will be displayed, the timed values will set the Hide time for the clone. +---@field paused boolean Set to true (and set a remaining value) to pause a "timed" progress. Set to false (and recalculate the expirationTime value) to resume. +---@field remaining number Only used with paused, gives WA the info needed to show paused progress at the current point. +state = {} + +---@alias allstates table \ No newline at end of file diff --git a/FreshShit/WhoSniffer/event.lua b/FreshShit/WhoSniffer/event.lua new file mode 100644 index 0000000..3c82d57 --- /dev/null +++ b/FreshShit/WhoSniffer/event.lua @@ -0,0 +1,18 @@ +-- WHO_LIST_UPDATE +function() + for i = 1, GetNumWhoResults() do + local name, guild, level, race, class, zone = GetWhoInfo(i) + local faction = aura_env.raceMap[race] + if not faction then print("Unknown faction for race", race) end + if faction == "Alliance" then + local player = aura_env.alliance[name] + if not player then + player = Player.new(name, guild, race, class, zone) + end + player:Touch() + player.zone = zone + aura_env.alliance[name] = player + end + end + _G["FriendsFrameCloseButton"]:Click() +end diff --git a/FreshShit/WhoSniffer/event2.lua b/FreshShit/WhoSniffer/event2.lua new file mode 100644 index 0000000..4a4a434 --- /dev/null +++ b/FreshShit/WhoSniffer/event2.lua @@ -0,0 +1,30 @@ +-- TICKER_500 +---@type allstates allstates +function(allstates) + local now = GetTime() + for k, v in pairs(aura_env.alliance) do + local ago = now - v.lastSeen + if ago > aura_env.ttl then + allstates[k] = { show = false, changed = true } + aura_env.alliance[k] = nil + else + if allstates[k] then + allstates[k].ago = string.format("%6.1fs", ago) + allstates[k].changed = true + else + allstates[k] = { + show = true, + changed = true, + name = v:ToString(), + progressType = "timed", + duration = aura_env.ttl, + expirationTime = GetTime() + aura_env.ttl, + autohide = true, + index = ago, + ago = string.format("%6.1fs", ago), + } + end + end + end + return true +end diff --git a/FreshShit/WhoSniffer/event3.lua b/FreshShit/WhoSniffer/event3.lua new file mode 100644 index 0000000..94c0012 --- /dev/null +++ b/FreshShit/WhoSniffer/event3.lua @@ -0,0 +1,5 @@ +-- TICKER_5000 +function() + SetWhoToUI(1) + SendWho(aura_env.whoQuery) +end \ No newline at end of file diff --git a/FreshShit/WhoSniffer/export b/FreshShit/WhoSniffer/export new file mode 100644 index 0000000..71edce3 --- /dev/null +++ b/FreshShit/WhoSniffer/export @@ -0,0 +1 @@ +!nRX(ZPno6)xYnDoyocJ5rasNYoxcbstAAsUyNn3SzlGITmOgJeRSDETB5V99tsw(fgtO3VClBBTL(037xswJBm2ASP)yZM1B0PERXMlgB6i(Fyue3(cmDwW8Xx2QJXyZhyChm)yK9JoC2YXMh7rE7ne3z1ulgZlGad9YvUU(4GXJ2VxRMDnA0RrNEh29aXYD3VDNXMVgbWLn7Dq9ETA1(Wogh2Q7bJnNXjowVUep28Mt00AaZJXbw5YgJV0awJ8VBj)72IbdgBYzpBUezJfVAISdimQVuKcq8a4baecLe9Kl8O)C5ZWBbCYSzyUVIawXdiE0b)qORRIF(8WlUE0TxaZlFffYrnbcSe75DMJVcZ(H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ffer/init.lua new file mode 100644 index 0000000..7b14f6d --- /dev/null +++ b/FreshShit/WhoSniffer/init.lua @@ -0,0 +1,125 @@ +---@class aura_env +---@field raceMap table +---@field alliance table +---@field classColors table +---@field whoQuery string +---@field ttl number + +---@param input string +---@return number +local function utf8len(input) + local len = 0 + local i = 1 + local n = #input + while i <= n do + local c = input:byte(i) + if c >= 0 and c <= 127 then + i = i + 1 + elseif c >= 194 and c <= 223 then + i = i + 2 + elseif c >= 224 and c <= 239 then + i = i + 3 + elseif c >= 240 and c <= 244 then + i = i + 4 + else + i = i + 1 + end + len = len + 1 + end + return len +end +---@param input string +---@param targetLength number +---@param left boolean +---@return string +local function padString(input, targetLength, left) + left = left or false + local len = utf8len(input) + if len < targetLength then + if left then + input = input .. string.rep(" ", targetLength - len) + else + input = string.rep(" ", targetLength - len) .. input + end + end + return input +end + +aura_env.ttl = 60 +aura_env.whoQuery = +"z-\"Orgrimmar\" z-\"Durotar\" 110 r-\"Human\" r-\"Dwarf\" r-\"Night Elf\" r-\"Gnome\" r-\"Draenei\" r-\"Worgen\" r-\"Kul Tiran\" r-\"Dark Iron Dwarf\" r-\"Void Elf\" r-\"Lightforged Draenei\" r-\"Mechagnome\"" +aura_env.raceMap = { + ["Orc"] = "Horde", + ["Undead"] = "Horde", + ["Tauren"] = "Horde", + ["Troll"] = "Horde", + ["Blood Elf"] = "Horde", + ["Goblin"] = "Horde", + ["Human"] = "Alliance", + ["Dwarf"] = "Alliance", + ["Night Elf"] = "Alliance", + ["Gnome"] = "Alliance", + ["Draenei"] = "Alliance", + ["Worgen"] = "Alliance", + ["Vulpera"] = "Horde", + ["Nightborne"] = "Horde", + ["Zandalari Troll"] = "Horde", + ["Kul Tiran"] = "Alliance", + ["Dark Iron Dwarf"] = "Alliance", + ["Void Elf"] = "Alliance", + ["Lightforged Draenei"] = "Alliance", + ["Mechagnome"] = "Alliance", + ["Mag'har Orc"] = "Horde", +} + +---@type table +aura_env.alliance = {} + +---@class Player +---@field name string +---@field guild string +---@field race string +---@field class string +---@field zone string +---@field lastSeen number +Player = { + ---@param name string + ---@param guild string + ---@param race string + ---@param class string + ---@param zone string + ---@return Player + new = function(name, guild, race, class, zone) + local self = setmetatable({}, { + __index = Player + }) + self.name = name + self.guild = guild + self.race = race + self.class = class + self.zone = zone + return self + end, + Touch = function(self) + self.lastSeen = GetTime() + end, + ToString = function(self) + local out = string.format("%s %s %s", padString(self.name, 16, true), padString(self.guild, 26, false), padString(self.zone, 26, false)) + return string.format("|cFF%s%s|r", aura_env.classColors[self.class], out) + end +} + +aura_env.classColors = { + ["Warrior"] = "C69B6D", + ["Paladin"] = "F48CBA", + ["Hunter"] = "AAD372", + ["Rogue"] = "FFF468", + ["Priest"] = "FFFFFF", + ["Death Knight"] = "C41E3A", + ["Shaman"] = "0070DD", + ["Mage"] = "3FC7EB", + ["Warlock"] = "8788EE", + ["Monk"] = "00FF98", + ["Druid"] = "FF7C0A", + ["Demon Hunter"] = "A330C9", +} \ No newline at end of file diff --git a/FreshShit/_GlobalTickers/init.lua b/FreshShit/_GlobalTickers/init.lua index a29d2ea..912f39c 100644 --- a/FreshShit/_GlobalTickers/init.lua +++ b/FreshShit/_GlobalTickers/init.lua @@ -4,6 +4,7 @@ aura_env.Tickers = { [200] = 0, [500] = 0, [1000] = 0, + [5000] = 0, [10000] = 0, [60000] = 0, }