45
45
function br .UnitBuffID (unit , spellID , filter )
46
46
local spellName = br ._G .GetSpellInfo (spellID )
47
47
local exactSearch = filter ~= nil and br ._G .strfind (br ._G .strupper (filter ), " EXACT" )
48
- if unit == " player" then
48
+ if unit == " player" then
49
49
local auraInfo = C_UnitAuras .GetPlayerAuraBySpellID (spellID )
50
- if auraInfo and auraInfo .expirationTime > br ._G .GetTime () then return true end
50
+ if auraInfo and auraInfo .expirationTime > br ._G .GetTime () then return auraInfo end
51
51
end
52
52
if exactSearch then
53
53
for i = 1 , 40 do
@@ -85,9 +85,9 @@ function br.UnitDebuffID(unit, spellID, filter)
85
85
86
86
-- Failsafe if not cached
87
87
local exactSearch = filter ~= nil and br ._G .strfind (br ._G .strupper (filter ), " EXACT" )
88
- if unit == " player" then
88
+ if unit == " player" then
89
89
local auraInfo = C_UnitAuras .GetPlayerAuraBySpellID (spellID )
90
- if auraInfo and auraInfo .expirationTime > br ._G .GetTime () then return true end
90
+ if auraInfo and auraInfo .expirationTime > br ._G .GetTime () then return auraInfo end
91
91
end
92
92
if exactSearch then
93
93
for i = 1 , 40 do
@@ -325,9 +325,9 @@ function br.canDispel(Unit, spellID)
325
325
end
326
326
327
327
function br .getAuraDuration (Unit , AuraID , Source )
328
- local duration = select ( 5 , br .UnitAuraID (Unit , AuraID , Source ) )
329
- if duration ~= nil then
330
- duration = duration * 1
328
+ local auraInfo = br .UnitAuraID (Unit , AuraID , Source )
329
+ if auraInfo and auraInfo . duration ~= nil then
330
+ local duration = auraInfo . duration * 1
331
331
return duration
332
332
end
333
333
-- if UnitAuraID(Unit,AuraID,Source) ~= nil then
@@ -337,9 +337,9 @@ function br.getAuraDuration(Unit, AuraID, Source)
337
337
end
338
338
339
339
function br .getAuraRemain (Unit , AuraID , Source )
340
- local remain = select ( 6 , br .UnitAuraID (Unit , AuraID , Source ) )
341
- if remain ~= nil then
342
- remain = remain - br ._G .GetTime ()
340
+ local auraInfo = br .UnitAuraID (Unit , AuraID , Source )
341
+ if auraInfo and auraInfo . expirationTime ~= nil then
342
+ local remain = auraInfo . expirationTime - br ._G .GetTime ()
343
343
return remain
344
344
end
345
345
-- if UnitAuraID(Unit,AuraID,Source) ~= nil then
@@ -349,8 +349,8 @@ function br.getAuraRemain(Unit, AuraID, Source)
349
349
end
350
350
351
351
function br .getAuraStacks (Unit , AuraID , Source )
352
- local stacks = select ( 3 , br .UnitAuraID (Unit , AuraID , Source ) )
353
- if stacks ~= nil then return stacks end
352
+ local auraInfo = br .UnitAuraID (Unit , AuraID , Source )
353
+ if auraInfo and auraInfo . applications ~= nil then return auraInfo . applications end
354
354
-- if UnitAuraID(Unit,AuraID,Source) ~= nil then
355
355
-- return select(3,UnitAuraID(Unit,AuraID,Source))
356
356
-- end
359
359
360
360
-- if br.getDebuffDuration("target",12345) < 3 then
361
361
function br .getDebuffDuration (Unit , DebuffID , Source )
362
- local duration = select ( 5 , br .UnitDebuffID (Unit , DebuffID , Source ) )
363
- if duration ~= nil then
364
- duration = duration * 1
362
+ local auraInfo = br .UnitDebuffID (Unit , DebuffID , Source )
363
+ if auraInfo and auraInfo . duration ~= nil then
364
+ local duration = auraInfo . duration * 1
365
365
return duration
366
366
end
367
367
-- if br.UnitDebuffID(Unit,DebuffID,Source) ~= nil then
372
372
373
373
-- if br.getDebuffRemain("target",12345) < 3 then
374
374
function br .getDebuffRemain (Unit , DebuffID , Source )
375
- local remain = select ( 6 , br .UnitDebuffID (Unit , DebuffID , Source ) )
376
- if remain ~= nil then
377
- remain = remain - br ._G .GetTime ()
375
+ local auraInfo = br .UnitDebuffID (Unit , DebuffID , Source )
376
+ if auraInfo and auraInfo . expirationTime ~= nil then
377
+ local remain = auraInfo . expirationTime - br ._G .GetTime ()
378
378
-- Print(GetSpellInfo(DebuffID)..": "..remain)
379
379
return remain
380
380
end
386
386
387
387
-- if br.getDebuffStacks("target",138756) > 0 then
388
388
function br .getDebuffStacks (Unit , DebuffID , Source )
389
- local stacks = select ( 3 , br .UnitDebuffID (Unit , DebuffID , Source ) )
390
- if stacks ~= nil then
391
- return stacks
389
+ local auraInfo = br .UnitDebuffID (Unit , DebuffID , Source )
390
+ if auraInfo and auraInfo . applications ~= nil then
391
+ return auraInfo . applications
392
392
end
393
393
return 0
394
394
-- if br.UnitDebuffID(Unit,DebuffID,Source) then
477
477
478
478
-- if getBuffDuration("target",12345) < 3 then
479
479
function br .getBuffDuration (Unit , BuffID , Source )
480
- local duration = select ( 5 , br .UnitBuffID (Unit , BuffID , Source ) )
481
- if duration ~= nil then
482
- duration = duration * 1
480
+ local auraInfo = br .UnitBuffID (Unit , BuffID , Source )
481
+ if auraInfo and auraInfo . duration ~= nil then
482
+ local duration = auraInfo . duration * 1
483
483
return duration
484
484
end
485
485
-- if br.UnitBuffID(Unit,BuffID,Source) ~= nil then
490
490
491
491
-- if br.getBuffRemain("target",12345) < 3 then
492
492
function br .getBuffRemain (Unit , BuffID , Source )
493
- local remain = select ( 6 , br .UnitBuffID (Unit , BuffID , Source ) )
494
- if remain ~= nil then
495
- remain = remain - br ._G .GetTime ()
493
+ local auraInfo = br .UnitBuffID (Unit , BuffID , Source )
494
+ if auraInfo and auraInfo . expirationTime ~= nil then
495
+ local remain = auraInfo . expirationTime - br ._G .GetTime ()
496
496
return remain
497
497
end
498
498
-- if br.UnitBuffID(Unit,BuffID,Source) ~= nil then
503
503
504
504
-- if br.getBuffStacks(138756) > 0 then
505
505
function br .getBuffStacks (Unit , BuffID , Source )
506
- local stacks = select ( 3 , br .UnitBuffID (Unit , BuffID , Source ) )
507
- if stacks ~= nil then
508
- return stacks
506
+ local auraInfo = br .UnitBuffID (Unit , BuffID , Source )
507
+ if auraInfo and auraInfo . applications ~= nil then
508
+ return auraInfo . applications
509
509
end
510
510
return 0
511
511
-- if br.UnitBuffID(unit,BuffID,Source) then
@@ -676,41 +676,3 @@ function br.hasBloodLustRemain()
676
676
return 0
677
677
end
678
678
end
679
-
680
- --- if isBuffed()
681
- function br .isBuffed (UnitID , SpellID , TimeLeft , Filter )
682
- if not TimeLeft then
683
- TimeLeft = 0
684
- end
685
- if type (SpellID ) == " number" then
686
- SpellID = { SpellID }
687
- end
688
- for i = 1 , # SpellID do
689
- local buff , _ , _ , _ , _ , _ , buffID = br ._G .GetSpellInfo (SpellID [i ])
690
- if buff then
691
- local expire = select (6 , br .UnitBuff (UnitID , buffID , Filter ))
692
- if expire and (expire == 0 or expire - br ._G .GetTime () > TimeLeft ) then
693
- return true
694
- end
695
- end
696
- end
697
- end
698
-
699
- -- if isDeBuffed("target",{123,456,789},2,"player") then
700
- function br .isDeBuffed (UnitID , DebuffID , TimeLeft , Filter )
701
- if not TimeLeft then
702
- TimeLeft = 0
703
- end
704
- if type (DebuffID ) == " number" then
705
- DebuffID = { DebuffID }
706
- end
707
- for i = 1 , # DebuffID do
708
- local debuff , _ , _ , _ , _ , _ , debuffID = br ._G .GetSpellInfo (DebuffID [i ])
709
- if debuff then
710
- local expire = select (6 , br ._G .UnitDebuff (UnitID , debuffID , Filter ))
711
- if expire and (expire == 0 or expire - br ._G .GetTime () > TimeLeft ) then
712
- return true
713
- end
714
- end
715
- end
716
- end
0 commit comments