View Single Post
02-14-15, 08:35 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, I can't tell you why that doesn't work with WeakAuras I don't use it, but you can reduce quite a bit of duplication in your code:

Code:
	local name, _, _, _, _, _, expirationTime = UnitBuff("player", "Lifebloom", nil, "PLAYER")
	if name then
		return expirationTime or 0
	end
	if not IsInGroup() then
		return
	end

	local unit, n = "raid", GetNumGroupMembers()
	if not IsInRaid() then
		unit, n = "party", n - 1
	end
	for i = 1, n do
		local name, _, _, _, _, _, expirationTime = UnitBuff(unit..i, "Lifebloom", nil, "PLAYER")
		if name then
			return expirationTime or 0
		end
	end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote