49
edits
(Typo fixing, typos fixed: occurances → occurrences using AWB) |
mNo edit summary |
||
| Line 1: | Line 1: | ||
In some circumstances, it may be benefecial to use spell textures, rather than names, to identify buff and debuff effects - textures require no additional localization, while buff names will require to be localized for every language your addon should support. This HOWTO describes an easy mechanism to find out if a certain unit is affected by a specific buff or debuff. | In some circumstances, it may be benefecial to use spell textures, rather than names, to identify buff and debuff effects - textures require no additional localization, while buff names will require to be localized for every language your addon should support. This HOWTO describes an easy mechanism to find out if a certain unit is affected by a specific buff or debuff. | ||
==Iterating buff / debuffs== | == Iterating buff / debuffs == | ||
While we could write separate functions for buffs and debuffs, it's easier to write a single ''iterator'' function and pass the desired spell effect type as an argument - effectively cutting down the amount of code required for the whole routine. We can get the buff's texture from [[API UnitBuff|UnitBuff]] and debuffs from [[API UnitDebuff|UnitDebuff]]: | While we could write separate functions for buffs and debuffs, it's easier to write a single ''iterator'' function and pass the desired spell effect type as an argument - effectively cutting down the amount of code required for the whole routine. We can get the buff's texture from [[API UnitBuff|UnitBuff]] and debuffs from [[API UnitDebuff|UnitDebuff]]: | ||
name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex [, castable]); | name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex [, castable]); | ||
| Line 60: | Line 60: | ||
==See also== | ==See also== | ||
* [[Queriable buff effects|List of buff and debuff textures]] | * [[Queriable buff effects|List of buff and debuff textures]] | ||
[[Category:HOWTOs|Identify Buffs Using Textures]] | [[Category:HOWTOs|Identify Buffs Using Textures]] | ||