More infrastructure

This commit is contained in:
2024-12-16 13:24:39 +01:00
parent c4b8bb8a26
commit 84e44dbb7d

View File

@@ -5,6 +5,32 @@ local addonname, shared = ...
---@class Autoloot ---@class Autoloot
---@field Init fun() ---@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 } shared.Autoloot = { Init = function() end }
function shared.Autoloot.Init() function shared.Autoloot.Init()
if not shared.config.autoloot.enabled then if not shared.config.autoloot.enabled then
@@ -12,6 +38,13 @@ function shared.Autoloot.Init()
return return
end end
---@param slot number
---@return NumberValue, string?
local function Ilvl(slot)
local ret =
if slot == nil then return
end
local lootReadyFrame = CreateFrame("Frame") local lootReadyFrame = CreateFrame("Frame")
lootReadyFrame:RegisterEvent("LOOT_READY") lootReadyFrame:RegisterEvent("LOOT_READY")
lootReadyFrame:SetScript("OnEvent", function() lootReadyFrame:SetScript("OnEvent", function()