From 3e36ad5ae0f75d261cdea6182dd4b402a4ad7bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Majdand=C5=BEi=C4=87?= Date: Wed, 5 Jun 2024 19:22:21 +0200 Subject: [PATCH] Update --- FreshShit/RIOChecker/init.lua | 7 +- FreshShit/UwowLadderboardScraper/event.lua | 29 ++++++++ FreshShit/UwowLadderboardScraper/init.lua | 85 ++++++++++++++++++++++ 3 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 FreshShit/UwowLadderboardScraper/event.lua create mode 100644 FreshShit/UwowLadderboardScraper/init.lua diff --git a/FreshShit/RIOChecker/init.lua b/FreshShit/RIOChecker/init.lua index 921a623..a503c2a 100644 --- a/FreshShit/RIOChecker/init.lua +++ b/FreshShit/RIOChecker/init.lua @@ -114,9 +114,6 @@ aura_env.KeyLevel = { end } -if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end -if not WeakAurasSaved.Cyka.MData then WeakAurasSaved.Cyka.MData = {} end - ---@class Key ---@field name string ---@field role string @@ -178,6 +175,8 @@ Key = { end, ---@param self Key register = function(self) + if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end + if not WeakAurasSaved.Cyka.MData then WeakAurasSaved.Cyka.MData = {} end WeakAurasSaved.Cyka.MData[self:hash()] = self end } @@ -215,3 +214,5 @@ function aura_env.Process() end -- /run WeakAurasSaved.Cyka.MData = {} +-- /dump WeakAurasSaved.Cyka.MData +-- /dump InterfaceGUI.Cashe_1[UnitGUID("player")] \ No newline at end of file diff --git a/FreshShit/UwowLadderboardScraper/event.lua b/FreshShit/UwowLadderboardScraper/event.lua new file mode 100644 index 0000000..8624854 --- /dev/null +++ b/FreshShit/UwowLadderboardScraper/event.lua @@ -0,0 +1,29 @@ +-- TICKER_10000 +function() + if not InterfaceGUI then return end + if not InterfaceGUI.Cashe_1 then return end + for k, v in pairs(InterfaceGUI.Cashe_1) do + if v.UIMSG_BEST_RUNS then + local bestRuns = v.UIMSG_BEST_RUNS + for i = 1, #bestRuns, 5 do + local challengeId = bestRuns[i] + local roleMask = bestRuns[i + 1] + -- print(roleMask) + local stars = bestRuns[i + 2] + local keyLvl = bestRuns[i + 3] + local score = bestRuns[i + 4] + + if challengeId and challengeId > 0 and roleMask and roleMask > 0 and keyLvl and keyLvl > 0 then + local dungeonName = aura_env.challengeNameMap[challengeId] or "???" + local key = aura_env.Key.new( + dungeonName, + "isDps", + string.rep("+", stars) .. keyLvl, + "???", + score) + key:register() + end + end + end + end +end diff --git a/FreshShit/UwowLadderboardScraper/init.lua b/FreshShit/UwowLadderboardScraper/init.lua new file mode 100644 index 0000000..b1ecbbf --- /dev/null +++ b/FreshShit/UwowLadderboardScraper/init.lua @@ -0,0 +1,85 @@ +aura_env.challengeNameMap = { + [165] = "Graimrail Depot", + [166] = "Shadowmoon Burial Grounds", + [197] = "Eye of Azshara", + [198] = "Darkheart Thicket", + [199] = "Black Rook Hold", + [200] = "Halls of Valor", + [206] = "Neltharion's Lair", + [207] = "Vault of the Wardens", + [208] = "Maw of Souls", + [209] = "The Arcway", + [210] = "Court of Stars", + [227] = "Return to Karazhan: Lower", + [233] = "Cathedral of Eternal Night", + [234] = "Return to Karazhan: Upper", + [239] = "Seat of the Triumvirate" +} + + +---@class Key +---@field name string +---@field role string +---@field level string +---@field time string +---@field score number +aura_env.Key = { + ---@return Key + ---@param name string + ---@param role string + ---@param level string + ---@param time string + ---@param score string + new = function(name, role, level, time, score) + local self = setmetatable({}, { + __index = Key, + __tostring = function(self) + local score = self.score + local keyLevel = tonumber(self.level:match("%d+$")) or 0 + + local formattedScore, err = aura_env.ScoreColorer.Interpolate(self.score) + if not err then + score = string.format("|cff%02x%02x%02x%d|r", formattedScore.r * 255, formattedScore.g * 255, + formattedScore.b * 255, self.score) + end + + local formattedLevel, err = aura_env.KeyLevel.Interpolate(keyLevel) + if not err then + level = string.format("|cff%02x%02x%02x%s|r", formattedLevel.r * 255, formattedLevel.g * 255, + formattedLevel.b * 255, self.level) + end + + return string.format("%-30s %-8s %-8s %-10s %-10s", self.name, self.role, level, self.time, + score) + end, + }) + self.name = name + self.role = role + self.level = level + self.time = time + self.score = tonumber(score) or 0 + return self + end, + ---@return string + hash = function(self) + return table.concat({ self.name, self.role, self.level, self.time, self.score }, "/") + end, + + ---@param self Key + ---@param other Key + ---@return boolean + compareTo = function(self, other) + if not self then return true end + if not other then return false end + if self.name <= other.name then + return true + end + return false + end, + ---@param self Key + register = function(self) + if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end + if not WeakAurasSaved.Cyka.MData then WeakAurasSaved.Cyka.MData = {} end + WeakAurasSaved.Cyka.MData[self:hash()] = self + end +} \ No newline at end of file