diff --git a/FreshShit/AutoLoot/Init.lua b/FreshShit/AutoLoot/Init.lua index daa1242..2cd1474 100644 --- a/FreshShit/AutoLoot/Init.lua +++ b/FreshShit/AutoLoot/Init.lua @@ -1,887 +1,887 @@ -local debug = false -if not WeakAurasSaved then WeakAurasSaved = {} end -if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end -if not WeakAurasSaved.Cyka.ItemCache then WeakAurasSaved.Cyka.ItemCache = {} end - ----@param slot number ----@return string, string|nil -local function getItemLink(slot) - if slot == nil then return "", string.format("Slot can not be nil") end - local link = GetLootSlotLink(slot) - if link == nil then return "", string.format("GetLootSlotLink returned nil for slot %d", slot) end - return link, nil -end ----@param slot number ----@return string, string|nil -local function getItemName(slot) - if slot == nil then return "", string.format("Slot can not be null") end - local name = select(2, GetLootSlotInfo(slot)) - if name == nil then return "", string.format("GetLootSlotInfo returned nil for slot %d", slot) end - return name, nil -end ----@param slot number ----@return string, string|nil -local function getItemType(slot) - if slot == nil then return "", string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return "", err end - local itemType = select(6, GetItemInfo(itemLink)) - if itemType == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end - return itemType, nil -end ----@param slot number ----@return string, string|nil -local function getItemSubtype(slot) - if slot == nil then return "", string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return "", err end - local itemSubtype = select(7, GetItemInfo(itemLink)) - if itemSubtype == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end - return itemSubtype, nil -end ----@param slot number ----@return number, string|nil -local function getItemLevel(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 0, err end - local itemLevel = select(4, GetItemInfo(itemLink)) - if itemLevel == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end - return itemLevel, nil -end - ----The vendor price in copper, or 0 for items that cannot be sold ----@param slot number ----@return number, string|nil -local function getItemValue(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 0, err end - local value = select(11, GetItemInfo(itemLink)) - if value == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end - return value, nil -end ----@param slot number ----@return number, string|nil -local function getItemSubclassId(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 0, err end - local subclassId = select(13, GetItemInfo(itemLink)) - if subclassId == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end - return subclassId, nil -end ----@param slot number ----@return number, string|nil -local function getItemQuantity(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local quantity = select(3, GetLootSlotInfo(slot)) - if quantity == nil then return 0, string.format("GetLootSlotInfo returned nil for slot %d", slot) end - return quantity, nil -end ----@param slot number ----@return Enum.ItemQuality, string|nil -local function getItemQuality(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 0, err end - local quality = select(3, GetItemInfo(itemLink)) - if quality == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end - return quality, nil -end ----@param slot number ----@return string, string|nil -local function getItemEquipLocation(slot) - if slot == nil then return "", string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return "", err end - local equipLoc = select(9, GetItemInfo(itemLink)) - if equipLoc == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end - return equipLoc, nil -end ----@param slot number ----@return number, string|nil -local function getItemIcon(slot) - if slot == nil then return 134400, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 134400, err end - local icon = select(10, GetItemInfo(itemLink)) - if icon == nil then return 134400, string.format("GetItemInfo returned nil for slot %d", slot) end - return icon, nil -end ----@param slot number ----@return number, string|nil -local function getBindType(slot) - if slot == nil then return 0, string.format("Slot can not be nil") end - local itemLink, err = getItemLink(slot) - if err then return 0, err end - local bindType = select(14, GetItemInfo(itemLink)) - if bindType == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end - return bindType, nil -end - ----@class Filter ----@field requires table | nil ----@field filter fun(slot: number, provided: table): boolean -Filter = { - ---@param requires table | nil - ---@param filter fun(slot: number, provided: table): boolean - ---@return Filter - new = function(requires, filter) - local self = setmetatable({}, { - __index = Filter - }) - self.requires = requires - self.filter = filter - return self - end, - - ---@param self Filter - ---@param slot number - ---@return boolean, string|nil - Run = function(self, slot) - ---@type table - local provided = {} - if self.requires then - for k, v in pairs(self.requires) do - local res, err = v(slot) - if err ~= nil then - if debug then print(err) end - return false, err - end - provided[k] = res - end - end - local res, err = self.filter(slot, provided) - if err ~= nil then - if debug then print(err) end - end - return res, nil - end -} - -local goldFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if string.find(provided.name, "Gold") or - string.find(provided.name, "Silver") or - string.find(provided.name, "Copper") then - if debug then print(string.format("Gold filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Gold filter fail for %s", provided.name)) end - return false - end) -local orderResourcesFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if string.find(provided.name, "Order Resources") then - if debug then print(string.format("Order resource filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Order resource filter fail for %s", provided.name)) end - return false - end) -local mountFilter = Filter.new({ ["type"] = getItemType }, - function(slot, provided) - ---@cast provided { type: string } - if provided.type == "Mount" then - if debug then print(string.format("Mount filter pass for type %s", provided.type)) end - return true - end - if debug then print(string.format("Mount filter fail for type %s", provided.type)) end - return false - end) -local ilvlFilter = Filter.new({ ["ilvl"] = getItemLevel }, - function(slot, provided) - ---@cast provided { ilvl: number } - if provided.ilvl and provided.ilvl > 800 then - if debug then print(string.format("ilvl filter pass for ilvl %d", provided.ilvl)) end - return true - end - if debug then print(string.format("ilvl filter fail for ilvl %d", provided.ilvl)) end - return false - end) -local professionFilter = Filter.new({ - ["type"] = getItemType, - ["subtype"] = getItemSubtype - }, - function(slot, provided) - ---@cast provided { type: string, subtype: string } - - local enabled = { - ["Cloth"] = true, - ["Cooking"] = true, - ["Enchanting"] = true, - ["Herb"] = true, - ["Inscription"] = true, - ["Jewelcrafting"] = true, - ["Leather"] = true, - ["Metal & Stone"] = true, - ["Ore"] = true, - } - - -- Maybe implement an expansion based filter - if provided.type == "Tradeskill" then - if enabled[provided.subtype] then - if debug then print(string.format("Profession filter pass for type %s", provided.type)) end - return true - end - end - if debug then print(string.format("Profession filter fail for type %s", provided.type)) end - return false - end) -local valueFilter = Filter.new({ - ["value"] = getItemValue, - ["quantity"] = getItemQuality - }, - function(slot, provided) - ---@cast provided { value: number, quantity: number } - - local valueThreshold = 35 * 100 * 100 - local applyValueTostack = false - - local value = provided.value - if applyValueTostack then value = value * provided.quantity end - - if value > valueThreshold then - if debug then print(string.format("Value filter pass for value %d", value)) end - return true - end - if debug then print(string.format("Value filter fail for value %d", value)) end - return false - end) -local greyValueFilter = Filter.new({ - ["quality"] = getItemQuality, - ["value"] = getItemValue, - ["quantity"] = getItemQuantity - }, - function(slot, provided) - ---@cast provided { quality: number, value: number, quantity: number } - - local valueThreshold = 4 * 100 * 100 - local applyValueTostack = false - - if provided.quality == 0 then - local value = provided.value - if applyValueTostack then value = value * provided.quantity end - - if value > valueThreshold then - if debug then - print(string.format("Grey value filter pass for value %d of %s quality items", value, - provided.quality)) - end - return true - end - end - if debug then - print(string.format("Grey value filter fail for value %d of %s quality items", provided.value, - provided.quality)) - end - return false - end) -local questItemFilter = Filter.new({ - ["type"] = getItemType, - ["subtype"] = getItemSubtype - }, - function(slot, provided) - ---@cast provided { type: string, subtype: string } - if provided.type == "Quest" and provided.subtype == "Quest" then - if debug then - print(string.format("Quest item filter pass for type %s and subtype", provided.type, - provided.subtype)) - end - return true - end - if debug then - print(string.format("Quest item filter fail for type %s and subtype", provided.type, - provided.subtype)) - end - return false - end) -local classGearFilter = Filter.new({ - ["ilvl"] = getItemLevel, - ["quality"] = getItemQuality, - ["type"] = getItemType, - ["subtype"] = getItemSubtype, - ["equiploc"] = getItemEquipLocation - }, - function(slot, provided) - ---@cast provided { ilvl: number, quality: number, type: string, subtype: string, equiploc: string } - - local ilvlThreshold = 800 - local qualityThreshold = 2 - - local isEquippable = aura_env.skills[select(3, UnitClass("player"))][provided.subtype] == 1 - - if isEquippable and provided.ilvl > ilvlThreshold and provided.quality > qualityThreshold then - if debug then - print(string.format("Class gear filter pass for ilvl %d and quality %d", provided.ilvl, - provided.quality)) - end - return true - end - if debug then - print(string.format("Class gear filter fail for ilvl %d and quality %d", provided.ilvl, - provided.quality)) - end - return false - end) -local arguniteFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Veiled Argunite" then - if debug then - print(string.format("Argunite filter pass for %s", provided.name)) - end - return true - end - if debug then print(string.format("Argunite filter fail for %s", provided.name)) end - return false - end) -local ancientManaFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if string.find(provided.name, "Ancient Mana") then - if debug then print(string.format("Ancient Mana filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Ancient Mana filter fail for %s", provided.name)) end - return false - end) -local reicpeFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if string.find(provided.name, "Recipe") or string.find(provided.name, "Technique") then - if debug then print(string.format("Recipe filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Recipe filter fail for %s", provided.name)) end - return false - end) -local bloodOfSargerasFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Blood of Sargeras" then - if debug then print(string.format("Blood of Sargeras filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Blood of Sargeras filter fail for %s", provided.name)) end - return false - end) -local primalSpiritFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Primal Spirit" then - if debug then print(string.format("Primal Spirit filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Primal Spirit filter fail for %s", provided.name)) end - return false - end) -local apexisCrystalFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Apexis Crystal" then - if debug then print(string.format("Apexis Crystal filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Apexis Crystal filter fail for %s", provided.name)) end - return false - end) -local nethershardFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Nethershard" then - if debug then print(string.format("Nethershard filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Nethershard filter fail for %s", provided.name)) end - return false - end) -local bloodhunerQuarryFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Bloodhunter's Quarry" then - if debug then print(string.format("Bloodhunter's Quarry filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Bloodhunter's Quarry filter fail for %s", provided.name)) end - return false - end) -local arguniteClusterFilter = Filter.new({ ["name"] = getItemName }, - function(slot, provided) - ---@cast provided { name: string } - if provided.name == "Argunite Cluster" then - if debug then print(string.format("Argunite Cluster filter pass for %s", provided.name)) end - return true - end - if debug then print(string.format("Argunite Cluster filter fail for %s", provided.name)) end - return false - end) -local boeFilter = Filter.new({ - ["ilvl"] = getItemLevel, - ["type"] = getItemType, - ["quality"] = getItemQuality, - ["equiploc"] = getItemEquipLocation, - ["bindtype"] = getBindType - }, - function(slot, provided) - ---@cast provided { ilvl: number, type: string, quality: number, equiploc: string, bindtype: number } - - local ilvlThreshold = 800 - local qualityThreshold = 1 - - local itemType = provided.type - local itemEquipLoc = provided.equiploc - if (itemType == "Armor" - or itemType == "Weapon" - or itemEquipLoc == "INVTYPE_FINGER" - or itemEquipLoc == "INVTYPE_TRINKET" - or itemEquipLoc == "INVTYPE_CLOAK" - or itemEquipLoc == "INVTYPE_NECK") then - local itemLevel = provided.ilvl - local itemQuality = provided.quality - local bindType = provided.bindtype - - if itemLevel > ilvlThreshold and itemQuality > qualityThreshold and bindType == 1 then - if debug then print(string.format("BoE filter pass for ilvl %d and quality %d", itemLevel, itemQuality)) end - return true - end - end - if debug then print(string.format("BoE filter fail for ilvl %d and quality %d", provided.ilvl, provided.quality)) end - return false - end) -local artifactPowerFilter = Filter.new({ - ["type"] = getItemType, - ["subtype"] = getItemSubtype, - ["subclassid"] = getItemSubclassId, - ["value"] = getItemValue -}, function(slot, provided) - ---@cast provided { type: string, subtype: string, subclassid: number, value: number } - if provided.value == 0 and provided.type == "Consumable" and provided.subtype == "Other" and provided.subclassid == 8 then - if debug then - print(string.format("Artifact power filter pass for type %s and subtype %s and subclassid %d with value %d", - provided.type, provided.subtype, provided.subclassid, provided.value)) - end - return true - end - if debug then - DevTools_Dump(provided) - print(string.format("Artifact power filter fail for type %s and subtype %s and subclassid %d with value %d", - provided.type, provided.subtype, provided.subclassid, provided.value)) - end - return false -end) - --- local azeriteFilter = { --- enabled = true, --- ilvlThreshold = 800, --- qualityThreshold = 2, --- filter = function(self, slot) --- if self.enabled the --- local itemType = getItemType(slot) --- local itemSubtype = getItemSubtype(slot) --- local itemQuality = getItemQuality(slot) --- if itemType and itemSubtype and itemQuality and itemType == "Consumable" and itemSubtype == "Other" and itemQuality > 1 the --- return true --- en --- tostring(itemType) .. " " .. tostring(itemSubtype) .. " " .. tostring(itemQuality)) --- end --- end --- } - - ----@type table -local filters = { - ancientManaFilter, - arguniteFilter, - artifactPowerFilter, - bloodhunerQuarryFilter, - bloodOfSargerasFilter, - boeFilter, - classGearFilter, - goldFilter, - greyValueFilter, - ilvlFilter, - mountFilter, - orderResourcesFilter, - professionFilter, - questItemFilter, - -- reicpeFilter, - valueFilter, - arguniteClusterFilter, - primalSpiritFilter, - apexisCrystalFilter, - nethershardFilter, -} - ----@class FilterService -aura_env.FilterService = { - ---@param lootInfo table - Run = function(lootInfo) - ---@type table - local slotsToLoot = {} - for slot, item in pairs(lootInfo) do - if debug then - local itemname = getItemName(slot) - print(string.format("Checking slot %d for %s", slot, itemname)) - end - for _, filter in pairs(filters) do - local res, err = filter:Run(slot) - if err then - if debug then print(err) end - end - if res then - slotsToLoot[#slotsToLoot + 1] = slot - break - end - end - end - - aura_env.FilterService.doLoot(slotsToLoot) - end, - - ---@param slots table - ---@return nil - doLoot = function(slots) - for i = #slots, 1, -1 do - aura_env.FilterService.lootslot(slots[i]) - end - end, - - ---@param slot number - ---@return nil - lootslot = function(slot) - LootSlot(slot) - - local itemIcon = getItemIcon(slot) or 134400 - local itemName = getItemName(slot) or "Unknown" - itemName = itemName:gsub("\n", ", ") - local itemQuality = getItemQuality(slot) or 0 - - if string.find(itemName, "Gold") == nil - and string.find(itemName, "Silver") == nil - and string.find(itemName, "Copper") == nil then - if not WeakAurasSaved.Cyka.ItemCache[itemName] then - WeakAurasSaved.Cyka.ItemCache[itemName] = { - icon = itemIcon, - quality = itemQuality, - } - end - end - end -} - -aura_env.skills = { - --Warrior - [1] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 1, - ["Shields"] = 1, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 1, - ["Bows"] = 1, - ["Guns"] = 1, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 1, - ["Polearms"] = 1, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 1, - ["Warglaives"] = 1, - ["Staves"] = 1, - ["Fist Weapons"] = 1, - ["Daggers"] = 1, - ["Crossbows"] = 1, - ["Wands"] = 0, - }, - --Paladin - [2] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 1, - ["Shields"] = 1, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 1, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 1, - ["Polearms"] = 1, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 1, - ["Warglaives"] = 0, - ["Staves"] = 0, - ["Fist Weapons"] = 0, - ["Daggers"] = 0, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Hunter - [3] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 0, - ["Mail"] = 1, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 1, - ["Bows"] = 1, - ["Guns"] = 1, - ["One-Handed Maces"] = 0, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 1, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 1, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 1, - ["Daggers"] = 1, - ["Crossbows"] = 1, - ["Wands"] = 0, - }, - --Rogue - [4] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 1, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 0, - ["Fist Weapons"] = 1, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Priest - [5] = { - --Armor Skills - ["Cloth"] = 1, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 0, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 0, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 0, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 1, - }, - --Death Knight - [6] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 1, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 1, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 1, - ["Polearms"] = 1, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 1, - ["Warglaives"] = 0, - ["Staves"] = 0, - ["Fist Weapons"] = 0, - ["Daggers"] = 0, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Shaman - [7] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 0, - ["Mail"] = 1, - ["Plate"] = 0, - ["Shields"] = 1, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 0, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 1, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Mage - [8] = { - --Armor Skills - ["Cloth"] = 1, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 0, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 0, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 0, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 1, - }, - --Warlock - [9] = { - --Armor Skills - ["Cloth"] = 1, - ["Leather"] = 0, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 0, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 0, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 0, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 1, - }, - --Monk - [10] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 1, - ["Mail"] = 0, - ["Plate"] = 1, - ["Shields"] = 1, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 1, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 1, - ["Daggers"] = 0, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Druid - [11] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 1, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 0, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 1, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 1, - ["One-Handed Swords"] = 0, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 0, - ["Staves"] = 1, - ["Fist Weapons"] = 1, - ["Daggers"] = 1, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, - --Demon Hunter - [12] = { - --Armor Skills - ["Cloth"] = 0, - ["Leather"] = 1, - ["Mail"] = 0, - ["Plate"] = 0, - ["Shields"] = 0, - --Weapon Skills - ["One-Handed Axes"] = 1, - ["Two-Handed Axes"] = 0, - ["Bows"] = 0, - ["Guns"] = 0, - ["One-Handed Maces"] = 0, - ["Two-Handed Maces"] = 0, - ["Polearms"] = 0, - ["One-Handed Swords"] = 1, - ["Two-Handed Swords"] = 0, - ["Warglaives"] = 1, - ["Staves"] = 0, - ["Fist Weapons"] = 1, - ["Daggers"] = 0, - ["Crossbows"] = 0, - ["Wands"] = 0, - }, -} -aura_env.qualityColors = { - "\124cff9d9d9d", -- Poor - "\124cffffffff", -- Common - "\124cff1eff00", -- Uncommon - "\124cff0070dd", -- Rare - "\124cffa335ee", -- Epic - "\124cffff8000", -- Legendary - "\124cffe6cc80", -- Artifact - "\124cff00ccff", -- Heirloom -} +local debug = false +if not WeakAurasSaved then WeakAurasSaved = {} end +if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end +if not WeakAurasSaved.Cyka.ItemCache then WeakAurasSaved.Cyka.ItemCache = {} end + +---@param slot number +---@return string, string|nil +local function getItemLink(slot) + if slot == nil then return "", string.format("Slot can not be nil") end + local link = GetLootSlotLink(slot) + if link == nil then return "", string.format("GetLootSlotLink returned nil for slot %d", slot) end + return link, nil +end +---@param slot number +---@return string, string|nil +local function getItemName(slot) + if slot == nil then return "", string.format("Slot can not be null") end + local name = select(2, GetLootSlotInfo(slot)) + if name == nil then return "", string.format("GetLootSlotInfo returned nil for slot %d", slot) end + return name, nil +end +---@param slot number +---@return string, string|nil +local function getItemType(slot) + if slot == nil then return "", string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return "", err end + local itemType = select(6, GetItemInfo(itemLink)) + if itemType == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end + return itemType, nil +end +---@param slot number +---@return string, string|nil +local function getItemSubtype(slot) + if slot == nil then return "", string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return "", err end + local itemSubtype = select(7, GetItemInfo(itemLink)) + if itemSubtype == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end + return itemSubtype, nil +end +---@param slot number +---@return number, string|nil +local function getItemLevel(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 0, err end + local itemLevel = select(4, GetItemInfo(itemLink)) + if itemLevel == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end + return itemLevel, nil +end + +---The vendor price in copper, or 0 for items that cannot be sold +---@param slot number +---@return number, string|nil +local function getItemValue(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 0, err end + local value = select(11, GetItemInfo(itemLink)) + if value == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end + return value, nil +end +---@param slot number +---@return number, string|nil +local function getItemSubclassId(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 0, err end + local subclassId = select(13, GetItemInfo(itemLink)) + if subclassId == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end + return subclassId, nil +end +---@param slot number +---@return number, string|nil +local function getItemQuantity(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local quantity = select(3, GetLootSlotInfo(slot)) + if quantity == nil then return 0, string.format("GetLootSlotInfo returned nil for slot %d", slot) end + return quantity, nil +end +---@param slot number +---@return Enum.ItemQuality, string|nil +local function getItemQuality(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 0, err end + local quality = select(3, GetItemInfo(itemLink)) + if quality == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end + return quality, nil +end +---@param slot number +---@return string, string|nil +local function getItemEquipLocation(slot) + if slot == nil then return "", string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return "", err end + local equipLoc = select(9, GetItemInfo(itemLink)) + if equipLoc == nil then return "", string.format("GetItemInfo returned nil for slot %d", slot) end + return equipLoc, nil +end +---@param slot number +---@return number, string|nil +local function getItemIcon(slot) + if slot == nil then return 134400, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 134400, err end + local icon = select(10, GetItemInfo(itemLink)) + if icon == nil then return 134400, string.format("GetItemInfo returned nil for slot %d", slot) end + return icon, nil +end +---@param slot number +---@return number, string|nil +local function getBindType(slot) + if slot == nil then return 0, string.format("Slot can not be nil") end + local itemLink, err = getItemLink(slot) + if err then return 0, err end + local bindType = select(14, GetItemInfo(itemLink)) + if bindType == nil then return 0, string.format("GetItemInfo returned nil for slot %d", slot) end + return bindType, nil +end + +---@class Filter +---@field requires table | nil +---@field filter fun(slot: number, provided: table): boolean +Filter = { + ---@param requires table | nil + ---@param filter fun(slot: number, provided: table): boolean + ---@return Filter + new = function(requires, filter) + local self = setmetatable({}, { + __index = Filter + }) + self.requires = requires + self.filter = filter + return self + end, + + ---@param self Filter + ---@param slot number + ---@return boolean, string|nil + Run = function(self, slot) + ---@type table + local provided = {} + if self.requires then + for k, v in pairs(self.requires) do + local res, err = v(slot) + if err ~= nil then + if debug then print(err) end + return false, err + end + provided[k] = res + end + end + local res, err = self.filter(slot, provided) + if err ~= nil then + if debug then print(err) end + end + return res, nil + end +} + +local goldFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if string.find(provided.name, "Gold") or + string.find(provided.name, "Silver") or + string.find(provided.name, "Copper") then + if debug then print(string.format("Gold filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Gold filter fail for %s", provided.name)) end + return false + end) +local orderResourcesFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if string.find(provided.name, "Order Resources") then + if debug then print(string.format("Order resource filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Order resource filter fail for %s", provided.name)) end + return false + end) +local mountFilter = Filter.new({ ["type"] = getItemType }, + function(slot, provided) + ---@cast provided { type: string } + if provided.type == "Mount" then + if debug then print(string.format("Mount filter pass for type %s", provided.type)) end + return true + end + if debug then print(string.format("Mount filter fail for type %s", provided.type)) end + return false + end) +local ilvlFilter = Filter.new({ ["ilvl"] = getItemLevel }, + function(slot, provided) + ---@cast provided { ilvl: number } + if provided.ilvl and provided.ilvl > 800 then + if debug then print(string.format("ilvl filter pass for ilvl %d", provided.ilvl)) end + return true + end + if debug then print(string.format("ilvl filter fail for ilvl %d", provided.ilvl)) end + return false + end) +local professionFilter = Filter.new({ + ["type"] = getItemType, + ["subtype"] = getItemSubtype + }, + function(slot, provided) + ---@cast provided { type: string, subtype: string } + + local enabled = { + ["Cloth"] = true, + ["Cooking"] = true, + ["Enchanting"] = true, + ["Herb"] = true, + ["Inscription"] = true, + ["Jewelcrafting"] = true, + ["Leather"] = true, + ["Metal & Stone"] = true, + ["Ore"] = true, + } + + -- Maybe implement an expansion based filter + if provided.type == "Tradeskill" then + if enabled[provided.subtype] then + if debug then print(string.format("Profession filter pass for type %s", provided.type)) end + return true + end + end + if debug then print(string.format("Profession filter fail for type %s", provided.type)) end + return false + end) +local valueFilter = Filter.new({ + ["value"] = getItemValue, + ["quantity"] = getItemQuality + }, + function(slot, provided) + ---@cast provided { value: number, quantity: number } + + local valueThreshold = 35 * 100 * 100 + local applyValueTostack = false + + local value = provided.value + if applyValueTostack then value = value * provided.quantity end + + if value > valueThreshold then + if debug then print(string.format("Value filter pass for value %d", value)) end + return true + end + if debug then print(string.format("Value filter fail for value %d", value)) end + return false + end) +local greyValueFilter = Filter.new({ + ["quality"] = getItemQuality, + ["value"] = getItemValue, + ["quantity"] = getItemQuantity + }, + function(slot, provided) + ---@cast provided { quality: number, value: number, quantity: number } + + local valueThreshold = 0.1 * 100 * 100 + local applyValueTostack = false + + if provided.quality == 0 then + local value = provided.value + if applyValueTostack then value = value * provided.quantity end + + if value > valueThreshold then + if debug then + print(string.format("Grey value filter pass for value %d of %s quality items", value, + provided.quality)) + end + return true + end + end + if debug then + print(string.format("Grey value filter fail for value %d of %s quality items", provided.value, + provided.quality)) + end + return false + end) +local questItemFilter = Filter.new({ + ["type"] = getItemType, + ["subtype"] = getItemSubtype + }, + function(slot, provided) + ---@cast provided { type: string, subtype: string } + if provided.type == "Quest" and provided.subtype == "Quest" then + if debug then + print(string.format("Quest item filter pass for type %s and subtype", provided.type, + provided.subtype)) + end + return true + end + if debug then + print(string.format("Quest item filter fail for type %s and subtype", provided.type, + provided.subtype)) + end + return false + end) +local classGearFilter = Filter.new({ + ["ilvl"] = getItemLevel, + ["quality"] = getItemQuality, + ["type"] = getItemType, + ["subtype"] = getItemSubtype, + ["equiploc"] = getItemEquipLocation + }, + function(slot, provided) + ---@cast provided { ilvl: number, quality: number, type: string, subtype: string, equiploc: string } + + local ilvlThreshold = 800 + local qualityThreshold = 2 + + local isEquippable = aura_env.skills[select(3, UnitClass("player"))][provided.subtype] == 1 + + if isEquippable and provided.ilvl > ilvlThreshold and provided.quality > qualityThreshold then + if debug then + print(string.format("Class gear filter pass for ilvl %d and quality %d", provided.ilvl, + provided.quality)) + end + return true + end + if debug then + print(string.format("Class gear filter fail for ilvl %d and quality %d", provided.ilvl, + provided.quality)) + end + return false + end) +local arguniteFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Veiled Argunite" then + if debug then + print(string.format("Argunite filter pass for %s", provided.name)) + end + return true + end + if debug then print(string.format("Argunite filter fail for %s", provided.name)) end + return false + end) +local ancientManaFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if string.find(provided.name, "Ancient Mana") then + if debug then print(string.format("Ancient Mana filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Ancient Mana filter fail for %s", provided.name)) end + return false + end) +local reicpeFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if string.find(provided.name, "Recipe") or string.find(provided.name, "Technique") then + if debug then print(string.format("Recipe filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Recipe filter fail for %s", provided.name)) end + return false + end) +local bloodOfSargerasFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Blood of Sargeras" then + if debug then print(string.format("Blood of Sargeras filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Blood of Sargeras filter fail for %s", provided.name)) end + return false + end) +local primalSpiritFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Primal Spirit" then + if debug then print(string.format("Primal Spirit filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Primal Spirit filter fail for %s", provided.name)) end + return false + end) +local apexisCrystalFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Apexis Crystal" then + if debug then print(string.format("Apexis Crystal filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Apexis Crystal filter fail for %s", provided.name)) end + return false + end) +local nethershardFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Nethershard" then + if debug then print(string.format("Nethershard filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Nethershard filter fail for %s", provided.name)) end + return false + end) +local bloodhunerQuarryFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Bloodhunter's Quarry" then + if debug then print(string.format("Bloodhunter's Quarry filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Bloodhunter's Quarry filter fail for %s", provided.name)) end + return false + end) +local arguniteClusterFilter = Filter.new({ ["name"] = getItemName }, + function(slot, provided) + ---@cast provided { name: string } + if provided.name == "Argunite Cluster" then + if debug then print(string.format("Argunite Cluster filter pass for %s", provided.name)) end + return true + end + if debug then print(string.format("Argunite Cluster filter fail for %s", provided.name)) end + return false + end) +local boeFilter = Filter.new({ + ["ilvl"] = getItemLevel, + ["type"] = getItemType, + ["quality"] = getItemQuality, + ["equiploc"] = getItemEquipLocation, + ["bindtype"] = getBindType + }, + function(slot, provided) + ---@cast provided { ilvl: number, type: string, quality: number, equiploc: string, bindtype: number } + + local ilvlThreshold = 800 + local qualityThreshold = 1 + + local itemType = provided.type + local itemEquipLoc = provided.equiploc + if (itemType == "Armor" + or itemType == "Weapon" + or itemEquipLoc == "INVTYPE_FINGER" + or itemEquipLoc == "INVTYPE_TRINKET" + or itemEquipLoc == "INVTYPE_CLOAK" + or itemEquipLoc == "INVTYPE_NECK") then + local itemLevel = provided.ilvl + local itemQuality = provided.quality + local bindType = provided.bindtype + + if itemLevel > ilvlThreshold and itemQuality > qualityThreshold and bindType == 1 then + if debug then print(string.format("BoE filter pass for ilvl %d and quality %d", itemLevel, itemQuality)) end + return true + end + end + if debug then print(string.format("BoE filter fail for ilvl %d and quality %d", provided.ilvl, provided.quality)) end + return false + end) +local artifactPowerFilter = Filter.new({ + ["type"] = getItemType, + ["subtype"] = getItemSubtype, + ["subclassid"] = getItemSubclassId, + ["value"] = getItemValue +}, function(slot, provided) + ---@cast provided { type: string, subtype: string, subclassid: number, value: number } + if provided.value == 0 and provided.type == "Consumable" and provided.subtype == "Other" and provided.subclassid == 8 then + if debug then + print(string.format("Artifact power filter pass for type %s and subtype %s and subclassid %d with value %d", + provided.type, provided.subtype, provided.subclassid, provided.value)) + end + return true + end + if debug then + DevTools_Dump(provided) + print(string.format("Artifact power filter fail for type %s and subtype %s and subclassid %d with value %d", + provided.type, provided.subtype, provided.subclassid, provided.value)) + end + return false +end) + +-- local azeriteFilter = { +-- enabled = true, +-- ilvlThreshold = 800, +-- qualityThreshold = 2, +-- filter = function(self, slot) +-- if self.enabled the +-- local itemType = getItemType(slot) +-- local itemSubtype = getItemSubtype(slot) +-- local itemQuality = getItemQuality(slot) +-- if itemType and itemSubtype and itemQuality and itemType == "Consumable" and itemSubtype == "Other" and itemQuality > 1 the +-- return true +-- en +-- tostring(itemType) .. " " .. tostring(itemSubtype) .. " " .. tostring(itemQuality)) +-- end +-- end +-- } + + +---@type table +local filters = { + ancientManaFilter, + arguniteFilter, + artifactPowerFilter, + bloodhunerQuarryFilter, + bloodOfSargerasFilter, + boeFilter, + classGearFilter, + goldFilter, + greyValueFilter, + ilvlFilter, + mountFilter, + orderResourcesFilter, + professionFilter, + questItemFilter, + -- reicpeFilter, + valueFilter, + arguniteClusterFilter, + primalSpiritFilter, + apexisCrystalFilter, + nethershardFilter, +} + +---@class FilterService +aura_env.FilterService = { + ---@param lootInfo table + Run = function(lootInfo) + ---@type table + local slotsToLoot = {} + for slot, item in pairs(lootInfo) do + if debug then + local itemname = getItemName(slot) + print(string.format("Checking slot %d for %s", slot, itemname)) + end + for _, filter in pairs(filters) do + local res, err = filter:Run(slot) + if err then + if debug then print(err) end + end + if res then + slotsToLoot[#slotsToLoot + 1] = slot + break + end + end + end + + aura_env.FilterService.doLoot(slotsToLoot) + end, + + ---@param slots table + ---@return nil + doLoot = function(slots) + for i = #slots, 1, -1 do + aura_env.FilterService.lootslot(slots[i]) + end + end, + + ---@param slot number + ---@return nil + lootslot = function(slot) + LootSlot(slot) + + local itemIcon = getItemIcon(slot) or 134400 + local itemName = getItemName(slot) or "Unknown" + itemName = itemName:gsub("\n", ", ") + local itemQuality = getItemQuality(slot) or 0 + + if string.find(itemName, "Gold") == nil + and string.find(itemName, "Silver") == nil + and string.find(itemName, "Copper") == nil then + if not WeakAurasSaved.Cyka.ItemCache[itemName] then + WeakAurasSaved.Cyka.ItemCache[itemName] = { + icon = itemIcon, + quality = itemQuality, + } + end + end + end +} + +aura_env.skills = { + --Warrior + [1] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 1, + ["Shields"] = 1, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 1, + ["Bows"] = 1, + ["Guns"] = 1, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 1, + ["Polearms"] = 1, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 1, + ["Warglaives"] = 1, + ["Staves"] = 1, + ["Fist Weapons"] = 1, + ["Daggers"] = 1, + ["Crossbows"] = 1, + ["Wands"] = 0, + }, + --Paladin + [2] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 1, + ["Shields"] = 1, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 1, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 1, + ["Polearms"] = 1, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 1, + ["Warglaives"] = 0, + ["Staves"] = 0, + ["Fist Weapons"] = 0, + ["Daggers"] = 0, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Hunter + [3] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 0, + ["Mail"] = 1, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 1, + ["Bows"] = 1, + ["Guns"] = 1, + ["One-Handed Maces"] = 0, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 1, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 1, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 1, + ["Daggers"] = 1, + ["Crossbows"] = 1, + ["Wands"] = 0, + }, + --Rogue + [4] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 1, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 0, + ["Fist Weapons"] = 1, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Priest + [5] = { + --Armor Skills + ["Cloth"] = 1, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 0, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 0, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 0, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 1, + }, + --Death Knight + [6] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 1, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 1, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 1, + ["Polearms"] = 1, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 1, + ["Warglaives"] = 0, + ["Staves"] = 0, + ["Fist Weapons"] = 0, + ["Daggers"] = 0, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Shaman + [7] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 0, + ["Mail"] = 1, + ["Plate"] = 0, + ["Shields"] = 1, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 0, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 1, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Mage + [8] = { + --Armor Skills + ["Cloth"] = 1, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 0, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 0, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 0, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 1, + }, + --Warlock + [9] = { + --Armor Skills + ["Cloth"] = 1, + ["Leather"] = 0, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 0, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 0, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 0, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 1, + }, + --Monk + [10] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 1, + ["Mail"] = 0, + ["Plate"] = 1, + ["Shields"] = 1, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 1, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 1, + ["Daggers"] = 0, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Druid + [11] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 1, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 0, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 1, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 1, + ["One-Handed Swords"] = 0, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 0, + ["Staves"] = 1, + ["Fist Weapons"] = 1, + ["Daggers"] = 1, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, + --Demon Hunter + [12] = { + --Armor Skills + ["Cloth"] = 0, + ["Leather"] = 1, + ["Mail"] = 0, + ["Plate"] = 0, + ["Shields"] = 0, + --Weapon Skills + ["One-Handed Axes"] = 1, + ["Two-Handed Axes"] = 0, + ["Bows"] = 0, + ["Guns"] = 0, + ["One-Handed Maces"] = 0, + ["Two-Handed Maces"] = 0, + ["Polearms"] = 0, + ["One-Handed Swords"] = 1, + ["Two-Handed Swords"] = 0, + ["Warglaives"] = 1, + ["Staves"] = 0, + ["Fist Weapons"] = 1, + ["Daggers"] = 0, + ["Crossbows"] = 0, + ["Wands"] = 0, + }, +} +aura_env.qualityColors = { + "\124cff9d9d9d", -- Poor + "\124cffffffff", -- Common + "\124cff1eff00", -- Uncommon + "\124cff0070dd", -- Rare + "\124cffa335ee", -- Epic + "\124cffff8000", -- Legendary + "\124cffe6cc80", -- Artifact + "\124cff00ccff", -- Heirloom +} diff --git a/FreshShit/ChatKeyScanner/event.lua b/FreshShit/ChatKeyScanner/event.lua index 7b2786f..9a7ebaf 100644 --- a/FreshShit/ChatKeyScanner/event.lua +++ b/FreshShit/ChatKeyScanner/event.lua @@ -16,7 +16,7 @@ function(allstates, e, ...) local keyname = aura_env.KeystoneIdMap[keyid] if keyname == nil then - DevTools_Dump({ keyid, level, message }) + DevTools_Dump({ "Failed getting key name from", keyid, level, message }) return end ---@cast keyname string diff --git a/FreshShit/ChatKeyScanner/init.lua b/FreshShit/ChatKeyScanner/init.lua index d883109..9702b01 100644 --- a/FreshShit/ChatKeyScanner/init.lua +++ b/FreshShit/ChatKeyScanner/init.lua @@ -56,6 +56,8 @@ aura_env.Colorer = { setmetatable(aura_env.Colorer, { __index = aura_env.Colorer }) aura_env.KeystoneIdMap = { + [165] = "Shadowmoon Burial Grounds", + [166] = "Grimrail Depot", [197] = "Eye of Azshara", [198] = "Darkheart Thicket", [199] = "Black Rook Hold", diff --git a/FreshShit/RIOChecker/event.lua b/FreshShit/RIOChecker/event.lua index 8f064c9..be89365 100644 --- a/FreshShit/RIOChecker/event.lua +++ b/FreshShit/RIOChecker/event.lua @@ -18,7 +18,7 @@ function(e, msg) if not name then return end if not aura_env.me then aura_env.me = UnitName("player") end local msg = ".ch " .. name - C_Timer.After(0.2, function() + C_Timer.After(0.5, function() SendChatMessage(msg, "WHISPER", nil, aura_env.me) end) return diff --git a/FreshShit/RIOChecker/event2.lua b/FreshShit/RIOChecker/event2.lua index 6fc9d22..fa0924c 100644 --- a/FreshShit/RIOChecker/event2.lua +++ b/FreshShit/RIOChecker/event2.lua @@ -6,7 +6,9 @@ function(e, source) if not UnitIsPlayer("target") then return end local name = UnitName("target") if not name then return end - if not aura_env.me then aura_env.me = UnitName("player") end + if not aura_env.me then aura_env.m = UnitName("player") end + if not aura_env.previousTarget then aura_env.previousTarget = name end + if aura_env.previousTarget == name then return end local msg = ".ch " .. name SendChatMessage(msg, "WHISPER", nil, aura_env.me) aura_env.messageSent = true diff --git a/FreshShit/RIOChecker/init.lua b/FreshShit/RIOChecker/init.lua index 24a2b2c..842d88d 100644 --- a/FreshShit/RIOChecker/init.lua +++ b/FreshShit/RIOChecker/init.lua @@ -3,6 +3,7 @@ aura_env.reading = false aura_env.fullMessage = {} aura_env.displayString = "" aura_env.messageSent = false +aura_env.previousTarget = "" ---@class ScoreColorer ---@field colors table @@ -147,7 +148,7 @@ Key = { formattedLevel.b * 255, self.level) end - return string.format("%-30s %-8s %-8s %-10s %-10s", self.name, self.role, level, self.time, + return string.format("%-30s %-10s %-10s %-10s %-10s", self.name, self.role, level, self.time, score) end, }) diff --git a/FreshShit/UwowLadderboardScraper/event.lua b/FreshShit/UwowLadderboardScraper/event.lua index 8624854..e70203d 100644 --- a/FreshShit/UwowLadderboardScraper/event.lua +++ b/FreshShit/UwowLadderboardScraper/event.lua @@ -3,7 +3,7 @@ function() if not InterfaceGUI then return end if not InterfaceGUI.Cashe_1 then return end for k, v in pairs(InterfaceGUI.Cashe_1) do - if v.UIMSG_BEST_RUNS then + if v.UIMSG_BEST_RUNS then local bestRuns = v.UIMSG_BEST_RUNS for i = 1, #bestRuns, 5 do local challengeId = bestRuns[i]