- Added Destruction spec (Burning Embers) support to the warlock power module and renamed it from Shard Counter to Warlock Power. Demonology support coming soon. Hopefully.

This commit is contained in:
Parnic
2012-08-26 05:46:19 +00:00
parent 3e32e4a481
commit 221d83566b
2 changed files with 129 additions and 26 deletions

View File

@ -1,23 +1,90 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
local ShardCounter = IceCore_CreateClass(IceClassPowerCounter)
local CurrentSpec = nil
function ShardCounter.prototype:init()
ShardCounter.super.prototype.init(self, "ShardCounter")
ShardCounter.super.prototype.init(self, "Warlock Power")
self:SetDefaultColor("ShardCounterNumeric", 218, 231, 31)
-- pulled from ShardBar.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.minLevel = SHARDBAR_SHOW_LEVEL
self.runeHeight = 23
self.runeWidth = 26
end
function ShardCounter.prototype:Enable(core)
ShardCounter.super.prototype.Enable(self, core)
if IceHUD.WowVer >= 50000 then
self:RegisterEvent("PLAYER_TALENT_UPDATE", "UpdatePowerType")
self:RegisterEvent("UNIT_POWER_FREQUENT", "UpdateRunePower")
end
self:UpdatePowerType()
end
function ShardCounter.prototype:UpdateRunePower(event, arg1, arg2)
if IceHUD.WowVer >= 50000 then
if event == "UNIT_POWER_FREQUENT" and arg1 == "player" then
if CurrentSpec == SPEC_WARLOCK_DESTRUCTION and arg2 ~= "BURNING_EMBERS" then
return
elseif CurrentSpec == SPEC_WARLOCK_DEMONOLOGY and arg2 ~= "DEMONIC_FURY" then
return
elseif CurrentSpec == SPEC_WARLOCK_AFFLICTION and arg2 ~= "SOUL_SHARDS" then
return
end
end
end
ShardCounter.super.prototype.UpdateRunePower(self, event, arg1, arg2)
end
function ShardCounter.prototype:UpdatePowerType()
if IceHUD.WowVer >= 50000 then
CurrentSpec = GetSpecialization()
else
-- all warlocks use shards in pre-5.0, so just act like our spec is affliction
CurrentSpec = SPEC_WARLOCK_AFFLICTION
end
self.shouldShowUnmodified = false
if CurrentSpec == SPEC_WARLOCK_AFFLICTION then
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.unitPower = SPELL_POWER_SOUL_SHARDS
self.runeHeight = 23
self.runeWidth = 26
elseif CurrentSpec == SPEC_WARLOCK_DESTRUCTION then
self.runeCoords =
{
{0.00390625, 0.14453125, 0.32812500, 0.93750000},
{0.00390625, 0.14453125, 0.32812500, 0.93750000},
{0.00390625, 0.14453125, 0.32812500, 0.93750000},
}
self.unitPower = SPELL_POWER_BURNING_EMBERS
self.shouldShowUnmodified = true
self.runeHeight = 28
self.runeWidth = 31
self.unmodifiedMaxPerRune = MAX_POWER_PER_EMBER
elseif CurrentSpec == SPEC_WARLOCK_DEMONOLOGY then
self.runeCoords =
{
{0.00390625, 0.03125000, 0.09765625, 0.18359375},
{0.00390625, 0.03125000, 0.09765625, 0.18359375},
{0.00390625, 0.03125000, 0.09765625, 0.18359375},
}
self.unitPower = SPELL_POWER_DEMONIC_FURY
self.runeHeight = 28
self.runeWidth = 31
end
self:CreateFrame()
for i=1, self.numRunes do
self:SetupRuneTexture(i)
end
self:UpdateRunePower()
end
function ShardCounter.prototype:GetOptions()
@ -43,6 +110,12 @@ function ShardCounter.prototype:GetRuneTexture(rune)
return
end
if CurrentSpec == SPEC_WARLOCK_DESTRUCTION then
return "Interface\\PlayerFrame\\Warlock-DestructionUI"
elseif CurrentSpec == SPEC_WARLOCK_DEMONOLOGY then
return "Interface\\PlayerFrame\\Warlock-DemonologyUI"
end
return "Interface\\PlayerFrame\\UI-WarlockShard"
end