Reply
 
Thread Tools Display Modes
Old 11-07-2009, 07: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
KleinerMink is online now   Reply With Quote
Old 11-14-2009, 08:22 PM   #2
shkm
A Flamescale Wyrmkin
 
shkm's Avatar
Interface Author - Click to view interfaces
Join Date: Aug 2008
Posts: 149
Strong suggestion: use the code tags and repost.
__________________
Blog
shkm is offline   Reply With Quote
Old 11-14-2009, 11:54 PM   #3
zero-kill
A Frostmaul Preserver
 
zero-kill's Avatar
Join Date: Aug 2009
Posts: 298
agreed, my eyes refused to read that.
__________________
zero-kill is offline   Reply With Quote
Old 11-15-2009, 12:58 AM   #4
Torhal
A Rage Talon Dragon Guard
 
Torhal's Avatar
Interface Author - Click to view interfaces
Join Date: Aug 2008
Posts: 323
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 GearGauge, Revelation, Volumizer, and many other AddOns.
Torhal is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua Script help » Target buff timers

Thread Tools
Display Modes

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




The Network:
EQInterface | EQ2Interface | LoTROInterface | MMOInterface | War.MMOUI | WoWInterface | VGInterface | Allakhazam | Thottbot | Wowhead | Zam


©2009 MMOUI / ZAM Network
vBulletin - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.