Fix small issues in loot and vendor
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
local debug = true
|
||||
local debug = false
|
||||
local iconDisplayDuration = 3
|
||||
|
||||
local function getItemLink(container, slot)
|
||||
aura_env.debugLog("getItemLink", container, slot)
|
||||
return select(7, GetContainerItemInfo(container, slot))
|
||||
end
|
||||
local function getItemQuantity(container, slot)
|
||||
|
||||
return select(2, GetContainerItemInfo(container, slot))
|
||||
end
|
||||
local function getItemName(container, slot)
|
||||
return select(1, GetItemInfo(getItemLink(container, slot)))
|
||||
@@ -60,7 +59,16 @@ local gearFilter = {
|
||||
aura_env.debugLog("Gear filter; container = " .. container .. ", slot = " .. slot)
|
||||
local itemLevel = getItemLevel(container, slot)
|
||||
local itemBindType = getBindType(container, slot)
|
||||
if (itemLevel and itemBindType and itemLevel < ilvlThreshold and (itemBindType == 1 or self.sellBoe)) then
|
||||
local itemType = getItemType(container, slot)
|
||||
local itemEquipLoc = getItemEquipLocation(container, slot)
|
||||
if (itemType and itemEquipLoc and
|
||||
(itemType == "Armor"
|
||||
or itemType == "Weapon"
|
||||
or itemEquipLoc == "INVTYPE_FINGER"
|
||||
or itemEquipLoc == "INVTYPE_TRINKET"
|
||||
or itemEquipLoc == "INVTYPE_CLOAK"
|
||||
or itemEquipLoc == "INVTYPE_NECK")
|
||||
and itemLevel and itemBindType and itemLevel < self.ilvlThreshold and (itemBindType == 1 or self.sellBoe)) then
|
||||
aura_env.debugLog("Gear filter pass")
|
||||
return true
|
||||
end
|
||||
@@ -69,13 +77,13 @@ local gearFilter = {
|
||||
}
|
||||
|
||||
local function doSell(container, slot)
|
||||
local itemIcon = getItemIcon(slot)
|
||||
local itemName = getItemName(slot)
|
||||
local itemQuantity = getItemQuantity(slot)
|
||||
local itemQuality = getItemQuality(slot)
|
||||
local itemIcon = getItemIcon(container, slot)
|
||||
local itemName = getItemName(container, slot)
|
||||
local itemQuantity = getItemQuantity(container, slot)
|
||||
local itemQuality = getItemQuality(container, slot)
|
||||
|
||||
aura_env.debugLog("Drawing icon for " .. itemName .. " with quality " .. itemQuality)
|
||||
local nameWithColor = "[" .. aura_env.qualityColors[itemQuality + 1] .. itemName .. "]\124r"
|
||||
local nameWithColor = aura_env.qualityColors[itemQuality + 1] .. "[" .. itemName .. "]\124r"
|
||||
local nameWithQuantity = nameWithColor .. " x" .. itemQuantity
|
||||
|
||||
aura_env.debugLog("Assigning name" .. nameWithQuantity)
|
||||
@@ -94,7 +102,7 @@ local function doSell(container, slot)
|
||||
duration = iconDisplayDuration,
|
||||
autoHide = true,
|
||||
}
|
||||
|
||||
|
||||
UseContainerItem(container, slot)
|
||||
end
|
||||
|
||||
@@ -107,6 +115,10 @@ aura_env.filterService = {
|
||||
slotsToLoot = {},
|
||||
run = function(self, container, slot)
|
||||
aura_env.debugLog("Filtering item in container = " .. container .. ", slot = " .. slot .. "...")
|
||||
if (not getItemLink(container, slot)) then
|
||||
aura_env.debugLog("Slot empty")
|
||||
return
|
||||
end
|
||||
for k, filter in pairs(self.filters) do
|
||||
if (filter:filter(container, slot)) then
|
||||
doSell(container, slot)
|
||||
|
||||
Reference in New Issue
Block a user