In 5.0 the max number of Holy power and Chi(Harmony Obrs) changes when:
Paladin learned
Boundless Conviction;
Monk learned
Ascension.
I set the max number by
UnitPowerMax("player", SPELL_POWER_HOLY_POWER) and
UnitPowerMax("player" , SPELL_POWER_LIGHT_FORCE).
But when my monk changes talent points, the harmony bar don't update it's max chi number and an error will occur if i get one more Chi.
It's hard to test this on a paladin, but i guess it's the same thing.
The width of Holy power bar and Harmony bar are fixed in my layout, so I have to calculate each's width using barwidth/number.
There are two way i can see to avoid this problem.
Give up fixed total width and set the number to 5 Holypower and 5 Chi.
Reload UI when max number update.
You see, the problem are not
solved but just
avoided.
Anyone has idea on update max number of holy power and Chi?
Here's my code:
Lua Code:
-- Runes, Shards, HolyPower --
if multicheck(class, "DEATHKNIGHT", "WARLOCK", "PALADIN", "MONK", "SHAMAN", "PRIEST") then
local count
if class == "DEATHKNIGHT" then
count = 6
elseif class == "MONK" then
count = UnitPowerMax("player" , SPELL_POWER_LIGHT_FORCE)
elseif class == "SHAMAN" then
count = 4
elseif class == "WARLOCK" then
count = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS)
elseif class == "PALADIN" then
count = UnitPowerMax("player", SPELL_POWER_HOLY_POWER)
elseif class == "PRIEST" then
count = UnitPowerMax("player", SPELL_POWER_SHADOW_ORBS)
end
local bars = CreateFrame("Frame", nil, self)
if cfg.Ruserplaced and class == "DEATHKNIGHT" then
bars:SetSize(cfg.Rwidth,cfg.Rheight)
bars:SetPoint(unpack(cfg.Runesp))
createBackdrop(bars, bars, 0, 3)
else
bars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -8)
bars:SetSize(cfg.width, 10)
end
local i = count
for index = 1, count do
bars[i] = createStatusbar(bars, cfg.texture, nil, cfg.height*-(cfg.hpheight-1), (cfg.width+3)/count-3, 1, 1, 1, 1)
if class == "WARLOCK" or class == "PRIEST" then
bars[i]:SetStatusBarColor(253/255, 91/255, 176/255)
elseif class == "PALADIN" or class == "MONK" then
bars[i]:SetStatusBarColor(255/255, 255/255, 53/255)
end
if cfg.Ruserplaced and class == "DEATHKNIGHT" then
bars[i]:SetSize((cfg.Rwidth+3)/count-3,cfg.Rheight)
end
if i == count then
bars[i]:SetPoint("TOPRIGHT", bars, "TOPRIGHT")
else
bars[i]:SetPoint("RIGHT", bars[i+1], "LEFT", -3, 0)
end
bars[i].bg = bars[i]:CreateTexture(nil, "BACKGROUND")
bars[i].bg:SetAllPoints(bars[i])
bars[i].bg:SetTexture(0.3, 0.3, 0.3, 1)
bars[i].bd = createBackdrop(bars[i], bars[i],1,3)
i=i-1
end
if class == "DEATHKNIGHT" then
bars[3], bars[4], bars[5], bars[6] = bars[5], bars[6], bars[3], bars[4]
self.Runes = bars
elseif class == "WARLOCK" then
self.SoulShards = bars
if cfg.customsp then bars:Hide() end
elseif class == "PALADIN" then
self.HolyPower = bars
if cfg.customsp then bars:Hide() end
elseif class == "MONK" then
self.Harmony = bars
if cfg.customsp then bars:Hide() end
elseif class == "SHAMAN" then
self.TotemBar = bars
elseif class == "PRIEST" then
self.ShadowOrbs = bars
if cfg.customsp then bars:Hide() end
end
end