WoW:API GetPlayerBuffTimeLeft: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API GetPlayerBuffTimeLeft to API GetPlayerBuffTimeLeft without leaving a redirect)
 
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<center>'''GetPlayerBuffTimeLeft''' ''-Documentation by Sarf-''</center>
{{removedapi|3.0|Use {{api|UnitAura}} (or derived functions) to retrieve information about buffs.}}
 
{{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);
== Parameters ==
 
=== Arguments ===
----
* buffIndex (number) - The index of the buff to retrieve. Can be obtained with [[API GetPlayerBuff|GetPlayerBuff]]
;''Arguments''
 
:(Number buffIndex)
 
:;buffIndex : The id of the buff to retrieve.


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


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


:;buffTimeLeft : The time (in seconds) left until the buff expires.
  for i=0,31 do
 
  local id,cancel = GetPlayerBuff(i,"HELPFUL|HARMFUL|PASSIVE");
----
  if(id > -1) then
;''Example''
    local timeleft = GetPlayerBuffTimeLeft(id);
local timeLeft = GetPlayerBuffTimeLeft(0);
    DEFAULT_CHAT_FRAME:AddMessage(timeleft);
 
  end
;''Result''
end
 
Result - Will display your buff/debuff durations.
Retrieves amount of time left of the first buff you have.
 
----
;''Description''
 
: Retrieves time left until a certain buff expires.
 
;''See Also''


==See Also==
:* [[API GetPlayerBuff|GetPlayerBuff]]
:* [[API GetPlayerBuff|GetPlayerBuff]]
:* [[API GetPlayerBuffTexture|GetPlayerBuffTexture]]
:* [[API GetPlayerBuffTexture|GetPlayerBuffTexture]]
----
{{Template:WoW API}}

Latest revision as of 04:46, 15 August 2023

WoW API < GetPlayerBuffTimeLeft

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

buffTimeLeft = GetPlayerBuffTimeLeft(buffIndex);

Parameters[edit]

Arguments[edit]

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

Returns[edit]

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

Examples[edit]

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[edit]