Add tostring to debug logs
This commit is contained in:
@@ -3,68 +3,69 @@ if not WeakAurasSaved then WeakAurasSaved = {} end
|
||||
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
||||
if not WeakAurasSaved.Cyka.ItemCache then WeakAurasSaved.Cyka.ItemCache = {} end
|
||||
|
||||
-- make blood of sargeras filter
|
||||
-- itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType,itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType,expacID, setID, isCraftingReagent = GetItemInfo(slot)
|
||||
-- lootIcon, lootName, lootQuantity, currencyID, lootQuality, locked, isQuestItem, questID, isActive = GetLootSlotInfo(slot)
|
||||
-- Link sometimes does not work
|
||||
local function getItemLink(slot)
|
||||
aura_env.debugLog("getItemLink " .. slot)
|
||||
aura_env.debugLog("getItemLink " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
return GetLootSlotLink(slot)
|
||||
end
|
||||
local function getItemName(slot)
|
||||
aura_env.debugLog("getItemName " .. slot)
|
||||
aura_env.debugLog("getItemName " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
return select(2, GetLootSlotInfo(slot))
|
||||
end
|
||||
local function getItemType(slot)
|
||||
aura_env.debugLog("getItemType " .. slot)
|
||||
aura_env.debugLog("getItemType " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(6, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemSubtype(slot)
|
||||
aura_env.debugLog("getItemSubtype " .. slot)
|
||||
aura_env.debugLog("getItemSubtype " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(7, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemLevel(slot)
|
||||
aura_env.debugLog("getItemLevel " .. slot)
|
||||
aura_env.debugLog("getItemLevel " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(4, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemValue(slot)
|
||||
aura_env.debugLog("getItemValue " .. slot)
|
||||
aura_env.debugLog("getItemValue " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(11, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemQuantity(slot)
|
||||
aura_env.debugLog("getItemQuantity " .. slot)
|
||||
aura_env.debugLog("getItemQuantity " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
return select(3, GetLootSlotInfo(slot))
|
||||
end
|
||||
local function getItemQuality(slot)
|
||||
aura_env.debugLog("getItemQuality " .. slot)
|
||||
aura_env.debugLog("getItemQuality " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(3, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemEquipLocation(slot)
|
||||
aura_env.debugLog("getItemEquipLocation " .. slot)
|
||||
aura_env.debugLog("getItemEquipLocation " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
return select(9, GetItemInfo(itemLink))
|
||||
end
|
||||
local function getItemIcon(slot)
|
||||
aura_env.debugLog("getItemIcon " .. slot)
|
||||
aura_env.debugLog("getItemIcon " .. tostring(slot))
|
||||
if (slot == nil) then return nil end
|
||||
local itemLink = getItemLink(slot)
|
||||
if (itemLink == nil) then return nil end
|
||||
@@ -73,7 +74,7 @@ end
|
||||
|
||||
|
||||
local doLoot = function(slot)
|
||||
aura_env.debugLog("Looting slot: " .. slot)
|
||||
aura_env.debugLog("Looting slot: " .. tostring(slot))
|
||||
LootSlot(slot)
|
||||
|
||||
local itemIcon = getItemIcon(slot) or 134400
|
||||
@@ -94,7 +95,7 @@ local goldFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Gold filter; slot: " .. slot)
|
||||
aura_env.debugLog("Gold filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
-- I guess it does not support OR in regex?
|
||||
-- itemName:match("%d+ ((Gold)|(Silver)|(Copper))")
|
||||
@@ -102,7 +103,7 @@ local goldFilter = {
|
||||
aura_env.debugLog("Gold filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Gold filter fail " .. itemName)
|
||||
aura_env.debugLog("Gold filter fail " .. tostring(itemName))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -110,13 +111,13 @@ local orderResourcesFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Resource filter; slot: " .. slot)
|
||||
aura_env.debugLog("Resource filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
if (itemName and itemName:match("Order Resources")) then
|
||||
aura_env.debugLog("Order resource filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Order resource filter fail " .. itemName)
|
||||
aura_env.debugLog("Order resource filter fail " .. tostring(itemName))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -124,13 +125,13 @@ local mountFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Mount filter; slot: " .. slot)
|
||||
aura_env.debugLog("Mount filter; slot: " .. tostring(slot))
|
||||
local itemType = getItemType(slot)
|
||||
if (itemType and itemType == "Mount") then
|
||||
aura_env.debugLog("Mount filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Mount filter fail " .. itemType)
|
||||
aura_env.debugLog("Mount filter fail " .. tostring(itemType))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -139,13 +140,13 @@ local ilvlFilter = {
|
||||
ilvlThreshold = 880,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("ILvl filter; slot: " .. slot)
|
||||
aura_env.debugLog("ILvl filter; slot: " .. tostring(slot))
|
||||
local itemLevel = getItemLevel(slot)
|
||||
if (itemLevel and itemLevel > self.ilvlThreshold) then
|
||||
aura_env.debugLog("Item level filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Item level filter fail " .. itemLevel)
|
||||
aura_env.debugLog("Item level filter fail " .. tostring(itemLevel))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -158,7 +159,7 @@ local professionFilter = {
|
||||
cooking = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Profession filter; slot: " .. slot)
|
||||
aura_env.debugLog("Profession filter; slot: " .. tostring(slot))
|
||||
local itemType = getItemType(slot)
|
||||
if (itemType and itemType == "Tradeskill") then
|
||||
local itemSubtype = getItemSubtype(slot)
|
||||
@@ -171,7 +172,7 @@ local professionFilter = {
|
||||
return true
|
||||
end
|
||||
end
|
||||
aura_env.debugLog("Profession filter fail " .. itemType)
|
||||
aura_env.debugLog("Profession filter fail " .. tostring(itemType))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -181,12 +182,12 @@ local valueFilter = {
|
||||
applyThresholdToItemStack = false,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Value filter; slot: " .. slot)
|
||||
aura_env.debugLog("Value filter; slot: " .. tostring(slot))
|
||||
local itemValue = getItemValue(slot)
|
||||
|
||||
if (self.applyThresholdToItemStack) then
|
||||
local itemQuantity = getItemQuantity(slot)
|
||||
aura_env.debugLog("There exist " .. itemQuantity .. " items in slot " .. slot)
|
||||
aura_env.debugLog("There exist " .. tostring(itemQuantity) .. " items in slot " .. tostring(slot))
|
||||
itemValue = itemValue * itemQuantity
|
||||
end
|
||||
|
||||
@@ -194,7 +195,7 @@ local valueFilter = {
|
||||
aura_env.debugLog("Value filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Value filter fail " .. itemValue)
|
||||
aura_env.debugLog("Value filter fail " .. tostring(itemValue))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -205,14 +206,14 @@ local greyValueFilter = {
|
||||
applyThresholdToItemStack = false,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Grey value filter; slot: " .. slot)
|
||||
aura_env.debugLog("Grey value filter; slot: " .. tostring(slot))
|
||||
local itemQuality = getItemQuality(slot)
|
||||
if (itemQuality and itemQuality == 0) then
|
||||
local itemValue = getItemValue(slot)
|
||||
|
||||
if (self.applyThresholdToItemStack) then
|
||||
local itemQuantity = getItemQuantity(slot)
|
||||
aura_env.debugLog("There exist " .. itemQuantity .. " items in slot " .. slot)
|
||||
aura_env.debugLog("There exist " .. tostring(itemQuantity) .. " items in slot " .. tostring(slot))
|
||||
itemValue = itemValue * itemQuantity
|
||||
end
|
||||
|
||||
@@ -220,9 +221,9 @@ local greyValueFilter = {
|
||||
aura_env.debugLog("Grey value filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Grey value filter fail " .. itemValue)
|
||||
aura_env.debugLog("Grey value filter fail " .. tostring(itemValue))
|
||||
end
|
||||
aura_env.debugLog("Grey value filter fail " .. itemQuality)
|
||||
aura_env.debugLog("Grey value filter fail " .. tostring(itemQuality))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -230,14 +231,14 @@ local questItemFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Quest item filter; slot: " .. slot)
|
||||
aura_env.debugLog("Quest item filter; slot: " .. tostring(slot))
|
||||
local itemType = getItemType(slot)
|
||||
local itemSubtype = getItemSubtype(slot)
|
||||
if (itemType and itemSubtype and itemType == "Quest" and itemSubtype == "Quest") then
|
||||
aura_env.debugLog("Quest item filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Quest item filter fail " .. itemType .. " " .. itemSubtype)
|
||||
aura_env.debugLog("Quest item filter fais " .. tostring(itemType) .. " " .. tostring(itemSubtype))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -247,7 +248,7 @@ local classGearFilter = {
|
||||
qualityThreshold = 2,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Class gear filter; slot: " .. slot)
|
||||
aura_env.debugLog("Class gear filter; slot: " .. tostring(slot))
|
||||
local itemType = getItemType(slot)
|
||||
local itemEquipLoc = getItemEquipLocation(slot)
|
||||
if (itemType == "Armor"
|
||||
@@ -265,7 +266,7 @@ local classGearFilter = {
|
||||
return true
|
||||
end
|
||||
end
|
||||
aura_env.debugLog("Class gear filter fail " .. itemType .. " " .. itemEquipLoc)
|
||||
aura_env.debugLog("Class gear filter fais " .. tostring(itemType) .. " " .. tostring(itemEquipLoc))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -275,7 +276,7 @@ local azeriteFilter = {
|
||||
qualityThreshold = 2,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Azerite filter; slot: " .. slot)
|
||||
aura_env.debugLog("Azerite filter; slot: " .. tostring(slot))
|
||||
local itemType = getItemType(slot)
|
||||
local itemSubtype = getItemSubtype(slot)
|
||||
local itemQuality = getItemQuality(slot)
|
||||
@@ -283,7 +284,7 @@ local azeriteFilter = {
|
||||
aura_env.debugLog("Azerite filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Azerite filter fail " .. itemType .. " " .. itemSubtype .. " " .. itemQuality)
|
||||
aura_env.debugLog("Azerite filter fais " .. tostring(itemType) .. " " .. tostring(itemSubtype) .. " " .. tostring(itemQuality))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -292,14 +293,14 @@ local arguniteFilter = {
|
||||
qualityThreshold = 1,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Argunite filter; slot: " .. slot)
|
||||
aura_env.debugLog("Argunite filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
local itemQuality = getItemQuality(slot)
|
||||
if (itemName and itemQuality and itemName:match("Argunite") and itemQuality > self.qualityThreshold) then
|
||||
aura_env.debugLog("Argunite filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Argunite filter fail " .. itemName .. " " .. itemQuality)
|
||||
aura_env.debugLog("Argunite filter fais " .. tostring(itemName) .. " " .. tostring(itemQuality))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -308,13 +309,13 @@ local ancientManaFilter = {
|
||||
qualityThreshold = 1,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Ancient mana filter; slot: " .. slot)
|
||||
aura_env.debugLog("Ancient mana filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
if (itemName and itemName:match("Ancient Mana")) then
|
||||
aura_env.debugLog("Ancient mana filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Ancient mana filter fail " .. itemName)
|
||||
aura_env.debugLog("Ancient mana filter fail " .. tostring(itemName))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -322,13 +323,27 @@ local reicpeFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Recipe filter; slot: " .. slot)
|
||||
aura_env.debugLog("Recipe filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
if (itemName and (itemName:match("Recipe") or itemName:match("Technique"))) then
|
||||
aura_env.debugLog("Recipe filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Recipe filter fail " .. itemName)
|
||||
aura_env.debugLog("Recipe filter fail " .. tostring(itemName))
|
||||
end
|
||||
end
|
||||
}
|
||||
local bloodOfSargerasFilter = {
|
||||
enabled = true,
|
||||
filter = function(self, slot)
|
||||
if (self.enabled) then
|
||||
aura_env.debugLog("Blood of Sargeras filter; slot: " .. tostring(slot))
|
||||
local itemName = getItemName(slot)
|
||||
if (itemName and itemName:match("Sargeras")) then
|
||||
aura_env.debugLog("Blood of Sargeras filter pass")
|
||||
return true
|
||||
end
|
||||
aura_env.debugLog("Blood of Sargeras filter fail " .. tostring(itemName))
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -353,7 +368,7 @@ aura_env.filterService = {
|
||||
run = function(self, lootInfo)
|
||||
self.slotsToLoot = {}
|
||||
for slot, item in pairs(lootInfo) do
|
||||
aura_env.debugLog("Loot slot: " .. slot .. " " .. item.item)
|
||||
aura_env.debugLog("Loot slot: " .. tostring(slot) .. " " .. item.item)
|
||||
self:runFilters(slot)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user