Add stylua toml

This commit is contained in:
2025-05-04 14:27:32 +02:00
parent 21b6ecccd0
commit cbe7741954
6 changed files with 191 additions and 546 deletions

View File

@@ -19,29 +19,17 @@ local skills = {}
---@field value number ---@field value number
local NumberValue = { local NumberValue = {
---@param other number ---@param other number
Gt = function(self, other) Gt = function(self, other) return self.value > other end,
return self.value > other
end,
---@param other number ---@param other number
Lt = function(self, other) Lt = function(self, other) return self.value < other end,
return self.value < other
end,
---@param other number ---@param other number
Eq = function(self, other) Eq = function(self, other) return self.value == other end,
return self.value == other
end,
---@param other number ---@param other number
Ne = function(self, other) Ne = function(self, other) return self.value ~= other end,
return self.value ~= other
end,
---@param other number ---@param other number
Ge = function(self, other) Ge = function(self, other) return self.value >= other end,
return self.value >= other
end,
---@param other number ---@param other number
Le = function(self, other) Le = function(self, other) return self.value <= other end,
return self.value <= other
end,
} }
local function NewNumberValue(value) local function NewNumberValue(value)
local ret = { value = value } local ret = { value = value }
@@ -59,37 +47,21 @@ end
---@field value string ---@field value string
local StringValue = { local StringValue = {
---@param other string ---@param other string
Gt = function(self, other) Gt = function(self, other) return self.value > other end,
return self.value > other
end,
---@param other string ---@param other string
Lt = function(self, other) Lt = function(self, other) return self.value < other end,
return self.value < other
end,
---@param other string ---@param other string
Eq = function(self, other) Eq = function(self, other) return self.value == other end,
return self.value == other
end,
---@param other string ---@param other string
Ne = function(self, other) Ne = function(self, other) return self.value ~= other end,
return self.value ~= other
end,
---@param other string ---@param other string
Ge = function(self, other) Ge = function(self, other) return self.value >= other end,
return self.value >= other
end,
---@param other string ---@param other string
Le = function(self, other) Le = function(self, other) return self.value <= other end,
return self.value <= other
end,
---@param other string ---@param other string
Matches = function(self, other) Matches = function(self, other) return string.match(self.value, other) end,
return string.match(self.value, other)
end,
---@param other string ---@param other string
Contains = function(self, other) Contains = function(self, other) return string.find(self.value, other) end,
return string.find(self.value, other)
end,
} }
local function NewStringValue(value) local function NewStringValue(value)
local ret = { value = value } local ret = { value = value }
@@ -126,13 +98,9 @@ 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 if slot == nil then return ret, "slot is nil" end
return ret, "slot is nil"
end
local link = GetLootSlotLink(slot) local link = GetLootSlotLink(slot)
if link == nil then if link == nil then return ret, "link is nil" end
return ret, "link is nil"
end
ret.value = link ret.value = link
return ret, nil return ret, nil
end end
@@ -141,13 +109,9 @@ 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 if slot == nil then return ret, "slot is nil" end
return ret, "slot is nil"
end
local name = select(2, GetLootSlotInfo(slot)) local name = select(2, GetLootSlotInfo(slot))
if name == nil then if name == nil then return ret, "name is nil" end
return ret, "name is nil"
end
ret.value = name ret.value = name
return ret, nil return ret, nil
end end
@@ -156,13 +120,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if type == nil then return ret, "type is nil" end
return ret, "type is nil"
end
ret.value = type ret.value = type
return ret, nil return ret, nil
end end
@@ -171,13 +131,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if subType == nil then return ret, "subType is nil" end
return ret, "subType is nil"
end
ret.value = subType ret.value = subType
return ret, nil return ret, nil
end end
@@ -186,13 +142,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if itemLevel == nil then return ret, "itemLevel is nil" end
return ret, "itemLevel is nil"
end
ret.value = itemLevel ret.value = itemLevel
return ret, nil return ret, nil
end end
@@ -201,13 +153,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if itemValue == nil then return ret, "itemValue is nil" end
return ret, "itemValue is nil"
end
ret.value = itemValue ret.value = itemValue
return ret, nil return ret, nil
end end
@@ -216,13 +164,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if subclassId == nil then return ret, "subclassId is nil" end
return ret, "subclassId is nil"
end
ret.value = subclassId ret.value = subclassId
return ret, nil return ret, nil
end end
@@ -231,13 +175,9 @@ 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 if slot == nil then return ret, "slot is nil" end
return ret, "slot is nil"
end
local quantity = select(3, GetLootSlotInfo(slot)) local quantity = select(3, GetLootSlotInfo(slot))
if quantity == nil then if quantity == nil then return ret, "quantity is nil" end
return ret, "quantity is nil"
end
ret.value = quantity ret.value = quantity
return ret, nil return ret, nil
end end
@@ -246,13 +186,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if equipLocation == nil then return ret, "equipLocation is nil" end
return ret, "equipLocation is nil"
end
ret.value = equipLocation ret.value = equipLocation
return ret, nil return ret, nil
end end
@@ -261,13 +197,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if icon == nil then return ret, "icon is nil" end
return ret, "icon is nil"
end
ret.value = icon ret.value = icon
return ret, nil return ret, nil
end end
@@ -276,13 +208,9 @@ 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 if slot == nil then return ret, "slot is nil" end
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 if bindType == nil then return ret, "bindType is nil" end
return ret, "bindType is nil"
end
ret.value = bindType ret.value = bindType
return ret, nil return ret, nil
end end
@@ -291,13 +219,9 @@ 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 if slot == nil then return ret, "slot is nil" end
return ret, "slot is nil"
end
local quality = select(4, GetLootSlotInfo(slot)) local quality = select(4, GetLootSlotInfo(slot))
if quality == nil then if quality == nil then return ret, "quality is nil" end
return ret, "quality is nil"
end
ret.value = quality ret.value = quality
return ret, nil return ret, nil
end end
@@ -311,9 +235,7 @@ 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 if not shared.config.autoloot.filter.gold.enabled then return false end
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,
@@ -321,40 +243,30 @@ function shared.Autoloot.Init()
---@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 if not shared.config.autoloot.filter.orderResource.enabled then return false end
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 if not shared.config.autoloot.filter.mount.enabled then return false end
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 if not shared.config.autoloot.filter.ilvl.enabled then return false end
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 if not shared.config.autoloot.filter.profession.enabled then return false end
return false
end
local type = Type(slot) local type = Type(slot)
if not type:Eq("Tradeskill") then if not type:Eq("Tradeskill") then return false end
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
@@ -363,69 +275,49 @@ function shared.Autoloot.Init()
---@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 if not shared.config.autoloot.filter.value.enabled then return false end
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 end
value = value * Quantity(slot).value
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 if not shared.config.autoloot.filter.greyvalue.enabled then return false end
return false
end
local quality = Quality(slot) local quality = Quality(slot)
if not quality:Eq(0) then if not quality:Eq(0) then return false end
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 end
value = value * Quantity(slot).value
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 if not shared.config.autoloot.filter.questItem.enabled then return false end
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 if not shared.config.autoloot.filter.classGear.enabled then return false end
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 if not isEquippable then return false end
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 if not shared.config.autoloot.filter.name.enabled then return false end
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 if not shared.config.autoloot.filter.name.caseSensitive then name = name:lower() end
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
@@ -440,9 +332,7 @@ function shared.Autoloot.Init()
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 if not shared.config.autoloot.filter.boe.enabled then return false end
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
@@ -457,9 +347,7 @@ function shared.Autoloot.Init()
---@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 if not shared.config.autoloot.filter.ap.enabled then return false end
return false
end
return Value(slot):Eq(0) return Value(slot):Eq(0)
and Type(slot):Eq("Consumable") and Type(slot):Eq("Consumable")
and SubType(slot):Eq("Other") and SubType(slot):Eq("Other")
@@ -469,9 +357,7 @@ function shared.Autoloot.Init()
---@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 if not shared.config.autoloot.filter.everything.enabled then return false end
return false
end
return true return true
end, end,
} }

