Compare commits

...

10 Commits

Author SHA1 Message Date
ccd87ef48f Add autoloot display weakaura 2024-12-27 08:48:38 +01:00
3db30236ea Fix up some oopsies with autoloot 2024-12-27 08:47:40 +01:00
5282dca2d4 Fix autoloot 2024-12-27 00:46:37 +01:00
82ee637a73 Fix settings 2024-12-17 14:22:02 +01:00
fa3e4ba02a Migrate camera and spellq settings 2024-12-16 16:19:44 +01:00
bbc764d782 Add CLEUParser 2024-12-16 16:19:36 +01:00
606549eed0 Add settings weakaura 2024-12-16 16:13:39 +01:00
9cc4fdb07f Add all settings 2024-12-16 15:44:51 +01:00
220138cc70 Migrate from weakaura 2024-12-16 15:29:34 +01:00
a06bdf3bf6 Implement some sort of basic filtering/looting 2024-12-16 13:52:52 +01:00
11 changed files with 2132 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
local addonname, shared = ...
---@cast shared CykaShared
---@cast addonname string
local skills = {}
---@class Autoloot
---@field Init fun()
@@ -30,6 +31,17 @@ local NumberValue = {
---@param other number
Le = function(self, other) return self.value <= other end,
}
local function NewNumberValue(value)
local ret = { value = value }
setmetatable(ret, NumberValue)
ret.Gt = NumberValue.Gt
ret.Lt = NumberValue.Lt
ret.Eq = NumberValue.Eq
ret.Ne = NumberValue.Ne
ret.Ge = NumberValue.Ge
ret.Le = NumberValue.Le
return ret
end
---@class StringValue : Value
---@field value string
@@ -51,9 +63,23 @@ local StringValue = {
---@param other string
Contains = function(self, other) return string.find(self.value, other) end,
}
local function NewStringValue(value)
local ret = { value = value }
-- Idk why setmetatable is not working... I thought it would...
setmetatable(ret, StringValue)
ret.Gt = StringValue.Gt
ret.Lt = StringValue.Lt
ret.Eq = StringValue.Eq
ret.Ne = StringValue.Ne
ret.Ge = StringValue.Ge
ret.Le = StringValue.Le
ret.Matches = StringValue.Matches
ret.Contains = StringValue.Contains
return ret
end
---@class Filter
---@field Matches fun(slot: number): boolean
---@field Matches fun(self: Filter, slot: number): boolean
shared.Autoloot = { Init = function() end }
function shared.Autoloot.Init()
@@ -71,7 +97,7 @@ function shared.Autoloot.Init()
---@param slot number
---@return StringValue, string?
local function Link(slot)
local ret = StringValue("")
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local link = GetLootSlotLink(slot)
if link == nil then return ret, "link is nil" end
@@ -82,7 +108,7 @@ function shared.Autoloot.Init()
---@param slot number
---@return StringValue, string?
local function Name(slot)
local ret = StringValue("")
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local name = select(2, GetLootSlotInfo(slot))
if name == nil then return ret, "name is nil" end
@@ -93,7 +119,7 @@ function shared.Autoloot.Init()
---@param slot number
---@return StringValue, string?
local function Type(slot)
local ret = StringValue("")
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local type = select(6, GetItemInfo(Link(slot).value))
if type == nil then return ret, "type is nil" end
@@ -101,6 +127,105 @@ function shared.Autoloot.Init()
return ret, nil
end
---@param slot number
---@return StringValue, string?
local function SubType(slot)
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local subType = select(7, GetItemInfo(Link(slot).value))
if subType == nil then return ret, "subType is nil" end
ret.value = subType
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function ItemLevel(slot)
local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end
local itemLevel = select(4, GetItemInfo(Link(slot).value))
if itemLevel == nil then return ret, "itemLevel is nil" end
ret.value = itemLevel
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function Value(slot)
local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end
local itemValue = select(11, GetItemInfo(Link(slot).value))
if itemValue == nil then return ret, "itemValue is nil" end
ret.value = itemValue
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function SubclassId(slot)
local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end
local subclassId = select(13, GetItemInfo(Link(slot).value))
if subclassId == nil then return ret, "subclassId is nil" end
ret.value = subclassId
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function Quantity(slot)
local ret = NewNumberValue(1)
if slot == nil then return ret, "slot is nil" end
local quantity = select(3, GetLootSlotInfo(slot))
if quantity == nil then return ret, "quantity is nil" end
ret.value = quantity
return ret, nil
end
---@param slot number
---@return StringValue, string?
local function EquipLocation(slot)
local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end
local equipLocation = select(9, GetItemInfo(Link(slot).value))
if equipLocation == nil then return ret, "equipLocation is nil" end
ret.value = equipLocation
return ret, nil
end
---@param slot number
---@return StringValue, string?
local function Icon(slot)
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local icon = select(10, GetItemInfo(Link(slot).value))
if icon == nil then return ret, "icon is nil" end
ret.value = icon
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function BindType(slot)
local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end
local bindType = select(14, GetItemInfo(Link(slot).value))
if bindType == nil then return ret, "bindType is nil" end
ret.value = bindType
return ret, nil
end
---@param slot number
---@return NumberValue, string?
local function Quality(slot)
local ret = NewNumberValue(-1)
if slot == nil then return ret, "slot is nil" end
local quality = select(4, GetLootSlotInfo(slot))
if quality == nil then return ret, "quality is nil" end
ret.value = quality
return ret, nil
end
-- _____ ___ _ _____ _____ ____ ____
-- | ___|_ _| | |_ _| ____| _ \/ ___|
-- | |_ | || | | | | _| | |_) \___ \
@@ -109,12 +234,150 @@ function shared.Autoloot.Init()
---@class GoldFilter : Filter
local GoldFilter = {
Matches = function(slot)
Matches = function(self, slot)
if not shared.config.autoloot.filter.gold.enabled then return false end
local name = Name(slot)
return name:Contains("Gold") or name:Contains("Silver") or name:Contains("Copper")
end
}
---@class OrderResourceFilter : Filter
local OrderResourceFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.orderResource.enabled then return false end
return Name(slot):Contains("Order Resources")
end
}
---@class MountFilter : Filter
local MountFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.mount.enabled then return false end
return Type(slot):Eq("Mount")
end
}
---@class IlvlFilter : Filter
local IlvlFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.ilvl.enabled then return false end
return ItemLevel(slot):Ge(shared.config.autoloot.filter.ilvl.value)
end
}
---@class ProfessionFilter : Filter
local ProfessionFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.profession.enabled then return false end
local type = Type(slot)
if not type:Eq("Tradeskill") then return false end
local subtype = SubType(slot)
local professions = { strsplit(",", shared.config.autoloot.filter.profession.professions) }
return shared.TableContains(professions, subtype) or false
end
}
---@class ValueFilter : Filter
local ValueFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.value.enabled then return false end
local value = Value(slot)
if shared.config.autoloot.filter.value.byStack then
value = value * Quantity(slot).value
end
return value:Ge(shared.config.autoloot.filter.value.value)
end
}
---@class GreyValueFilter : Filter
local GreyValueFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.greyvalue.enabled then return false end
local quality = Quality(slot)
if not quality:Eq(0) then return false end
local value = Value(slot)
if shared.config.autoloot.filter.greyvalue.byStack then
value = value * Quantity(slot).value
end
return value:Ge(shared.config.autoloot.filter.greyvalue.value)
end
}
---@class QuestItemFilter : Filter
local QuestItemFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.questItem.enabled then return false end
return Type(slot):Eq("Quest") and SubType(slot):Eq("Quest")
end
}
---@class ClassGearFilter : Filter
local ClassGearFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.classGear.enabled then return false end
local ilvlThreshold = shared.config.autoloot.filter.classGear.ilvlThreshold
local qualityThreshold = shared.config.autoloot.filter.classGear.qualityThreshold
local isEquippable = skills[select(3, UnitClass("player"))][SubType(slot).value] or false
if not isEquippable then return false end
return ItemLevel(slot):Ge(ilvlThreshold) and Quality(slot):Ge(qualityThreshold)
end
}
---@class NameFilter : Filter
local NameFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.name.enabled then return false end
local whitelist = { strsplit(",", shared.config.autoloot.filter.name.whitelist) }
for _, name in ipairs(whitelist) do
if not shared.config.autoloot.filter.name.caseSensitive then name = name:lower() end
if shared.config.autoloot.filter.name.exact then
return Name(slot):Eq(name)
else
return Name(slot):Contains(name)
end
end
return false
end
}
---@class BoeFilter : Filter
local BoeFilter = {
types = { "Armor", "Weapon" },
equipLocs = { "INVTYPE_FINGER", "INVTYPE_TRINKET", "INVTYPE_CLOAK", "INVTYPE_NECK" },
Matches = function(self, slot)
if not shared.config.autoloot.filter.boe.enabled then return false end
local ilvlThreshold = shared.config.autoloot.filter.boe.ilvlThreshold
local qualityThreshold = shared.config.autoloot.filter.boe.qualityThreshold
local type = Type(slot)
local equipLoc = EquipLocation(slot)
if not shared.TableContains(self.types, type) or not shared.TableContains(self.equipLocs, equipLoc) then return false end
return BindType(slot):Eq(1) and ItemLevel(slot):Ge(ilvlThreshold) and Quality(slot):Ge(qualityThreshold)
end
}
---@class APFilter : Filter
local APFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.ap.enabled then return false end
return Value(slot):Eq(0) and Type(slot):Eq("Consumable") and SubType(slot):Eq("Other") and
SubclassId(slot):Eq(8)
end
}
---@class EverythingFilter : Filter
local EverythingFilter = {
Matches = function(self, slot)
if not shared.config.autoloot.filter.everything.enabled then return false end
return true
end
}
---@type Filter[]
local Filters = {
APFilter,
BoeFilter,
ClassGearFilter,
EverythingFilter,
GoldFilter,
GreyValueFilter,
IlvlFilter,
MountFilter,
NameFilter,
OrderResourceFilter,
ProfessionFilter,
QuestItemFilter,
ValueFilter,
}
-- _ ___ ___ _____ _ ___ ____ ___ ____
-- | | / _ \ / _ \_ _| | | / _ \ / ___|_ _/ ___|
@@ -127,9 +390,26 @@ function shared.Autoloot.Init()
lootReadyFrame:SetScript("OnEvent", function()
local lootInfo = GetLootInfo()
shared.DumpTable(lootInfo, 0)
for _, loot in ipairs(lootInfo) do
if loot.locked then
Name(loot.item)
for slot = #lootInfo, 1, -1 do
for _, filter in ipairs(Filters) do
if filter:Matches(slot) then
print(string.format("Autolooting slot %s", tostring(slot)))
local name = Name(slot).value
local quantity = Quantity(slot).value
local quality = Quality(slot).value
local icon = Icon(slot).value
local addonPayload = string.format("%s|%s|%s|%s",
name,
quantity,
quality,
icon)
SendAddonMessage("CYKA_AUTOLOOT", addonPayload, "WHISPER", UnitName("player"))
LootSlot(slot)
end
end
end
--aura_env.FilterService.Run(lootInfo)
@@ -138,3 +418,316 @@ function shared.Autoloot.Init()
print("Cyka - Autoloot loaded")
end
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
--}

