Code format

This commit is contained in:
2025-05-01 17:06:20 +02:00
parent c365178b99
commit 3d8fa46711
7 changed files with 642 additions and 490 deletions

View File

@@ -19,17 +19,29 @@ local skills = {}
---@field value number ---@field value number
local NumberValue = { local NumberValue = {
---@param other number ---@param other number
Gt = function(self, other) return self.value > other end, Gt = function(self, other)
return self.value > other
end,
---@param other number ---@param other number
Lt = function(self, other) return self.value < other end, Lt = function(self, other)
return self.value < other
end,
---@param other number ---@param other number
Eq = function(self, other) return self.value == other end, Eq = function(self, other)
return self.value == other
end,
---@param other number ---@param other number
Ne = function(self, other) return self.value ~= other end, Ne = function(self, other)
return self.value ~= other
end,
---@param other number ---@param other number
Ge = function(self, other) return self.value >= other end, Ge = function(self, other)
return self.value >= other
end,
---@param other number ---@param other number
Le = function(self, other) return self.value <= other end, Le = function(self, other)
return self.value <= other
end,
} }
local function NewNumberValue(value) local function NewNumberValue(value)
local ret = { value = value } local ret = { value = value }
@@ -47,21 +59,37 @@ end
---@field value string ---@field value string
local StringValue = { local StringValue = {
---@param other string ---@param other string
Gt = function(self, other) return self.value > other end, Gt = function(self, other)
return self.value > other
end,
---@param other string ---@param other string
Lt = function(self, other) return self.value < other end, Lt = function(self, other)
return self.value < other
end,
---@param other string ---@param other string
Eq = function(self, other) return self.value == other end, Eq = function(self, other)
return self.value == other
end,
---@param other string ---@param other string
Ne = function(self, other) return self.value ~= other end, Ne = function(self, other)
return self.value ~= other
end,
---@param other string ---@param other string
Ge = function(self, other) return self.value >= other end, Ge = function(self, other)
return self.value >= other
end,
---@param other string ---@param other string
Le = function(self, other) return self.value <= other end, Le = function(self, other)
return self.value <= other
end,
---@param other string ---@param other string
Matches = function(self, other) return string.match(self.value, other) end, Matches = function(self, other)
return string.match(self.value, other)
end,
---@param other string ---@param other string
Contains = function(self, other) return string.find(self.value, other) end, Contains = function(self, other)
return string.find(self.value, other)
end,
} }
local function NewStringValue(value) local function NewStringValue(value)
local ret = { value = value } local ret = { value = value }
@@ -98,9 +126,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function Link(slot) local function Link(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local link = GetLootSlotLink(slot) local link = GetLootSlotLink(slot)
if link == nil then return ret, "link is nil" end if link == nil then
return ret, "link is nil"
end
ret.value = link ret.value = link
return ret, nil return ret, nil
end end
@@ -109,9 +141,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function Name(slot) local function Name(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local name = select(2, GetLootSlotInfo(slot)) local name = select(2, GetLootSlotInfo(slot))
if name == nil then return ret, "name is nil" end if name == nil then
return ret, "name is nil"
end
ret.value = name ret.value = name
return ret, nil return ret, nil
end end
@@ -120,9 +156,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function Type(slot) local function Type(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local type = select(6, GetItemInfo(Link(slot).value)) local type = select(6, GetItemInfo(Link(slot).value))
if type == nil then return ret, "type is nil" end if type == nil then
return ret, "type is nil"
end
ret.value = type ret.value = type
return ret, nil return ret, nil
end end
@@ -131,9 +171,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function SubType(slot) local function SubType(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local subType = select(7, GetItemInfo(Link(slot).value)) local subType = select(7, GetItemInfo(Link(slot).value))
if subType == nil then return ret, "subType is nil" end if subType == nil then
return ret, "subType is nil"
end
ret.value = subType ret.value = subType
return ret, nil return ret, nil
end end
@@ -142,9 +186,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function ItemLevel(slot) local function ItemLevel(slot)
local ret = NewNumberValue(0) local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local itemLevel = select(4, GetItemInfo(Link(slot).value)) local itemLevel = select(4, GetItemInfo(Link(slot).value))
if itemLevel == nil then return ret, "itemLevel is nil" end if itemLevel == nil then
return ret, "itemLevel is nil"
end
ret.value = itemLevel ret.value = itemLevel
return ret, nil return ret, nil
end end
@@ -153,9 +201,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function Value(slot) local function Value(slot)
local ret = NewNumberValue(0) local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local itemValue = select(11, GetItemInfo(Link(slot).value)) local itemValue = select(11, GetItemInfo(Link(slot).value))
if itemValue == nil then return ret, "itemValue is nil" end if itemValue == nil then
return ret, "itemValue is nil"
end
ret.value = itemValue ret.value = itemValue
return ret, nil return ret, nil
end end
@@ -164,9 +216,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function SubclassId(slot) local function SubclassId(slot)
local ret = NewNumberValue(0) local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local subclassId = select(13, GetItemInfo(Link(slot).value)) local subclassId = select(13, GetItemInfo(Link(slot).value))
if subclassId == nil then return ret, "subclassId is nil" end if subclassId == nil then
return ret, "subclassId is nil"
end
ret.value = subclassId ret.value = subclassId
return ret, nil return ret, nil
end end
@@ -175,9 +231,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function Quantity(slot) local function Quantity(slot)
local ret = NewNumberValue(1) local ret = NewNumberValue(1)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local quantity = select(3, GetLootSlotInfo(slot)) local quantity = select(3, GetLootSlotInfo(slot))
if quantity == nil then return ret, "quantity is nil" end if quantity == nil then
return ret, "quantity is nil"
end
ret.value = quantity ret.value = quantity
return ret, nil return ret, nil
end end
@@ -186,9 +246,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function EquipLocation(slot) local function EquipLocation(slot)
local ret = NewNumberValue(0) local ret = NewNumberValue(0)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local equipLocation = select(9, GetItemInfo(Link(slot).value)) local equipLocation = select(9, GetItemInfo(Link(slot).value))
if equipLocation == nil then return ret, "equipLocation is nil" end if equipLocation == nil then
return ret, "equipLocation is nil"
end
ret.value = equipLocation ret.value = equipLocation
return ret, nil return ret, nil
end end
@@ -197,9 +261,13 @@ function shared.Autoloot.Init()
---@return StringValue, string? ---@return StringValue, string?
local function Icon(slot) local function Icon(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local icon = select(10, GetItemInfo(Link(slot).value)) local icon = select(10, GetItemInfo(Link(slot).value))
if icon == nil then return ret, "icon is nil" end if icon == nil then
return ret, "icon is nil"
end
ret.value = icon ret.value = icon
return ret, nil return ret, nil
end end
@@ -208,9 +276,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function BindType(slot) local function BindType(slot)
local ret = NewStringValue("") local ret = NewStringValue("")
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local bindType = select(14, GetItemInfo(Link(slot).value)) local bindType = select(14, GetItemInfo(Link(slot).value))
if bindType == nil then return ret, "bindType is nil" end if bindType == nil then
return ret, "bindType is nil"
end
ret.value = bindType ret.value = bindType
return ret, nil return ret, nil
end end
@@ -219,9 +291,13 @@ function shared.Autoloot.Init()
---@return NumberValue, string? ---@return NumberValue, string?
local function Quality(slot) local function Quality(slot)
local ret = NewNumberValue(-1) local ret = NewNumberValue(-1)
if slot == nil then return ret, "slot is nil" end if slot == nil then
return ret, "slot is nil"
end
local quality = select(4, GetLootSlotInfo(slot)) local quality = select(4, GetLootSlotInfo(slot))
if quality == nil then return ret, "quality is nil" end if quality == nil then
return ret, "quality is nil"
end
ret.value = quality ret.value = quality
return ret, nil return ret, nil
end end
@@ -235,93 +311,121 @@ function shared.Autoloot.Init()
---@class GoldFilter : Filter ---@class GoldFilter : Filter
local GoldFilter = { local GoldFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.gold.enabled then return false end if not shared.config.autoloot.filter.gold.enabled then
return false
end
local name = Name(slot) local name = Name(slot)
return name:Contains("Gold") or name:Contains("Silver") or name:Contains("Copper") return name:Contains("Gold") or name:Contains("Silver") or name:Contains("Copper")
end end,
} }
---@class OrderResourceFilter : Filter ---@class OrderResourceFilter : Filter
local OrderResourceFilter = { local OrderResourceFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.orderResource.enabled then return false end if not shared.config.autoloot.filter.orderResource.enabled then
return false
end
return Name(slot):Contains("Order Resources") return Name(slot):Contains("Order Resources")
end end,
} }
---@class MountFilter : Filter ---@class MountFilter : Filter
local MountFilter = { local MountFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.mount.enabled then return false end if not shared.config.autoloot.filter.mount.enabled then
return false
end
return Type(slot):Eq("Mount") return Type(slot):Eq("Mount")
end end,
} }
---@class IlvlFilter : Filter ---@class IlvlFilter : Filter
local IlvlFilter = { local IlvlFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.ilvl.enabled then return false end if not shared.config.autoloot.filter.ilvl.enabled then
return false
end
return ItemLevel(slot):Ge(shared.config.autoloot.filter.ilvl.value) return ItemLevel(slot):Ge(shared.config.autoloot.filter.ilvl.value)
end end,
} }
---@class ProfessionFilter : Filter ---@class ProfessionFilter : Filter
local ProfessionFilter = { local ProfessionFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.profession.enabled then return false end if not shared.config.autoloot.filter.profession.enabled then
return false
end
local type = Type(slot) local type = Type(slot)
if not type:Eq("Tradeskill") then return false end if not type:Eq("Tradeskill") then
return false
end
local subtype = SubType(slot) local subtype = SubType(slot)
local professions = { strsplit(",", shared.config.autoloot.filter.profession.professions) } local professions = { strsplit(",", shared.config.autoloot.filter.profession.professions) }
return shared.TableContains(professions, subtype) or false return shared.TableContains(professions, subtype) or false
end end,
} }
---@class ValueFilter : Filter ---@class ValueFilter : Filter
local ValueFilter = { local ValueFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.value.enabled then return false end if not shared.config.autoloot.filter.value.enabled then
return false
end
local value = Value(slot) local value = Value(slot)
if shared.config.autoloot.filter.value.byStack then if shared.config.autoloot.filter.value.byStack then
value = value * Quantity(slot).value value = value * Quantity(slot).value
end end
return value:Ge(shared.config.autoloot.filter.value.value) return value:Ge(shared.config.autoloot.filter.value.value)
end end,
} }
---@class GreyValueFilter : Filter ---@class GreyValueFilter : Filter
local GreyValueFilter = { local GreyValueFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.greyvalue.enabled then return false end if not shared.config.autoloot.filter.greyvalue.enabled then
return false
end
local quality = Quality(slot) local quality = Quality(slot)
if not quality:Eq(0) then return false end if not quality:Eq(0) then
return false
end
local value = Value(slot) local value = Value(slot)
if shared.config.autoloot.filter.greyvalue.byStack then if shared.config.autoloot.filter.greyvalue.byStack then
value = value * Quantity(slot).value value = value * Quantity(slot).value
end end
return value:Ge(shared.config.autoloot.filter.greyvalue.value) return value:Ge(shared.config.autoloot.filter.greyvalue.value)
end end,
} }
---@class QuestItemFilter : Filter ---@class QuestItemFilter : Filter
local QuestItemFilter = { local QuestItemFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.questItem.enabled then return false end if not shared.config.autoloot.filter.questItem.enabled then
return false
end
return Type(slot):Eq("Quest") and SubType(slot):Eq("Quest") return Type(slot):Eq("Quest") and SubType(slot):Eq("Quest")
end end,
} }
---@class ClassGearFilter : Filter ---@class ClassGearFilter : Filter
local ClassGearFilter = { local ClassGearFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.classGear.enabled then return false end if not shared.config.autoloot.filter.classGear.enabled then
return false
end
local ilvlThreshold = shared.config.autoloot.filter.classGear.ilvlThreshold local ilvlThreshold = shared.config.autoloot.filter.classGear.ilvlThreshold
local qualityThreshold = shared.config.autoloot.filter.classGear.qualityThreshold local qualityThreshold = shared.config.autoloot.filter.classGear.qualityThreshold
local isEquippable = skills[select(3, UnitClass("player"))][SubType(slot).value] or false local isEquippable = skills[select(3, UnitClass("player"))][SubType(slot).value] or false
if not isEquippable then return false end if not isEquippable then
return false
end
return ItemLevel(slot):Ge(ilvlThreshold) and Quality(slot):Ge(qualityThreshold) return ItemLevel(slot):Ge(ilvlThreshold) and Quality(slot):Ge(qualityThreshold)
end end,
} }
---@class NameFilter : Filter ---@class NameFilter : Filter
local NameFilter = { local NameFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.name.enabled then return false end if not shared.config.autoloot.filter.name.enabled then
return false
end
local whitelist = { strsplit(",", shared.config.autoloot.filter.name.whitelist) } local whitelist = { strsplit(",", shared.config.autoloot.filter.name.whitelist) }
for _, name in ipairs(whitelist) do for _, name in ipairs(whitelist) do
if not shared.config.autoloot.filter.name.caseSensitive then name = name:lower() end if not shared.config.autoloot.filter.name.caseSensitive then
name = name:lower()
end
if shared.config.autoloot.filter.name.exact then if shared.config.autoloot.filter.name.exact then
return Name(slot):Eq(name) return Name(slot):Eq(name)
else else
@@ -329,37 +433,47 @@ function shared.Autoloot.Init()
end end
end end
return false return false
end end,
} }
---@class BoeFilter : Filter ---@class BoeFilter : Filter
local BoeFilter = { local BoeFilter = {
types = { "Armor", "Weapon" }, types = { "Armor", "Weapon" },
equipLocs = { "INVTYPE_FINGER", "INVTYPE_TRINKET", "INVTYPE_CLOAK", "INVTYPE_NECK" }, equipLocs = { "INVTYPE_FINGER", "INVTYPE_TRINKET", "INVTYPE_CLOAK", "INVTYPE_NECK" },
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.boe.enabled then return false end if not shared.config.autoloot.filter.boe.enabled then
return false
end
local ilvlThreshold = shared.config.autoloot.filter.boe.ilvlThreshold local ilvlThreshold = shared.config.autoloot.filter.boe.ilvlThreshold
local qualityThreshold = shared.config.autoloot.filter.boe.qualityThreshold local qualityThreshold = shared.config.autoloot.filter.boe.qualityThreshold
local type = Type(slot) local type = Type(slot)
local equipLoc = EquipLocation(slot) local equipLoc = EquipLocation(slot)
if not shared.TableContains(self.types, type) or not shared.TableContains(self.equipLocs, equipLoc) then return false end 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) return BindType(slot):Eq(1) and ItemLevel(slot):Ge(ilvlThreshold) and Quality(slot):Ge(qualityThreshold)
end end,
} }
---@class APFilter : Filter ---@class APFilter : Filter
local APFilter = { local APFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.ap.enabled then return false end if not shared.config.autoloot.filter.ap.enabled then
return Value(slot):Eq(0) and Type(slot):Eq("Consumable") and SubType(slot):Eq("Other") and return false
SubclassId(slot):Eq(8) end
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 ---@class EverythingFilter : Filter
local EverythingFilter = { local EverythingFilter = {
Matches = function(self, slot) Matches = function(self, slot)
if not shared.config.autoloot.filter.everything.enabled then return false end if not shared.config.autoloot.filter.everything.enabled then
return false
end
return true return true
end end,
} }
---@type Filter[] ---@type Filter[]
@@ -401,11 +515,7 @@ function shared.Autoloot.Init()
local quality = Quality(slot).value local quality = Quality(slot).value
local icon = Icon(slot).value local icon = Icon(slot).value
local addonPayload = string.format("%s|%s|%s|%s", local addonPayload = string.format("%s|%s|%s|%s", name, quantity, quality, icon)
name,
quantity,
quality,
icon)
SendAddonMessage("CYKA_AUTOLOOT", addonPayload, "WHISPER", UnitName("player")) SendAddonMessage("CYKA_AUTOLOOT", addonPayload, "WHISPER", UnitName("player"))
LootSlot(slot) LootSlot(slot)

View File

@@ -11,12 +11,12 @@ local function Init()
["destGUID"] = 8, ["destGUID"] = 8,
["destName"] = 9, ["destName"] = 9,
["destFlags"] = 10, ["destFlags"] = 10,
["destRaidFlags"] = 11 ["destRaidFlags"] = 11,
}, },
["GENERIC_SPELL"] = { ["GENERIC_SPELL"] = {
["spellId"] = 12, ["spellId"] = 12,
["spellName"] = 13, ["spellName"] = 13,
["spellSchool"] = 14 ["spellSchool"] = 14,
}, },
["GENERIC_DAMAGE"] = { ["GENERIC_DAMAGE"] = {
["amount"] = 15, ["amount"] = 15,
@@ -28,19 +28,19 @@ local function Init()
["critical"] = 21, ["critical"] = 21,
["glancing"] = 22, ["glancing"] = 22,
["crushing"] = 23, ["crushing"] = 23,
["isOffHand"] = 24 ["isOffHand"] = 24,
}, },
["GENERIC_MISSED"] = { ["GENERIC_MISSED"] = {
["missType"] = 15, ["missType"] = 15,
["isOffHand"] = 16, ["isOffHand"] = 16,
["amountMissed"] = 17, ["amountMissed"] = 17,
["critical"] = 18 ["critical"] = 18,
}, },
["GENERIC_HEAL"] = { ["GENERIC_HEAL"] = {
["amount"] = 15, ["amount"] = 15,
["overhealing"] = 16, ["overhealing"] = 16,
["absorbed"] = 17, ["absorbed"] = 17,
["critical"] = 18 ["critical"] = 18,
}, },
["GENERIC_HEAL_ABSORBED"] = { ["GENERIC_HEAL_ABSORBED"] = {
["extraGUID"] = 15, ["extraGUID"] = 15,
@@ -51,44 +51,44 @@ local function Init()
["extraSpellName"] = 20, ["extraSpellName"] = 20,
["extraSchool"] = 21, ["extraSchool"] = 21,
["absorbedAmount"] = 22, ["absorbedAmount"] = 22,
["totalAmount"] = 23 ["totalAmount"] = 23,
}, },
["GENERIC_ENERGIZE"] = { ["GENERIC_ENERGIZE"] = {
["amount"] = 15, ["amount"] = 15,
["overEnergize"] = 16, ["overEnergize"] = 16,
["powerType"] = 17 ["powerType"] = 17,
}, },
["GENERIC_DRAIN"] = { ["GENERIC_DRAIN"] = {
["amount"] = 15, ["amount"] = 15,
["powerType"] = 16, ["powerType"] = 16,
["extraAmount"] = 17 ["extraAmount"] = 17,
}, },
["GENERIC_LEECH"] = { ["GENERIC_LEECH"] = {
["amount"] = 15, ["amount"] = 15,
["powerType"] = 16, ["powerType"] = 16,
["extraAmount"] = 17 ["extraAmount"] = 17,
}, },
["GENERIC_INTERRUPT"] = { ["GENERIC_INTERRUPT"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17 ["extraSchool"] = 17,
}, },
["GENERIC_DISPEL"] = { ["GENERIC_DISPEL"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_DISPEL_FAILED"] = { ["GENERIC_DISPEL_FAILED"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17 ["extraSchool"] = 17,
}, },
["GENERIC_STOLEN"] = { ["GENERIC_STOLEN"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_EXTRA_ATTACKS"] = { ["amount"] = 15 }, ["GENERIC_EXTRA_ATTACKS"] = { ["amount"] = 15 },
["GENERIC_AURA_APPLIED"] = { ["auraType"] = 15, ["amount"] = 16 }, ["GENERIC_AURA_APPLIED"] = { ["auraType"] = 15, ["amount"] = 16 },
@@ -101,38 +101,32 @@ local function Init()
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_CAST_START"] = {}, ["GENERIC_CAST_START"] = {},
["GENERIC_CAST_SUCCESS"] = {}, ["GENERIC_CAST_SUCCESS"] = {},
["GENERIC_CAST_FAILED"] = {} ["GENERIC_CAST_FAILED"] = {},
} }
CLEUEventInfo["SWING_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SWING_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SWING_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SWING_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SWING_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SWING_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SWING_HEAL_ABSORBED"] = CLEUEventInfo["SWING_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SWING_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SWING_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SWING_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SWING_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SWING_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SWING_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SWING_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["SWING_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SWING_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SWING_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SWING_DISPEL_FAILED"] = CLEUEventInfo["SWING_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SWING_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SWING_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SWING_EXTRA_ATTACKS"] = CLEUEventInfo["SWING_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SWING_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SWING_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SWING_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SWING_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SWING_AURA_APPLIED_DOSE"] = CLEUEventInfo["SWING_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SWING_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SWING_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SWING_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["SWING_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SWING_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["SWING_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SWING_AURA_BROKEN_SPELL"] = CLEUEventInfo["SWING_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SWING_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["SWING_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SWING_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["SWING_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SWING_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["SWING_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -140,28 +134,22 @@ local function Init()
CLEUEventInfo["RANGE_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["RANGE_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["RANGE_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["RANGE_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["RANGE_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["RANGE_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["RANGE_HEAL_ABSORBED"] = CLEUEventInfo["RANGE_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["RANGE_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["RANGE_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["RANGE_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["RANGE_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["RANGE_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["RANGE_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["RANGE_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["RANGE_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["RANGE_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["RANGE_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["RANGE_DISPEL_FAILED"] = CLEUEventInfo["RANGE_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["RANGE_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["RANGE_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["RANGE_EXTRA_ATTACKS"] = CLEUEventInfo["RANGE_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["RANGE_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["RANGE_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["RANGE_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["RANGE_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["RANGE_AURA_APPLIED_DOSE"] = CLEUEventInfo["RANGE_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["RANGE_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["RANGE_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["RANGE_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["RANGE_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["RANGE_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["RANGE_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["RANGE_AURA_BROKEN_SPELL"] = CLEUEventInfo["RANGE_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["RANGE_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["RANGE_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["RANGE_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["RANGE_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["RANGE_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["RANGE_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -169,28 +157,22 @@ local function Init()
CLEUEventInfo["SPELL_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SPELL_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SPELL_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SPELL_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_HEAL_ABSORBED"] = CLEUEventInfo["SPELL_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SPELL_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SPELL_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SPELL_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["SPELL_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SPELL_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_DISPEL_FAILED"] = CLEUEventInfo["SPELL_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SPELL_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_EXTRA_ATTACKS"] = CLEUEventInfo["SPELL_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SPELL_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SPELL_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SPELL_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SPELL_AURA_APPLIED_DOSE"] = CLEUEventInfo["SPELL_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SPELL_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["SPELL_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["SPELL_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SPELL_AURA_BROKEN_SPELL"] = CLEUEventInfo["SPELL_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["SPELL_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SPELL_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["SPELL_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["SPELL_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -198,39 +180,25 @@ local function Init()
CLEUEventInfo["SPELL_PERIODIC_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SPELL_PERIODIC_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_PERIODIC_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SPELL_PERIODIC_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_PERIODIC_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SPELL_PERIODIC_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_PERIODIC_HEAL_ABSORBED"] = CLEUEventInfo["SPELL_PERIODIC_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_PERIODIC_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SPELL_PERIODIC_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_PERIODIC_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SPELL_PERIODIC_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_PERIODIC_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SPELL_PERIODIC_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_PERIODIC_INTERRUPT"] = CLEUEventInfo["SPELL_PERIODIC_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SPELL_PERIODIC_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL_FAILED"] = CLEUEventInfo["SPELL_PERIODIC_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_PERIODIC_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SPELL_PERIODIC_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_PERIODIC_EXTRA_ATTACKS"] = CLEUEventInfo["SPELL_PERIODIC_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"] CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED"] = CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED"] = CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SPELL_PERIODIC_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED_DOSE"] = CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED_DOSE"] = CLEUEventInfo["SPELL_PERIODIC_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"] CLEUEventInfo["SPELL_PERIODIC_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REFRESH"] = CLEUEventInfo["SPELL_PERIODIC_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN"] =
CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN_SPELL"] =
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_PERIODIC_CAST_START"] =
CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SPELL_PERIODIC_CAST_SUCCESS"] =
CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_PERIODIC_CAST_FAILED"] =
CLEUEventInfo["GENERIC_CAST_FAILED"]
---@class CLEUParser ---@class CLEUParser
CLEUParser = { CLEUParser = {
@@ -378,7 +346,9 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetSpellId = function(...) GetSpellId = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellId"], ...) local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellId"], ...)
if val == nil then return 0, "SpellId is nil or missing" end if val == nil then
return 0, "SpellId is nil or missing"
end
if type(val) ~= "number" then if type(val) ~= "number" then
return 0, "SpellId is not a number" return 0, "SpellId is not a number"
end end
@@ -413,8 +383,7 @@ local function Init()
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSpellSchool = function(...) GetSpellSchool = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellSchool"], local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellSchool"], ...)
...)
if val == nil then if val == nil then
return 0, "SpellSchool is nil or missing" return 0, "SpellSchool is nil or missing"
end end
@@ -451,11 +420,12 @@ local function Init()
GetAmount = function(...) GetAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["amount"], ...) local val = select(CLEUEventInfo[subevent]["amount"], ...)
if val == nil then return 0, "Amount is nil or missing" end if val == nil then
return 0, "Amount is nil or missing"
end
if type(val) ~= "number" then if type(val) ~= "number" then
return 0, "Amount is not a number" return 0, "Amount is not a number"
end end
@@ -479,8 +449,7 @@ local function Init()
GetOverkill = function(...) GetOverkill = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
if not CLEUEventInfo[subevent] then if not CLEUEventInfo[subevent] then
return 0, "Subevent is not a valid event" return 0, "Subevent is not a valid event"
@@ -489,7 +458,9 @@ local function Init()
return 0, "Overkill is nil or missing" return 0, "Overkill is nil or missing"
end end
local val = select(CLEUEventInfo[subevent]["overkill"], ...) local val = select(CLEUEventInfo[subevent]["overkill"], ...)
if val == nil then return 0, "Overkill is nil or missing" end if val == nil then
return 0, "Overkill is nil or missing"
end
if type(val) ~= "number" then if type(val) ~= "number" then
return 0, "Overkill is not a number" return 0, "Overkill is not a number"
end end
@@ -513,11 +484,12 @@ local function Init()
GetSchool = function(...) GetSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["school"], ...) local val = select(CLEUEventInfo[subevent]["school"], ...)
if val == nil then return 0, "School is nil or missing" end if val == nil then
return 0, "School is nil or missing"
end
if type(val) ~= "number" then if type(val) ~= "number" then
return 0, "School is not a number" return 0, "School is not a number"
end end
@@ -543,8 +515,7 @@ local function Init()
GetResisted = function(...) GetResisted = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["resisted"], ...) local val = select(CLEUEventInfo[subevent]["resisted"], ...)
if val == nil then if val == nil then
@@ -575,8 +546,7 @@ local function Init()
GetBlocked = function(...) GetBlocked = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["blocked"], ...) local val = select(CLEUEventInfo[subevent]["blocked"], ...)
if val == nil then if val == nil then
@@ -608,8 +578,7 @@ local function Init()
GetAbsorbed = function(...) GetAbsorbed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["absorbed"], ...) local val = select(CLEUEventInfo[subevent]["absorbed"], ...)
if val == nil then if val == nil then
@@ -640,8 +609,7 @@ local function Init()
GetCritical = function(...) GetCritical = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["critical"], ...) local val = select(CLEUEventInfo[subevent]["critical"], ...)
if val == nil then if val == nil then
@@ -670,8 +638,7 @@ local function Init()
GetGlancing = function(...) GetGlancing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["glancing"], ...) local val = select(CLEUEventInfo[subevent]["glancing"], ...)
if val == nil then if val == nil then
@@ -700,8 +667,7 @@ local function Init()
GetCrushing = function(...) GetCrushing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["crushing"], ...) local val = select(CLEUEventInfo[subevent]["crushing"], ...)
if val == nil then if val == nil then
@@ -731,8 +697,7 @@ local function Init()
GetIsOffHand = function(...) GetIsOffHand = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return false, return false, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["isOffHand"], ...) local val = select(CLEUEventInfo[subevent]["isOffHand"], ...)
if val == nil then if val == nil then
@@ -764,8 +729,7 @@ local function Init()
GetMissType = function(...) GetMissType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return "", return "", string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["missType"], ...) local val = select(CLEUEventInfo[subevent]["missType"], ...)
if val == nil then if val == nil then
@@ -797,8 +761,7 @@ local function Init()
GetAmountMissed = function(...) GetAmountMissed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["amountMissed"], ...) local val = select(CLEUEventInfo[subevent]["amountMissed"], ...)
if val == nil then if val == nil then
@@ -830,8 +793,7 @@ local function Init()
GetOverhealing = function(...) GetOverhealing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["overhealing"], ...) local val = select(CLEUEventInfo[subevent]["overhealing"], ...)
if val == nil then if val == nil then
@@ -861,8 +823,7 @@ local function Init()
GetExtraGUID = function(...) GetExtraGUID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return "", return "", string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraGUID"], ...) local val = select(CLEUEventInfo[subevent]["extraGUID"], ...)
if val == nil then if val == nil then
@@ -892,8 +853,7 @@ local function Init()
GetExtraName = function(...) GetExtraName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return "", return "", string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraName"], ...) local val = select(CLEUEventInfo[subevent]["extraName"], ...)
if val == nil then if val == nil then
@@ -923,8 +883,7 @@ local function Init()
GetExtraFlags = function(...) GetExtraFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraFlags"], ...)
if val == nil then if val == nil then
@@ -954,8 +913,7 @@ local function Init()
GetExtraRaidFlags = function(...) GetExtraRaidFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...)
if val == nil then if val == nil then
@@ -989,8 +947,7 @@ local function Init()
GetExtraSpellID = function(...) GetExtraSpellID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...)
if val == nil then if val == nil then
@@ -1025,8 +982,7 @@ local function Init()
GetExtraSpellName = function(...) GetExtraSpellName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return "", return "", string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...)
if val == nil then if val == nil then
@@ -1061,8 +1017,7 @@ local function Init()
GetExtraSchool = function(...) GetExtraSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraSchool"], ...) local val = select(CLEUEventInfo[subevent]["extraSchool"], ...)
if val == nil then if val == nil then
@@ -1092,8 +1047,7 @@ local function Init()
GetAbsorbedAmount = function(...) GetAbsorbedAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...) local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...)
if val == nil then if val == nil then
@@ -1123,8 +1077,7 @@ local function Init()
GetOverEnergize = function(...) GetOverEnergize = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["overEnergize"], ...) local val = select(CLEUEventInfo[subevent]["overEnergize"], ...)
if val == nil then if val == nil then
@@ -1158,8 +1111,7 @@ local function Init()
GetPowerType = function(...) GetPowerType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["powerType"], ...) local val = select(CLEUEventInfo[subevent]["powerType"], ...)
if val == nil then if val == nil then
@@ -1190,8 +1142,7 @@ local function Init()
GetExtraAmount = function(...) GetExtraAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraAmount"], ...) local val = select(CLEUEventInfo[subevent]["extraAmount"], ...)
if val == nil then if val == nil then
@@ -1229,8 +1180,7 @@ local function Init()
GetExtraSpellId = function(...) GetExtraSpellId = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...)
if val == nil then if val == nil then
@@ -1268,16 +1218,17 @@ local function Init()
GetExtraAuraType = function(...) GetExtraAuraType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then
return 0, return 0, string.format("Failed getting subevent due to: %s", err)
string.format("Failed getting subevent due to: %s", err)
end end
local val = select(CLEUEventInfo[subevent]["auraType"], ...) local val = select(CLEUEventInfo[subevent]["auraType"], ...)
if val == nil then return 0, "AuraType is nil or missing" end if val == nil then
return 0, "AuraType is nil or missing"
end
if type(val) ~= "number" then if type(val) ~= "number" then
return 0, "AuraType is not a number" return 0, "AuraType is not a number"
end end
return val, nil return val, nil
end end,
} }
end end
@@ -1288,4 +1239,4 @@ frame:RegisterEvent("GUILD_ROSTER_UPDATE")
frame:SetScript("OnEvent", function(self, event, ...) frame:SetScript("OnEvent", function(self, event, ...)
Init() Init()
end) end)
Init() Init()

View File

@@ -6,129 +6,128 @@ local addonname, shared = ...
---@field Init fun() ---@field Init fun()
shared.CameraSettings = { shared.CameraSettings = {
Init = function() Init = function() end,
end
} }
function shared.CameraSettings.Init() function shared.CameraSettings.Init()
if not shared.config.camera.enabled then if not shared.config.camera.enabled then
print("Cyka - Camera settings disabled") print("Cyka - Camera settings disabled")
return return
end end
local function SetCameraSpeed(speed) local function SetCameraSpeed(speed)
if not speed then if not speed then
return return
end end
print("Camera speed set to " .. tostring(speed)) print("Camera speed set to " .. tostring(speed))
SetCVar("cameraYawMoveSpeed", speed) SetCVar("cameraYawMoveSpeed", speed)
SetCVar("cameraPitchMoveSpeed", speed) SetCVar("cameraPitchMoveSpeed", speed)
SetBinding("BUTTON3", "TOGGLEAUTORUN") SetBinding("BUTTON3", "TOGGLEAUTORUN")
SetBinding("A", "STRAFELEFT") SetBinding("A", "STRAFELEFT")
SetBinding("D", "STRAFERIGHT") SetBinding("D", "STRAFERIGHT")
SetBinding("Q", "ACTIONBUTTON1") SetBinding("Q", "ACTIONBUTTON1")
SetBinding("E", "ACTIONBUTTON2") SetBinding("E", "ACTIONBUTTON2")
SetBinding("SPACE", "ACTIONBUTTON5") SetBinding("SPACE", "ACTIONBUTTON5")
SetBinding("NUMPAD0", "NONE") SetBinding("NUMPAD0", "NONE")
SetBinding("Z", "TOGGLESHEATH") SetBinding("Z", "TOGGLESHEATH")
SetBinding("NUMLOCK", "NONE") SetBinding("NUMLOCK", "NONE")
SetBinding("BUTTON4", "MULTIACTIONBAR2BUTTON11") SetBinding("BUTTON4", "MULTIACTIONBAR2BUTTON11")
SetBinding("R", "ACTIONBUTTON6") SetBinding("R", "ACTIONBUTTON6")
SetBinding("SHIFT-R", "MULTIACTIONBAR1BUTTON6") SetBinding("SHIFT-R", "MULTIACTIONBAR1BUTTON6")
SetBinding("1", "ACTIONBUTTON8") SetBinding("1", "ACTIONBUTTON8")
SetBinding("2", "ACTIONBUTTON9") SetBinding("2", "ACTIONBUTTON9")
SetBinding("3", "ACTIONBUTTON10") SetBinding("3", "ACTIONBUTTON10")
SetBinding("4", "ACTIONBUTTON11") SetBinding("4", "ACTIONBUTTON11")
SetBinding("5", "MULTIACTIONBAR2BUTTON2") SetBinding("5", "MULTIACTIONBAR2BUTTON2")
SetBinding("6", "MULTIACTIONBAR2BUTTON3") SetBinding("6", "MULTIACTIONBAR2BUTTON3")
SetBinding("7", "MULTIACTIONBAR2BUTTON4") SetBinding("7", "MULTIACTIONBAR2BUTTON4")
SetBinding("8", "MULTIACTIONBAR2BUTTON5") SetBinding("8", "MULTIACTIONBAR2BUTTON5")
SetBinding("9", "NONE") SetBinding("9", "NONE")
SetBinding("0", "NONE") SetBinding("0", "NONE")
SetBinding("-", "NONE") SetBinding("-", "NONE")
SetBinding("=", "NONE") SetBinding("=", "NONE")
SetBinding("CTRL-1", "ELVUIBAR6BUTTON3") SetBinding("CTRL-1", "ELVUIBAR6BUTTON3")
SetBinding("CTRL-2", "ELVUIBAR6BUTTON4") SetBinding("CTRL-2", "ELVUIBAR6BUTTON4")
SetBinding("CTRL-3", "ELVUIBAR6BUTTON5") SetBinding("CTRL-3", "ELVUIBAR6BUTTON5")
SetBinding("CTRL-4", "ELVUIBAR6BUTTON6") SetBinding("CTRL-4", "ELVUIBAR6BUTTON6")
SetBinding("CTRL-5", "ELVUIBAR6BUTTON2") SetBinding("CTRL-5", "ELVUIBAR6BUTTON2")
SetBinding("SHIFT-1", "MULTIACTIONBAR1BUTTON8") SetBinding("SHIFT-1", "MULTIACTIONBAR1BUTTON8")
SetBinding("SHIFT-2", "MULTIACTIONBAR1BUTTON9") SetBinding("SHIFT-2", "MULTIACTIONBAR1BUTTON9")
SetBinding("SHIFT-3", "MULTIACTIONBAR1BUTTON10") SetBinding("SHIFT-3", "MULTIACTIONBAR1BUTTON10")
SetBinding("SHIFT-4", "MULTIACTIONBAR1BUTTON11") SetBinding("SHIFT-4", "MULTIACTIONBAR1BUTTON11")
SetBinding("SHIFT-5", "MULTIACTIONBAR1BUTTON12") SetBinding("SHIFT-5", "MULTIACTIONBAR1BUTTON12")
SetBinding("MOUSEWHEELUP", "INTERACTMOUSEOVER") SetBinding("MOUSEWHEELUP", "INTERACTMOUSEOVER")
SetBinding("SHIFT-MOUSEWHEELDOWN", "MULTIACTIONBAR4BUTTON3") SetBinding("SHIFT-MOUSEWHEELDOWN", "MULTIACTIONBAR4BUTTON3")
SetBinding("TAB", "ACTIONBUTTON12") SetBinding("TAB", "ACTIONBUTTON12")
SetBinding("G", "INTERACTTARGET") SetBinding("G", "INTERACTTARGET")
SetBinding("F", "ACTIONBUTTON7") SetBinding("F", "ACTIONBUTTON7")
SetBinding("V", "JUMP") SetBinding("V", "JUMP")
SetBinding("C", "ACTIONBUTTON3") SetBinding("C", "ACTIONBUTTON3")
SetBinding("SHIFT-P", "TOGGLECOLLECTIONSMOUNTJOURNAL") SetBinding("SHIFT-P", "TOGGLECOLLECTIONSMOUNTJOURNAL")
SetBinding("Y", "ACTIONBUTTON4") SetBinding("Y", "ACTIONBUTTON4")
SetBinding("SHIFT-Y", "MULTIACTIONBAR1BUTTON4") SetBinding("SHIFT-Y", "MULTIACTIONBAR1BUTTON4")
SetBinding("SHIFT-MOUSEWHEELUP", "MULTIACTIONBAR2BUTTON9") SetBinding("SHIFT-MOUSEWHEELUP", "MULTIACTIONBAR2BUTTON9")
SetBinding("MOUSEWHEELDOWN", "MULTIACTIONBAR2BUTTON10") SetBinding("MOUSEWHEELDOWN", "MULTIACTIONBAR2BUTTON10")
SetBinding("CTRL-Q", "MULTIACTIONBAR4BUTTON10") SetBinding("CTRL-Q", "MULTIACTIONBAR4BUTTON10")
SetBinding("CTRL-E", "MULTIACTIONBAR4BUTTON9") SetBinding("CTRL-E", "MULTIACTIONBAR4BUTTON9")
SetBinding("CTRL-MOUSEWHEELUP", "CAMERAZOOMIN") SetBinding("CTRL-MOUSEWHEELUP", "CAMERAZOOMIN")
SetBinding("CTRL-MOUSEWHEELDOWN", "CAMERAZOOMOUT") SetBinding("CTRL-MOUSEWHEELDOWN", "CAMERAZOOMOUT")
SetBinding("SHIFT-C", "MULTIACTIONBAR1BUTTON3") SetBinding("SHIFT-C", "MULTIACTIONBAR1BUTTON3")
SetBinding("¸", "MULTIACTIONBAR2BUTTON1") SetBinding("¸", "MULTIACTIONBAR2BUTTON1")
SetBinding("ALT-1", "MULTIACTIONBAR3BUTTON8") SetBinding("ALT-1", "MULTIACTIONBAR3BUTTON8")
SetBinding("ALT-2", "MULTIACTIONBAR3BUTTON9") SetBinding("ALT-2", "MULTIACTIONBAR3BUTTON9")
SetBinding("ALT-3", "MULTIACTIONBAR3BUTTON10") SetBinding("ALT-3", "MULTIACTIONBAR3BUTTON10")
SetBinding("ALT-4", "MULTIACTIONBAR3BUTTON11") SetBinding("ALT-4", "MULTIACTIONBAR3BUTTON11")
SetBinding("SHIFT-Q", "MULTIACTIONBAR1BUTTON1") SetBinding("SHIFT-Q", "MULTIACTIONBAR1BUTTON1")
SetBinding("SHIFT-E", "MULTIACTIONBAR1BUTTON2") SetBinding("SHIFT-E", "MULTIACTIONBAR1BUTTON2")
SetBinding("ALT-E", "MULTIACTIONBAR3BUTTON2") SetBinding("ALT-E", "MULTIACTIONBAR3BUTTON2")
SetBinding("ALT-C", "MULTIACTIONBAR3BUTTON3") SetBinding("ALT-C", "MULTIACTIONBAR3BUTTON3")
SetBinding("ALT-Y", "MULTIACTIONBAR3BUTTON4") SetBinding("ALT-Y", "MULTIACTIONBAR3BUTTON4")
SetBinding("SHIFT-F", "MULTIACTIONBAR1BUTTON7") SetBinding("SHIFT-F", "MULTIACTIONBAR1BUTTON7")
SetBinding("ALT-R", "MULTIACTIONBAR3BUTTON6") SetBinding("ALT-R", "MULTIACTIONBAR3BUTTON6")
SetBinding("ALT-F", "MULTIACTIONBAR3BUTTON7") SetBinding("ALT-F", "MULTIACTIONBAR3BUTTON7")
SetBinding("SHIFT-BUTTON5", "MULTIACTIONBAR4BUTTON1") SetBinding("SHIFT-BUTTON5", "MULTIACTIONBAR4BUTTON1")
SetBinding("BUTTON5", "MULTIACTIONBAR2BUTTON12") SetBinding("BUTTON5", "MULTIACTIONBAR2BUTTON12")
SetBinding("SHIFT-BUTTON4", "MULTIACTIONBAR4BUTTON2") SetBinding("SHIFT-BUTTON4", "MULTIACTIONBAR4BUTTON2")
SetBinding("CTRL-BUTTON4", "ELVUIBAR6BUTTON11") SetBinding("CTRL-BUTTON4", "ELVUIBAR6BUTTON11")
SetBinding("CTRL-BUTTON5", "ELVUIBAR6BUTTON12") SetBinding("CTRL-BUTTON5", "ELVUIBAR6BUTTON12")
SetBinding("SHIFT-L", "TOGGLEACHIEVEMENT") SetBinding("SHIFT-L", "TOGGLEACHIEVEMENT")
SetBinding("ALT-G", "DEATH_NOTE_SHOW_TARGET_DEATH") SetBinding("ALT-G", "DEATH_NOTE_SHOW_TARGET_DEATH")
SetBinding("[", "PAWN_COMPARE_LEFT") SetBinding("[", "PAWN_COMPARE_LEFT")
SetBinding("]", "PAWN_COMPARE_RIGHT") SetBinding("]", "PAWN_COMPARE_RIGHT")
SetBinding("ALT-5", "MULTIACTIONBAR3BUTTON12") SetBinding("ALT-5", "MULTIACTIONBAR3BUTTON12")
SetBinding("ALT-6", "MULTIACTIONBAR2BUTTON6") SetBinding("ALT-6", "MULTIACTIONBAR2BUTTON6")
SetBinding("SHIFT-¸", "HEKILI_TOGGLE_COOLDOWNS") SetBinding("SHIFT-¸", "HEKILI_TOGGLE_COOLDOWNS")
SetBinding("CTRL-C", "MULTIACTIONBAR4BUTTON6") SetBinding("CTRL-C", "MULTIACTIONBAR4BUTTON6")
SetBinding("ALT-CTRL-P", "MULTIACTIONBAR2BUTTON7") SetBinding("ALT-CTRL-P", "MULTIACTIONBAR2BUTTON7")
InterfaceOptionsControlsPanelInteractOnLeftClick:SetValue(0) InterfaceOptionsControlsPanelInteractOnLeftClick:SetValue(0)
InterfaceOptionsControlsPanelStickyTargeting:SetValue(1) InterfaceOptionsControlsPanelStickyTargeting:SetValue(1)
InterfaceOptionsCombatPanelTargetOfTarget:SetValue(1) InterfaceOptionsCombatPanelTargetOfTarget:SetValue(1)
InterfaceOptionsDisplayPanelShowTutorials:SetValue(0) InterfaceOptionsDisplayPanelShowTutorials:SetValue(0)
InterfaceOptionsDisplayPanelAJAlerts:SetValue(1) InterfaceOptionsDisplayPanelAJAlerts:SetValue(1)
InterfaceOptionsSocialPanelProfanityFilter:SetValue(0) InterfaceOptionsSocialPanelProfanityFilter:SetValue(0)
InterfaceOptionsSocialPanelSpamFilter:SetValue(0) InterfaceOptionsSocialPanelSpamFilter:SetValue(0)
InterfaceOptionsNamesPanelMyName:SetValue(1) InterfaceOptionsNamesPanelMyName:SetValue(1)
InterfaceOptionsCameraPanelStyleDropDown:SetValue(0) InterfaceOptionsCameraPanelStyleDropDown:SetValue(0)
InterfaceOptionsMousePanelClickToMove:SetValue(1) InterfaceOptionsMousePanelClickToMove:SetValue(1)
InterfaceOptionsMousePanelClickMoveStyleDropDown:SetValue(0) InterfaceOptionsMousePanelClickMoveStyleDropDown:SetValue(0)
end end
local frame = CreateFrame("Frame") local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, event, ...) frame:SetScript("OnEvent", function(self, event, ...)
SetCameraSpeed(shared.config.camera.speed) SetCameraSpeed(shared.config.camera.speed)
end) end)
SlashCmdList["CAMERASETTINGS"] = function(speed) SlashCmdList["CAMERASETTINGS"] = function(speed)
if speed then if speed then
shared.config.camera.speed = speed shared.config.camera.speed = speed
end end
SetCameraSpeed(shared.config.camera.speed) SetCameraSpeed(shared.config.camera.speed)
end end
SLASH_CAMERASETTINGS1 = "/cs" SLASH_CAMERASETTINGS1 = "/cs"
print("Cyka - Camera settings loaded") print("Cyka - Camera settings loaded")
end end