View File

@@ -206,132 +206,88 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetTimestamp = function(...) GetTimestamp = function(...)
local val = select(CLEUEventInfo["GENERIC"]["timestamp"], ...) local val = select(CLEUEventInfo["GENERIC"]["timestamp"], ...)
if val == nil then if val == nil then return 0, "Timestamp is nil or missing" end
return 0, "Timestamp is nil or missing" if type(val) ~= "number" then return 0, "Timestamp is not a number" end
end
if type(val) ~= "number" then
return 0, "Timestamp is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSubevent = function(...) GetSubevent = function(...)
local val = select(CLEUEventInfo["GENERIC"]["subevent"], ...) local val = select(CLEUEventInfo["GENERIC"]["subevent"], ...)
if val == nil then if val == nil then return "", "Subevent is nil or missing" end
return "", "Subevent is nil or missing" if type(val) ~= "string" then return "", "Subevent is not a string" end
end
if type(val) ~= "string" then
return "", "Subevent is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return boolean, nil|string ---@return boolean, nil|string
GetHideCaster = function(...) GetHideCaster = function(...)
local val = select(CLEUEventInfo["GENERIC"]["hideCaster"], ...) local val = select(CLEUEventInfo["GENERIC"]["hideCaster"], ...)
if val == nil then if val == nil then return false, "HideCaster is nil or missing" end
return false, "HideCaster is nil or missing" if type(val) ~= "boolean" then return false, "HideCaster is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "HideCaster is not a boolean"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSourceGUID = function(...) GetSourceGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceGUID"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceGUID"], ...)
if val == nil then if val == nil then return "", "SourceGUID is nil or missing" end
return "", "SourceGUID is nil or missing" if type(val) ~= "string" then return "", "SourceGUID is not a string" end
end
if type(val) ~= "string" then
return "", "SourceGUID is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSourceName = function(...) GetSourceName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceName"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceName"], ...)
if val == nil then if val == nil then return "", "SourceName is nil or missing" end
return "", "SourceName is nil or missing" if type(val) ~= "string" then return "", "SourceName is not a string" end
end
if type(val) ~= "string" then
return "", "SourceName is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSourceFlags = function(...) GetSourceFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceFlags"], ...)
if val == nil then if val == nil then return 0, "SourceFlags is nil or missing" end
return 0, "SourceFlags is nil or missing" if type(val) ~= "number" then return 0, "SourceFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "SourceFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSourceRaidFlags = function(...) GetSourceRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceRaidFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceRaidFlags"], ...)
if val == nil then if val == nil then return 0, "SourceRaidFlags is nil or missing" end
return 0, "SourceRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "SourceRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "SourceRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetDestGUID = function(...) GetDestGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destGUID"], ...) local val = select(CLEUEventInfo["GENERIC"]["destGUID"], ...)
if val == nil then if val == nil then return "", "DestGUID is nil or missing" end
return "", "DestGUID is nil or missing" if type(val) ~= "string" then return "", "DestGUID is not a string" end
end
if type(val) ~= "string" then
return "", "DestGUID is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetDestName = function(...) GetDestName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destName"], ...) local val = select(CLEUEventInfo["GENERIC"]["destName"], ...)
if val == nil then if val == nil then return "", "DestName is nil or missing" end
return "", "DestName is nil or missing" if type(val) ~= "string" then return "", "DestName is not a string" end
end
if type(val) ~= "string" then
return "", "DestName is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetDestFlags = function(...) GetDestFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["destFlags"], ...)
if val == nil then if val == nil then return 0, "DestFlags is nil or missing" end
return 0, "DestFlags is nil or missing" if type(val) ~= "number" then return 0, "DestFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "DestFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetDestRaidFlags = function(...) GetDestRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destRaidFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["destRaidFlags"], ...)
if val == nil then if val == nil then return 0, "DestRaidFlags is nil or missing" end
return 0, "DestRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "DestRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "DestRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -346,12 +302,8 @@ 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 if val == nil then return 0, "SpellId is nil or missing" end
return 0, "SpellId is nil or missing" if type(val) ~= "number" then return 0, "SpellId is not a number" end
end
if type(val) ~= "number" then
return 0, "SpellId is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -365,12 +317,8 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetSpellName = function(...) GetSpellName = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellName"], ...) local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellName"], ...)
if val == nil then if val == nil then return "", "SpellName is nil or missing" end
return "", "SpellName is nil or missing" if type(val) ~= "string" then return "", "SpellName is not a string" end
end
if type(val) ~= "string" then
return "", "SpellName is not a string"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -384,12 +332,8 @@ local function Init()
---@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" end
return 0, "SpellSchool is nil or missing" if type(val) ~= "number" then return 0, "SpellSchool is not a number" end
end
if type(val) ~= "number" then
return 0, "SpellSchool is not a number"
end
return val, nil return val, nil
end, end,
@@ -419,16 +363,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetAmount = function(...) GetAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amount"], ...) local val = select(CLEUEventInfo[subevent]["amount"], ...)
if val == nil then if val == nil then return 0, "Amount is nil or missing" end
return 0, "Amount is nil or missing" if type(val) ~= "number" then return 0, "Amount is not a number" end
end
if type(val) ~= "number" then
return 0, "Amount is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -448,22 +386,12 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverkill = function(...) GetOverkill = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err) if not CLEUEventInfo[subevent] then return 0, "Subevent is not a valid event" end
end if not CLEUEventInfo[subevent]["overkill"] then return 0, "Overkill is nil or missing" end
if not CLEUEventInfo[subevent] then
return 0, "Subevent is not a valid event"
end
if not CLEUEventInfo[subevent]["overkill"] then
return 0, "Overkill is nil or missing"
end
local val = select(CLEUEventInfo[subevent]["overkill"], ...) local val = select(CLEUEventInfo[subevent]["overkill"], ...)
if val == nil then if val == nil then return 0, "Overkill is nil or missing" end
return 0, "Overkill is nil or missing" if type(val) ~= "number" then return 0, "Overkill is not a number" end
end
if type(val) ~= "number" then
return 0, "Overkill is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -483,16 +411,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetSchool = function(...) GetSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["school"], ...) local val = select(CLEUEventInfo[subevent]["school"], ...)
if val == nil then if val == nil then return 0, "School is nil or missing" end
return 0, "School is nil or missing" if type(val) ~= "number" then return 0, "School is not a number" end
end
if type(val) ~= "number" then
return 0, "School is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -514,16 +436,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetResisted = function(...) GetResisted = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["resisted"], ...) local val = select(CLEUEventInfo[subevent]["resisted"], ...)
if val == nil then if val == nil then return false, "Resisted is nil or missing" end
return false, "Resisted is nil or missing" if type(val) ~= "boolean" then return false, "Resisted is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Resisted is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -545,16 +461,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetBlocked = function(...) GetBlocked = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["blocked"], ...) local val = select(CLEUEventInfo[subevent]["blocked"], ...)
if val == nil then if val == nil then return false, "Blocked is nil or missing" end
return false, "Blocked is nil or missing" if type(val) ~= "boolean" then return false, "Blocked is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Blocked is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -577,16 +487,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetAbsorbed = function(...) GetAbsorbed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbed"], ...) local val = select(CLEUEventInfo[subevent]["absorbed"], ...)
if val == nil then if val == nil then return false, "Absorbed is nil or missing" end
return false, "Absorbed is nil or missing" if type(val) ~= "boolean" then return false, "Absorbed is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Absorbed is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -608,16 +512,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetCritical = function(...) GetCritical = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["critical"], ...) local val = select(CLEUEventInfo[subevent]["critical"], ...)
if val == nil then if val == nil then return false, "Critical is nil or missing" end
return false, "Critical is nil or missing" if type(val) ~= "boolean" then return false, "Critical is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Critical is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -637,16 +535,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetGlancing = function(...) GetGlancing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["glancing"], ...) local val = select(CLEUEventInfo[subevent]["glancing"], ...)
if val == nil then if val == nil then return false, "Glancing is nil or missing" end
return false, "Glancing is nil or missing" if type(val) ~= "boolean" then return false, "Glancing is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Glancing is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -666,16 +558,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetCrushing = function(...) GetCrushing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["crushing"], ...) local val = select(CLEUEventInfo[subevent]["crushing"], ...)
if val == nil then if val == nil then return false, "Crushing is nil or missing" end
return false, "Crushing is nil or missing" if type(val) ~= "boolean" then return false, "Crushing is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Crushing is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -696,16 +582,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetIsOffHand = function(...) GetIsOffHand = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["isOffHand"], ...) local val = select(CLEUEventInfo[subevent]["isOffHand"], ...)
if val == nil then if val == nil then return false, "IsOffHand is nil or missing" end
return false, "IsOffHand is nil or missing" if type(val) ~= "boolean" then return false, "IsOffHand is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "IsOffHand is not a boolean"
end
return val, nil return val, nil
end, end,
@@ -728,16 +608,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetMissType = function(...) GetMissType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "", string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["missType"], ...) local val = select(CLEUEventInfo[subevent]["missType"], ...)
if val == nil then if val == nil then return "", "MissType is nil or missing" end
return "", "MissType is nil or missing" if type(val) ~= "string" then return "", "MissType is not a string" end
end
if type(val) ~= "string" then
return "", "MissType is not a string"
end
return val, nil return val, nil
end, end,
@@ -760,16 +634,10 @@ local function Init()
--- return type is unconfirmed! --- return type is unconfirmed!
GetAmountMissed = function(...) GetAmountMissed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amountMissed"], ...) local val = select(CLEUEventInfo[subevent]["amountMissed"], ...)
if val == nil then if val == nil then return 0, "AmountMissed is nil or missing" end
return 0, "AmountMissed is nil or missing" if type(val) ~= "number" then return 0, "AmountMissed is not a number" end
end
if type(val) ~= "number" then
return 0, "AmountMissed is not a number"
end
return val, nil return val, nil
end, end,
@@ -792,16 +660,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverhealing = function(...) GetOverhealing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overhealing"], ...) local val = select(CLEUEventInfo[subevent]["overhealing"], ...)
if val == nil then if val == nil then return 0, "Overhealing is nil or missing" end
return 0, "Overhealing is nil or missing" if type(val) ~= "number" then return 0, "Overhealing is not a number" end
end
if type(val) ~= "number" then
return 0, "Overhealing is not a number"
end
return val, nil return val, nil
end, end,
@@ -822,16 +684,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraGUID = function(...) GetExtraGUID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "", string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraGUID"], ...) local val = select(CLEUEventInfo[subevent]["extraGUID"], ...)
if val == nil then if val == nil then return "", "ExtraGUID is nil or missing" end
return "", "ExtraGUID is nil or missing" if type(val) ~= "string" then return "", "ExtraGUID is not a string" end
end
if type(val) ~= "string" then
return "", "ExtraGUID is not a string"
end
return val, nil return val, nil
end, end,
@@ -852,16 +708,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraName = function(...) GetExtraName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "", string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraName"], ...) local val = select(CLEUEventInfo[subevent]["extraName"], ...)
if val == nil then if val == nil then return "", "ExtraName is nil or missing" end
return "", "ExtraName is nil or missing" if type(val) ~= "string" then return "", "ExtraName is not a string" end
end
if type(val) ~= "string" then
return "", "ExtraName is not a string"
end
return val, nil return val, nil
end, end,
@@ -882,16 +732,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraFlags = function(...) GetExtraFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraFlags"], ...)
if val == nil then if val == nil then return 0, "ExtraFlags is nil or missing" end
return 0, "ExtraFlags is nil or missing" if type(val) ~= "number" then return 0, "ExtraFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -912,16 +756,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraRaidFlags = function(...) GetExtraRaidFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...)
if val == nil then if val == nil then return 0, "ExtraRaidFlags is nil or missing" end
return 0, "ExtraRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "ExtraRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -946,16 +784,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSpellID = function(...) GetExtraSpellID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...)
if val == nil then if val == nil then return 0, "ExtraSpellID is nil or missing" end
return 0, "ExtraSpellID is nil or missing" if type(val) ~= "number" then return 0, "ExtraSpellID is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSpellID is not a number"
end
return val, nil return val, nil
end, end,
@@ -981,16 +813,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraSpellName = function(...) GetExtraSpellName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "", string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...)
if val == nil then if val == nil then return "", "extraSpellName is nil or missing" end
return "", "extraSpellName is nil or missing" if type(val) ~= "string" then return "", "extraSpellName is not a string" end
end
if type(val) ~= "string" then
return "", "extraSpellName is not a string"
end
return val, nil return val, nil
end, end,
@@ -1016,16 +842,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSchool = function(...) GetExtraSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSchool"], ...) local val = select(CLEUEventInfo[subevent]["extraSchool"], ...)
if val == nil then if val == nil then return 0, "ExtraSchool is nil or missing" end
return 0, "ExtraSchool is nil or missing" if type(val) ~= "number" then return 0, "ExtraSchool is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSchool is not a number"
end
return val, nil return val, nil
end, end,
@@ -1046,16 +866,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetAbsorbedAmount = function(...) GetAbsorbedAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...) local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...)
if val == nil then if val == nil then return 0, "AbsorbedAmount is nil or missing" end
return 0, "AbsorbedAmount is nil or missing" if type(val) ~= "number" then return 0, "AbsorbedAmount is not a number" end
end
if type(val) ~= "number" then
return 0, "AbsorbedAmount is not a number"
end
return val, nil return val, nil
end, end,
@@ -1076,16 +890,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverEnergize = function(...) GetOverEnergize = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overEnergize"], ...) local val = select(CLEUEventInfo[subevent]["overEnergize"], ...)
if val == nil then if val == nil then return 0, "OverEnergize is nil or missing" end
return 0, "OverEnergize is nil or missing" if type(val) ~= "number" then return 0, "OverEnergize is not a number" end
end
if type(val) ~= "number" then
return 0, "OverEnergize is not a number"
end
return val, nil return val, nil
end, end,
@@ -1110,16 +918,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetPowerType = function(...) GetPowerType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["powerType"], ...) local val = select(CLEUEventInfo[subevent]["powerType"], ...)
if val == nil then if val == nil then return 0, "PowerType is nil or missing" end
return 0, "PowerType is nil or missing" if type(val) ~= "number" then return 0, "PowerType is not a number" end
end
if type(val) ~= "number" then
return 0, "PowerType is not a number"
end
return val, nil return val, nil
end, end,
@@ -1141,16 +943,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraAmount = function(...) GetExtraAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraAmount"], ...) local val = select(CLEUEventInfo[subevent]["extraAmount"], ...)
if val == nil then if val == nil then return 0, "ExtraAmount is nil or missing" end
return 0, "ExtraAmount is nil or missing" if type(val) ~= "number" then return 0, "ExtraAmount is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraAmount is not a number"
end
return val, nil return val, nil
end, end,
@@ -1179,16 +975,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSpellId = function(...) GetExtraSpellId = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...)
if val == nil then if val == nil then return 0, "ExtraSpellId is nil or missing" end
return 0, "ExtraSpellId is nil or missing" if type(val) ~= "number" then return 0, "ExtraSpellId is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSpellId is not a number"
end
return val, nil return val, nil
end, end,
@@ -1217,16 +1007,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraAuraType = function(...) GetExtraAuraType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["auraType"], ...) local val = select(CLEUEventInfo[subevent]["auraType"], ...)
if val == nil then if val == nil then return 0, "AuraType is nil or missing" end
return 0, "AuraType is nil or missing" if type(val) ~= "number" then return 0, "AuraType is not a number" end
end
if type(val) ~= "number" then
return 0, "AuraType is not a number"
end
return val, nil return val, nil
end, end,
} }
@@ -1236,7 +1020,5 @@ local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("GUILD_ROSTER_UPDATE") frame:RegisterEvent("GUILD_ROSTER_UPDATE")
frame:SetScript("OnEvent", function(self, event, ...) frame:SetScript("OnEvent", function(self, event, ...) Init() end)
Init()
end)
Init() Init()

