View Single Post
08-18-10, 09:04 PM   #25
Toran
A Nerdscale Dorkin
 
Toran's Avatar
Premium Member
Join Date: May 2006
Posts: 143
I've been working on this for a while now and the debuffs just aren't moving if there are combo points. I know I have something not right, so here is the code. Any further hints / kicks in the right direction would be helpful.

Code:
local comboUpdate = function(self, event, unit)
	-- copied from standard update routine
	if(unit == 'pet') then return end

	local cp
	if(UnitExists'vehicle') then
		cp = GetComboPoints('vehicle', 'target')
	else
		cp = GetComboPoints('player', 'target')
	end

	local cpoints = self.CPoints
	for i=1, MAX_COMBO_POINTS do
		if(i <= cp) then
			cpoints[i]:Show()
		else
			cpoints[i]:Hide()
		end
	end

	-- add postupdate support
	if cpoints.PostUpdate then cpoints.PostUpdate(self) end
end

			
--move the debuffs if combo points are detected
local comboPostUpdate = function(self)
	if CPoints then
		self.Debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 45)
	else
		self.Debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 10)
	end			
end	

local UnitSpecific = {
...
     target = function(self)
     ...
         if auras then
         ...
			local debuffs = CreateFrame("Frame", nil, self)
			debuffs:SetHeight(height+2)
			debuffs:SetWidth(width)
			--debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 10)
			debuffs.spacing = 4
			debuffs.size = height+2
			debuffs.initialAnchor = "BOTTOMLEFT"
			
			debuffs.PostCreateIcon = auraIcon
			debuffs.PostUpdateIcon = PostUpdateIcon
		
			self.Debuffs = debuffs
			self.Debuffs.num = 32
          end

          local CPoints = {}
			for index = 1, MAX_COMBO_POINTS do
				local CPoint = CreateFrame("Frame", nil, self.Health)
				CPoint:SetHeight(6)
				CPoint:SetWidth(width * .96 / MAX_COMBO_POINTS)
				CPoint:SetFrameStrata("BACKGROUND")
				kiss_set_me_a_backdrop(CPoint)
				CPoint.bg = CPoint:CreateTexture(nil, "LOW")
				CPoint.bg:SetTexture(texture)
				CPoint.bg:SetAllPoints(CPoint)
				--CPoint:SetPoint('LEFT', index == 1 and self.Health or CPoints[index - 1], 'LEFT', 20, 10)
				if(index == 1) then
					CPoint:SetPoint("LEFT", self.Health, "LEFT", 0, 15)
				else
					CPoint:SetPoint("LEFT", CPoints[index-1], "RIGHT", 2, 0)
				end

				if(index == 1) then CPoint.bg:SetVertexColor(1,1,0) end
				if(index == 2) then CPoint.bg:SetVertexColor(1,0.75,0) end
				if(index == 3) then CPoint.bg:SetVertexColor(1,0.5,0) end
				if(index == 4) then CPoint.bg:SetVertexColor(1,0.25,0) end
				if(index == 5) then CPoint.bg:SetVertexColor(1,0,0) end
				CPoints[index] = CPoint
			end
			CPoints.Update = comboUpdate
			CPoints.PostUpdate = comboPostUpdate
			self.CPoints = CPoints
     end

Last edited by Toran : 08-20-10 at 11:10 AM.
  Reply With Quote