API:GetBuffs
From RoR Wiki
UI Lua API · Effect functions
Version: WAR 1.4.8
Returns the effects (buffs and debuffs) on the player, a target or a group member.
effects = GetBuffs(buffTargetType)
Arguments
- buffTargetType
number– Whose effects to return, aGameData.BuffTargetTypevalue (for exampleSELF,TARGET_HOSTILE,TARGET_FRIENDLY, or a group member betweenGROUP_MEMBER_STARTandGROUP_MEMBER_END).
Returns
- effects
table– Table of effect tables keyed by effect index. Nothing is returned if there is no player object or no effect holder for that value.
Each effect table has these fields:
| Key | Type | Meaning |
|---|---|---|
effectIndex |
number |
Index of the effect; also the key of the entry. |
name |
wstring |
Name of the ability that applied the effect, from the AbilityNames string table.
|
abilityId |
number |
Id of the ability that applied the effect. |
iconNum |
number |
Icon id for GetIconData. |
duration |
number |
Duration in whole seconds. |
effectText |
wstring |
Description of the effect. |
stackCount |
number |
Number of stacks. |
permanentUntilDispelled |
boolean |
– |
isCasterDispellable |
boolean |
– |
castByPlayer |
boolean |
true if the player applied the effect.
|
trackerPriority |
number |
Sort priority. The stock buff tracker shows effects with a higher priority first. |
isBuff, isDebuff, … |
boolean |
The effect type flags described for the ability data table (isHex, isCurse, …, and the typeColor fields).
|
Details
- Effects are left out when their ability has no effect entry or has a particular ability flag set. An effect without a duration is only listed when
permanentUntilDispelledistrue. - The effect type flags are filled by the same code as for the ability data table, from the ability that applied the effect.
- The table is keyed by effect index, not an array; use
pairs(). - Pass only
GameData.BuffTargetTypevalues; the value is used as an index into the client's list of effect holders.
Errors
None besides the generic Invalid Parameters message when the argument is missing or not a number.
Example
From eatemplate_unitframes/source/bufftracker.lua:
function BuffTracker:Refresh()
-- Get the full list of buffs from native code.
local allBuffs = GetBuffs( self.m_targetType )
if ( allBuffs ~= nil )
then
self.m_buffData = allBuffs
else
self.m_buffData = {}
end
self:OnBuffsChanged()
end
