From b6c37bb81bbed7bce7d11014f5f6bffe86fcc4cb Mon Sep 17 00:00:00 2001 From: Adirelle Date: Tue, 15 Oct 2013 19:50:12 +0200 Subject: [PATCH 1/4] Added Moved Warlocks' Grimoire of Sacrifice to its own file and properly handle it. E.g. do not try to use it without any pet or if the player already have the aura. --- Cork.toc | 1 + modules/Warlock.lua | 5 ----- modules/WarlockGoSacrifice.lua | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 modules/WarlockGoSacrifice.lua 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..dfe3719 100644 --- a/modules/Warlock.lua +++ b/modules/Warlock.lua @@ -3,11 +3,6 @@ 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 spellname, _, icon = GetSpellInfo(109773) Cork:GenerateRaidBuffer(spellname, icon) 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) From ede66eb860b83afc470c754069297c34f9b0d44d Mon Sep 17 00:00:00 2001 From: Adirelle Date: Tue, 15 Oct 2013 19:51:40 +0200 Subject: [PATCH 2/4] Fixed Soul Link. Support talent changes. Do not suggest it while Grimoire of Sacrifice is active. --- modules/WarlockSoulLink.lua | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 From 95e7c8995cc6e95cf93c56bc0e32e293742421a9 Mon Sep 17 00:00:00 2001 From: Adirelle Date: Tue, 15 Oct 2013 19:53:31 +0200 Subject: [PATCH 3/4] Fixed Warlocks' pet summoning quirks. Do not suggest to summon a demon while Grimoire of Sacrifice is active. Use IsMounted() instead of home-brew IsMountSummoned(). --- modules/WarlockPets.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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) From 366070066b7dfe5dbb70e57cbb017f5aae7e5dd6 Mon Sep 17 00:00:00 2001 From: Adirelle Date: Thu, 7 Nov 2013 23:57:19 +0100 Subject: [PATCH 4/4] Warlocks: check for alternatives of Dark Intent. --- modules/Warlock.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/Warlock.lua b/modules/Warlock.lua index dfe3719..f67998d 100644 --- a/modules/Warlock.lua +++ b/modules/Warlock.lua @@ -4,8 +4,17 @@ if Cork.MYCLASS ~= "WARLOCK" then return end -- 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