From 2b07d3ddf79cd0deaf074570d60602759e21708d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tekkub=20=CA=95=20=C2=B4=E1=B4=A5=60=20=CA=94?= Date: Thu, 24 Nov 2016 01:38:55 -0700 Subject: [PATCH] Add module for WQ bonus event quest --- Cork.toc | 1 + modules/BonusEvents.lua | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 modules/BonusEvents.lua diff --git a/Cork.toc b/Cork.toc index 5811cea..22c8add 100644 --- a/Cork.toc +++ b/Cork.toc @@ -56,6 +56,7 @@ modules\Warrior.lua modules\ArtifactPowerItems.lua modules\BattleStandard.lua +modules\BonusEvents.lua modules\BuffItems.lua modules\ClassHallWorkOrders.lua modules\Capsules.lua diff --git a/modules/BonusEvents.lua b/modules/BonusEvents.lua new file mode 100755 index 0000000..c8801d4 --- /dev/null +++ b/modules/BonusEvents.lua @@ -0,0 +1,46 @@ + +local myname, ns = ... + + +local WQ_QUEST_ID = 44175 +local WQ_BUFF, _, WQ_BUFF_ICON = GetSpellInfo(186404) +local WQ_ICONLINE = ns.IconLine(WQ_BUFF_ICON, "Bonus event quest") + + +-- You have to be 110 to get the weekly bonus events +if UnitLevel("player") < 110 then return end + + +local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0") + + +local dataobj = ns:New("Bonus Events") +dataobj.tiptext = "Notify you when there is a weekly Bonus Event quest to accept" +dataobj.priority = 15 + + +function dataobj:Init() + ns.defaultspc[self.name.."-enabled"] = true +end + + +local function Test() + if not UnitAura("player", WQ_BUFF) then return end + if IsQuestComplete(WQ_QUEST_ID) then return end + if GetQuestLogIndexByID(WQ_QUEST_ID) ~= 0 then return end + return WQ_ICONLINE +end + + +local lastid +function dataobj:Scan() + if not ns.dbpc[self.name.."-enabled"] then + self.player = nil + return + end + + self.player = Test() +end + + +ae.RegisterEvent(dataobj, "QUEST_LOG_UPDATE", "Scan")