- Added support for bar-style class powers that grow left to right instead of just adding a new count or growing individual powers bottom-up. This could really use a background to give a sense of the bar's extents, but I'll leave that for a future improvement.

- Added basic support for Demonology spec (Demonic Fury) Warlock power.
- Fixed a bug or two in Warlock power presentation when un-speccing or learning a new spec after having been without a spec.
- Added support for hiding Warlock power until the requisite spell has been learned because apparently (after looking at Blizzard's code) you can have the spec without having the spell that builds up the power associated with the spec. Okay.
This commit is contained in:
Parnic
2012-08-26 19:17:46 +00:00
parent 221d83566b
commit b585385273
2 changed files with 72 additions and 10 deletions

View File

@ -18,6 +18,9 @@ IceClassPowerCounter.prototype.requiredSpec = nil
IceClassPowerCounter.prototype.shouldShowUnmodified = false
IceClassPowerCounter.prototype.unmodifiedMaxPerRune = 10
IceClassPowerCounter.prototype.growModes = { width = 1, height = 2 }
IceClassPowerCounter.prototype.currentGrowMode = nil
-- Constructor --
function IceClassPowerCounter.prototype:init(name)
assert(name ~= nil, "ClassPowerCounter cannot be instantiated directly - supply a name from the child class and pass it up.")
@ -453,15 +456,25 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
self.frame.graphical[i]:Show()
end
if i > numReady then
if i > numReady or self.numRunes == 1 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))
if self.numRunes == 1 then
currPercent = numReady / UnitPowerMax("player", self.unitPower)
end
if self.currentGrowMode == self.growModes["height"] then
top = bottom - (currPercent * (bottom - top))
self.frame.graphical[i].rune:SetHeight(currPercent * self.runeHeight)
elseif self.currentGrowMode == self.growModes["width"] then
right = left + (currPercent * (right - left))
self.frame.graphical[i].rune:SetWidth(currPercent * self.runeWidth)
end
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
@ -593,7 +606,7 @@ function IceClassPowerCounter.prototype:CreateRuneFrame()
-- create numeric runes
self.frame.numeric = self:FontFactory(self.moduleSettings.runeFontSize, self.frame, self.frame.numeric)
self.frame.numeric:SetWidth(50)
self.frame.numeric:SetWidth(100)
self.frame.numeric:SetJustifyH("CENTER")
self.frame.numeric:SetAllPoints(self.frame)
@ -615,7 +628,6 @@ function IceClassPowerCounter.prototype:CreateRune(i)
self.frame.graphical[i]:SetFrameStrata("BACKGROUND")
self.frame.graphical[i].rune = self.frame.graphical[i]:CreateTexture(nil, "LOW")
self.frame.graphical[i].rune:SetPoint("BOTTOM", self.frame.graphical[i], "BOTTOM")
self.frame.graphical[i].rune:SetVertexColor(0, 0, 0)
self:SetupRuneTexture(i)
@ -637,6 +649,11 @@ function IceClassPowerCounter.prototype:CreateRune(i)
self.frame.graphical[i]:SetHeight(self.runeHeight)
self.frame.graphical[i].rune:SetWidth(self.runeWidth)
self.frame.graphical[i].rune:SetHeight(self.runeHeight)
if self.currentGrowMode == self.growModes["width"] then
self.frame.graphical[i].rune:SetPoint("LEFT", self.frame.graphical[i], "LEFT")
else
self.frame.graphical[i].rune:SetPoint("BOTTOM", self.frame.graphical[i], "BOTTOM")
end
end
function IceClassPowerCounter.prototype:SetupRuneTexture(rune)

View File

@ -17,7 +17,10 @@ function ShardCounter.prototype:Enable(core)
if IceHUD.WowVer >= 50000 then
self:RegisterEvent("PLAYER_TALENT_UPDATE", "UpdatePowerType")
self:RegisterEvent("UNIT_DISPLAYPOWER", "UpdatePowerType")
self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "UpdatePowerType")
self:RegisterEvent("UNIT_POWER_FREQUENT", "UpdateRunePower")
self:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED", "UpdatePowerType")
end
self:UpdatePowerType()
end
@ -38,14 +41,18 @@ function ShardCounter.prototype:UpdateRunePower(event, arg1, arg2)
ShardCounter.super.prototype.UpdateRunePower(self, event, arg1, arg2)
end
function ShardCounter.prototype:UpdatePowerType()
function ShardCounter.prototype:UpdatePowerType(event)
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
self.requiredSpec = CurrentSpec
self.currentGrowMode = nil
if CurrentSpec == SPEC_WARLOCK_AFFLICTION then
self.runeCoords =
{
@ -56,6 +63,15 @@ function ShardCounter.prototype:UpdatePowerType()
self.unitPower = SPELL_POWER_SOUL_SHARDS
self.runeHeight = 23
self.runeWidth = 26
self.numRunes = 3
self.numConsideredFull = 99
if not IsPlayerSpell(WARLOCK_SOULBURN) then
self.requiredSpec = -1
self:RegisterEvent("SPELLS_CHANGED", "UpdatePowerType")
else
self:UnregisterEvent("SPELLS_CHANGED", "UpdatePowerType")
end
elseif CurrentSpec == SPEC_WARLOCK_DESTRUCTION then
self.runeCoords =
{
@ -68,18 +84,37 @@ function ShardCounter.prototype:UpdatePowerType()
self.runeHeight = 28
self.runeWidth = 31
self.unmodifiedMaxPerRune = MAX_POWER_PER_EMBER
self.numRunes = 3
self.numConsideredFull = 3
self.currentGrowMode = self.growModes["height"]
if not IsPlayerSpell(WARLOCK_BURNING_EMBERS) then
self.requiredSpec = -1
self:RegisterEvent("SPELLS_CHANGED", "UpdatePowerType")
else
self:UnregisterEvent("SPELLS_CHANGED", "UpdatePowerType")
end
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},
{0.03906250, 0.55468750, 0.10546875, 0.19921875},
}
self.unitPower = SPELL_POWER_DEMONIC_FURY
self.runeHeight = 28
self.runeWidth = 31
self.runeWidth = 93
self.numRunes = 1
self.numConsideredFull = 99
self.currentGrowMode = self.growModes["width"]
for i=self.numRunes + 1, #self.frame.graphical do
self.frame.graphical[i]:Hide()
end
else
self.requiredSpec = -1
self:RegisterEvent("SPELLS_CHANGED", "UpdatePowerType")
end
self:CheckValidSpec()
self:CreateFrame()
for i=1, self.numRunes do
self:SetupRuneTexture(i)
@ -87,6 +122,16 @@ function ShardCounter.prototype:UpdatePowerType()
self:UpdateRunePower()
end
function ShardCounter.prototype:SetDisplayMode()
if CurrentSpec == SPEC_WARLOCK_DEMONOLOGY then
if self.moduleSettings.runeMode ~= "Numeric" and self.moduleSettings.runeMode ~= "Graphical" then
self.moduleSettings.runeMode = "Graphical"
end
end
ShardCounter.super.prototype.SetDisplayMode(self)
end
function ShardCounter.prototype:GetOptions()
local opts = ShardCounter.super.prototype.GetOptions(self)