View File

@@ -15,9 +15,7 @@ function shared.CameraSettings.Init()
end end
local function SetCameraSpeed(speed) local function SetCameraSpeed(speed)
if not speed then if not speed then return end
return
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)
@@ -117,14 +115,10 @@ function shared.CameraSettings.Init()
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) end)
SetCameraSpeed(shared.config.camera.speed)
end)
SlashCmdList["CAMERASETTINGS"] = function(speed) SlashCmdList["CAMERASETTINGS"] = function(speed)
if speed then if speed then shared.config.camera.speed = speed end
shared.config.camera.speed = speed
end
SetCameraSpeed(shared.config.camera.speed) SetCameraSpeed(shared.config.camera.speed)
end end
SLASH_CAMERASETTINGS1 = "/cs" SLASH_CAMERASETTINGS1 = "/cs"

View File

@@ -43,21 +43,13 @@ local addonname, shared = ...
---@field everything { enabled: boolean } ---@field everything { enabled: boolean }
local function init() local function init()
if not CykaPersistentData then if not CykaPersistentData then CykaPersistentData = {} end
CykaPersistentData = {} if not CykaPersistentData.config then CykaPersistentData.config = {} end
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 if not table then return value end
return value if not keys then return value end
end
if not keys then
return value
end
local traverse = table local traverse = table
for i = 1, #keys do for i = 1, #keys do
@@ -68,9 +60,7 @@ local function init()
break break
end end
if i == #keys then if i == #keys then value = traverse end
value = traverse
end
end end
return value return value
end end
@@ -82,9 +72,7 @@ local function init()
print(tostring(table)) print(tostring(table))
return return
end end
if depth == nil then if depth == nil then depth = 0 end
depth = 0
end
if depth > 200 then if depth > 200 then
print("Error: Depth > 200 in dumpTable()") print("Error: Depth > 200 in dumpTable()")
return return
@@ -103,9 +91,7 @@ local function init()
---@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 if v == value then return true end
return true
end
end end
return false return false
end end
@@ -293,9 +279,7 @@ local loaded = 0
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() end
init()
end
end) end)
local ticker local ticker
@@ -303,13 +287,9 @@ ticker = C_Timer.NewTicker(1, function()
-- IT JUST WONT FUCKING RUN JUST FUCKING RUN THE FUCKING FUNCTION GOD DAMN IT -- IT JUST WONT FUCKING RUN JUST FUCKING RUN THE FUCKING FUNCTION GOD DAMN IT
loaded = loaded + 1 loaded = loaded + 1
init() init()
if loaded > 100 then if loaded > 100 then ticker:Cancel() end
ticker:Cancel()
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 end)
CykaPersistentData.config = shared.config
end)

