|
|
@ -5,8 +5,8 @@ local Bastion = _Bastion |
|
|
|
|
|
|
|
|
|
|
|
---@alias BigWigsBars table<string, { spellId: number, duration: number, startTime: number, pauseTime: number | nil }> |
|
|
|
---@alias BigWigsBars table<string, { spellId: number, duration: number, startTime: number, pauseTime: number | nil }> |
|
|
|
|
|
|
|
|
|
|
|
---@class MythicPlusUtils |
|
|
|
---@class ContentUtils |
|
|
|
local MythicPlusUtils = { |
|
|
|
local ContentUtils = { |
|
|
|
---@type InterruptList |
|
|
|
---@type InterruptList |
|
|
|
interruptList = {}, |
|
|
|
interruptList = {}, |
|
|
|
---@type TankBusterList |
|
|
|
---@type TankBusterList |
|
|
@ -16,7 +16,7 @@ local MythicPlusUtils = { |
|
|
|
isBigWigsEnabled = false |
|
|
|
isBigWigsEnabled = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MythicPlusUtils.__index = MythicPlusUtils |
|
|
|
ContentUtils.__index = ContentUtils |
|
|
|
|
|
|
|
|
|
|
|
local function BWEventCallBack(event, ...) |
|
|
|
local function BWEventCallBack(event, ...) |
|
|
|
if event == "BigWigs_StartBar" then |
|
|
|
if event == "BigWigs_StartBar" then |
|
|
@ -25,56 +25,56 @@ local function BWEventCallBack(event, ...) |
|
|
|
|
|
|
|
|
|
|
|
print('START BAR', text) |
|
|
|
print('START BAR', text) |
|
|
|
|
|
|
|
|
|
|
|
MythicPlusUtils.bars[text] = MythicPlusUtils.bars[text] or {} |
|
|
|
ContentUtils.bars[text] = ContentUtils.bars[text] or {} |
|
|
|
|
|
|
|
|
|
|
|
MythicPlusUtils.bars[text].duration = duration |
|
|
|
ContentUtils.bars[text].duration = duration |
|
|
|
MythicPlusUtils.bars[text].startTime = now |
|
|
|
ContentUtils.bars[text].startTime = now |
|
|
|
MythicPlusUtils.bars[text].spellId = spellId |
|
|
|
ContentUtils.bars[text].spellId = spellId |
|
|
|
elseif event == "BigWigs_StopBar" then |
|
|
|
elseif event == "BigWigs_StopBar" then |
|
|
|
local addon, text = ... |
|
|
|
local addon, text = ... |
|
|
|
|
|
|
|
|
|
|
|
print('STOP BAR', text) |
|
|
|
print('STOP BAR', text) |
|
|
|
|
|
|
|
|
|
|
|
if MythicPlusUtils.bars[text] then |
|
|
|
if ContentUtils.bars[text] then |
|
|
|
MythicPlusUtils.bars[text] = nil |
|
|
|
ContentUtils.bars[text] = nil |
|
|
|
end |
|
|
|
end |
|
|
|
elseif event == "BigWigs_PauseBar" then |
|
|
|
elseif event == "BigWigs_PauseBar" then |
|
|
|
local addon, text = ... |
|
|
|
local addon, text = ... |
|
|
|
|
|
|
|
|
|
|
|
print('PAUSE BAR', text) |
|
|
|
print('PAUSE BAR', text) |
|
|
|
|
|
|
|
|
|
|
|
if MythicPlusUtils.bars[text] then |
|
|
|
if ContentUtils.bars[text] then |
|
|
|
MythicPlusUtils.bars[text].pauseTime = GetTime() |
|
|
|
ContentUtils.bars[text].pauseTime = GetTime() |
|
|
|
end |
|
|
|
end |
|
|
|
elseif event == "BigWigs_ResumeBar" then |
|
|
|
elseif event == "BigWigs_ResumeBar" then |
|
|
|
local addon, text = ... |
|
|
|
local addon, text = ... |
|
|
|
|
|
|
|
|
|
|
|
print('RESUME BAR', text) |
|
|
|
print('RESUME BAR', text) |
|
|
|
|
|
|
|
|
|
|
|
if MythicPlusUtils.bars[text] and MythicPlusUtils.bars[text].pauseTime then |
|
|
|
if ContentUtils.bars[text] and ContentUtils.bars[text].pauseTime then |
|
|
|
local pauseTime = MythicPlusUtils.bars[text].pauseTime |
|
|
|
local pauseTime = ContentUtils.bars[text].pauseTime |
|
|
|
local startTime = MythicPlusUtils.bars[text].startTime |
|
|
|
local startTime = ContentUtils.bars[text].startTime |
|
|
|
local duration = MythicPlusUtils.bars[text].duration |
|
|
|
local duration = ContentUtils.bars[text].duration |
|
|
|
|
|
|
|
|
|
|
|
local newDuration = duration - (pauseTime - startTime) |
|
|
|
local newDuration = duration - (pauseTime - startTime) |
|
|
|
|
|
|
|
|
|
|
|
MythicPlusUtils.bars[text].duration = newDuration |
|
|
|
ContentUtils.bars[text].pauseTime = nil |
|
|
|
MythicPlusUtils.bars[text].startTime = GetTime() |
|
|
|
ContentUtils.bars[text].duration = newDuration |
|
|
|
MythicPlusUtils.bars[text].pauseTime = nil |
|
|
|
ContentUtils.bars[text].startTime = GetTime() |
|
|
|
end |
|
|
|
end |
|
|
|
elseif event == "BigWigs_StopBars" or event == "BigWigs_OnBossDisable" then |
|
|
|
elseif event == "BigWigs_StopBars" or event == "BigWigs_OnBossDisable" then |
|
|
|
MythicPlusUtils.bars = {} |
|
|
|
ContentUtils.bars = {} |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
---@type InterruptList |
|
|
|
---@type InterruptList |
|
|
|
local _interruptList = Tinkr:require("scripts/bastion/MythicPlusUtils/lists/interrupt-list", Bastion) |
|
|
|
local _interruptList = Tinkr:require("scripts/bastion/ContentUtils/lists/interrupt-list", Bastion) |
|
|
|
---@type TankBusterList |
|
|
|
---@type TankBusterList |
|
|
|
local _tankBusterList = Tinkr:require("scripts/bastion/MythicPlusUtils/lists/tank-buster-list", Bastion) |
|
|
|
local _tankBusterList = Tinkr:require("scripts/bastion/ContentUtils/lists/tank-buster-list", Bastion) |
|
|
|
|
|
|
|
|
|
|
|
---@return MythicPlusUtils |
|
|
|
---@return ContentUtils |
|
|
|
function MythicPlusUtils:New() |
|
|
|
function ContentUtils:New() |
|
|
|
local self = setmetatable({}, MythicPlusUtils) |
|
|
|
local self = setmetatable({}, ContentUtils) |
|
|
|
|
|
|
|
|
|
|
|
self.interruptList = _interruptList |
|
|
|
self.interruptList = _interruptList |
|
|
|
self.tankBusterList = _tankBusterList |
|
|
|
self.tankBusterList = _tankBusterList |
|
|
@ -95,8 +95,8 @@ end |
|
|
|
|
|
|
|
|
|
|
|
---@param unit Unit |
|
|
|
---@param unit Unit |
|
|
|
---@param percent number |
|
|
|
---@param percent number |
|
|
|
---@return { kickable: boolean, paraliseable: boolean, sweepable: boolean } | nil |
|
|
|
---@return Interrupt | nil |
|
|
|
function MythicPlusUtils:CastingCriticalStop(unit, percent) |
|
|
|
function ContentUtils:CastingCriticalStop(unit, percent) |
|
|
|
local castingSpell = unit:GetCastingOrChannelingSpell() |
|
|
|
local castingSpell = unit:GetCastingOrChannelingSpell() |
|
|
|
|
|
|
|
|
|
|
|
local npcSpells = self.interruptList[unit:GetID()] |
|
|
|
local npcSpells = self.interruptList[unit:GetID()] |
|
|
@ -120,7 +120,7 @@ function MythicPlusUtils:CastingCriticalStop(unit, percent) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function MythicPlusUtils:RefreshBars() |
|
|
|
function ContentUtils:RefreshBars() |
|
|
|
if self.isBigWigsEnabled then |
|
|
|
if self.isBigWigsEnabled then |
|
|
|
for key, value in pairs(self.bars) do |
|
|
|
for key, value in pairs(self.bars) do |
|
|
|
local expireTime = value.duration + value.startTime |
|
|
|
local expireTime = value.duration + value.startTime |
|
|
@ -135,11 +135,11 @@ end |
|
|
|
---@param spellId number |
|
|
|
---@param spellId number |
|
|
|
---@param timeUntilCast number |
|
|
|
---@param timeUntilCast number |
|
|
|
---@return boolean |
|
|
|
---@return boolean |
|
|
|
function MythicPlusUtils:IsSpellCastSoon(spellId, timeUntilCast) |
|
|
|
function ContentUtils:IsSpellCastSoon(spellId, timeUntilCast) |
|
|
|
if self.isBigWigsEnabled then |
|
|
|
if self.isBigWigsEnabled then |
|
|
|
self:RefreshBars() |
|
|
|
self:RefreshBars() |
|
|
|
for key, value in pairs(self.bars) do |
|
|
|
for key, value in pairs(self.bars) do |
|
|
|
if value.spellId == spellId then |
|
|
|
if value.spellId == spellId and not value.pauseTime then |
|
|
|
local expireTime = value.duration + value.startTime |
|
|
|
local expireTime = value.duration + value.startTime |
|
|
|
|
|
|
|
|
|
|
|
local timeUntilSpell = expireTime - GetTime() |
|
|
|
local timeUntilSpell = expireTime - GetTime() |
|
|
@ -155,10 +155,31 @@ end |
|
|
|
|
|
|
|
|
|
|
|
---@param unit Unit |
|
|
|
---@param unit Unit |
|
|
|
---@param timeUntilCast? number |
|
|
|
---@param timeUntilCast? number |
|
|
|
---@return boolean |
|
|
|
---@return TankBuster | nil |
|
|
|
function MythicPlusUtils:CastingTankBuster(unit, timeUntilCast) |
|
|
|
function ContentUtils:CastingTankBuster(unit, timeUntilCast) |
|
|
|
|
|
|
|
local npcSpells = self.tankBusterList[unit:GetID()] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if npcSpells then |
|
|
|
|
|
|
|
-- If timeUntilCast is provided, check if any of this NPC |
|
|
|
|
|
|
|
if timeUntilCast then |
|
|
|
|
|
|
|
for key, value in pairs(self.bars) do |
|
|
|
|
|
|
|
local spellTraits = npcSpells[value.spellId] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if spellTraits and not value.pauseTime and ((value.startTime + value.duration) - GetTime()) <= timeUntilCast then |
|
|
|
|
|
|
|
return spellTraits |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
return false |
|
|
|
local castingSpell = unit:GetCastingOrChannelingSpell() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if castingSpell then |
|
|
|
|
|
|
|
if npcSpells[castingSpell:GetID()] then return npcSpells[castingSpell:GetID()] end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
return MythicPlusUtils |
|
|
|
return ContentUtils |