- Cleaner method for the warlock Shards module to retrieve the current rune mode such that switching to Demonology spec and back doesn't overwrite it. (I currently force the rune mode to 'graphical' or 'numeric' for Demonology spec since nothing else makes sense at the moment.)

This commit is contained in:
Parnic
2013-03-21 03:03:51 +00:00
parent 713b9d04bb
commit 7d6a880623
2 changed files with 23 additions and 17 deletions

View File

@ -486,15 +486,15 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
local numReady = UnitPower("player", self.unitPower) local numReady = UnitPower("player", self.unitPower)
local percentReady = self.shouldShowUnmodified and (UnitPower("player", self.unitPower, true) / self.unmodifiedMaxPerRune) or numReady local percentReady = self.shouldShowUnmodified and (UnitPower("player", self.unitPower, true) / self.unmodifiedMaxPerRune) or numReady
if self.moduleSettings.runeMode == "Numeric" or self.moduleSettings.alsoShowNumeric then if self:GetRuneMode() == "Numeric" or self.moduleSettings.alsoShowNumeric then
self.frame.numeric:SetText(tostring(percentReady)) self.frame.numeric:SetText(tostring(percentReady))
self.frame.numeric:SetTextColor(self:GetColor(self.numericColor)) self.frame.numeric:SetTextColor(self:GetColor(self.numericColor))
end end
if self.moduleSettings.runeMode ~= "Numeric" then if self:GetRuneMode() ~= "Numeric" then
for i=1, self.numRunes do for i=1, self.numRunes do
if i <= ceil(percentReady) then if i <= ceil(percentReady) then
if self.moduleSettings.runeMode == "Graphical" then if self:GetRuneMode() == "Graphical" then
self.frame.graphical[i].rune:SetVertexColor(1, 1, 1) self.frame.graphical[i].rune:SetVertexColor(1, 1, 1)
else else
self:SetCustomColor(i) self:SetCustomColor(i)
@ -506,7 +506,7 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
if i > numReady or self.numRunes == 1 then if i > numReady or self.numRunes == 1 then
local left, right, top, bottom = 0, 1, 0, 1 local left, right, top, bottom = 0, 1, 0, 1
if self.moduleSettings.runeMode == "Graphical" then if self:GetRuneMode() == "Graphical" then
left, right, top, bottom = unpack(self.runeCoords[i]) left, right, top, bottom = unpack(self.runeCoords[i])
end end
@ -526,7 +526,7 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
elseif i > self.lastNumReady then elseif i > self.lastNumReady then
if self.runeCoords ~= nil and #self.runeCoords >= i then if self.runeCoords ~= nil and #self.runeCoords >= i then
local left, right, top, bottom = 0, 1, 0, 1 local left, right, top, bottom = 0, 1, 0, 1
if self.moduleSettings.runeMode == "Graphical" then if self:GetRuneMode() == "Graphical" then
left, right, top, bottom = unpack(self.runeCoords[i]) left, right, top, bottom = unpack(self.runeCoords[i])
end end
self.frame.graphical[i].rune:SetTexCoord(left, right, top, bottom) self.frame.graphical[i].rune:SetTexCoord(left, right, top, bottom)
@ -635,8 +635,12 @@ function IceClassPowerCounter.prototype:CreateFrame()
self:SetDisplayMode() self:SetDisplayMode()
end end
function IceClassPowerCounter.prototype:GetRuneMode()
return self.moduleSettings.runeMode
end
function IceClassPowerCounter.prototype:SetDisplayMode() function IceClassPowerCounter.prototype:SetDisplayMode()
if self.moduleSettings.runeMode == "Numeric" or self.moduleSettings.alsoShowNumeric then if self:GetRuneMode() == "Numeric" or self.moduleSettings.alsoShowNumeric then
self.frame.numeric:Show() self.frame.numeric:Show()
for i=1, self.numRunes do for i=1, self.numRunes do
self.frame.graphical[i]:Hide() self.frame.graphical[i]:Hide()
@ -645,7 +649,7 @@ function IceClassPowerCounter.prototype:SetDisplayMode()
self.frame.numeric:Hide() self.frame.numeric:Hide()
end end
if self.moduleSettings.runeMode ~= "Numeric" then if self:GetRuneMode() ~= "Numeric" then
for i=1, self.numRunes do for i=1, self.numRunes do
self:SetupRuneTexture(i) self:SetupRuneTexture(i)
self.frame.graphical[i]:Show() self.frame.graphical[i]:Show()
@ -713,7 +717,7 @@ function IceClassPowerCounter.prototype:SetupRuneTexture(rune)
local width = self.runeHeight local width = self.runeHeight
local a,b,c,d = 0, 1, 0, 1 local a,b,c,d = 0, 1, 0, 1
if self.moduleSettings.runeMode == "Graphical" then if self:GetRuneMode() == "Graphical" then
width = self.runeWidth width = self.runeWidth
a,b,c,d = unpack(self.runeCoords[rune]) a,b,c,d = unpack(self.runeCoords[rune])
end end
@ -728,15 +732,15 @@ function IceClassPowerCounter.prototype:SetupRuneTexture(rune)
self.frame.graphical[rune]:SetPoint("TOPLEFT", 0, -1 * ((rune-1) * (self.runeHeight-5) + (rune-1) + ((rune-1) * self.moduleSettings.runeGap))) self.frame.graphical[rune]:SetPoint("TOPLEFT", 0, -1 * ((rune-1) * (self.runeHeight-5) + (rune-1) + ((rune-1) * self.moduleSettings.runeGap)))
end end
if self.moduleSettings.runeMode == "Graphical" then if self:GetRuneMode() == "Graphical" then
self.frame.graphical[rune].rune:SetTexture(self:GetRuneTexture(rune)) self.frame.graphical[rune].rune:SetTexture(self:GetRuneTexture(rune))
elseif self.moduleSettings.runeMode == "Graphical Bar" then elseif self:GetRuneMode() == "Graphical Bar" then
self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "Combo") self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "Combo")
elseif self.moduleSettings.runeMode == "Graphical Circle" then elseif self:GetRuneMode() == "Graphical Circle" then
self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboRound") self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboRound")
elseif self.moduleSettings.runeMode == "Graphical Glow" then elseif self:GetRuneMode() == "Graphical Glow" then
self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboGlow") self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboGlow")
elseif self.moduleSettings.runeMode == "Graphical Clean Circle" then elseif self:GetRuneMode() == "Graphical Clean Circle" then
self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboCleanCurves") self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "ComboCleanCurves")
end end
end end

View File

@ -150,14 +150,16 @@ function ShardCounter.prototype:UpdatePowerType(event)
self:UpdateRunePower() self:UpdateRunePower()
end end
function ShardCounter.prototype:SetDisplayMode() function ShardCounter.prototype:GetRuneMode()
local CurrentRuneMode = ShardCounter.super.prototype.GetRuneMode(self)
if CurrentSpec == SPEC_WARLOCK_DEMONOLOGY then if CurrentSpec == SPEC_WARLOCK_DEMONOLOGY then
if self.moduleSettings.runeMode ~= "Numeric" and self.moduleSettings.runeMode ~= "Graphical" then if CurrentRuneMode ~= "Numeric" and CurrentRuneMode ~= "Graphical" then
self.moduleSettings.runeMode = "Graphical" CurrentRuneMode = "Graphical"
end end
end end
ShardCounter.super.prototype.SetDisplayMode(self) return CurrentRuneMode
end end
function ShardCounter.prototype:GetOptions() function ShardCounter.prototype:GetOptions()