WoW:API CancelPlayerBuff: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Fixed error with buffIndex/buffId)
m (Move page script moved page API CancelPlayerBuff to API CancelPlayerBuff without leaving a redirect)
 
(9 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<center>'''CancelPlayerBuff''' ''-Documentation by Voratus-''</center>
{{removedapi|3.0|Replaced by {{api|CancelUnitBuff}}("unit", buffIndex[, filter]) or ("unit", "spell"[, "rank"])}}
{{wowapi}}


Removes a specific buff from the player.
Removes a specific buff from the player.
Line 5: Line 6:
  CancelPlayerBuff(buffIndex);
  CancelPlayerBuff(buffIndex);


----
==Arguments==
;''Arguments''
;buffIndex : The index of the buff to remove. Can be obtained with [[API GetPlayerBuff|GetPlayerBuff]]. Can also use buff name since the 2.3 patch.


:;buffIndex : The index of the buff to remove. Can be obtained with [[API GetPlayerBuff|GetPlayerBuff]]
==Example==
 
----
;''Example''
  CancelPlayerBuff(GetPlayerBuff(0,"HELPFUL"))
  CancelPlayerBuff(GetPlayerBuff(0,"HELPFUL"))


;''Result''
;Result : Removes the first (right-most in the default UI) buff from the player.
 
Removes the first (right-most in the default UI) buff from the player.
 
 
;''See Also''
 
:* [[API UnitBuff|UnitBuff]]


----
====Notes====
{{WoW API}}
* This function is not protected nor limited in any way to hardware event restriction Blizzard used so far. This function can be called freely from an AddOn to auto-remove a given buff.
(tested on live servers 2.0)
* This function uses a zero-based index, while UnitBuff() does not.
* '''The Burning Crusade:''' [[API GetPlayerBuff|GetPlayerBuff]]() returns 0 if the buff doesn't exist. It stands to reason that this function would then be 1-based in TBC.

Latest revision as of 04:45, 15 August 2023

WoW API < CancelPlayerBuff

Removes a specific buff from the player.

CancelPlayerBuff(buffIndex);

Arguments[edit]

buffIndex
The index of the buff to remove. Can be obtained with GetPlayerBuff. Can also use buff name since the 2.3 patch.

Example[edit]

CancelPlayerBuff(GetPlayerBuff(0,"HELPFUL"))
Result
Removes the first (right-most in the default UI) buff from the player.

Notes[edit]

  • This function is not protected nor limited in any way to hardware event restriction Blizzard used so far. This function can be called freely from an AddOn to auto-remove a given buff.

(tested on live servers 2.0)

  • This function uses a zero-based index, while UnitBuff() does not.
  • The Burning Crusade: GetPlayerBuff() returns 0 if the buff doesn't exist. It stands to reason that this function would then be 1-based in TBC.