- 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

@ -15,6 +15,8 @@ IceClassPowerCounter.prototype.DesiredAnimDuration = 0.6
IceClassPowerCounter.prototype.DesiredScaleMod = .4
IceClassPowerCounter.prototype.DesiredAnimPause = 0.5
IceClassPowerCounter.prototype.requiredSpec = nil
IceClassPowerCounter.prototype.shouldShowUnmodified = false
IceClassPowerCounter.prototype.unmodifiedMaxPerRune = 10
-- Constructor --
function IceClassPowerCounter.prototype:init(name)
@ -427,15 +429,20 @@ function IceClassPowerCounter.prototype:Disable(core)
end
end
function IceClassPowerCounter.prototype:UpdateRunePower()
function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
if event and (event == "UNIT_POWER" or event == "UNIT_POWER_FREQUENT") and arg1 ~= "player" and arg1 ~= "vehicle" then
return
end
local numReady = UnitPower("player", self.unitPower)
local percentReady = self.shouldShowUnmodified and (UnitPower("player", self.unitPower, true) / self.unmodifiedMaxPerRune) or numReady
if self.moduleSettings.runeMode == "Numeric" then
self.frame.numeric:SetText(tostring(numReady))
self.frame.numeric:SetText(tostring(percentReady))
self.frame.numeric:SetTextColor(self:GetColor(self.numericColor))
else
for i=1, self.numRunes do
if i <= numReady then
if i <= ceil(percentReady) then
if self.moduleSettings.runeMode == "Graphical" then
self.frame.graphical[i].rune:SetVertexColor(1, 1, 1)
else
@ -446,14 +453,34 @@ function IceClassPowerCounter.prototype:UpdateRunePower()
self.frame.graphical[i]:Show()
end
if i > self.lastNumReady and self.moduleSettings.flashWhenBecomingReady then
local fadeInfo={
mode = "IN",
timeToFade = self.runeShineFadeSpeed,
finishedFunc = function() self:ShineFinished(i) end,
finishedArg1 = i
}
UIFrameFade(self.frame.graphical[i].shine, fadeInfo);
if i > numReady then
local left, right, top, bottom = 0, 1, 0, 1
if self.moduleSettings.runeMode == "Graphical" then
left, right, top, bottom = unpack(self.runeCoords[i])
end
local currPercent = percentReady - numReady
top = bottom - (currPercent * (bottom - top))
self.frame.graphical[i].rune:SetTexCoord(left, right, top, bottom)
self.frame.graphical[i].rune:SetHeight(currPercent * self.runeHeight)
elseif i > self.lastNumReady then
if self.runeCoords ~= nil and #self.runeCoords >= i then
local left, right, top, bottom = 0, 1, 0, 1
if self.moduleSettings.runeMode == "Graphical" then
left, right, top, bottom = unpack(self.runeCoords[i])
end
self.frame.graphical[i].rune:SetTexCoord(left, right, top, bottom)
self.frame.graphical[i].rune:SetHeight(self.runeHeight)
end
if self.moduleSettings.flashWhenBecomingReady then
local fadeInfo={
mode = "IN",
timeToFade = self.runeShineFadeSpeed,
finishedFunc = function() self:ShineFinished(i) end,
finishedArg1 = i
}
UIFrameFade(self.frame.graphical[i].shine, fadeInfo);
end
end
else
if self.moduleSettings.inactiveDisplayMode == "Darkened" then
@ -586,11 +613,9 @@ function IceClassPowerCounter.prototype:CreateRune(i)
if (not self.frame.graphical[i]) then
self.frame.graphical[i] = CreateFrame("Frame", nil, self.frame)
self.frame.graphical[i]:SetFrameStrata("BACKGROUND")
self.frame.graphical[i]:SetWidth(self.runeWidth)
self.frame.graphical[i]:SetHeight(self.runeHeight)
self.frame.graphical[i].rune = self.frame.graphical[i]:CreateTexture(nil, "LOW")
self.frame.graphical[i].rune:SetAllPoints(self.frame.graphical[i])
self.frame.graphical[i].rune:SetPoint("BOTTOM", self.frame.graphical[i], "BOTTOM")
self.frame.graphical[i].rune:SetVertexColor(0, 0, 0)
self:SetupRuneTexture(i)
@ -607,6 +632,11 @@ function IceClassPowerCounter.prototype:CreateRune(i)
self.frame.graphical[i]:Hide()
end
self.frame.graphical[i]:SetWidth(self.runeWidth)
self.frame.graphical[i]:SetHeight(self.runeHeight)
self.frame.graphical[i].rune:SetWidth(self.runeWidth)
self.frame.graphical[i].rune:SetHeight(self.runeHeight)
end
function IceClassPowerCounter.prototype:SetupRuneTexture(rune)
@ -709,7 +739,7 @@ function IceClassPowerCounter.prototype:AlphaPassThroughTarget()
end
function IceClassPowerCounter.prototype:HideBlizz()
assert(true, "Must override HideBlizz in child classes.")
assert(false, "Must override HideBlizz in child classes.")
end
function IceClassPowerCounter.prototype:UseTargetAlpha()

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