From 84e44dbb7d160077b91978e3aa6cc02f4e414fe3 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 16 Dec 2024 13:24:39 +0100 Subject: [PATCH] More infrastructure --- Autoloot.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Autoloot.lua b/Autoloot.lua index 0517dc4..93c2dc3 100644 --- a/Autoloot.lua +++ b/Autoloot.lua @@ -5,6 +5,32 @@ local addonname, shared = ... ---@class Autoloot ---@field Init fun() +---@class Value +---@field value any +---@field Gt fun(other: any): boolean +---@field Lt fun(other: any): boolean +---@field Eq fun(other: any): boolean +---@field Ne fun(other: any): boolean +---@field Ge fun(other: any): boolean +---@field Le fun(other: any): boolean + +---@class NumberValue : Value +---@field value number +local NumberValue = { + ---@param other number + Gt = function(self, other) return self.value > other end, + ---@param other number + Lt = function(self, other) return self.value < other end, + ---@param other number + Eq = function(self, other) return self.value == other end, + ---@param other number + Ne = function(self, other) return self.value ~= other end, + ---@param other number + Ge = function(self, other) return self.value >= other end, + ---@param other number + Le = function(self, other) return self.value <= other end, +} + shared.Autoloot = { Init = function() end } function shared.Autoloot.Init() if not shared.config.autoloot.enabled then @@ -12,6 +38,13 @@ function shared.Autoloot.Init() return end + ---@param slot number + ---@return NumberValue, string? + local function Ilvl(slot) + local ret = +if slot == nil then return + end + local lootReadyFrame = CreateFrame("Frame") lootReadyFrame:RegisterEvent("LOOT_READY") lootReadyFrame:SetScript("OnEvent", function()