Move moving of the shit

This commit is contained in:
2024-03-07 12:40:11 +01:00
parent 52b888b0e9
commit 93b7c7ac65
17 changed files with 3117 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
-- CHAT_MSG_LOOT
function(allstates, e, msg)
if msg:match("You receive loot") then
DrawIcon(msg, allstates)
return true
end
end

View File

@@ -0,0 +1,48 @@
local iconDisplayDuration = 3
---@alias CItemInfo {name: string, icon: number, quantity: number, color: string}
---@param msg string
---@return CItemInfo, string | nil
GetItemInfo = function(msg)
local itemInfo = {name = "", icon = 134400, quantity = 0, color = ""}
local name = msg:match("h%[(.+)%]")
if not name then return itemInfo, "No item name found" end
local quantity = msg:match("x(%d+)") or 1
itemInfo.name = name
itemInfo.quantity = quantity
if WeakAurasSaved.Cyka.ItemCache[name] then
itemInfo.icon = WeakAurasSaved.Cyka.ItemCache[name].icon
end
local color = msg:match("cff(%w%w%w%w%w%w)") or "ffffff"
itemInfo.color = color
return itemInfo, nil
end
---@param msg string
---@param allstates allstates
DrawIcon = function(msg, allstates)
local info, err = GetItemInfo(msg)
if err then
print(err)
return
end
local formattedName = "\124cff" .. info.color .. "[" .. info.name .. "]\124r x" .. info.quantity
allstates[#aura_env.allstates + 1] = {
show = true,
changed = true,
index = GetTime(),
resort = true,
icon = info.icon,
name = formattedName,
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
end

View File

@@ -0,0 +1,6 @@
-- LOOT_READY
function(e)
C_Timer.After(0.1, function()
WeakAuras.ScanEvents("DO_AUTOLOOT")
end)
end

View File

@@ -0,0 +1,6 @@
-- DO_AUTOLOOT
function(e)
local lootInfo = GetLootInfo()
aura_env.FilterService.Run(lootInfo)
CloseLoot()
end

852
FreshShit/AutoLoot/Init.lua Normal file
View File

@@ -0,0 +1,852 @@
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<string, fun(slot: number): string|number|boolean> | nil
---@field filter fun(slot: number, provided: table<string, string|number|boolean>): boolean
Filter = {
---@param requires table<string, fun(slot: number): string|number|boolean> | nil
---@param filter fun(slot: number, provided: table<string, string|number|boolean>): 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<string, string|number|boolean>
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 = {
["Herb"] = true,
["Leather"] = true,
["Cloth"] = true,
["Ore"] = false,
["Cooking"] = true,
["Inscription"] = true,
["Enchanting"] = 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 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<Filter>
local filters = {
ancientManaFilter,
arguniteFilter,
artifactPowerFilter,
bloodhunerQuarryFilter,
bloodOfSargerasFilter,
boeFilter,
classGearFilter,
goldFilter,
greyValueFilter,
ilvlFilter,
mountFilter,
orderResourcesFilter,
professionFilter,
questItemFilter,
-- reicpeFilter,
valueFilter,
arguniteClusterFilter,
}
---@class FilterService
aura_env.FilterService = {
---@param lootInfo table<number>
Run = function(lootInfo)
---@type table<number>
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<number>
---@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
}

View File

@@ -0,0 +1,15 @@
-- MERCHANT_SHOW
function(allstates, e)
if (GetMerchantNumItems() > 0) then
aura_env.allstates = allstates
if CanMerchantRepair() == true then RepairAllItems() end
for container = 0, 4 do
for slot = 1, GetContainerNumSlots(container) do
aura_env.FilterService.Run(container, slot)
end
end
return true
end
end

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,264 @@
local debug = false
local iconDisplayDuration = 3
---@param container number
---@param slot number
---@return string, string|nil
local function getItemLink(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local link = select(7, GetContainerItemInfo(container, slot))
if link == nil then return "", string.format("GetContainerItemInfo returned nil for link (arg 7)") end
return link
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemQuantity(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local quantity = select(2, GetContainerItemInfo(container, slot))
if quantity == nil then
return "",
string.format("GetContainerItemInfo returned nil for quantity (arg 2)")
end
return quantity
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemName(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local name = select(1, GetItemInfo(getItemLink(container, slot)))
if name == nil then return "", string.format("GetItemInfo returned nil for name (arg 1)") end
return name
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemType(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local type = select(6, GetItemInfo(getItemLink(container, slot)))
if type == nil then return "", string.format("GetItemInfo returned nil for type (arg 6)") end
return type
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemSubtype(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local subtype = select(7, GetItemInfo(getItemLink(container, slot)))
if subtype == nil then return "", string.format("GetItemInfo returned nil for subtype (arg 7)") end
return subtype
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemLevel(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local level = select(4, GetItemInfo(getItemLink(container, slot)))
if level == nil then return "", string.format("GetItemInfo returned nil for level (arg 4)") end
return level
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemValue(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local value = select(11, GetItemInfo(getItemLink(container, slot)))
if value == nil then return "", string.format("GetItemInfo returned nil for value (arg 11)") end
return value
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemQuality(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local quality = select(3, GetItemInfo(getItemLink(container, slot)))
if quality == nil then return "", string.format("GetItemInfo returned nil for quality (arg 3)") end
return quality
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemEquipLocation(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local equipLoc = select(9, GetItemInfo(getItemLink(container, slot)))
if equipLoc == nil then return "", string.format("GetItemInfo returned nil for equipLoc (arg 9)") end
return equipLoc
end
---@param container number
---@param slot number
---@return string, string|nil
local function getItemIcon(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local icon = select(10, GetItemInfo(getItemLink(container, slot)))
if icon == nil then return "", string.format("GetItemInfo returned nil for icon (arg 10)") end
return icon
end
---@param container number
---@param slot number
---@return string, string|nil
local function getBindType(container, slot)
if container == nil then return "", string.format("Container is nil") end
if slot == nil then return "", string.format("Slot is nil") end
local bindType = select(14, GetItemInfo(getItemLink(container, slot)))
if bindType == nil then return "", string.format("GetItemInfo returned nil for bindType (arg 14)") end
return bindType
end
---@class Filter
---@field requires table<string, fun(container:number, slot: number): string|number|boolean> | nil
---@field filter fun(container: number, slot: number, provided: table<string, string|number|boolean>): boolean
Filter = {
---@param requires table<string, fun(container:number, slot: number): string|number|boolean> | nil
---@param filter fun(container: number, slot: number, provided: table<string, string|number|boolean>): 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 container number
---@param slot number
---@return boolean, string|nil
Run = function(self, container, slot)
---@type table<string, string|number|boolean>
local provided = {}
if self.requires then
for k, v in pairs(self.requires) do
local res, err = v(container, slot)
if err then
if debug then print(err) end
return false, err
end
provided[k] = res
end
end
local res, err = self.filter(container, slot, provided)
if err then
if debug then print(err) end
end
return res, nil
end
}
local grayFilter = Filter.new({
["quality"] = getItemQuality
},
function(container, slot, provided)
if provided.quality == 0 then
return true
end
return false
end)
local gearFilter = Filter.new({
["ilvl"] = getItemLevel,
["bindType"] = getBindType,
["type"] = getItemType,
["equipLoc"] = getItemEquipLocation
},
function(container, slot, provided)
local ilvlThreshold = 850
local sellBoe = false
if provided.type == "Armor"
or provided.type == "Weapon"
or provided.equipLoc == "INVTYPE_FINGER"
or provided.equipLoc == "INVTYPE_TRINKET"
or provided.equipLoc == "INVTYPE_CLOAK"
or provided.equipLoc == "INVTYPE_NECK" then
if provided.ilvl < ilvlThreshold and (provided.bindType == 1 or sellBoe) then
return true
end
end
return false
end)
---@param container number
---@param slot number
---@return nil, string|nil
local function doSell(container, slot)
local itemIcon, err = getItemIcon(container, slot)
if err then return nil, string.format("Error getting item icon: %s", err) end
local itemName, err = getItemName(container, slot)
if err then return nil, string.format("Error getting item name: %s", err) end
local itemQuantity, err = getItemQuantity(container, slot)
if err then return nil, string.format("Error getting item quantity: %s", err) end
local itemQuality, err = getItemQuality(container, slot)
if err then return nil, string.format("Error getting item quality: %s", err) end
local nameWithColor = string.format("%s[%s]\124r", aura_env.qualityColors[itemQuality + 1], itemName)
local nameWithQuantity = string.format("%s x%s", nameWithColor, itemQuantity)
aura_env.allstates[#aura_env.allstates + 1] = {
show = true,
changed = true,
index = GetTime(),
resort = true,
icon = itemIcon,
name = nameWithQuantity,
amount = itemQuantity,
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
UseContainerItem(container, slot)
return nil, nil
end
---@type table<Filter>
local filters = {
grayFilter,
gearFilter
}
---@class FilterService
aura_env.FilterService = {
---@param container number
---@param slot number
---@return nil, nil
Run = function(container, slot)
local itemLink, err = getItemLink(container, slot)
if err then return nil, string.format("Err: slot empty (%d-%d) - %s", container, slot, err) end
for k, filter in pairs(filters) do
local res, err = filter:Run(container, slot)
if err then
if debug then print(err) end
else
if res then
doSell(container, slot)
return
end
end
end
end,
}
aura_env.qualityColors = {
"\124cff9d9d9d", -- Poor
"\124cffffffff", -- Common
"\124cff1eff00", -- Uncommon
"\124cff0070dd", -- Rare
"\124cffa335ee", -- Epic
"\124cffff8000", -- Legendary
"\124cffe6cc80", -- Artifact
"\124cff00ccff", -- Heirloom
}

View File

@@ -0,0 +1,14 @@
-- PLAYER_ENTERING_WORLD GUILD_ROSTER_UPDATE
function(e)
for interval, ticker in pairs(Tickers) do
if ticker == 0 then
if Debug then print("Creating ticker") end
local tickerEvent = string.format("TICKER_%d", interval)
Tickers[interval] = C_Timer.NewTicker(interval / 1000, function()
WeakAuras.ScanEvents(tickerEvent)
end)
else
if Debug then print("Ticker already exists") end
end
end
end

View File

@@ -0,0 +1,7 @@
Debug = false
Tickers = {
[100] = 0,
[200] = 0,
[500] = 0,
[1000] = 0,
}

View File

@@ -0,0 +1 @@
C:/Users/Administrator/Seafile/Backup-WoW/Ruski/WTF/Account/phatphuckdave/SavedVariables/WeakAuras.lua

View File

@@ -0,0 +1 @@
C:/Users/Administrator/Seafile/Backup-WoW/Ruski/WTF/Account/Iridian/SavedVariables/WeakAuras.lua

View File

@@ -0,0 +1,12 @@
--- COMBAT_LOG_EVENT_UNFILTERED
---@param e string
---@param ... any
function(e, ...)
local spellName, err = CLEUParser.GetSpellName(...)
if err then return end
local spellId, err = CLEUParser.GetSpellId(...)
if err then return end
local subevent, err = CLEUParser.GetSubevent(...)
if err then return end
aura_env.LogSpell(spellName, spellId, subevent, ...)
end

View File

@@ -0,0 +1 @@
IFS=$'\n'; for spell in $(cat spells.txt | grep -P "^\w+"); do filename=$(echo $spell | sed 's/ /_/g'); grep $spell WeakAurasIridian.lua > out/$filename.txt; done

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
local function varargToString(...)
local output = {}
for i = 1, select("#", ...) do
table.insert(output, tostring(select(i, ...)))
end
print(table.concat(output, ", "))
end
test("Hello", "world", "again", 2323, true)

View File

@@ -0,0 +1,548 @@
#####################################################################################
### DEBUG ###
#####################################################################################
##774!3
Rejuvenation
##33763!3
Lifebloom
##5185!3
Healing Touch
#####################################################################################
### Antorus ###
#####################################################################################
##########################################
## Garothi ##
##########################################
#244410!3
Decimation
#246220!3
Fel Bombardment
#244969!3
Eradication
#244106!3
Carnage
##########################################
## Felhounds ##
##########################################
#244086!3
Molten Touch
#244768!3
Desolate Gaze
#244057!3
Enflame Corruption
#244131!3
Consuming Sphere
#244056!3
Siphon Corruption
##########################################
## High Command ##
##########################################
#245161!3
Entropic Mine
#245546!3
Summon Reinforcements
##########################################
## Portal Keeper ##
##########################################
#244016!3
Reality Tear
#243983!3
Collapsing World
#244000!3
Felstorm Barrage
##########################################
## Imonar ##
##########################################
#247552!3
Sleep Canister
#247367!3
Shock Lance
#248068!3
Empowered Pulse Grenade
#247376!3
Pulse Grenade
#247716!3
Charged Blasts
#247687!3
Sever
#248070!3
Empowered Shrapnel Blast
#250255!3
Empowered Shock Lance
##########################################
## Kin'garoth ##
##########################################
#254919!3
Forging Strike
#254926!3
Reverberating Strike
#246840!3
Ruiner
#246779!3
Diabolic Bomb
#246706!3
Demolish
#246664!3
Annihilation
##########################################
## Varimathras ##
##########################################
#243960!3
Shadow Strike
#243961!3
Misery
#244042!3
Marked Prey
#244093!3
Necrotic Embrace
#248732!3
Echoes of Doom
#243999!3
Dark Fissure
##########################################
## Coven ##
##########################################
#253189!3
Shivan Pact
#244899!1
Fiery Strike
#245627!1
Whirling Saber
#245281!3
Shadow Blades
#245586!2
Chilled Blood
##########################################
## Aggramar ##
##########################################
#254452!3
Ravenous Blaze
#244693!3
Wake of Flame
#244291!1
Foe Braker
#244033!1
Flame Rend
#247079!1
Empowered Flame Rend
#245983!3
Flare
#246037!3
Empowered Flare
##########################################
## Argus ##
##########################################
#256457!3
Cone of Death
#248396!3
Soulblight
#257296!3
Tortured Rage
#251570!3
Soulbomb
######################################################################################
### DUNGEONS ###
######################################################################################
##########################################
## Black Rook Hold ##
##########################################
#225573!3
Dark Mending
#200105!3
Sacrifice Soul
#225732!3
Strike Down
#194996!3
Soul Echoes
#195254!3
Swirling Scythe
#194956!3
Reap Soul
#200248!3
Arcane Blitz
#200345!3
Arrow Barrage
#200291!3
Knife Dance
#200261!3
Bonebreaking Strike
#197418!3
Vengeful Shear
#201139!3
Brutal Assault
#198245!3
Brutal Haymaker
#198079!3
Hateful Gaze
##########################################
## Cathedral of Eternal Night ##
##########################################
#241937!3
Shadow Wall
#238543!3
Demonic Mending
#242792!3
Vile Roots
#236627!3
Floral Fulmination
#239217!3
Blinding Glare
#237726!3
Scornful Gaze
#190620!3
Felblaze Orb
#239268!3
Venom Storm
#234107!3
Chaotic Energy
#236543!3
Felsoul Cleave
#238315!3
Shadow Sweep
#243168!3
Demonic Upheaval
##########################################
## Court of Stars ##
##########################################
#210261!3
Sound Alarm
#215204!3
Hinder
#209027!3
Quelling Strike
#209516!3
Mana Fang
#209485!3
Drain Magic
#209404!3
Seal Magic
#209495!3
Charged Smash
#225100!3
Charging Station
#219488!3
Streetsweeper
#212784!3
Eye Storm
#211464!3
Fel Detonation
#207980!3
Disintegration Beam
#207979!3
Shockwave
#209628!3
Piercing Gale
#209676!3
Slicing Maelstrom
##########################################
## Darkheart Thicket ##
##########################################
#200631!3
Unnerving Screech
#200580!3
Maddening Roar
#191326!3
Breath of Corruption
#201400!3
Dread Inferno
#200238!3
Feed on the Weak
##########################################
## Eye of Azshara ##
##########################################
#195172!3
Mighty Slam
#195129!3
Thundering Stomp
#195046!3
Rejuvenating Waters
#162135!3
Bellowing Roar
#197105!3
Polymorh Fish
#193597!3
Static Nova
#193611!3
Focused Lightning
#196129!3
Spray Sand
#196144!3
Sandstorm
#196296!3
Roiling Storm
#196290!3
Chaotic Tempest
#191848!3
Rampage
##########################################
## Halls of Valor ##
##########################################
#198605!3
Thunderstrike
#198888!3
Lightning Breath
#191284!3
Horn of Valor
#198934!3
Rune of Healing
#215433!3
Holy Radiance
#199210!3
Penetrating Shot
#191976!3
Arcing Bolt
#192305!3
Eye of the Storm
#192307!3
Sanctify
#192048!3
Expel Light
#192018!3
Shield of Light
#196512!3
Claw Frenzy
#199652!3
Sever
#199726!3
Unruly Yell
#199674!3
Wicked Dagger
#193826!3
Ragnarok
#198263!3
Radiant Tempest
#198072!3
Spear of Light
#197961!3
Runic Band
#198750!3
Surge
##########################################
## Maw of Souls ##
##########################################
#193364!3
Screams of the Dead
#194442!3
Six Pound Barrel
#194615!3
Sea Legs
#192019!3
Lantern of Darkness
#194099!3
Bile Breath
#198405!3
Bone Chilling Scream
#194325!3
Fragment
#194216!3
Cosmic Scythe
#195293!3
Debilitating Shout
#185539!3
Rapid Rupture
#198495!3
Torrent
#202098!3
Brackwater Barrage
##########################################
## Neltharion's Lair ##
##########################################
#202181!3
Stone Gaze
#226296!3
Piercing Shards
#188169!3
Razor Shards
#198496!3
Sunder
#199176!3
Spiked Tongue
#193585!3
Bound
#200700!3
Landslide
#200732!3
Molten Crash
##########################################
## The Arcway ##
##########################################
#211771!3
Prophecies of Doom
#211037!3
Celerity Zone
#195791!3
Quarantine
#226285!3
Demonic Ascension
#197810!3
Wicked Slam
#211217!3
Arcane Slicer
#211115!3
Phase Breach
#196392!3
Overcharge Mana
#200040!3
Nether Venom
#200227!3
Tangled Web
#220871!3
Unstable Mana
##########################################
## Vault of the Wardens ##
##########################################
#193069!3
Nightmares
#197799!3
Unleash Fury
#191735!3
Deafening Screech
#190836!3
Hatred
#202913!3
Fel Mortar
#200898!3
Teleport
#199917!3
Shadow Crash
#202658!3
Drain
#194945!3
Lingering Gaze
#196249!3
Meteor
#192631!3
Lava Wreath
#197513!3
Detonating Moonglaive
#189469!3
Turn Kick
##########################################
## Seat of the Triumvirate ##
##########################################
##########################################
## Upper Karazhan ##
##########################################
#230083!3
Nullification
#227267!3
Summon Volatile Energy
#227254!3
Evocation
#229662!3
Fel Breath
#36247!3
Fel Fireball
#227628!3
Piercing Missiles
#227615!3
Inferno Bolt
#227592!3
Frostbite
#228269!3
Flame Wreath
#227779!3
Ceaseless Winter
#229706!3
Leech Life
#229714!3
Consume Magic
#229159!3
Chaotic Shadows
#229083!3
Burning Blast
#229151!3
Disintegrate
##########################################
## Lower Karazhan ##
##########################################
#228221!3
Severe Dusting
#228225!3
Sultry Heat
#232153!3
Kara Kazham
#227987!3
Dinner Bell
#228025!3
Heat Wave
#227568!3
Burning Leg Sweep
#227776!3
Magic Magnificent
#227966!3
Flashlight
#228279!3
Shadow Rejuvenation
#228278!3
Demoralizing Shout
#228277!3
Shackles of Servitude
#226316!3
Shadow Bolt Volley
#227508!3
Mass Repentance
#227793!3
Sacred Ground
#227463!3
Whirling Edge
#227646!3
Iron Whirlwind
#227672!3
Will Breaker
#227404!3
Intangible Presence
#227493!3
Mortal Strike
#228852!3
Shared Suffering
#228837!3
#Bellowing Roar