Skip to content

Commit

Permalink
Add warlock healthstone module
Browse files Browse the repository at this point in the history
  • Loading branch information
tekkub committed Jan 5, 2010

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e601561 commit 2fa90ff
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cork.toc
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ modules\WarlockWeapon.lua
modules\WarlockPets.lua
modules\WarlockSoulLink.lua
modules\WarlockSoulstone.lua
modules\WarlockHealthstone.lua
modules\Warrior.lua
modules\WarriorShout.lua

32 changes: 32 additions & 0 deletions modules/WarlockHealthstone.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

local Cork = Cork
local spellname = GetSpellInfo(6201)
local IconLine = Cork.IconLine(GetItemIcon(5509), spellname)
local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0")

local ITEMS = {5509, 5510, 5511, 5512, 9421, 19004, 19005, 19006, 19007, 19008, 19009, 19010, 19011, 19012, 19013, 22103, 22104, 22105, 36889, 36890, 36891, 36892, 36893, 36894}

Cork.defaultspc["Healthstone-enabled"] = true

local dataobj = ldb:NewDataObject("Cork Healthstone", {type = "cork"})

function dataobj:Scan()
if not Cork.dbpc["Healthstone-enabled"] then
dataobj.player = nil
return
end

for _,id in pairs(ITEMS) do
if (GetItemCount(id) or 0) > 0 then
dataobj.player = nil
return
end
end
dataobj.player = IconLine
end

ae.RegisterEvent("Cork Healthstone", "BAG_UPDATE", dataobj.Scan)

function dataobj:CorkIt(frame)
if dataobj.player then return frame:SetManyAttributes("type1", "spell", "spell", spellname) end
end

0 comments on commit 2fa90ff

Please sign in to comment.