This is what I use to add the altpower bar:
lua Code:
local function AddAltPowerBar(self)
self.AltPowerBar = CreateFrame("StatusBar", "oUF_Rain_AltPowerBar", self)
self.AltPowerBar:SetHeight(3)
self.AltPowerBar:SetPoint("BOTTOMLEFT", self.Overlay, "TOPLEFT", 0, 1)
self.AltPowerBar:SetPoint("BOTTOMRIGHT", self.Overlay, "TOPRIGHT", 0, 1)
self.AltPowerBar:SetFrameLevel(self.Overlay:GetFrameLevel() + 1)
self.AltPowerBar:SetStatusBarTexture(cfg.TEXTURE)
self.AltPowerBar:SetStatusBarColor(0, 0.5, 1)
self.AltPowerBar:SetBackdrop(cfg.BACKDROP)
self.AltPowerBar:SetBackdropColor(0, 0, 0)
self.AltPowerBar.Text = PutFontString(self.AltPowerBar, cfg.FONT2, 8, nil, "CENTER")
self.AltPowerBar.Text:SetPoint("CENTER", self.AltPowerBar, 0, 0)
self:Tag(self.AltPowerBar.Text, "[rain:altpower]")
self.AltPowerBar.Tooltip = function(self)
local unit = self.__owner.unit
-- XXX Temp fix for vehicle
if unit == "vehicle" then unit = "player" end
-- XXX
local powerName = select(10, UnitAlternatePowerInfo(unit))
local powerTooltip = select(11, UnitAlternatePowerInfo(unit))
if powerName then
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 5)
GameTooltip:AddLine(powerName)
if powerTooltip then
GameTooltip:AddLine("\n"..powerTooltip, nil, nil, nil, true)
end
GameTooltip:Show()
end
end
self.AltPowerBar:EnableMouse()
self.AltPowerBar:HookScript("OnLeave", GameTooltip_Hide)
self.AltPowerBar:HookScript("OnEnter", self.AltPowerBar.Tooltip)
self.AltPowerBar.PostUpdate = ns.PostUpdateAltPower
end
And this is how I call it from within UnitSpecific
lua Code:
pet = function(self)
ns.AddAltPowerBar(self) -- we need to pass the player frame here or rework positioning code to use player frame name
end,
So the question is if I could pass the player frame to AddAltPowerBar from within the pet function or do I have to use the player frame name for positioning the bar. This is because I use different styles for player and pet and the Overlay element is only defined for player and target.
This is how it currently looks:
http://img850.imageshack.us/i/wowscr...911213539.jpg/