Thread Tools Display Modes
12-11-09, 11:16 AM   #1
Ilve
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 5
Growing of debuffs/Castbar

Hi everyone. I have two questions to you.
At first. We have unitframe and 6 debuffs.
Standart oUF growing of debuffs:
[Unit_____] [1] [2] [3]
[ ___frame] [4] [5] [6]

But I want to make like that:
[Unit_____] [1] [3] [5]
[ ___frame] [2] [4] [6]

Someone have ideas how realize it?
Fragment of my simple lua
Code:
		self.Debuffs = CreateFrame("Frame", nil, self)
		self.Debuffs.size = 18
		self.Debuffs:SetHeight(self.Debuffs.size)
		self.Debuffs:SetWidth(self.Debuffs.size * 3)
		self.Debuffs:SetPoint("RIGHT", self, 53, 10)
		self.Debuffs.initialAnchor = "BOTTOMLEFT"
		self.Debuffs["growth-x"] = "RIGHT"
		self.Debuffs["growth-y"] = "DOWN"
		self.Debuffs.num = 6
		self.Debuffs.spacing = 0
------------------------
Second question. I want to make castbar as on pictures, but don't know how. Can you help me?
Code:
If target/focus have 1-10 buffs then 
set position #1 
else 
set position #2
end
  Reply With Quote
12-11-09, 12:30 PM   #2
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
For the second part, create a frame that the buffs are anchored to. Make the frame change size depending on the number of buffs that are shown but with a minimum size of 1. Then set the castbar to be anchored to that frame. There's an example of this in oUF_Banthis, though it's not terribly pretty. Need to clean it up at some point.
  Reply With Quote
12-12-09, 04:56 AM   #3
Ilve
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 5
Originally Posted by wurmfood View Post
Make the frame change size depending on the number of buffs...
This is a little problem for me, but I try) Thanks!
oUF_Banthis repoint position only after /rl
  Reply With Quote
12-22-09, 11:58 AM   #4
Ilve
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 5
Originally Posted by Ilve View Post
Second question. I want to make castbar as on pictures, but don't know how. Can you help me?
Done)

Code:
local UpdatePosition = function(self, event, unit)
	self.Castbar:ClearAllPoints()
	if UnitAura(self.unit, 1) then
		self.Castbar:SetPoint("TOP", self.Power, "BOTTOM", -9, -23)
	else
		self.Castbar:SetPoint("TOP", self.Power, "BOTTOM", -9, -5)
	end
end
Code:
if unit=="target" or unit=="focus" then
	    self.Castbar = CreateFrame("StatusBar", nil, self)
		self.Castbar:SetFrameStrata("LOW")
		self.Castbar:SetPoint("BOTTOM", self.Power)

...

		self:RegisterEvent("UNIT_AURA", UpdatePosition)
		self:RegisterEvent("UNIT_SPELLCAST_START", UpdatePosition)
		self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", UpdatePosition)
	end
  Reply With Quote
12-23-09, 04:55 AM   #5
Nodd
A Murloc Raider
 
Nodd's Avatar
Join Date: Dec 2009
Posts: 7
Did you check if it works while in combat ?

In my layout the buffs position changes depending on if I have a pet or not, but this works only while out of combat.

I had to do this (copied from somwhere...) :

Code:
local buffNpet = CreateFrame('Frame')
buffNpet:RegisterEvent('UNIT_PET')
buffNpet:SetScript('OnEvent', function(self,event,unit)
	if(InCombatLockdown()) then
		self:RegisterEvent('PLAYER_REGEN_ENABLED')
	else
		self:UnregisterEvent('PLAYER_REGEN_ENABLED')

		(...)
	end
end)
  Reply With Quote
12-23-09, 05:16 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You only get combat restrictions when you are dealing with the secure frames. In most of the oUF cases that's:
- The main header frames
- The main frame object.

