59 lines
1.5 KiB
Lua
59 lines
1.5 KiB
Lua
local addonname, shared = ...
|
|
---@cast shared CykaShared
|
|
---@cast addonname string
|
|
|
|
---@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
|
|
print("Cyka - Autoloot disabled")
|
|
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()
|
|
local lootInfo = GetLootInfo()
|
|
shared.DumpTable(lootInfo, 0)
|
|
--aura_env.FilterService.Run(lootInfo)
|
|
--CloseLoot()
|
|
end)
|
|
|
|
print("Cyka - Autoloot loaded")
|
|
end
|