Need to make this weak aura only trigger on my lifebloom. What is the change I need to make?
function()
local bloomName = GetSpellInfo(33763)
local function findBloom(unit, bloom)
for i = 1, 40 do
local name, _, _, _, dur, etime = UnitBuff(unit,i)
if ( name == bloom ) then
return true, dur, etime
end
end
return false
end
local unit = (IsInRaid() and "raid") or ( IsInGroup() and "party" ) or "player"
local loopCount = 1
local loopStart = 1
if ( unit ~= "player" ) then
loopCount = GetNumGroupMembers()
loopStart = 0
end
for i = loopStart, loopCount do
local unitID = "player"
if ( unit ~= "player" ) then
unitID = unit..i
if ( i == 0 ) then
unitID = "player"
end
end
local name = UnitName(unitID)
local found, dur, etime = findBloom(unitID, bloomName)
if ( found ) then
local class = select(2,UnitClass(unitID))
local colorText = RAID_CLASS_COLORS[class] and RAID_CLASS_COLORS[class].colorStr or "ffbbbbbb"
aura_env.name = "|c" .. colorText .. tostring(name) .. "|r"
aura_env.duration = dur
aura_env.expires = etime
return true
end
end
aura_env.duration = 0
aura_env.expires = 0
aura_env.name = "NO BLOOM!"
return true
end
function()
local bloomName = GetSpellInfo(33763)
local function findBloom(unit, bloom)
for i = 1, 40 do
local name, _, _, _, dur, etime = UnitBuff(unit,i)
if ( name == bloom ) then
return true, dur, etime
end
end
return false
end
local unit = (IsInRaid() and "raid") or ( IsInGroup() and "party" ) or "player"
local loopCount = 1
local loopStart = 1
if ( unit ~= "player" ) then
loopCount = GetNumGroupMembers()
loopStart = 0
end
for i = loopStart, loopCount do
local unitID = "player"
if ( unit ~= "player" ) then
unitID = unit..i
if ( i == 0 ) then
unitID = "player"
end
end
local name = UnitName(unitID)
local found, dur, etime = findBloom(unitID, bloomName)
if ( found ) then
local class = select(2,UnitClass(unitID))
local colorText = RAID_CLASS_COLORS[class] and
RAID_CLASS_COLORS[class].colorStr or
"ffbbbbbb"
aura_env.name = "|c" .. colorText .. tostring(name) .. "|r"
aura_env.duration = dur
aura_env.expires = etime
return true
end
end
aura_env.duration = 0
aura_env.expires = 0
aura_env.name = "NO BLOOM!"
return true
end
That’s looping through every player in your group.
You need to just do this part:
function()
for i = 1, 40 do
local name, _, _, _, dur, etime = UnitBuff("player",i)
if ( name == GetSpellInfo(33763) ) then
return true, dur, etime
end
end
return false
end
When you say “only trigger on my lifebloom” do you mean lifebloom on your character or cast by your character?
I think its more likely that you’re playing a druid and want to know the duration of your lifebloom no matter who it’s on.
You can do this without a custom trigger now.
Setup a buff trigger like normal then change Unit to “Group” and check the box for “Own Only”. On the display tab set the text to “%unitName”.
If you want to keep the class colors on the name you’ll need a custom function for the text.
function()
if aura_env.state and aura_env.state.unitName and UnitExists(aura_env.state.unitName) then
return WA_ClassColorName(aura_env.state.sourceName)
end
end
If you want to keep the custom trigger then change the UnitBuff call in the findBloom function.
UnitBuff(unit,i,"PLAYER")