|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
-- Document with emmy lua: https://emmylua.github.io/ |
|
|
|
|
|
|
|
|
|
|
|
local Tinkr, Bastion = ... |
|
|
|
local Tinkr, Bastion = ... |
|
|
|
|
|
|
|
|
|
|
|
-- Create a new Aura class |
|
|
|
-- Create a new Aura class |
|
|
@ -19,6 +21,8 @@ function Aura:__index(k) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Equals |
|
|
|
-- Equals |
|
|
|
|
|
|
|
---@param other Aura|Spell |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:__eq(other) |
|
|
|
function Aura:__eq(other) |
|
|
|
if getmetatable(other) == Aura then |
|
|
|
if getmetatable(other) == Aura then |
|
|
|
return self:GetSpell():GetID() == other:GetSpell():GetID() |
|
|
|
return self:GetSpell():GetID() == other:GetSpell():GetID() |
|
|
@ -31,11 +35,16 @@ function Aura:__eq(other) |
|
|
|
return false |
|
|
|
return false |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- tostring |
|
|
|
|
|
|
|
---@return string |
|
|
|
function Aura:__tostring() |
|
|
|
function Aura:__tostring() |
|
|
|
return "Bastion.__Aura(" .. self:GetSpell():GetID() .. ")" .. " - " .. (self:GetName() or "''") |
|
|
|
return "Bastion.__Aura(" .. self:GetSpell():GetID() .. ")" .. " - " .. (self:GetName() or "''") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Constructor |
|
|
|
-- Constructor |
|
|
|
|
|
|
|
---@param unit Unit |
|
|
|
|
|
|
|
---@param index number |
|
|
|
|
|
|
|
---@param type string |
|
|
|
function Aura:New(unit, index, type) |
|
|
|
function Aura:New(unit, index, type) |
|
|
|
if unit == nil then |
|
|
|
if unit == nil then |
|
|
|
local self = setmetatable({}, Aura) |
|
|
|
local self = setmetatable({}, Aura) |
|
|
@ -68,7 +77,8 @@ function Aura:New(unit, index, type) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal, |
|
|
|
local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal, |
|
|
|
spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitAura(unit:GetOMToken(), index, type) |
|
|
|
spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitAura(unit:GetOMToken(), index, |
|
|
|
|
|
|
|
type) |
|
|
|
|
|
|
|
|
|
|
|
local self = setmetatable({}, Aura) |
|
|
|
local self = setmetatable({}, Aura) |
|
|
|
self.aura = { |
|
|
|
self.aura = { |
|
|
@ -98,6 +108,9 @@ function Aura:New(unit, index, type) |
|
|
|
return self |
|
|
|
return self |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Constructor |
|
|
|
|
|
|
|
---@param unitAuraInfo UnitAuraInfo |
|
|
|
|
|
|
|
---@return Aura |
|
|
|
function Aura:CreateFromUnitAuraInfo(unitAuraInfo) |
|
|
|
function Aura:CreateFromUnitAuraInfo(unitAuraInfo) |
|
|
|
local self = setmetatable({}, Aura) |
|
|
|
local self = setmetatable({}, Aura) |
|
|
|
self.aura = { |
|
|
|
self.aura = { |
|
|
@ -128,56 +141,67 @@ function Aura:CreateFromUnitAuraInfo(unitAuraInfo) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is valid |
|
|
|
-- Check if the aura is valid |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:IsValid() |
|
|
|
function Aura:IsValid() |
|
|
|
return self.aura.name ~= nil |
|
|
|
return self.aura.name ~= nil |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is up |
|
|
|
-- Check if the aura is up |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:IsUp() |
|
|
|
function Aura:IsUp() |
|
|
|
return self:IsValid() and (self:GetDuration() == 0 or self:GetRemainingTime() > 0) |
|
|
|
return self:IsValid() and (self:GetDuration() == 0 or self:GetRemainingTime() > 0) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is down |
|
|
|
-- Check if the aura is down |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:IsDown() |
|
|
|
function Aura:IsDown() |
|
|
|
return not self:IsUp() |
|
|
|
return not self:IsUp() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras index |
|
|
|
-- Get the auras index |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetIndex() |
|
|
|
function Aura:GetIndex() |
|
|
|
return self.aura.index |
|
|
|
return self.aura.index |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras type |
|
|
|
-- Get the auras type |
|
|
|
|
|
|
|
---@return string |
|
|
|
function Aura:GetType() |
|
|
|
function Aura:GetType() |
|
|
|
return self.aura.type |
|
|
|
return self.aura.type |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras name |
|
|
|
-- Get the auras name |
|
|
|
|
|
|
|
---@return string |
|
|
|
function Aura:GetName() |
|
|
|
function Aura:GetName() |
|
|
|
return self.aura.name |
|
|
|
return self.aura.name |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras icon |
|
|
|
-- Get the auras icon |
|
|
|
|
|
|
|
---@return string |
|
|
|
function Aura:GetIcon() |
|
|
|
function Aura:GetIcon() |
|
|
|
return self.aura.icon |
|
|
|
return self.aura.icon |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras count |
|
|
|
-- Get the auras count |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetCount() |
|
|
|
function Aura:GetCount() |
|
|
|
return self.aura.count |
|
|
|
return self.aura.count |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras dispel type |
|
|
|
-- Get the auras dispel type |
|
|
|
|
|
|
|
---@return string |
|
|
|
function Aura:GetDispelType() |
|
|
|
function Aura:GetDispelType() |
|
|
|
return self.aura.dispelType |
|
|
|
return self.aura.dispelType |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras duration |
|
|
|
-- Get the auras duration |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetDuration() |
|
|
|
function Aura:GetDuration() |
|
|
|
return self.aura.duration |
|
|
|
return self.aura.duration |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras remaining time |
|
|
|
-- Get the auras remaining time |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetRemainingTime() |
|
|
|
function Aura:GetRemainingTime() |
|
|
|
local remainingTime = self.aura.expirationTime - GetTime() |
|
|
|
local remainingTime = self.aura.expirationTime - GetTime() |
|
|
|
|
|
|
|
|
|
|
@ -189,71 +213,85 @@ function Aura:GetRemainingTime() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras expiration time |
|
|
|
-- Get the auras expiration time |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetExpirationTime() |
|
|
|
function Aura:GetExpirationTime() |
|
|
|
return self.aura.expirationTime |
|
|
|
return self.aura.expirationTime |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras source |
|
|
|
-- Get the auras source |
|
|
|
|
|
|
|
---@return Unit |
|
|
|
function Aura:GetSource() |
|
|
|
function Aura:GetSource() |
|
|
|
return Bastion.UnitManager[self.aura.source] |
|
|
|
return Bastion.UnitManager[self.aura.source] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras stealable status |
|
|
|
-- Get the auras stealable status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetIsStealable() |
|
|
|
function Aura:GetIsStealable() |
|
|
|
return self.aura.isStealable |
|
|
|
return self.aura.isStealable |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras nameplate show personal status |
|
|
|
-- Get the auras nameplate show personal status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetNameplateShowPersonal() |
|
|
|
function Aura:GetNameplateShowPersonal() |
|
|
|
return self.aura.nameplateShowPersonal |
|
|
|
return self.aura.nameplateShowPersonal |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras spell id |
|
|
|
-- Get the auras spell id |
|
|
|
|
|
|
|
---@return Spell |
|
|
|
function Aura:GetSpell() |
|
|
|
function Aura:GetSpell() |
|
|
|
return Bastion.SpellBook:GetSpell(self.aura.spellId) |
|
|
|
return Bastion.SpellBook:GetSpell(self.aura.spellId) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras can apply aura status |
|
|
|
-- Get the auras can apply aura status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetCanApplyAura() |
|
|
|
function Aura:GetCanApplyAura() |
|
|
|
return self.aura.canApplyAura |
|
|
|
return self.aura.canApplyAura |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras is boss debuff status |
|
|
|
-- Get the auras is boss debuff status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetIsBossDebuff() |
|
|
|
function Aura:GetIsBossDebuff() |
|
|
|
return self.aura.isBossDebuff |
|
|
|
return self.aura.isBossDebuff |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras cast by player status |
|
|
|
-- Get the auras cast by player status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetCastByPlayer() |
|
|
|
function Aura:GetCastByPlayer() |
|
|
|
return self.aura.castByPlayer |
|
|
|
return self.aura.castByPlayer |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras nameplate show all status |
|
|
|
-- Get the auras nameplate show all status |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:GetNameplateShowAll() |
|
|
|
function Aura:GetNameplateShowAll() |
|
|
|
return self.aura.nameplateShowAll |
|
|
|
return self.aura.nameplateShowAll |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get the auras time mod |
|
|
|
-- Get the auras time mod |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetTimeMod() |
|
|
|
function Aura:GetTimeMod() |
|
|
|
return self.aura.timeMod |
|
|
|
return self.aura.timeMod |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is a buff |
|
|
|
-- Check if the aura is a buff |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:IsBuff() |
|
|
|
function Aura:IsBuff() |
|
|
|
return self.aura.type == "HELPFUL" |
|
|
|
return self.aura.type == "HELPFUL" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is a debuff |
|
|
|
-- Check if the aura is a debuff |
|
|
|
|
|
|
|
---@return boolean |
|
|
|
function Aura:IsDebuff() |
|
|
|
function Aura:IsDebuff() |
|
|
|
return self.aura.type == "HARMFUL" |
|
|
|
return self.aura.type == "HARMFUL" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Get aura instance id |
|
|
|
-- Get aura instance id |
|
|
|
|
|
|
|
---@return number |
|
|
|
function Aura:GetAuraInstanceID() |
|
|
|
function Aura:GetAuraInstanceID() |
|
|
|
return self.aura.auraInstanceID |
|
|
|
return self.aura.auraInstanceID |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Check if the aura is dispelable by a spell |
|
|
|
-- Check if the aura is dispelable by a spell |
|
|
|
|
|
|
|
---@param spell Spell |
|
|
|
function Aura:IsDispelableBySpell(spell) |
|
|
|
function Aura:IsDispelableBySpell(spell) |
|
|
|
if self:GetDispelType() == nil then |
|
|
|
if self:GetDispelType() == nil then |
|
|
|
return false |
|
|
|
return false |
|
|
|