From 3db30236ea39e34d11bbee15d15a64aa6d647b8e Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 27 Dec 2024 08:47:26 +0100 Subject: [PATCH] Fix up some oopsies with autoloot --- Autoloot.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Autoloot.lua b/Autoloot.lua index f6c698c..87521dd 100644 --- a/Autoloot.lua +++ b/Autoloot.lua @@ -176,7 +176,7 @@ function shared.Autoloot.Init() local function Quantity(slot) local ret = NewNumberValue(1) if slot == nil then return ret, "slot is nil" end - local quantity = select(3, GetItemInfo(Link(slot).value)) + local quantity = select(3, GetLootSlotInfo(slot)) if quantity == nil then return ret, "quantity is nil" end ret.value = quantity return ret, nil @@ -220,7 +220,7 @@ function shared.Autoloot.Init() local function Quality(slot) local ret = NewNumberValue(-1) if slot == nil then return ret, "slot is nil" end - local quality = select(3, GetItemInfo(Link(slot).value)) + local quality = select(4, GetLootSlotInfo(slot)) if quality == nil then return ret, "quality is nil" end ret.value = quality return ret, nil @@ -395,6 +395,19 @@ function shared.Autoloot.Init() for _, filter in ipairs(Filters) do if filter:Matches(slot) then print(string.format("Autolooting slot %s", tostring(slot))) + + local name = Name(slot).value + local quantity = Quantity(slot).value + local quality = Quality(slot).value + local icon = Icon(slot).value + + local addonPayload = string.format("%s|%s|%s|%s", + name, + quantity, + quality, + icon) + + SendAddonMessage("CYKA_AUTOLOOT", addonPayload, "WHISPER", UnitName("player")) LootSlot(slot) end end