392
Cyka.lua
View File

@@ -16,7 +16,6 @@ local addonname, shared = ...
---@field CameraSettings CameraSettings ---@field CameraSettings CameraSettings
---@field SpellQSettings SpellQSettings ---@field SpellQSettings SpellQSettings
---@class CykaData ---@class CykaData
---@class CykaConfig ---@class CykaConfig
@@ -44,173 +43,262 @@ local addonname, shared = ...
---@field everything { enabled: boolean } ---@field everything { enabled: boolean }
local function init() local function init()
if not CykaPersistentData then CykaPersistentData = {} end if not CykaPersistentData then
if not CykaPersistentData.config then CykaPersistentData.config = {} end CykaPersistentData = {}
end
if not CykaPersistentData.config then
CykaPersistentData.config = {}
end
shared.GetOrDefault = function(table, keys, default) shared.GetOrDefault = function(table, keys, default)
local value = default local value = default
if not table then return value end if not table then
if not keys then return value end return value
end
if not keys then
return value
end
local traverse = table local traverse = table
for i = 1, #keys do for i = 1, #keys do
local key = keys[i] local key = keys[i]
if traverse[key] ~= nil then if traverse[key] ~= nil then
traverse = traverse[key] traverse = traverse[key]
else else
break break
end end
if i == #keys then if i == #keys then
value = traverse value = traverse
end end
end end
return value return value
end end
---@param table table ---@param table table
---@param depth number? ---@param depth number?
shared.DumpTable = function(table, depth) shared.DumpTable = function(table, depth)
if not table then if not table then
print(tostring(table)) print(tostring(table))
return return
end end
if depth == nil then if depth == nil then
depth = 0 depth = 0
end end
if (depth > 200) then if depth > 200 then
print("Error: Depth > 200 in dumpTable()") print("Error: Depth > 200 in dumpTable()")
return return
end end
for k, v in pairs(table) do for k, v in pairs(table) do
if (type(v) == "table") then if type(v) == "table" then
print(string.rep(" ", depth) .. k .. ":") print(string.rep(" ", depth) .. k .. ":")
shared.DumpTable(v, depth + 1) shared.DumpTable(v, depth + 1)
else else
print(string.rep(" ", depth) .. k .. ": ", v) print(string.rep(" ", depth) .. k .. ": ", v)
end end
end end
end end
---@param table table<any, any> ---@param table table<any, any>
---@param value any ---@param value any
shared.TableContains = function(table, value) shared.TableContains = function(table, value)
for _, v in pairs(table) do for _, v in pairs(table) do
if v == value then return true end if v == value then
end return true
return false end
end end
return false
end
shared.config = { shared.config = {
camera = { camera = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "camera", "enabled" }, true), enabled = shared.GetOrDefault(CykaPersistentData.config, { "camera", "enabled" }, true),
speed = shared.GetOrDefault(CykaPersistentData.config, { "camera", "speed" }, 30), speed = shared.GetOrDefault(CykaPersistentData.config, { "camera", "speed" }, 30),
}, },
spellQueue = { spellQueue = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "enabled" }, true), enabled = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "enabled" }, true),
queue = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "queue" }, 1), queue = shared.GetOrDefault(CykaPersistentData.config, { "spellQueue", "queue" }, 1),
}, },
autoloot = { autoloot = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "enabled" }, true), enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "enabled" }, true),
filter = { filter = {
gold = { gold = {
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "gold", "enabled" }, enabled = shared.GetOrDefault(
true), CykaPersistentData.config,
}, { "autoloot", "filter", "gold", "enabled" },
orderResource = { true
enabled = shared.GetOrDefault(CykaPersistentData.config, ),
{ "autoloot", "filter", "orderResource", "enabled" }, true), },
}, orderResource = {
mount = { enabled = shared.GetOrDefault(
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "mount", "enabled" }, CykaPersistentData.config,
true), { "autoloot", "filter", "orderResource", "enabled" },
}, true
ilvl = { ),
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "enabled" }, },
true), mount = {
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "value" }, 910), enabled = shared.GetOrDefault(
}, CykaPersistentData.config,
profession = { { "autoloot", "filter", "mount", "enabled" },
enabled = shared.GetOrDefault(CykaPersistentData.config, true
{ "autoloot", "filter", "profession", "enabled" }, true), ),
professions = shared.GetOrDefault(CykaPersistentData.config, },
{ "autoloot", "filter", "profession", "professions" }, ""), ilvl = {
}, enabled = shared.GetOrDefault(
value = { CykaPersistentData.config,
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "enabled" }, { "autoloot", "filter", "ilvl", "enabled" },
true), true
byStack = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "byStack" }, ),
false), value = shared.GetOrDefault(
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "value" }, CykaPersistentData.config,
10000), { "autoloot", "filter", "ilvl", "value" },
}, 910
greyvalue = { ),
enabled = shared.GetOrDefault(CykaPersistentData.config, },
{ "autoloot", "filter", "greyvalue", "enabled" }, true), profession = {
byStack = shared.GetOrDefault(CykaPersistentData.config, enabled = shared.GetOrDefault(
{ "autoloot", "filter", "greyvalue", "byStack" }, false), CykaPersistentData.config,
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "value" }, { "autoloot", "filter", "profession", "enabled" },
100000), true
}, ),
questItem = { professions = shared.GetOrDefault(
enabled = shared.GetOrDefault(CykaPersistentData.config, CykaPersistentData.config,
{ "autoloot", "filter", "questItem", "enabled" }, true), { "autoloot", "filter", "profession", "professions" },
}, ""
classGear = { ),
enabled = shared.GetOrDefault(CykaPersistentData.config, },
{ "autoloot", "filter", "classGear", "enabled" }, true), value = {
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, enabled = shared.GetOrDefault(
{ "autoloot", "filter", "classGear", "ilvlThreshold" }, 910), CykaPersistentData.config,
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "enabled" },
{ "autoloot", "filter", "classGear", "qualityThreshold" }, 3), true
}, ),
boe = { byStack = shared.GetOrDefault(
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "enabled" }, CykaPersistentData.config,
true), { "autoloot", "filter", "value", "byStack" },
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, false
{ "autoloot", "filter", "boe", "ilvlThreshold" }, 910), ),
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, value = shared.GetOrDefault(
{ "autoloot", "filter", "boe", "qualityThreshold" }, 3), CykaPersistentData.config,
}, { "autoloot", "filter", "value", "value" },
ap = { 10000
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ap", "enabled" }, ),
true), },
}, greyvalue = {
name = { enabled = shared.GetOrDefault(
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "enabled" }, CykaPersistentData.config,
false), { "autoloot", "filter", "greyvalue", "enabled" },
exact = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "exact" }, true
false), ),
caseSensitive = shared.GetOrDefault(CykaPersistentData.config, byStack = shared.GetOrDefault(
{ "autoloot", "filter", "name", "caseSensitive" }, false), CykaPersistentData.config,
whitelist = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "byStack" },
{ "autoloot", "filter", "name", "whitelist" }, ""), false
}, ),
everything = { value = shared.GetOrDefault(
enabled = shared.GetOrDefault(CykaPersistentData.config, CykaPersistentData.config,
{ "autoloot", "filter", "everything", "enabled" }, true), { "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.Autoloot.Init()
shared.CameraSettings.Init() shared.CameraSettings.Init()
shared.SpellQSettings.Init() shared.SpellQSettings.Init()
print("Cyka loaded!") print("Cyka loaded!")
end end
local loadedFrame = CreateFrame("Frame") local loadedFrame = CreateFrame("Frame")
loadedFrame:RegisterEvent("ADDON_LOADED") loadedFrame:RegisterEvent("ADDON_LOADED")
loadedFrame:SetScript("OnEvent", function(self, event, addonName) loadedFrame:SetScript("OnEvent", function(self, event, addonName)
if addonName == addonname then if addonName == addonname then
init() init()
end end
end) end)
local logoutFrame = CreateFrame("Frame") local logoutFrame = CreateFrame("Frame")
logoutFrame:RegisterEvent("PLAYER_LOGOUT") logoutFrame:RegisterEvent("PLAYER_LOGOUT")
logoutFrame:SetScript("OnEvent", function(self, event, ...) logoutFrame:SetScript("OnEvent", function(self, event, ...)
CykaPersistentData.config = shared.config CykaPersistentData.config = shared.config
end) end)

View File

@@ -13,7 +13,9 @@ function shared.SpellQSettings.Init()
end end
local function SetSpellQueue(window) local function SetSpellQueue(window)
if not window then return end if not window then
return
end
print("Spell queue window set to " .. tostring(window)) print("Spell queue window set to " .. tostring(window))
SetCVar("SpellQueueWindow", window) SetCVar("SpellQueueWindow", window)
end end
@@ -26,7 +28,9 @@ function shared.SpellQSettings.Init()
end) end)
SlashCmdList["SPELLQSETTINGS"] = function(window) SlashCmdList["SPELLQSETTINGS"] = function(window)
if window then shared.config.spellQueue.queue = window end if window then
shared.config.spellQueue.queue = window
end
SetSpellQueue(shared.config.spellQueue.queue) SetSpellQueue(shared.config.spellQueue.queue)
end end
SLASH_SPELLQSETTINGS1 = "/sq" SLASH_SPELLQSETTINGS1 = "/sq"

View File

@@ -9,4 +9,4 @@ aura_env.QualityColors = {
"E6CC80", "E6CC80",
"00CCFF", "00CCFF",
} }
aura_env.ttl = 3 aura_env.ttl = 3

View File

@@ -1,2 +1,2 @@
local foo = {1, 2, 3, 4} local foo = { 1, 2, 3, 4 }
print(table.contains(foo, 3)) print(table.contains(foo, 3))