WoW:API GetPlayerBuffTimeLeft: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(removedapi, format)
mNo edit summary
Line 1: Line 1:
{{removedapi|3.0|Use {{api|UnitAura}} (or derived functions) to retrieve information about buffs.}}
{{removedapi|3.0|Use {{api|UnitAura}} (or derived functions) to retrieve information about buffs.}}
{{wowapi}}
{{wowapi|toc=0}}
Retrieve info about a certain player buff of a certain type.
Retrieve info about a certain player buff of a certain type.
  buffTimeLeft = GetPlayerBuffTimeLeft(buffIndex);
  buffTimeLeft = GetPlayerBuffTimeLeft(buffIndex);


==Arguments==
== Parameters ==
;buffIndex : The index of the buff to retrieve. Can be obtained with [[API GetPlayerBuff|GetPlayerBuff]]
=== Arguments ===
* buffIndex (number) - The index of the buff to retrieve. Can be obtained with [[API GetPlayerBuff|GetPlayerBuff]]


==Returns==
=== Returns ===
;buffTimeLeft : The time (in seconds) left until the buff expires.
* buffTimeLeft (number) - The time, in seconds, left until the buff expires.


==Example==
== Examples ==
  local timeLeft = GetPlayerBuffTimeLeft(buffIndex)
  local timeLeft = GetPlayerBuffTimeLeft(buffIndex)
 
Result - Retrieves amount of time left of the first buff you have.
;Result : Retrieves amount of time left of the first buff you have.


   for i=0,31 do
   for i=0,31 do
Line 22: Line 22:
   end
   end
  end
  end
 
Result - Will display your buff/debuff durations.
;Result : Will display your buff/debuff durations.


==See Also==
==See Also==
:* [[API GetPlayerBuff|GetPlayerBuff]]
:* [[API GetPlayerBuff|GetPlayerBuff]]
:* [[API GetPlayerBuffTexture|GetPlayerBuffTexture]]
:* [[API GetPlayerBuffTexture|GetPlayerBuffTexture]]

Revision as of 07:36, 19 June 2020

WoW API < GetPlayerBuffTimeLeft

Retrieve info about a certain player buff of a certain type.

buffTimeLeft = GetPlayerBuffTimeLeft(buffIndex);

Parameters

Arguments

  • buffIndex (number) - The index of the buff to retrieve. Can be obtained with GetPlayerBuff

Returns

  • buffTimeLeft (number) - The time, in seconds, left until the buff expires.

Examples

local timeLeft = GetPlayerBuffTimeLeft(buffIndex)

Result - Retrieves amount of time left of the first buff you have.

 for i=0,31 do
  local id,cancel = GetPlayerBuff(i,"HELPFUL|HARMFUL|PASSIVE");
  if(id > -1) then
    local timeleft = GetPlayerBuffTimeLeft(id);
   DEFAULT_CHAT_FRAME:AddMessage(timeleft);
  end
end

Result - Will display your buff/debuff durations.

See Also