Maerlyns |
03-24-15 09:40 AM |
oUF_Mu problem with class power and vehicle UI
Hey :)
Since the author of oUF_Mu seems not to be active anymore I hope you could help me.
Every time I leave a vehicle (for example the mounts of the Argent Tournament) my class power like Holy Power doesn't work correctly. If you download the normal files you'll see that the frame doesn't show up again. That's easily fixed with taking every power in the function "VehicleVisibilityUpdate" but now the frame shows up and if I gain one Holy Power the frame doesn't show me that. With DK runes it works great. I couldn't find any mistake but well, I'm not very good at LUA.
All I have found in the code was this:
Code:
--=================================--
-- class points bars
--=================================--
local function cpPositionCalc(width, count) -- calculate the position of the first point
return 1-floor((width+2)*count/2)
end
local function PostUpdateRune(runes, rune, rid, start, duration, ready)
local runetype = GetRuneType(rid)
local r, g, b = unpack(oUF.colors.runes[runetype])
if ready then
rune:SetStatusBarColor(r, g, b)
else
rune:SetStatusBarColor(r*.6, g*.6, b*.6)
end
end
local function VehicleVisibilityUpdate(self, event, unit)
local element = self.Runes and self.Runes or self.TotemBar or self.ClassIcons or self.CPoints
for i = 1, #element do
if UnitHasVehicleUI('player') then
element[i]:Hide()
else
element[i]:Show()
end
end
end
local function ShadowOrbsVisibilityUpdate(self, event, ...)
local orbs = self.ClassIcons
for i = 1, 3 do
if UnitHasVehicleUI('player') or GetSpecialization() ~= 3 then
orbs[i]:Hide()
else
orbs[i]:Show()
end
end
end
local function classPointHelper(self, class, pinfo)
local w, h, count = pinfo.size.w, pinfo.size.h, pinfo.count
if count < 5 and class ~= 'SHAMAN' then count = 5 end
local points = {}
for i = 1, count do
local point = CreateFrame('StatusBar', nil, self)
point:SetSize(w-2, h-2)
point:SetStatusBarTexture(cfg.powertex)
point.bg = point:CreateTexture(nil, 'BACKGROUND')
point.bg:SetAllPoints(point)
point.border = mu.createBorder(point)
if class == 'DEATHKNIGHT' then
local runetype = GetRuneType(i)
local r, g, b = unpack(oUF.colors.runes[runetype])
point.bg:SetTexture(r, g, b, 0.75)
point.bg.multiplier = .25
elseif class == 'ROGUE' or class == 'DRUID' then
point:SetStatusBarColor(unpack(cpcolor[i]))
end
points[i] = point
if i == 1 then
point:SetPoint('BOTTOMLEFT', UIParent, 'CENTER', cpPositionCalc(w, pinfo.count), -109)
else
point:SetPoint('LEFT', points[i-1], 'RIGHT', 4, 0)
end
end
return points
end
local function ClassIconsPostUpdate(points, cur, max, changed)
local r1, b1, g1, r2, b2, g2
if pClass == 'PALADIN' then
r1, g1, b1 = 0.82, 0.56, 0.18
r2, g2, b2 = 0.9, 0.78, 0.21
elseif pClass == 'PRIEST' then
r1, g1, b1 = 0.48, 0.15, 0.93
r2, g2, b2 = 0.62, 0.32, 0.98
elseif pClass == 'MONK' then
r1, g1, b1 = 0.3, 0.85, 0.51
r2, g2, b2 = 0.56, 0.91, 0.78
end
for i = 1, max do
local point = points[i]
local minvalue, maxvalue = points[i]:GetMinMaxValues()
if cur == max then
point:SetStatusBarColor(r2, g2, b2)
point:SetValue(maxvalue)
point:Show()
elseif i > cur then
point:SetValue(minvalue)
point:Show()
else
point:SetStatusBarColor(r1, g1, b1)
point:SetValue(maxvalue)
point:Show()
end
end
end
local function ClassIconsUpdateTexture(element)
local r, g, b
if pClass == 'PALADIN' then
r, g, b = 0.82, 0.56, 0.18
elseif pClass == 'PRIEST' then
r, g, b = 0.52, 0.13, 0.93
elseif pClass == 'MONK' then
r, g, b = 0.3, 0.85, 0.51
end
for i = 1, #element do
element[i]:SetMinMaxValues(0,1)
element[i]['bg']:SetTexture(r*.25, g*.25, b*.25, .75)
end
end
mu.classPoints = function(self)
local pinfo
if pClass == 'PALADIN' then
pinfo = {
count = UnitPowerMax('player', SPELL_POWER_HOLY_POWER),
size = { w=26, h=12 },
}
elseif pClass == 'PRIEST' then
pinfo = {
count = 3,
size = { w=30, h=12 },
}
elseif pClass == 'MONK' then
pinfo = {
count = UnitPowerMax('player', SPELL_POWER_CHI),
size = { w=26, h=12 },
}
elseif pClass == 'DRUID' or pClass == 'ROGUE' then
pinfo = {
count = MAX_COMBO_POINTS,
size = { w=26, h=12 },
}
elseif pClass == 'DEATHKNIGHT' then
pinfo = {
count = 6,
size = { w=24, h=12 },
}
elseif pClass == 'SHAMAN' then
pinfo = {
count = 4,
size = { w=30, h=12},
}
end
local points = classPointHelper(self, pClass, pinfo)
if mu.multicheck(pClass, 'PALADIN', 'PRIEST', 'MONK') then
self.ClassIcons = points
self.ClassIcons.UpdateTexture = ClassIconsUpdateTexture
self.ClassIcons.PostUpdate = ClassIconsPostUpdate
self:RegisterEvent('UNIT_ENTERING_VEHICLE', VehicleVisibilityUpdate)
self:RegisterEvent('UNIT_EXITED_VEHICLE', VehicleVisibilityUpdate)
elseif pClass == 'DRUID' or pClass == 'ROGUE' then
self.CPoints = points
self:RegisterEvent('UNIT_ENTERING_VEHICLE', VehicleVisibilityUpdate)
self:RegisterEvent('UNIT_EXITED_VEHICLE', VehicleVisibilityUpdate)
elseif pClass == 'DEATHKNIGHT' then
oUF.colors.runes = {
{0.75, 0.21, 0.21}, -- blood
{0.36, 0.72, 0.22}, -- unholy
{0.18, 0.63, 0.79}, -- frost
{0.67, 0.15, 0.75}, -- death
}
self.Runes = points
self.Runes.PostUpdateType = PostUpdateRuneType
self.Runes.PostUpdateRune = PostUpdateRune
self:RegisterEvent('UNIT_ENTERING_VEHICLE', VehicleVisibilityUpdate)
self:RegisterEvent('UNIT_EXITED_VEHICLE', VehicleVisibilityUpdate)
elseif pClass == 'SHAMAN' then
self.TotemBar = points
self.TotemBar.Destroy = true
self:RegisterEvent('UNIT_ENTERING_VEHICLE', VehicleVisibilityUpdate)
self:RegisterEvent('UNIT_EXITED_VEHICLE', VehicleVisibilityUpdate)
end
if pClass == 'PRIEST' then
self:RegisterEvent('PLAYER_ENTERING_WORLD', ShadowOrbsVisibilityUpdate)
self:RegisterEvent('PLAYER_TALENT_UPDATE', ShadowOrbsVisibilityUpdate)
self:RegisterEvent('ACTIVE_TALENT_GROUP_CHANGED', ShadowOrbsVisibilityUpdate)
self:RegisterEvent('UNIT_ENTERING_VEHICLE', ShadowOrbsVisibilityUpdate)
self:RegisterEvent('UNIT_EXITED_VEHICLE', ShadowOrbsVisibilityUpdate)
end
end
Could you please help me find the incorrect parts in this code?
|