diff --git a/src/MythicPlusUtils/MythicPlusUtils.lua b/src/ContentUtils/ContentUtils.lua similarity index 58% rename from src/MythicPlusUtils/MythicPlusUtils.lua rename to src/ContentUtils/ContentUtils.lua index 4b0fefd..e550ece 100644 --- a/src/MythicPlusUtils/MythicPlusUtils.lua +++ b/src/ContentUtils/ContentUtils.lua @@ -5,8 +5,8 @@ local Bastion = _Bastion ---@alias BigWigsBars table ----@class MythicPlusUtils -local MythicPlusUtils = { +---@class ContentUtils +local ContentUtils = { ---@type InterruptList interruptList = {}, ---@type TankBusterList @@ -16,7 +16,7 @@ local MythicPlusUtils = { isBigWigsEnabled = false } -MythicPlusUtils.__index = MythicPlusUtils +ContentUtils.__index = ContentUtils local function BWEventCallBack(event, ...) if event == "BigWigs_StartBar" then @@ -25,56 +25,56 @@ local function BWEventCallBack(event, ...) print('START BAR', text) - MythicPlusUtils.bars[text] = MythicPlusUtils.bars[text] or {} + ContentUtils.bars[text] = ContentUtils.bars[text] or {} - MythicPlusUtils.bars[text].duration = duration - MythicPlusUtils.bars[text].startTime = now - MythicPlusUtils.bars[text].spellId = spellId + ContentUtils.bars[text].duration = duration + ContentUtils.bars[text].startTime = now + ContentUtils.bars[text].spellId = spellId elseif event == "BigWigs_StopBar" then local addon, text = ... print('STOP BAR', text) - if MythicPlusUtils.bars[text] then - MythicPlusUtils.bars[text] = nil + if ContentUtils.bars[text] then + ContentUtils.bars[text] = nil end elseif event == "BigWigs_PauseBar" then local addon, text = ... print('PAUSE BAR', text) - if MythicPlusUtils.bars[text] then - MythicPlusUtils.bars[text].pauseTime = GetTime() + if ContentUtils.bars[text] then + ContentUtils.bars[text].pauseTime = GetTime() end elseif event == "BigWigs_ResumeBar" then local addon, text = ... print('RESUME BAR', text) - if MythicPlusUtils.bars[text] and MythicPlusUtils.bars[text].pauseTime then - local pauseTime = MythicPlusUtils.bars[text].pauseTime - local startTime = MythicPlusUtils.bars[text].startTime - local duration = MythicPlusUtils.bars[text].duration + if ContentUtils.bars[text] and ContentUtils.bars[text].pauseTime then + local pauseTime = ContentUtils.bars[text].pauseTime + local startTime = ContentUtils.bars[text].startTime + local duration = ContentUtils.bars[text].duration local newDuration = duration - (pauseTime - startTime) - MythicPlusUtils.bars[text].duration = newDuration - MythicPlusUtils.bars[text].startTime = GetTime() - MythicPlusUtils.bars[text].pauseTime = nil + ContentUtils.bars[text].pauseTime = nil + ContentUtils.bars[text].duration = newDuration + ContentUtils.bars[text].startTime = GetTime() end elseif event == "BigWigs_StopBars" or event == "BigWigs_OnBossDisable" then - MythicPlusUtils.bars = {} + ContentUtils.bars = {} end end ---@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 -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 -function MythicPlusUtils:New() - local self = setmetatable({}, MythicPlusUtils) +---@return ContentUtils +function ContentUtils:New() + local self = setmetatable({}, ContentUtils) self.interruptList = _interruptList self.tankBusterList = _tankBusterList @@ -95,8 +95,8 @@ end ---@param unit Unit ---@param percent number ----@return { kickable: boolean, paraliseable: boolean, sweepable: boolean } | nil -function MythicPlusUtils:CastingCriticalStop(unit, percent) +---@return Interrupt | nil +function ContentUtils:CastingCriticalStop(unit, percent) local castingSpell = unit:GetCastingOrChannelingSpell() local npcSpells = self.interruptList[unit:GetID()] @@ -120,7 +120,7 @@ function MythicPlusUtils:CastingCriticalStop(unit, percent) return nil end -function MythicPlusUtils:RefreshBars() +function ContentUtils:RefreshBars() if self.isBigWigsEnabled then for key, value in pairs(self.bars) do local expireTime = value.duration + value.startTime @@ -135,11 +135,11 @@ end ---@param spellId number ---@param timeUntilCast number ---@return boolean -function MythicPlusUtils:IsSpellCastSoon(spellId, timeUntilCast) +function ContentUtils:IsSpellCastSoon(spellId, timeUntilCast) if self.isBigWigsEnabled then self:RefreshBars() 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 timeUntilSpell = expireTime - GetTime() @@ -155,10 +155,31 @@ end ---@param unit Unit ---@param timeUntilCast? number ----@return boolean -function MythicPlusUtils:CastingTankBuster(unit, timeUntilCast) +---@return TankBuster | nil +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 -return MythicPlusUtils +return ContentUtils diff --git a/src/MythicPlusUtils/lists/ramp-list.lua b/src/ContentUtils/lists/dispel-list.lua similarity index 100% rename from src/MythicPlusUtils/lists/ramp-list.lua rename to src/ContentUtils/lists/dispel-list.lua diff --git a/src/ContentUtils/lists/group-wide-list.lua b/src/ContentUtils/lists/group-wide-list.lua new file mode 100644 index 0000000..1ebd5c2 --- /dev/null +++ b/src/ContentUtils/lists/group-wide-list.lua @@ -0,0 +1,2 @@ +---@alias GroupWide { shouldDampen: boolean, shouldDiffuse: boolean, shouldFort: boolean, shouldBubble: boolean, shouldKarma: boolean } +---@alias GroupWideList table> diff --git a/src/MythicPlusUtils/lists/interrupt-list.lua b/src/ContentUtils/lists/interrupt-list.lua similarity index 98% rename from src/MythicPlusUtils/lists/interrupt-list.lua rename to src/ContentUtils/lists/interrupt-list.lua index 550956d..5bca4c2 100644 --- a/src/MythicPlusUtils/lists/interrupt-list.lua +++ b/src/ContentUtils/lists/interrupt-list.lua @@ -1,5 +1,6 @@ ----@alias InterruptList table> +---@alias Interrupt { kickable: boolean, sweepable: boolean, paraliseable: boolean } +---@alias InterruptList table> ---@type InterruptList local _InterruptList = { diff --git a/src/MythicPlusUtils/lists/tank-buster-list.lua b/src/ContentUtils/lists/tank-buster-list.lua similarity index 96% rename from src/MythicPlusUtils/lists/tank-buster-list.lua rename to src/ContentUtils/lists/tank-buster-list.lua index c8ad6b5..0709612 100644 --- a/src/MythicPlusUtils/lists/tank-buster-list.lua +++ b/src/ContentUtils/lists/tank-buster-list.lua @@ -1,5 +1,6 @@ ----@alias TankBusterList table> +---@alias TankBuster { shouldDampen: boolean, shouldDiffuse: boolean, shouldFort: boolean, shouldBubble: boolean } +---@alias TankBusterList table> ---@type TankBusterList local _TankBusterList = { @@ -10,7 +11,7 @@ local _TankBusterList = { [188244] = { -- Crushing Smash [372730] = { - shouldBubble = false, + shouldBubble = true, shouldDampen = true, shouldDiffuse = false, shouldFort = false @@ -20,7 +21,7 @@ local _TankBusterList = { [187897] = { -- Steel Barrage [372047] = { - shouldBubble = false, + shouldBubble = true, shouldDampen = true, shouldDiffuse = false, shouldFort = false diff --git a/src/_bastion.lua b/src/_bastion.lua index f317a56..b55074f 100644 --- a/src/_bastion.lua +++ b/src/_bastion.lua @@ -58,8 +58,8 @@ Bastion.Class = Bastion.require("Class") Bastion.Timer = Bastion.require("Timer") ---@type Timer Bastion.CombatTimer = Bastion.Timer:New('combat') ----@type MythicPlusUtils -Bastion.MythicPlusUtils = Bastion.require("MythicPlusUtils"):New() +---@type ContentUtils +Bastion.ContentUtils = Bastion.require("ContentUtils"):New() ---@type NotificationsList Bastion.Notifications = Bastion.NotificationsList:New() @@ -91,23 +91,12 @@ Bastion.EventManager:RegisterWoWEvent("UNIT_SPELLCAST_SUCCEEDED", function(...) end) local pguid = UnitGUID("player") -local missed = {} Bastion.EventManager:RegisterWoWEvent("COMBAT_LOG_EVENT_UNFILTERED", function() local args = { CombatLogGetCurrentEventInfo() } - local subEvent = args[2] local sourceGUID = args[4] - local destGUID = args[8] - local spellID = args[12] - - -- if sourceGUID == pguid then - -- local args = { CombatLogGetCurrentEventInfo() } - - -- for i = 1, #args do - -- Log(tostring(args[i])) - -- end - -- end + local destGUID = args[8] local u = Bastion.UnitManager[sourceGUID] local u2 = Bastion.UnitManager[destGUID] @@ -120,20 +109,6 @@ Bastion.EventManager:RegisterWoWEvent("COMBAT_LOG_EVENT_UNFILTERED", function() if u2 then u2:SetLastCombatTime(t) - - if subEvent == "SPELL_MISSED" and sourceGUID == pguid and spellID == 408 then - local missType = args[15] - - if missType == "IMMUNE" then - local castingSpell = u:GetCastingOrChannelingSpell() - - if castingSpell then - if not missed[castingSpell:GetID()] then - missed[castingSpell:GetID()] = true - end - end - end - end end end) @@ -269,12 +244,6 @@ Command:Register('pause', 'Pause a module for X seconds', function (args) end) -Command:Register('missed', 'Dump the list of immune kidney shot spells', function() - for k, v in pairs(missed) do - Bastion:Print(k) - end -end) - if UnitClass('player') == 'Monk' and GetSpecialization() == 1 then Tinkr:require("scripts/bastion/scripts/brewmaster", Bastion) Eval('RunMacroText("/bastion module brewmaster")', 'bastion')