Fix up some oopsies with autoloot
This commit is contained in:
17
Autoloot.lua
17
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
|
||||
|
Reference in New Issue
Block a user