1291
CLEUParser.lua Normal file

File diff suppressed because it is too large Load Diff

36
CameraSettings.lua Normal file
View File

@@ -0,0 +1,36 @@
local addonname, shared = ...
---@cast shared CykaShared
---@cast addonname string
---@class CameraSettings
---@field Init fun()
shared.CameraSettings = { Init = function() end }
function shared.CameraSettings.Init()
if not shared.config.camera.enabled then
print("Cyka - Camera settings disabled")
return
end
local function SetCameraSpeed(speed)
if not speed then return end
print("Camera speed set to " .. tostring(speed))
SetCVar("cameraYawMoveSpeed", speed)
SetCVar("cameraPitchMoveSpeed", speed)
end
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, event, ...)
SetCameraSpeed(shared.config.camera.speed)
end)
SlashCmdList["CAMERASETTINGS"] = function(speed)
if speed then shared.config.camera.speed = speed end
SetCameraSpeed(shared.config.camera.speed)
end
SLASH_CAMERASETTINGS1 = "/cs"
print("Cyka - Camera settings loaded")
end

View File

@@ -11,12 +11,18 @@ local addonname, shared = ...
---@field data CykaData
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
---@field DumpTable fun(table: table<any, any>, depth: number)
---@field TableContains fun(table: table<any, any>, value: any): boolean
---@field Autoloot Autoloot
---@field CameraSettings CameraSettings
---@field SpellQSettings SpellQSettings
---@class CykaData
---@class CykaConfig
---@field autoloot CykaAutolootConfig
---@field camera { enabled: boolean, speed: number }
---@field spellQueue { enabled: boolean, queue: number }
---@class CykaAutolootConfig
---@field enabled boolean
@@ -24,6 +30,18 @@ local addonname, shared = ...
---@class CykaAutoLootFilterConfig
---@field gold { enabled: boolean }
---@field orderResource { enabled: boolean }
---@field mount { enabled: boolean }
---@field ilvl { enabled: boolean, value: number }
---@field profession { enabled: boolean, professions: string }
---@field value { enabled: boolean, byStack: boolean, value: number }
---@field greyvalue { enabled: boolean, byStack: boolean, value: number }
---@field questItem { enabled: boolean }
---@field classGear { enabled: boolean, ilvlThreshold: number, qualityThreshold: number }
---@field name { enabled: boolean, exact: boolean, caseSensitive: boolean, whitelist: string }
---@field boe { enabled: boolean, ilvlThreshold: number, qualityThreshold: number }
---@field ap { enabled: boolean }
---@field everything { enabled: boolean }
local function init()
if not CykaPersistentData then CykaPersistentData = {} end
@@ -74,17 +92,87 @@ local function init()
end
end
---@param table table<any, any>
---@param value any
shared.TableContains = function(table, value)
for _, v in pairs(table) do
if v == value then return true end
end
return false
end
shared.config = {
camera = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "camera", "enabled" }, true),
speed = shared.GetOrDefault(CykaPersistentData.config, { "camera", "speed" }, 30),
},
spellQueue = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "enabled" }, true),
queue = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "queue" }, 1),
},
autoloot = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "enabled" }, true),
filter = {
gold = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "gold", "enabled" }, true),
}
},
orderResource = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "orderResource", "enabled" }, true),
},
mount = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "mount", "enabled" }, true),
},
ilvl = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "enabled" }, true),
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "value" }, 910),
},
profession = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "profession", "enabled" }, true),
professions = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "profession", "professions" }, ""),
},
value = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "enabled" }, true),
byStack = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "byStack" }, false),
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "value" }, 10000),
},
greyvalue = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "enabled" }, true),
byStack = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "byStack" }, false),
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "value" }, 100000),
},
questItem = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "questItem", "enabled" }, true),
},
classGear = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "enabled" }, true),
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "ilvlThreshold" }, 910),
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "qualityThreshold" }, 3),
},
boe = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "enabled" }, true),
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "ilvlThreshold" }, 910),
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "qualityThreshold" }, 3),
},
ap = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ap", "enabled" }, true),
},
name = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "enabled" }, false),
exact = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "exact" }, false),
caseSensitive = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "caseSensitive" }, false),
whitelist = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "whitelist" }, ""),
},
everything = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "everything", "enabled" }, true),
},
}
}
}
shared.Autoloot.Init()
shared.CameraSettings.Init()
shared.SpellQSettings.Init()
print("Cyka loaded!")
end
@@ -95,3 +183,9 @@ loadedFrame:SetScript("OnEvent", function(self, event, addonName)
init()
end
end)
local logoutFrame = CreateFrame("Frame")
logoutFrame:RegisterEvent("PLAYER_LOGOUT")
logoutFrame:SetScript("OnEvent", function(self, event, ...)
CykaPersistentData.config = shared.config
end)

