- abstracted the HolyPower module's functionality to a ClassPowerCounter module since the warlock shard bar is functionally identical to holy power

- added shard bar inheriting from ClassPowerCounter. same basic functionality as the holy power module: graphical mode that shows the default shards and numeric mode that just displays a count of active shards
This commit is contained in:
Parnic
2010-09-10 06:49:45 +00:00
parent e95db24dd0
commit fb884f41f4
4 changed files with 477 additions and 395 deletions

57
modules/Shards.lua Normal file
View File

@ -0,0 +1,57 @@
local AceOO = AceLibrary("AceOO-2.0")
local ShardCounter = AceOO.Class(IceClassPowerCounter)
function ShardCounter.prototype:init()
ShardCounter.super.prototype.init(self, "ShardCounter")
self:SetDefaultColor("ShardCounterNumeric", 218, 231, 31)
-- pulled from PaladinPowerBar.xml in Blizzard's UI source
self.runeCoords =
{
{0.01562500, 0.28125000, 0.00781250, 0.13281250},
{0.01562500, 0.28125000, 0.00781250, 0.13281250},
{0.01562500, 0.28125000, 0.00781250, 0.13281250},
}
self.numericColor = "ShardCounterNumeric"
self.unitPower = SPELL_POWER_SOUL_SHARDS
self.runeHeight = 23
self.runeWidth = 26
end
function ShardCounter.prototype:GetOptions()
local opts = ShardCounter.super.prototype.GetOptions(self)
opts.hideBlizz.desc = "Hides Blizzard shard frame and disables all events related to it.\n\nNOTE: Blizzard attaches the shard UI to the player's unitframe, so if you have that hidden in PlayerHealth, then this won't do anything."
return opts
end
function ShardCounter.prototype:GetRuneTexture(rune)
if not rune or rune ~= tonumber(rune) then
return
end
return "Interface\\PlayerFrame\\UI-WarlockShard"
end
function ShardCounter.prototype:ShowBlizz()
ShardBarFrame:Show()
ShardBarFrame:RegisterEvent("UNIT_POWER");
ShardBarFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
ShardBarFrame:RegisterEvent("UNIT_DISPLAYPOWER");
end
function ShardCounter.prototype:HideBlizz()
ShardBarFrame:Hide()
ShardBarFrame:UnregisterAllEvents()
end
-- Load us up
local _, unitClass = UnitClass("player")
if (unitClass == "WARLOCK" and IceHUD.WowVer >= 40000) then
IceHUD.ShardCounter = ShardCounter:new()
end