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 function Quantity(slot)
|
||||||
local ret = NewNumberValue(1)
|
local ret = NewNumberValue(1)
|
||||||
if slot == nil then return ret, "slot is nil" end
|
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
|
if quantity == nil then return ret, "quantity is nil" end
|
||||||
ret.value = quantity
|
ret.value = quantity
|
||||||
return ret, nil
|
return ret, nil
|
||||||
@@ -220,7 +220,7 @@ function shared.Autoloot.Init()
|
|||||||
local function Quality(slot)
|
local function Quality(slot)
|
||||||
local ret = NewNumberValue(-1)
|
local ret = NewNumberValue(-1)
|
||||||
if slot == nil then return ret, "slot is nil" end
|
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
|
if quality == nil then return ret, "quality is nil" end
|
||||||
ret.value = quality
|
ret.value = quality
|
||||||
return ret, nil
|
return ret, nil
|
||||||
@@ -395,6 +395,19 @@ function shared.Autoloot.Init()
|
|||||||
for _, filter in ipairs(Filters) do
|
for _, filter in ipairs(Filters) do
|
||||||
if filter:Matches(slot) then
|
if filter:Matches(slot) then
|
||||||
print(string.format("Autolooting slot %s", tostring(slot)))
|
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)
|
LootSlot(slot)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user