View File

@@ -6,4 +6,7 @@
#core
Autoloot.lua
Cyka.lua
CameraSettings.lua
SpellQSettings.lua
CLEUParser.lua
Cyka.lua

35
SpellQSettings.lua Normal file
View File

@@ -0,0 +1,35 @@
local addonname, shared = ...
---@cast shared CykaShared
---@cast addonname string
---@class SpellQSettings
---@field Init fun()
shared.SpellQSettings = { Init = function() end }
function shared.SpellQSettings.Init()
if not shared.config.spellQueue.enabled then
print("Cyka - Spell queue disabled")
return
end
local function SetSpellQueue(window)
if not window then return end
print("Spell queue window set to " .. tostring(window))
SetCVar("SpellQueueWindow", window)
end
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, event, ...)
SetSpellQueue(shared.config.spellQueue.queue)
end)
SlashCmdList["SPELLQSETTINGS"] = function(window)
if window then shared.config.spellQueue.queue = window end
SetSpellQueue(shared.config.spellQueue.queue)
end
SLASH_SPELLQSETTINGS1 = "/sq"
print("Cyka - Spell queue settings loaded")
end

View File

@@ -0,0 +1 @@
!TMvx3Pnoq0Fn7Jnh(OnP9H9Hekjn9qiKyNM3Cq2wg0wJf1sMg6d8BFNrYFjW2iF2nhoeBXO7C1Orw3r2BONRNZgpNq8dCjptgZsOEop(I7S7Np1ZjINiDy)H6nF4iphjpyhnvW4jEZVAW4bd8Cc4X8uOVZhQ(ms99y13Fe)wcqZeBJj7DPVd38xB9C2)yuKGk9Md9pLUcGZD)wWRsLfKm5AE6JBLq7cnYa1KAl4Rwfd))N09Eo0eIFmf4EMG(vQiWZh8fnIKflXltiBalNwy0VzHY1ibL4xLiUMscPPf(wH1CSJ(M9y8PCOMxv0zfpoSWR3PUUgzYXcJhqCXTYFMSOfV)PwIa8uOxptf8S0aA3XHhrtpSSWyHjLUS3u6QZhq2WZsKf()b9nTes(CVNq(slHew8U4UJe3RSOU3hoOcSKSn(5d7ce2qEhTzaMUlK0TyVQ6VZgwIktUc9dl)WHL)GeNvNu53xqN5Fb8k67H9o0pC05J9Bt5ruHALAoXwuRLwMfgwllNLSntAGBjfobq14T6wi3AdGot9OKAZaW4lMMSs5UbNWtJ(dUDM2uFfX(yVZpg22AMD65HUYqYNQmcnxAzkI(plsuuorf5CxNsfRvpXOIHhNUOtwUQRb1n7DKKGFAqSJ9vPnTLc85(No(flE2ykDF(ik)bKqdLRrAHlJgyDmVZ4DTy4PEVXzGs6QjiYLg2eQzSAAwO2a0e)sJng39F7PrJBjX4xzuH8EjDt3z8pHMDyP2qdU0)vEJ(05ZhcIjcXDusAbbMGnCyPUP2YhSEnyNPdMeO2u)jmrnFQFGEnZmxso6QZtQr9HqpLrIzY9n7Ww4yEFQttKA9FT8O22wv73UsHuWzmFnEW5teW(o9DsGSomQXuERTKlmEyheDcrqb1HcMKTZcwRCh2NdlR1ldVnQpBmwI5RRzsAmtin2dSKM1(567lAS35rBeoEC)vU(XZpl4ZlFC2n8PTh0)0)ppqU0tnVaRGs4p066UXx(FEDNjnAynKXkVcwDY6tKmx17vAJ)CljWKTDNXE9cJjfWJVxRCQGmHKVbl16LTHejypDhnrxvfFdrYcEv1xNRH7HwdkQYccuKujCHetXz4voH83045DtbYWZE2)tYcSiqiYMi)krsUiGNeXwDrE9yhw(3hwsYsjVrt2D8V9927EelwstValJQtOqdSahJAJ6eqdlTazvDnDIOYclqcRlOtGqdSfNDAjiTGIwGY5HQsqENeRYS(Hz1LIZGBT6bSWfQbFNmENLbans(AHzTJuUYnRbS9zNk5(2S6auoE(XAP(YEHyxJ5JvS2lGBFSBk02cql1Z254V0klqSu4vNiwAvVqKvFhSUXTYS(4GFD0MrD7JJ36YcxH750zGbnWACqjDTIIsWNTqfuxIxRqAie0wO)DHSSwHTu4Mfqckg6m(b)ULOC(KPJ1mzjWwLe1GYhlGNSTZbpz7HVJcoIafhI1kXhWDYu2QvaQvN9RUbLKeQFwuK(4I)20zlU9LzfQOqWbn4IT0447dfAPmImFLaihOxS39CEBY1oUV54E9ZayzOohh8SPrHAfMUiLQm1zX0zZk1p9nkjg1nHZ)IcMc7YxsnvdOEQDuxDJpWdPEZ)G6C(CijbR5Pl4meSjtN7o9zuOfeKsiX)O4q1HsCD(hqOflcucoB6Taj)nip51uuv4RLxXc1c4MX5YjQqjWfSXjxDxY(lFAE6cONrPaxHGhmTO09QPWTyR6aOZKNNoDog(FNg(AU4u9H6RW0TzbVOot1XS6xCgV(1pHh)geVRKMEAj3yZhDwlytMhRTF(rR7xC2D(1p)a)6NXHF1lfWV(PUA4(ghpv1H63WXZui(2VP6l9pPAoJJWdrhRVY)OtPZ34qA9B9Oqvve4RtHyOcEW6AY1lkbIJV2MqyjaAWB6gfuyIewjiX6Hyj2BD56r7SxVo7z1BYPyDhnokpz)MhDDF8bvsvitwzsmNOEPtWc2a17HcR7TyHKA26Kwf4BI6OgL6xsLNZTPS)OkJleZ4H640eXZz0fdV8IXq4hpi5ryrtE)7d

View File

@@ -0,0 +1,26 @@
CykaPersistentData.config.enabled = aura_env.config.enabled
CykaPersistentData.config.filter.gold.enabled = aura_env.config.gold
CykaPersistentData.config.filter.orderResource.enabled = aura_env.config.orderResource
CykaPersistentData.config.filter.mount.enabled = aura_env.config.mount
CykaPersistentData.config.filter.ilvl.enabled = aura_env.config.ilvl
CykaPersistentData.config.filter.ilvl.value = aura_env.config.ilvlValue
CykaPersistentData.config.filter.profession.enabled = aura_env.config.profession
CykaPersistentData.config.filter.profession.professions = aura_env.config.professionProfessions
CykaPersistentData.config.filter.value.enabled = aura_env.config.value
CykaPersistentData.config.filter.value.byStack = aura_env.config.valueByStack
CykaPersistentData.config.filter.value.value = aura_env.config.valueValue
CykaPersistentData.config.filter.greyvalue.enabled = aura_env.config.greyValue
CykaPersistentData.config.filter.greyvalue.byStack = aura_env.config.greyValueByStack
CykaPersistentData.config.filter.greyvalue.value = aura_env.config.greyValueValue
CykaPersistentData.config.filter.questItem.enabled = aura_env.config.questItem
CykaPersistentData.config.filter.classGear.enabled = aura_env.config.classGear
CykaPersistentData.config.filter.classGear.ilvlThreshold = aura_env.config.classGearThreshold
CykaPersistentData.config.filter.classGear.qualityThreshold = aura_env.config.classGearQualityThreshold
CykaPersistentData.config.filter.name.enabled = aura_env.config.name
CykaPersistentData.config.filter.name.exact = aura_env.config.nameExact
CykaPersistentData.config.filter.name.caseSensitive = aura_env.config.nameCaseSensitive
CykaPersistentData.config.filter.name.whitelist = aura_env.config.nameWhitelist
CykaPersistentData.config.filter.boe.enabled = aura_env.config.boe
CykaPersistentData.config.filter.boe.ilvlThreshold = aura_env.config.boeIlvlThreshold
CykaPersistentData.config.filter.boe.qualityThreshold = aura_env.config.boeQualityThreshold
CykaPersistentData.config.filter.ap.enabled = aura_env.config.ap

View File

@@ -0,0 +1,30 @@
-- CHAT_MSG_ADDON
function(allstates, e, prefix, message, type, target)
if prefix ~= "CYKA_AUTOLOOT" then return end
local name, quantityS, qualityS, icon = strsplit("|", message)
local quality = tonumber(qualityS)
local quantity = tonumber(quantityS)
local formattedName = string.format("\124cff%s[%s]\124r x%s (%s)",
tostring(aura_env.QualityColors[quality+1]),
tostring(name),
tostring(quantity),
tostring(GetItemCount(name) + quantity))
allstates[#allstates + 1] = {
show = true,
changed = true,
index = GetTime(),
resort = true,
icon = icon,
name = formattedName,
progressType = "timed",
expirationTime = GetTime() + aura_env.ttl,
duration = aura_env.ttl,
autoHide = true,
}
return true
end

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,12 @@
RegisterAddonMessagePrefix("CYKA_AUTOLOOT")
aura_env.QualityColors = {
"9C9D9D",
"FFFFFF",
"1EFF00",
"0070DD",
"A335EE",
"FF8000",
"E6CC80",
"00CCFF",
}
aura_env.ttl = 3