Thread Tools Display Modes
01-08-10, 04:26 PM   #1
aleceiffel
A Kobold Labourer
Join Date: Oct 2008
Posts: 1
Question A few layout questions

1 - I'm trying to make a filter so that my targets buffs show all buffs at a smaller size when the target is a friendly player, and show only spellstealable buffs otherwise, but at a larger size. I've gotten it to work for the most part, but there are 2 things I haven't been able to sort out. My relevant code is

Code:
local function auraUpdateIcon(self, icons, unit, icon, index, offset, filter, isDebuff)
   
	local button = icons[index + offset]
	if (unit == "target") then
		if (playerClass == "MAGE") then
				if (UnitIsFriend('player', unit) and UnitIsPlayer(unit)) then
					--buff code
					button:SetHeight(24)
					button:SetWidth(24)
					icons:SetWidth(24*8)
					elseif (UnitIsEnemy('player', unit) or (not UnitIsPlayer(unit))) then
					-- filter buff code
					button:SetHeight(36)
					button:SetWidth(36)
					icons:SetWidth(36*5)
				end
		else
			--buff code
			button:SetHeight(24)
			button:SetWidth(24)
			icons:SetWidth(24*8)
		end
	end	
	
	if(unit) or (self:GetParent():GetName():match"oUF_Party") then 
		local _, _, _, _, _, duration, timeLeft = UnitAura(unit, index, filter)
		
		if duration > 0 and timeLeft then
			icon.timeLeft = timeLeft - GetTime()
			
			if unit == 'player' then
				icon:SetScript('OnUpdate', auraUpdateTimeShort)			
			else
				icon:SetScript('OnUpdate', auraUpdateTimeShort)
			end
		else
			icon.timeLeft = nil
			icon.time:SetText()
			
			icon:SetScript('OnUpdate', nil)
		end
	end
end

local function SSFilter(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
	local reac = UnitIsFriend("player", "target")
	
	if(buffFilter[name] or isStealable) then
		return true
	elseif reac == 1 then
		return true
	end
	icon:SetScript('OnUpdate', auraUpdateIcon)
end
Code:
self.Buffs = CreateFrame("Frame", nil, self)
self.Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -1, 55)
self.Buffs.initialAnchor = "TOPLEFT"
self.Buffs["growth-y"] = "UP"
self.Buffs["growth-x"] = "RIGHT"
self.Buffs.numBuffs = 20
self.Buffs.gap = false
self.Buffs.spacing = 3
self.Buffs.size = 36
self.Buffs:SetHeight(self.Buffs.size)
self.Buffs:SetWidth(self.Buffs.size * 5)
Code:
self.CustomAuraFilter = SSFilter
The 2 issues I'm having are that the buffs do not change if the target is friendly initially and then goes hostile (like when someone get's MC'd or a duel is initiated) and when the buffs are smaller, there is a large gap between the buffs. I assume that for the first problem I'm missing an event or an OnUpdate, since if i detarget and retarget, they show correctly, but for the second one I'm not sure, but I'd guess I'm not resetting the width properly. I saw a discussion about reimplementing SetAuraPosition, but I'm not sure if that's the direction I should be looking in.

2 - I would like to recolor the spell name on the castbar based on whether the cast is interruptable or not, but I'm not sure how to approach this. I know how I could go about setting the text color, but I'm not sure how to set up the logic to determine whether the cast is interruptable, or how to implement the events associated with it, as i didn't see them implemented in the core, though i did see that the return from UnitCastingInfo is in there.

3 - Now that your AFK flag is removed when entering an instance/BG, I'm not sure how to set up detection for that in my AFK tag. I already check against the event PLAYER_FLAGS_CHANGED, but that doesn't seem to fire when entering an instance, and I'm guessing that the state of the flag changes after PLAYER_ENTERING_WORLD fires as I wasn't able to add that to fix the issue. Reading over at wowwiki, it seemed there was no reliable way to tell when you have entered an instance, so I was hoping someone could give me some insight as to how to approach this.

Normally when I run into an issue I check out some of the other well designed layouts for ideas, but I haven't been able to find anything similar to what I wanted to do here and would appreciate any pointers.

Last edited by aleceiffel : 01-08-10 at 05:36 PM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » A few layout questions


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