View Single Post
05-27-11, 08:21 AM   #5
Fugaru
A Murloc Raider
Join Date: Apr 2011
Posts: 6


This is what I have so far. If someone can push me a bit closer into the direction, I would be very happy.
Btw, the first bar is my totembar, the lowest bar should be the maelstrom bar.

Not sure if this is needed but I added it to my tags.lua file anyway
Code:
local MAELSTROM_WEAPON = GetSpellInfo(53817)
oUF.TagEvents["maelstrom"] = "UNIT_AURA"
oUF.Tags["maelstrom"] = function(unit)
	if unit == "player" then
		local name, _, icon, count = UnitBuff("player", MAELSTROM_WEAPON)
		return name and count
	end
end
Than in my lib.lua I've wrote the following
Code:
lib.genMaelstrom = function(self)
	if playerClass ~= "SHAMAN" then return end
	local bars = CreateFrame("Frame", nil, self)
	bars:SetFrameStrata("LOW")
	bars:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0,-37)
	bars:SetWidth(260)
	bars:SetHeight(6)

	for i = 1, 5 do					
		bars[i]=CreateFrame("StatusBar", nil, bars)
		bars[i]:SetHeight(bars:GetHeight())					
		bars[i]:SetStatusBarTexture(cfg.statusbar_texture)
		bars[i]:GetStatusBarTexture():SetHorizTile(false)

		bars[i].bg = bars[i]:CreateTexture(nil, 'BORDER')
		bars[i]:SetStatusBarColor(90/255,90/255,90/255)
		bars[i].bg:SetTexture(228/255,225/255,16/255)
					
		if i == 1 then
			bars[i]:SetPoint("LEFT", bars)
		else
			bars[i]:SetPoint("LEFT", bars[i-1], "RIGHT", 1, 0)
		end
		
		bars[i].bg:SetAllPoints(bars[i])
		bars[i]:SetWidth((bars:GetWidth() - 2)/5)
		bars[i].bg:SetTexture(cfg.statusbar_texture)					
		bars[i].bg:SetAlpha(.15)
	end
				
	bars.backdrop = CreateFrame("Frame", nil, bars)
	frame1px(bars.backdrop)
	CreateShadow(bars.backdrop)
	bars.backdrop:SetBackdropBorderColor(.2,.2,.2,1)
	bars.backdrop:SetPoint("TOPLEFT", -2, 2)
	bars.backdrop:SetPoint("BOTTOMRIGHT", 2, -2)
	bars.backdrop:SetFrameLevel(bars:GetFrameLevel() - 1)
	bars.Override = UpdateMaelstrom
	self.Maelstrom = bars	
end
And like with HolyPower, I also added this
Code:
UpdateMaelstrom = function(self, event, unit, unitBuff)
		if(self.unit ~= unit or (unitBuff and unitBuff ~= 'MAELSTROM_WEAPON')) then return end
		local num = UnitBuff(unit, MAELSTROM_WEAPON)
		for i = 1, MAX_MAELSTROM do
			if(i <= num) then
				self.Maelstrom[i]:SetAlpha(1)
			else
				self.Maelstrom[i]:SetAlpha(.2)
			end
		end
	end
I'm probably doing a lot of things wrong but I got a bar up there, it just doesn't fill up. Atleast I'm not getting lua errors, that's something.

So any idea's?

Last edited by Fugaru : 05-27-11 at 08:27 AM.
  Reply With Quote