As long as you aren't directly playing with those or frames those are anchored to you are fine.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-23-09, 05:17 AM   #7
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Also, regarding the initial question: You have to re-implement :SetAuraPositions() with support for your column based anchoring. The default function in oUF only does row.
__________________
「貴方は1人じゃないよ」

Last edited by haste : 12-23-09 at 05:17 AM. Reason: damn this lack of time!
  Reply With Quote
12-23-09, 08:20 AM   #8
Ilve
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 5
Originally Posted by Nodd View Post
Did you check if it works while in combat ?
Yes, it works in combat.

Originally Posted by haste View Post
Also, regarding the initial question: You have to re-implement :SetAuraPositions() with support for your column based anchoring. The default function in oUF only does row.
Thank you, I'll try it.

My previous try, with attempt to adapt original Rupture Tourney code.
Code:
if unit=="player" or unit=="target" or unit=="focus" or (self:GetParent():GetName():match"oUF_Party") then
	self.Debuffs = {}
	for i = 1, 6 do
		self.Debuffs[i] = CreateFrame("Frame", nil, self)
		self.Debuffs[i].size = 18
		self.Debuffs[i]:SetWidth(18)
		self.Debuffs[i]:SetHeight(18)
		self.Debuffs[i].num = i
		self.Debuffs[i].spacing = 0
		self.Debuffs.num = {}
		if i == 1 then
			self.Debuffs[i]:SetPoint("RIGHT", self, 53, 10)
		else
			if math.fmod(2, i) == 0 then
				self.Debuffs[i]:SetPoint("TOP", self.Debuffs[i - 1], "BOTTOM", 0, -1)
			else
				self.Debuffs[i]:SetPoint("LEFT", self.Debuffs[i - 2], "RIGHT", 0, 0)
			end
		end
	end
end
fail
  Reply With Quote
12-23-09, 02:03 PM   #9
Ilve
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 5
Originally Posted by haste View Post
Also, regarding the initial question: You have to re-implement :SetAuraPositions() with support for your column based anchoring. The default function in oUF only does row.
It's working!!!
Code:
local SetAuraPosition = function(self, icons, x)
	if(icons and x > 0) then
		local col = 0
		local row = 0
		local spacing = icons.spacing or 0
		local gap = icons.gap
		local size = (icons.size or 16) + spacing
		local anchor = icons.initialAnchor or "BOTTOMLEFT"
		local growthx = (icons["growth-x"] == "LEFT" and -1) or 1
		local growthy = (icons["growth-y"] == "DOWN" and -1) or 1
		local cols = math.floor(icons:GetWidth() / size + .5)
		local rows = math.floor(icons:GetHeight() / size + .5)

		for i = 1, #icons do
			local button = icons[i]
			if(button and button:IsShown()) then
				if(gap and button.debuff) then
					if(col > 0) then
						col = col + 1
					end

					gap = false
				end

				if(row >= rows) then
					row = 0
					col = col + 1
				end
				button:ClearAllPoints()
				button:SetPoint(anchor, icons, anchor, col * size * growthx, row * size * growthy)

				row = row + 1
			elseif(not button) then
				break
			end
		end
	end
end
Code:
	if unit=="player" or unit=="target" or unit=="focus" or (self:GetParent():GetName():match"oUF_Party") then
		self.Debuffs = CreateFrame("Frame", nil, self)
		self.Debuffs.size = 18
		self.Debuffs:SetHeight(self.Debuffs.size * 2)
		self.Debuffs:SetWidth(self.Debuffs.size * 3)
		self.Debuffs:SetPoint("RIGHT", self, 53, 19)
		self.Debuffs["growth-x"] = "RIGHT"
		self.Debuffs["growth-y"] = "DOWN"
		self.Debuffs.num = 6
		self.Debuffs.spacing = 0
		
		self.SetAuraPosition = SetAuraPosition
	end
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Growing of debuffs/Castbar


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off