diff --git a/Cork.toc b/Cork.toc index b90bfd3..3192b8f 100644 --- a/Cork.toc +++ b/Cork.toc @@ -51,6 +51,7 @@ modules\Priest.lua modules\RogueWeapon.lua modules\Shaman.lua modules\Warlock.lua +modules\WarlockGoSacrifice.lua modules\WarlockPets.lua modules\WarlockSoulLink.lua modules\WarlockHealthstone.lua diff --git a/modules/Warlock.lua b/modules/Warlock.lua index ca7db73..f67998d 100644 --- a/modules/Warlock.lua +++ b/modules/Warlock.lua @@ -3,14 +3,18 @@ local myname, Cork = ... if Cork.MYCLASS ~= "WARLOCK" then return end --- Grimoire of Sacrifice -local spellname, _, icon = GetSpellInfo(108503) -Cork:GenerateSelfBuffer(spellname, icon) - - -- Dark Intent +local FORT, CSHOUT = GetSpellInfo(21562), GetSpellInfo(469) +local ARCB, BWRATH = GetSpellInfo(1459), GetSpellInfo(77747) local spellname, _, icon = GetSpellInfo(109773) -Cork:GenerateRaidBuffer(spellname, icon) +Cork:GenerateRaidBuffer(spellname, icon, nil, nil, function(unit) + if UnitAura(unit, spellname) then return true end + if (UnitAura(unit, FORT) or UnitAura(unit, CSHOUT)) -- Another stamina buff + and (UnitAura(unit, ARCB) or UnitAura(unit, BWRATH) or UnitPowerType(unit) ~= SPELL_POWER_MANA) -- Another spellpower buff (or not a mana user) + then + return true + end +end) -- Soulstone diff --git a/modules/WarlockGoSacrifice.lua b/modules/WarlockGoSacrifice.lua new file mode 100644 index 0000000..0c6da0b --- /dev/null +++ b/modules/WarlockGoSacrifice.lua @@ -0,0 +1,38 @@ + +local myname, Cork = ... +if Cork.MYCLASS ~= "WARLOCK" then return end + +local IconLine = Cork.IconLine +local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0") + +local spellname, _, icon = GetSpellInfo(108503) +local iconline = IconLine(icon, spellname) + +local dataobj = ldb:NewDataObject("Cork Grimoire of Sacrifice", {type = "cork"}) + +local function IsGoSEnabled() + return select(5, GetTalentInfo(15)) +end + +function dataobj:Init() + Cork.defaultspc["Grimoire of Sacrifice-enabled"] = IsGoSEnabled() +end + +local function Test() + if not IsMounted() and Cork.dbpc["Grimoire of Sacrifice-enabled"] and IsGoSEnabled() and UnitExists("pet") and not UnitIsDead("pet") and not UnitAura("player", spellname) then + return iconline + end +end + +function dataobj:Scan() + dataobj.player = Test() +end + +function dataobj:CorkIt(frame) + if self.player then + return frame:SetManyAttributes("type1", "spell", "spell", spellname) + end +end + +ae.RegisterEvent("Cork "..spellname, "UNIT_PET", function(event, unit) if unit == "player" then dataobj.player = Test() end end) +ae.RegisterEvent("Cork "..spellname, "UNIT_AURA", function(event, unit) if unit == "player" then dataobj.player = Test() end end) diff --git a/modules/WarlockPets.lua b/modules/WarlockPets.lua index 692243f..266bb26 100644 --- a/modules/WarlockPets.lua +++ b/modules/WarlockPets.lua @@ -14,6 +14,7 @@ local SUC, _, SUCICON = GetSpellInfo(712) local FELH, _, FELHICON = GetSpellInfo(691) local FELG, _, FELGICON = GetSpellInfo(30146) local soulburn = GetSpellInfo(74434) +local gos = GetSpellInfo(108503) -- Grimoire of Sacrifice local defaultspell = IMP @@ -33,21 +34,15 @@ local function RefreshKnownSpells() -- Refresh in case the player has learned th for buff in pairs(icons) do if known[buff] == nil then known[buff] = GetSpellInfo(buff) end end end -local function IsMountSummoned() - for i=1,GetNumCompanions("MOUNT") do - if select(5,GetCompanionInfo("MOUNT", i) ) then return true end - end -end - function dataobj:Init() RefreshKnownSpells() Cork.defaultspc["Summon demon-enabled"] = known[buffnames[spellidlist[1]]] ~= nil end function dataobj:Scan() - if IsMountSummoned() or not Cork.dbpc["Summon demon-enabled"] or UnitExists("pet") then dataobj.player = nil + if IsMounted() or not Cork.dbpc["Summon demon-enabled"] or (UnitExists("pet") and not UnitIsDead("pet")) or UnitAura("player", gos) then dataobj.player = nil else dataobj.player = IconLine(icons[Cork.dbpc["Summon demon-spell"]], Cork.dbpc["Summon demon-spell"]) end end ae.RegisterEvent("Cork Summon demon", "UNIT_PET", function(event, unit) if unit == "player" then dataobj:Scan() end end) -ae.RegisterEvent("Cork mount check", "COMPANION_UPDATE", function(event, type) if type == "MOUNT" then dataobj:Scan() end end) +ae.RegisterEvent("Cork Summon demon", "UNIT_AURA", function(event, unit) if unit == "player" then dataobj:Scan() end end) function dataobj:CorkIt(frame) if self.player then knowssoulburn = knowssoulburn or GetSpellInfo(soulburn) diff --git a/modules/WarlockSoulLink.lua b/modules/WarlockSoulLink.lua index 6b1b3c0..d0b2512 100644 --- a/modules/WarlockSoulLink.lua +++ b/modules/WarlockSoulLink.lua @@ -6,28 +6,30 @@ local myname, Cork = ... local UnitAura = UnitAura local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0") +local function IsSoulLinkEnabled() + return select(5, GetTalentInfo(7)) +end -local soul_link_enabled = select(5, GetTalentInfo(7)) -if soul_link_enabled then - local spellname, _, icon = GetSpellInfo(108415) - local IconLine = Cork.IconLine(icon, spellname) +local spellname, _, icon = GetSpellInfo(108415) +local gos = GetSpellInfo(108503) -- Grimoire of Sacrifice +local IconLine = Cork.IconLine(icon, spellname) - local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Cork "..spellname, {type = "cork", tiplink = GetSpellLink(spellname)}) +local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Cork "..spellname, {type = "cork", tiplink = GetSpellLink(spellname)}) - function dataobj:Init() Cork.defaultspc[spellname.."-enabled"] = GetSpellInfo(spellname) ~= nil end +function dataobj:Init() Cork.defaultspc[spellname.."-enabled"] = GetSpellInfo(spellname) ~= nil end - local function Test(unit) - if Cork.dbpc[spellname.."-enabled"] and UnitExists("pet") and not UnitIsDead("pet") and not UnitAura("pet", spellname) and UnitName("pet") ~= UNKNOWN and not IsMounted() then - return IconLine - end +local function Test(unit) + if Cork.dbpc[spellname.."-enabled"] and IsSoulLinkEnabled() and UnitExists("pet") and not UnitIsDead("pet") and not UnitAura("pet", spellname) and UnitName("pet") ~= UNKNOWN and not IsMounted() and not UnitAura("player", gos) then + return IconLine end +end - ae.RegisterEvent("Cork "..spellname, "UNIT_PET", function(event, unit) if unit == "player" then dataobj.pet = Test() end end) - ae.RegisterEvent("Cork "..spellname, "UNIT_AURA", function(event, unit) if unit == "pet" then dataobj.pet = Test() end end) +ae.RegisterEvent("Cork "..spellname, "UNIT_PET", function(event, unit) if unit == "player" then dataobj.pet = Test() end end) +ae.RegisterEvent("Cork "..spellname, "UNIT_AURA", function(event, unit) if unit == "pet" then dataobj.pet = Test() end end) +ae.RegisterEvent("Cork "..spellname, "PLAYER_TALENT_UPDATE", function(event, unit) dataobj.pet = Test() end) - function dataobj:Scan() self.pet = Test() end +function dataobj:Scan() self.pet = Test() end - function dataobj:CorkIt(frame) - if self.pet then return frame:SetManyAttributes("type1", "spell", "spell", spellname) end - end +function dataobj:CorkIt(frame) + if self.pet then return frame:SetManyAttributes("type1", "spell", "spell", spellname) end end