Quantcast WoWInterface - View Single Post - How could this be written neater?
View Single Post
05-13-17, 03:23 AM   #27
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
Originally Posted by Layback_ View Post
(1) I guess the example is limited to Unstable Affliction (UA). Of course, I know that example is just an example and I should modify bits to make it generic, but, hm...... I don't know
Just add other spellIDs to IDs table then o_O I don't see what's the problem...

Originally Posted by Layback_ View Post
(2) What if the a nth debuff on "target" is not "player's" while (n+1)th debuff is?
Eh? You don't understand how UnitAura's (that includes UnitBuff/UnitDebuff) filter works...

Lua Code:
  1. UnitDebuff("target", i, "PLAYER")

W/ "PLAYER" as a filter you'll be getting ONLY debuffs that were applied by the player. It's a separate pre-filtered list of auras, there's no gaps, its indices aren't related to anything.

For example, this code:
Lua Code:
  1. /run for i = 1, 40 do print(i, UnitBuff("player", i, "PLAYER|RAID")) end

will return this on my paladin:
Lua Code:
  1. 1 Greater Blessing of Kings  135993 0 nil 3600 16015.356 player false false 203538 true false true false 1 89847 89848 0
  2. 2 Greater Blessing of Wisdom  135912 0 nil 3600 16016.726 player false false 203539 true false true false 1

whereas actual buff list look like this:
Lua Code:
  1. /run for i = 1, 40 do print(i, UnitBuff("player", i)) end

Lua Code:
  1. 1 Sign of the Warrior  1450455 0 nil 0 0 player false false 225787 false false true false 1
  2. 2 Fel Focus  134924 0 nil 4500.005 14209.837 player false false 242551 false false true false 1
  3. 3 Mana Divining Stone  134423 0 nil 0 0 player false false 227723 false false true false 1
  4. 4 Greater Blessing of Kings  135993 0 nil 3600 16015.414 player false false 203538 true false true false 1 89847 89848 0
  5. 5 Greater Blessing of Wisdom  135912 0 nil 3600 16016.726 player false false 203539 true false true false 1
  6. 6 Blessing of the Ashbringer  1109508 0 nil 0 0 player false false 242981 false false true false 1
  7. 7 March of the Highlord  589117 0 Magic 300 13282.648 nil false false 225455 false false false false 1
__________________

Last edited by lightspark : 05-13-17 at 03:30 AM.
  Reply With Quote