View File

@@ -13,9 +13,7 @@ function shared.SpellQSettings.Init()
end end
local function SetSpellQueue(window) local function SetSpellQueue(window)
if not window then if not window then return end
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
@@ -23,14 +21,10 @@ function shared.SpellQSettings.Init()
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, ...) SetSpellQueue(shared.config.spellQueue.queue) end)
SetSpellQueue(shared.config.spellQueue.queue)
end)
SlashCmdList["SPELLQSETTINGS"] = function(window) SlashCmdList["SPELLQSETTINGS"] = function(window)
if window then if window then shared.config.spellQueue.queue = window end
shared.config.spellQueue.queue = window
end
SetSpellQueue(shared.config.spellQueue.queue) SetSpellQueue(shared.config.spellQueue.queue)
end end
SLASH_SPELLQSETTINGS1 = "/sq" SLASH_SPELLQSETTINGS1 = "/sq"

9
stylua.toml Normal file
View File

@@ -0,0 +1,9 @@
syntax = "All" # Specify a disambiguation for the style of Lua syntax being formatted. Possible options: All (default), Lua51, Lua52, Lua53, Lua54, LuaJIT, Luau, CfxLua
column_width = 120 # Approximate line length for printing. Used as a guide for line wrapping - this is not a hard requirement: lines may fall under or over the limit.
line_endings = "Unix" # Line endings type. Possible options: Unix (LF) or Windows (CRLF)
indent_type = "Tabs" # Indent type. Possible options: Tabs or Spaces
indent_width = 4 # Character size of single indentation. If indent_type is set to Tabs, this option is used as a heuristic to determine column width only.
quote_style = "AutoPreferDouble" # Quote style for string literals. Possible options: AutoPreferDouble, AutoPreferSingle, ForceDouble, ForceSingle. AutoPrefer styles will prefer the specified quote style, but fall back to the alternative if it has fewer string escapes. Force styles always use the specified style regardless of escapes.
call_parentheses = "Always" # Whether parentheses should be applied on function calls with a single string/table argument. Possible options: Always, NoSingleString, NoSingleTable, None, Input. Always applies parentheses in all cases. NoSingleString omits parentheses on calls with a single string argument. Similarly, NoSingleTable omits parentheses on calls with a single table argument. None omits parentheses in both cases. Note: parentheses are still kept in situations where removal can lead to obscurity (e.g. foo "bar".setup -> foo("bar").setup, since the index is on the call result, not the string). Input removes all automation and preserves parentheses only if they were present in input code: consistency is not enforced.
space_after_function_names = "Never" # Specify whether to add a space between the function name and parentheses. Possible options: Never, Definitions, Calls, or Always
collapse_simple_statement = "Always" # Specify whether to collapse simple statements. Possible options: Never, FunctionOnly, ConditionalOnly, or Always