Skip to content

Commit

Permalink
Add pilgrim bounty buff reminder
Browse files Browse the repository at this point in the history
  • Loading branch information
tekkub committed Nov 24, 2016
1 parent 5fc55f4 commit 5e3415e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 19 deletions.
3 changes: 3 additions & 0 deletions Cork.toc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ CallbackHandler-1.0.lua
LibDataBroker-1.1\LibDataBroker-1.1.lua
AceEvent-3.0\AceEvent-3.0.xml

services\holiday_active.lua

Locale.lua
KeyBlacklist.lua

Expand Down Expand Up @@ -71,6 +73,7 @@ modules\LancePole.lua
modules\Lures.lua
modules\Minipet.lua
modules\OpenableItems.lua
modules\PilgrimsBountyRep.lua
modules\QuestStartingItems.lua
modules\Repairs.lua
modules\Salvage.lua
Expand Down
23 changes: 4 additions & 19 deletions modules/DarkmoonExp.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@

local myname, Cork = ...
local myname, ns = ...
local ae = LibStub("AceEvent-3.0")


local maxlevel = GetMaxPlayerLevel()
local itemname = "Darkmoon EXP Buff"
local spellname, _, icon = GetSpellInfo(46668)
local hatspell = GetSpellInfo(136583)
local dataobj = Cork:GenerateSelfBuffer(itemname, icon, spellname, hatspell)
Cork.defaultspc[itemname.."-enabled"] = true
local dataobj = ns:GenerateSelfBuffer(itemname, icon, spellname, hatspell)
ns.defaultspc[itemname.."-enabled"] = true


local function DarkmoonToday()
local _, _, day = CalendarGetDate()
local title, hour, sequenceType
local i = 1
repeat
title, hour, _, _, sequenceType = CalendarGetDayEvent(0, day, i)
if title == "Darkmoon Faire" then
if sequenceType == "START" then
return GetGameTime() >= hour
elseif sequenceType == "END" then
return GetGameTime() < hour
else
return true
end
end
i = i + 1
until not title
return ns.IsHolidayActive("Darkmoon Faire")
end


Expand Down
31 changes: 31 additions & 0 deletions modules/PilgrimsBountyRep.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

local myname, ns = ...
local ae = LibStub("AceEvent-3.0")


local maxlevel = GetMaxPlayerLevel()
local itemname = "Pilgrim's Bounty Rep Buff"
local spellname, _, icon = GetSpellInfo(61849)
local dataobj = ns:GenerateSelfBuffer(itemname, icon, spellname)
ns.defaultspc[itemname.."-enabled"] = true


local function BountyToday()
return ns.IsHolidayActive("Pilgrim's Bounty")
end


function dataobj:Test()
if UnitLevel("player") < maxlevel then return false end
return BountyToday() and self:TestWithoutResting()
end


function dataobj:Init()
if UnitLevel("player") == maxlevel then OpenCalendar() end
end


ae.RegisterEvent(dataobj, "CALENDAR_UPDATE_EVENT_LIST", "Scan")
dataobj.tiplink = "spell:61849"
dataobj.CorkIt = nil
22 changes: 22 additions & 0 deletions services/holiday_active.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

local myname, ns = ...


function ns.IsHolidayActive(name)
local _, _, day = CalendarGetDate()
local title, hour, sequenceType
local i = 1
repeat
title, hour, _, _, sequenceType = CalendarGetDayEvent(0, day, i)
if title == name then
if sequenceType == "START" then
return GetGameTime() >= hour
elseif sequenceType == "END" then
return GetGameTime() < hour
else
return true
end
end
i = i + 1
until not title
end

0 comments on commit 5e3415e

Please sign in to comment.