Thread Tools Display Modes
11-07-09, 06:44 AM   #1
KleinerMink
A Deviate Faerie Dragon
Join Date: Jun 2009
Posts: 11
Target buff timers

What do i need to change here to make the buff timers for target stay and not disappear when i change targets? In addition it would be nice that if i change back to the original target the buff expiration time left is refreshed.


local function OnEvent(self, event, ...)
local unit = ...;
if ( ( unit == "target" or unit == "player" ) or event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_ENTERING_WORLD" or event == "SPELL_UPDATE_COOLDOWN" ) then
local data, name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable, start, enabled, slotLink;
local id = self.Id;
for i=1, #spells[class][id], 1 do
data = spells[class][id][i];
if ( data.filter == "BUFF" ) then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitBuff(data.unitId, data.spellName);
elseif ( data.filter == "DEBUFF" ) then
name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitDebuff(data.unitId, data.spellName);
else
if ( type(data.spellName) == "string" ) then
start, duration, enabled = GetSpellCooldown(data.spellName);
icon = GetSpellTexture(data.spellName);
else
slotLink = GetInventoryItemLink("player", data.spellName);
if ( slotLink ) then
name, _, _, _, _, _, _, _, _, icon = GetItemInfo(slotLink);
if ( not data.displayName ) then
data.displayName = name;
end
start, duration, enabled = GetInventoryItemCooldown("player", data.spellName);
end
end
count = 0;
caster = "all";
end
if ( not active[id] ) then
active[id] = {};
end
for index, value in ipairs(active[id]) do
if ( data.spellName == value.data.spellName ) then
tremove(active[id], index);
break;
end
end
if ( ( name and ( caster == data.caster or data.caster == "all" ) ) or ( ( enabled or 0 ) > 0 and ( duration or 0 ) > 1.5 ) ) then
table.insert(active[id], { data = data, icon = icon, count = count, duration = duration, expirationTime = expirationTime or start });
end
end
Update(self);
end
end
  Reply With Quote
11-14-09, 07:22 PM   #2
shkm
A Chromatic Dragonspawn
 
shkm's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 186
Strong suggestion: use the code tags and repost.
__________________
Quit WoW again on 17/04/2014.
  Reply With Quote
11-14-09, 10:54 PM   #3
zero-kill
A Firelord
 
zero-kill's Avatar
Join Date: Aug 2009
Posts: 497
agreed, my eyes refused to read that.
  Reply With Quote
11-14-09, 11:58 PM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Considering the fact that the OP is a week old and nobody has responded, methinks that was the general reaction.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Target buff timers


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