m
Move page script moved page Identifying buffs using textures to WoW:Identifying buffs using textures without leaving a redirect
(HOWTO: Identify Buffs Using Textures) |
m (Move page script moved page Identifying buffs using textures to WoW:Identifying buffs using textures without leaving a redirect) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| 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 [[ | 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]); | ||
name, rank, texture, count, debuffType, duration, timeLeft = UnitDebuff(unitID, debuffIndex [, removable]); | name, rank, texture, count, debuffType, duration, timeLeft = UnitDebuff(unitID, debuffIndex [, removable]); | ||
| Line 56: | Line 56: | ||
end | end | ||
message("Following debuffs on unit share Spell_Fire_FireArmor texture: " .. out); | message("Following debuffs on unit share Spell_Fire_FireArmor texture: " .. out); | ||
Note that the last example is somewhat inefficient - you would be better off acquiring all the buff names in a single local loop rather than iterating through buffs multiple times to find all | Note that the last example is somewhat inefficient - you would be better off acquiring all the buff names in a single local loop rather than iterating through buffs multiple times to find all occurrences of a certain texture. | ||
==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]] | |||