Files
wow-weakauras/WeakAuras/Projects/_Shared/CLEUParser.lua

1284 lines
34 KiB
Lua

---PLAYER_ENTERING_WORLD GUILD_ROSTER_UPDATE
function()
CLEUEventInfo = {
["GENERIC"] = {
["timestamp"] = 1,
["subevent"] = 2,
["hideCaster"] = 3,
["sourceGUID"] = 4,
["sourceName"] = 5,
["sourceFlags"] = 6,
["sourceRaidFlags"] = 7,
["destGUID"] = 8,
["destName"] = 9,
["destFlags"] = 10,
["destRaidFlags"] = 11
},
["GENERIC_SPELL"] = {
["spellId"] = 12,
["spellName"] = 13,
["spellSchool"] = 14
},
["GENERIC_DAMAGE"] = {
["amount"] = 15,
["overkill"] = 16,
["school"] = 17,
["resisted"] = 18,
["blocked"] = 19,
["absorbed"] = 20,
["critical"] = 21,
["glancing"] = 22,
["crushing"] = 23,
["isOffHand"] = 24
},
["GENERIC_MISSED"] = {
["missType"] = 15,
["isOffHand"] = 16,
["amountMissed"] = 17,
["critical"] = 18
},
["GENERIC_HEAL"] = {
["amount"] = 15,
["overhealing"] = 16,
["absorbed"] = 17,
["critical"] = 18
},
["GENERIC_HEAL_ABSORBED"] = {
["extraGUID"] = 15,
["extraName"] = 17,
["extraFlags"] = 17,
["extraRaidFlags"] = 18,
["extraSpellID"] = 19,
["extraSpellName"] = 20,
["extraSchool"] = 21,
["absorbedAmount"] = 22,
["totalAmount"] = 23
},
["GENERIC_ENERGIZE"] = {
["amount"] = 15,
["overEnergize"] = 16,
["powerType"] = 17
},
["GENERIC_DRAIN"] = {
["amount"] = 15,
["powerType"] = 16,
["extraAmount"] = 17
},
["GENERIC_LEECH"] = {
["amount"] = 15,
["powerType"] = 16,
["extraAmount"] = 17
},
["GENERIC_INTERRUPT"] = {
["extraSpellId"] = 15,
["extraSpellName"] = 16,
["extraSchool"] = 17
},
["GENERIC_DISPEL"] = {
["extraSpellId"] = 15,
["extraSpellName"] = 16,
["extraSchool"] = 17,
["auraType"] = 18
},
["GENERIC_DISPEL_FAILED"] = {
["extraSpellId"] = 15,
["extraSpellName"] = 16,
["extraSchool"] = 17
},
["GENERIC_STOLEN"] = {
["extraSpellId"] = 15,
["extraSpellName"] = 16,
["extraSchool"] = 17,
["auraType"] = 18
},
["GENERIC_EXTRA_ATTACKS"] = { ["amount"] = 15 },
["GENERIC_AURA_APPLIED"] = { ["auraType"] = 15, ["amount"] = 16 },
["GENERIC_AURA_REMOVED"] = { ["auraType"] = 15, ["amount"] = 16 },
["GENERIC_AURA_APPLIED_DOSE"] = { ["auraType"] = 15, ["amount"] = 16 },
["GENERIC_AURA_REMOVED_DOSE"] = { ["auraType"] = 15, ["amount"] = 16 },
["GENERIC_AURA_REFRESH"] = { ["auraType"] = 15 },
["GENERIC_AURA_BROKEN"] = { ["auraType"] = 15 },
["GENERIC_AURA_BROKEN_SPELL"] = {
["extraSpellId"] = 15,
["extraSpellName"] = 16,
["extraSchool"] = 17,
["auraType"] = 18
},
["GENERIC_CAST_START"] = {},
["GENERIC_CAST_SUCCESS"] = {},
["GENERIC_CAST_FAILED"] = {}
}
CLEUEventInfo["SWING_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SWING_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SWING_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SWING_HEAL_ABSORBED"] =
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SWING_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SWING_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SWING_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SWING_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SWING_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SWING_DISPEL_FAILED"] =
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SWING_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SWING_EXTRA_ATTACKS"] =
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SWING_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SWING_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SWING_AURA_APPLIED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["SWING_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SWING_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SWING_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SWING_AURA_BROKEN_SPELL"] =
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SWING_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SWING_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SWING_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
CLEUEventInfo["RANGE_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["RANGE_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["RANGE_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["RANGE_HEAL_ABSORBED"] =
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["RANGE_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["RANGE_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["RANGE_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["RANGE_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["RANGE_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["RANGE_DISPEL_FAILED"] =
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["RANGE_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["RANGE_EXTRA_ATTACKS"] =
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["RANGE_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["RANGE_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["RANGE_AURA_APPLIED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["RANGE_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["RANGE_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["RANGE_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["RANGE_AURA_BROKEN_SPELL"] =
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["RANGE_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["RANGE_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["RANGE_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
CLEUEventInfo["SPELL_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_HEAL_ABSORBED"] =
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_DISPEL_FAILED"] =
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_EXTRA_ATTACKS"] =
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SPELL_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SPELL_AURA_APPLIED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["SPELL_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SPELL_AURA_BROKEN_SPELL"] =
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SPELL_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
CLEUEventInfo["SPELL_PERIODIC_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_PERIODIC_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_PERIODIC_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_PERIODIC_HEAL_ABSORBED"] =
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_PERIODIC_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_PERIODIC_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_PERIODIC_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_PERIODIC_INTERRUPT"] =
CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL_FAILED"] =
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_PERIODIC_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_PERIODIC_EXTRA_ATTACKS"] =
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED"] =
CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED"] =
CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REFRESH"] =
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
CLEUParser = {
---@param ... any
---@return number, nil|string
GetTimestamp = function(...)
local val = select(CLEUEventInfo["GENERIC"]["timestamp"], ...)
if val == nil then
return 0, "Timestamp is nil or missing"
end
if type(val) ~= "number" then
return 0, "Timestamp is not a number"
end
return val, nil
end,
---@param ... any
---@return string, nil|string
GetSubevent = function(...)
local val = select(CLEUEventInfo["GENERIC"]["subevent"], ...)
if val == nil then
return "", "Subevent is nil or missing"
end
if type(val) ~= "string" then
return "", "Subevent is not a string"
end
return val, nil
end,
---@param ... any
---@return boolean, nil|string
GetHideCaster = function(...)
local val = select(CLEUEventInfo["GENERIC"]["hideCaster"], ...)
if val == nil then
return false, "HideCaster is nil or missing"
end
if type(val) ~= "boolean" then
return false, "HideCaster is not a boolean"
end
return val, nil
end,
---@param ... any
---@return string, nil|string
GetSourceGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceGUID"], ...)
if val == nil then
return "", "SourceGUID is nil or missing"
end
if type(val) ~= "string" then
return "", "SourceGUID is not a string"
end
return val, nil
end,
---@param ... any
---@return string, nil|string
GetSourceName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceName"], ...)
if val == nil then
return "", "SourceName is nil or missing"
end
if type(val) ~= "string" then
return "", "SourceName is not a string"
end
return val, nil
end,
---@param ... any
---@return number, nil|string
GetSourceFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceFlags"], ...)
if val == nil then
return 0, "SourceFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "SourceFlags is not a number"
end
return val, nil
end,
---@param ... any
---@return number, nil|string
GetSourceRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceRaidFlags"], ...)
if val == nil then
return 0, "SourceRaidFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "SourceRaidFlags is not a number"
end
return val, nil
end,
---@param ... any
---@return string, nil|string
GetDestGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destGUID"], ...)
if val == nil then
return "", "DestGUID is nil or missing"
end
if type(val) ~= "string" then
return "", "DestGUID is not a string"
end
return val, nil
end,
---@param ... any
---@return string, nil|string
GetDestName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destName"], ...)
if val == nil then
return "", "DestName is nil or missing"
end
if type(val) ~= "string" then
return "", "DestName is not a string"
end
return val, nil
end,
---@param ... any
---@return number, nil|string
GetDestFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destFlags"], ...)
if val == nil then
return 0, "DestFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "DestFlags is not a number"
end
return val, nil
end,
---@param ... any
---@return number, nil|string
GetDestRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destRaidFlags"], ...)
if val == nil then
return 0, "DestRaidFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "DestRaidFlags is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---@param ... any
---@return number, nil|string
GetSpellId = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellId"], ...)
if val == nil then return 0, "SpellId is nil or missing" end
if type(val) ~= "number" then
return 0, "SpellId is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---@param ... any
---@return string, nil|string
GetSpellName = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellName"], ...)
if val == nil then
return "", "SpellName is nil or missing"
end
if type(val) ~= "string" then
return "", "SpellName is not a string"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---@param ... any
---@return number, nil|string
GetSpellSchool = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellSchool"],
...)
if val == nil then
return 0, "SpellSchool is nil or missing"
end
if type(val) ~= "number" then
return 0, "SpellSchool is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
--- |_HEAL|
--- |_ENERGIZE|
--- |_DRAIN|
--- |_LEECH|
--- |_EXTRA_ATTACKS|
--- |_AURA_APPLIED|
--- |_AURA_REMOVED|
--- |_AURA_APPLIED_DOSE|
--- |_AURA_REMOVED_DOSE|
---@param ... any
---@return number, nil|string
GetAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amount"], ...)
if val == nil then return 0, "Amount is nil or missing" end
if type(val) ~= "number" then
return 0, "Amount is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---@param ... any
---@return number, nil|string
GetOverkill = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
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"], ...)
if val == nil then return 0, "Overkill is nil or missing" end
if type(val) ~= "number" then
return 0, "Overkill is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---@param ... any
---@return number, nil|string
GetSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["school"], ...)
if val == nil then return 0, "School is nil or missing" end
if type(val) ~= "number" then
return 0, "School is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---
--- Apparently this is allowed to be nil?
---@param ... any
---@return boolean, nil|string
GetResisted = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["resisted"], ...)
if val == nil then
return false, "Resisted is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Resisted is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---
--- Apparently this is allowed to be nil?
---@param ... any
---@return boolean, nil|string
GetBlocked = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["blocked"], ...)
if val == nil then
return false, "Blocked is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Blocked is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
--- |_HEAL|
---
--- Apparently this is allowed to be nil?
---@param ... any
---@return boolean, nil|string
GetAbsorbed = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbed"], ...)
if val == nil then
return false, "Absorbed is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Absorbed is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
--- |_MISSED|
--- |_HEAL|
---@param ... any
---@return boolean, nil|string
GetCritical = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["critical"], ...)
if val == nil then
return false, "Critical is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Critical is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---@param ... any
---@return boolean, nil|string
GetGlancing = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["glancing"], ...)
if val == nil then
return false, "Glancing is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Glancing is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
---@param ... any
---@return boolean, nil|string
GetCrushing = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["crushing"], ...)
if val == nil then
return false, "Crushing is nil or missing"
end
if type(val) ~= "boolean" then
return false, "Crushing is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DAMAGE|
--- |_MISSED|
---@param ... any
---@return boolean, nil|string
GetIsOffHand = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["isOffHand"], ...)
if val == nil then
return false, "IsOffHand is nil or missing"
end
if type(val) ~= "boolean" then
return false, "IsOffHand is not a boolean"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_MISSED|
---
--- return type is unconfirmed!
---@param ... any
---@return string, nil|string
GetMissType = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["missType"], ...)
if val == nil then
return "", "MissType is nil or missing"
end
if type(val) ~= "string" then
return "", "MissType is not a string"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_MISSED|
---@param ... any
---@return number, nil|string
---
--- return type is unconfirmed!
GetAmountMissed = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amountMissed"], ...)
if val == nil then
return 0, "AmountMissed is nil or missing"
end
if type(val) ~= "number" then
return 0, "AmountMissed is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL|
---
--- return type is unconfirmed!
---@param ... any
---@return number, nil|string
GetOverhealing = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overhealing"], ...)
if val == nil then
return 0, "Overhealing is nil or missing"
end
if type(val) ~= "number" then
return 0, "Overhealing is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---@param ... any
---@return string, nil|string
GetExtraGUID = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraGUID"], ...)
if val == nil then
return "", "ExtraGUID is nil or missing"
end
if type(val) ~= "string" then
return "", "ExtraGUID is not a string"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---@param ... any
---@return string, nil|string
GetExtraName = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraName"], ...)
if val == nil then
return "", "ExtraName is nil or missing"
end
if type(val) ~= "string" then
return "", "ExtraName is not a string"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---@param ... any
---@return number, nil|string
GetExtraFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraFlags"], ...)
if val == nil then
return 0, "ExtraFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraFlags is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---@param ... any
---@return number, nil|string
GetExtraRaidFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...)
if val == nil then
return 0, "ExtraRaidFlags is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraRaidFlags is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---
--- WARNING! Different from "GetExtraSpellId" (capital ID!)<br>
--- This is the doing of Blizzard, not me.<br>
---@see CLEUParser.GetExtraSpellId
---@param ... any
---@return number, nil|string
GetExtraSpellID = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...)
if val == nil then
return 0, "ExtraSpellID is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraSpellID is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
--- |_INTERRUPT|
--- |_DISPEL|
--- |_DISPEL_FAILED|
--- |_STOLEN|
--- |_AURA_BROKEN_SPELL|
---@param ... any
---@return string, nil|string
GetExtraSpellName = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...)
if val == nil then
return "", "extraSpellName is nil or missing"
end
if type(val) ~= "string" then
return "", "extraSpellName is not a string"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
--- |_INTERRUPT|
--- |_DISPEL|
--- |_DISPEL_FAILED|
--- |_STOLEN|
--- |_AURA_BROKEN_SPELL|
---@param ... any
---@return number, nil|string
GetExtraSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSchool"], ...)
if val == nil then
return 0, "ExtraSchool is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraSchool is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_HEAL_ABSORBED|
---@param ... any
---@return number, nil|string
GetAbsorbedAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...)
if val == nil then
return 0, "AbsorbedAmount is nil or missing"
end
if type(val) ~= "number" then
return 0, "AbsorbedAmount is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_ENERGIZE|
---@param ... any
---@return number, nil|string
GetOverEnergize = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overEnergize"], ...)
if val == nil then
return 0, "OverEnergize is nil or missing"
end
if type(val) ~= "number" then
return 0, "OverEnergize is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_ENERGIZE|
--- |_DRAIN|
--- |_LEECH|
---
--- return type is unconfirmed!
---@param ... any
---@return number, nil|string
GetPowerType = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["powerType"], ...)
if val == nil then
return 0, "PowerType is nil or missing"
end
if type(val) ~= "number" then
return 0, "PowerType is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DRAIN|
--- |_LEECH|
---@param ... any
---@return number, nil|string
GetExtraAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraAmount"], ...)
if val == nil then
return 0, "ExtraAmount is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraAmount is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_INTERRUPT|
--- |_DISPEL|
--- |_DISPEL_FAILED|
--- |_STOLEN|
--- |_AURA_BROKEN_SPELL|
---
--- WARNING! Different from "GetExtraSpellID" (capital ID!)<br>
--- This is the doing of Blizzard, not me.<br>
---@see CLEUParser.GetExtraSpellID
---@param ... any
---@return number, nil|string
GetExtraSpellId = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...)
if val == nil then
return 0, "ExtraSpellId is nil or missing"
end
if type(val) ~= "number" then
return 0, "ExtraSpellId is not a number"
end
return val, nil
end,
--- Specific to subevents prefixed by:
--- |Prefix|
--- |-----|
--- |RANGE|
--- |SWING|
--- |SPELL|
--- |SPELL_PERIODIC|
--- |SPELL_BUILDING|
---
--- And suffixed by:
--- |Suffix|
--- |------|
--- |_DISPEL|
--- |_STOLEN|
--- |_AURA_APPLIED|
--- |_AURA_REMOVED|
--- |_AURA_APPLIED_DOSE|
--- |_AURA_REMOVED_DOSE|
--- |_AURA_REFRESH|
--- |_AURA_BROKEN|
--- |_AURA_BROKEN_SPELL|
---@param ... any
---@return number, nil|string
GetExtraAuraType = function(...)
local subevent, err = CLEUParser.GetSubevent(...)
if err then
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["auraType"], ...)
if val == nil then return 0, "AuraType is nil or missing" end
if type(val) ~= "number" then
return 0, "AuraType is not a number"
end
return val, nil
end
}
end