@@ -60,10 +60,13 @@ GetTriggerConditions(data, triggernum)
6060Returns the potential conditions for a trigger
6161]] --
6262
63+ -- luacheck: globals CombatLogGetCurrentEventInfo
6364
6465-- Lua APIs
6566local tinsert , wipe = table.insert , wipe
6667local pairs , next , type = pairs , next , type
68+ local BUFF_MAX_DISPLAY = _G .BUFF_MAX_DISPLAY
69+ local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
6770
6871local WeakAuras = WeakAuras ;
6972local L = WeakAuras .L ;
@@ -493,8 +496,10 @@ function WeakAuras.ScanAuras(unit)
493496 -- Update scan cache
494497 if (aura_scan_cache [unit ][filter ].up_to_date < index ) then
495498 -- Query aura data
496- name , _ , icon , count , _ , duration , expirationTime , unitCaster , isStealable , _ , spellId = UnitAura (unit , index , filter );
497- tooltip , debuffClass , tooltipSize = WeakAuras .GetAuraTooltipInfo (unit , index , filter );
499+ name , icon , count , debuffClass , duration , expirationTime , unitCaster , isStealable , _ , spellId = UnitAura (unit , index , filter );
500+ local tooltipSize1 , tooltipSize2 , tooltipSize3 ;
501+ tooltip , _ , tooltipSize1 , tooltipSize2 , tooltipSize3 = WeakAuras .GetAuraTooltipInfo (unit , index , filter );
502+ tooltipSize = {tooltipSize1 , tooltipSize2 , tooltipSize3 }
498503 aura_scan_cache [unit ][filter ][index ] = aura_scan_cache [unit ][filter ][index ] or {};
499504
500505 -- Save aura data to cache
@@ -539,7 +544,8 @@ function WeakAuras.ScanAuras(unit)
539544
540545 -- Aura conforms to trigger options?
541546 if (data .subcount ) then
542- count = tooltipSize ;
547+ local index = data .subcountCount or 1 ;
548+ count = tooltipSize [index ];
543549 end
544550 if (name and ((not data .count ) or data .count (count )) and (data .ownOnly ~= false or not UnitIsUnit (" player" , unitCaster or " " )) and data .scanFunc (name , tooltip , isStealable , spellId , debuffClass )) then
545551 -- Show display and handle clones
@@ -589,8 +595,18 @@ function WeakAuras.ScanAuras(unit)
589595
590596 for index , checkname in pairs (data .names ) do
591597 -- Fetch aura data
592- name , _ , icon , count , _ , duration , expirationTime , unitCaster , isStealable , _ , spellId = UnitAura (unit , checkname , nil , filter );
593- if (name ) then
598+ -- TODO 8.0: Check if there is a better way than iterating all auras
599+ local detected
600+ for i = 1 , BUFF_MAX_DISPLAY do
601+ name , icon , count , _ , duration , expirationTime , unitCaster , isStealable , _ , spellId = UnitAura (unit , i , filter );
602+ if not name then break end
603+ if name == checkname then
604+ detected = true
605+ break
606+ end
607+ end
608+
609+ if (detected ) then
594610 WeakAuras .SetDynamicIconCache (name , spellId , icon );
595611 end
596612 checkPassed = false ;
965981 local updateTriggerState = false ;
966982 for triggernum , data in pairs (triggers ) do
967983 local filter = data .debuffType .. (data .ownOnly and " |PLAYER" or " " );
968- local name , rank , icon , count , debuffType , duration , expirationTime , unitCaster , isStealable , nameplateShowPersonal , spellId = UnitAura (unit , spellName , nil , filter );
969- if (name and (data .spellId == nil or data .spellId == spellId )) then
984+
985+ -- TODO 8.0: Check if there is a better way than iterating all auras
986+ local detected
987+ local name , icon , count , duration , expirationTime , unitCaster , spellId , _
988+ for i = 1 , BUFF_MAX_DISPLAY do
989+ name , icon , count , _ , duration , expirationTime , unitCaster , _ , _ , spellId = UnitAura (unit , i , filter );
990+ if not name then break end
991+ if name == spellName then
992+ detected = true
993+ break
994+ end
995+ end
996+
997+ if (detected and (data .spellId == nil or data .spellId == spellId )) then
970998 data .GUIDs = data .GUIDs or {};
971999 data .GUIDs [destGUID ] = data .GUIDs [destGUID ] or {};
9721000 data .GUIDs [destGUID ].name = spellName ;
11081136 local function handleEvent (frame , event , ...)
11091137 WeakAuras .StartProfileSystem (" bufftrigger - multi" );
11101138 if (event == " COMBAT_LOG_EVENT_UNFILTERED" ) then
1111- combatLog (... );
1139+ combatLog (CombatLogGetCurrentEventInfo () );
11121140 elseif (event == " UNIT_TARGET" ) then
11131141 uidTrack (... );
11141142 elseif (event == " PLAYER_FOCUS_CHANGED" ) then
@@ -1133,8 +1161,20 @@ do
11331161 local updateTriggerState = false ;
11341162 for triggernum , data in pairs (triggers ) do
11351163 local filter = data .debuffType .. (data .ownOnly and " |PLAYER" or " " );
1136- local name , rank , icon , count , debuffType , duration , expirationTime , unitCaster , isStealable , nameplateShowPersonal , spellId = UnitAura (uid , spellName , nil , filter );
1137- if (name ) then
1164+
1165+ -- TODO 8.0: Check if there is a better way than iterating all auras
1166+ local detected
1167+ local name , icon , count , duration , expirationTime , unitCaster , _
1168+ for i = 1 , BUFF_MAX_DISPLAY do
1169+ name , icon , count , _ , duration , expirationTime , unitCaster = UnitAura (uid , i , filter );
1170+ if not name then break end
1171+ if name == spellName then
1172+ detected = true
1173+ break
1174+ end
1175+ end
1176+
1177+ if (detected ) then
11381178 data .GUIDs = data .GUIDs or {};
11391179 data .GUIDs [guid ] = data .GUIDs [guid ] or {};
11401180 data .GUIDs [guid ].name = spellName ;
@@ -1468,6 +1508,7 @@ function BuffTrigger.Add(data)
14681508 autoclone = trigger .autoclone ,
14691509 groupclone = trigger .groupclone ,
14701510 subcount = trigger .subcount ,
1511+ subcountCount = trigger .subcountCount ,
14711512 scanFunc = scanFunc ,
14721513 debuffType = trigger .debuffType ,
14731514 names = trigger .names ,
0 commit comments