Skip to content

Commit 3396d85

Browse files
committed
System - Aura/Buff/Debuff Fixes
1 parent b0e4a98 commit 3396d85

File tree

2 files changed

+32
-73
lines changed

2 files changed

+32
-73
lines changed

.gitignore

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.*
12
Simc.lua
23
System/SimC/aplList.lua
34
System/SimC/parser.lua
@@ -8,7 +9,6 @@ Rotations/Druid/Guardian.lua
89
Rotations/Priest/Shadow_CML.lua
910
Rotations/Priest/Shadow_ragnar.lua
1011
Rotations/Priest/Shadow_ragnar_MoP.lua
11-
.gitignore
1212
rename.sh
1313
Rotations/Druid/moonkin_combat_backup.lua
1414
Rotations/Priest/Shadow/tbd.txt
@@ -18,15 +18,13 @@ Rotations/Priest/Shadow/libs/prio-2015-01-09.txt
1818
Rotations/Priest/Shadow/libs/prio-2014-11-19.txt
1919
System/Libs/LibDispellable-1.0/LibDispellable-1.0.lua
2020
Rotations/Priest/Shadow/libs/Functions_old.lua
21-
/.project
2221
Rotations/Priest/Discipline/libs/Functions_old.lua
2322
Rotations/Priest/Discipline/libs/Options_old.lua
2423
Rotations/Priest/Discipline/libs/Toggles_old.lua
2524
Rotations/Priest/Discipline/Discipline_old.lua
2625
config.ini
2726
AutoIndent.exe
2827
QuickIndent.exe
29-
.idea
3028
misc.xml
3129
Rotations/Test
3230
.vscode/settings.json
@@ -35,5 +33,4 @@ Settings/*
3533
Unlockers/mmb.lua
3634
Unlockers/daemonic.lua
3735
Unlockers/icc.lua
38-
Rotations/Rogue/Outlaw/OutlawRavens\.lua
39-
.DS_Store
36+
Rotations/Rogue/Outlaw/OutlawRavens\.lua

System/Functions/Aura.lua

+30-68
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ end
4545
function br.UnitBuffID(unit, spellID, filter)
4646
local spellName = br._G.GetSpellInfo(spellID)
4747
local exactSearch = filter ~= nil and br._G.strfind(br._G.strupper(filter), "EXACT")
48-
if unit == "player" then
48+
if unit == "player" then
4949
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
5151
end
5252
if exactSearch then
5353
for i = 1, 40 do
@@ -85,9 +85,9 @@ function br.UnitDebuffID(unit, spellID, filter)
8585

8686
-- Failsafe if not cached
8787
local exactSearch = filter ~= nil and br._G.strfind(br._G.strupper(filter), "EXACT")
88-
if unit == "player" then
88+
if unit == "player" then
8989
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
9191
end
9292
if exactSearch then
9393
for i = 1, 40 do
@@ -325,9 +325,9 @@ function br.canDispel(Unit, spellID)
325325
end
326326

327327
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
331331
return duration
332332
end
333333
--if UnitAuraID(Unit,AuraID,Source) ~= nil then
@@ -337,9 +337,9 @@ function br.getAuraDuration(Unit, AuraID, Source)
337337
end
338338

339339
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()
343343
return remain
344344
end
345345
-- if UnitAuraID(Unit,AuraID,Source) ~= nil then
@@ -349,8 +349,8 @@ function br.getAuraRemain(Unit, AuraID, Source)
349349
end
350350

351351
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
354354
-- if UnitAuraID(Unit,AuraID,Source) ~= nil then
355355
-- return select(3,UnitAuraID(Unit,AuraID,Source))
356356
-- end
@@ -359,9 +359,9 @@ end
359359

360360
-- if br.getDebuffDuration("target",12345) < 3 then
361361
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
365365
return duration
366366
end
367367
-- if br.UnitDebuffID(Unit,DebuffID,Source) ~= nil then
@@ -372,9 +372,9 @@ end
372372

373373
-- if br.getDebuffRemain("target",12345) < 3 then
374374
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()
378378
-- Print(GetSpellInfo(DebuffID)..": "..remain)
379379
return remain
380380
end
@@ -386,9 +386,9 @@ end
386386

387387
-- if br.getDebuffStacks("target",138756) > 0 then
388388
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
392392
end
393393
return 0
394394
-- if br.UnitDebuffID(Unit,DebuffID,Source) then
@@ -477,9 +477,9 @@ end
477477

478478
-- if getBuffDuration("target",12345) < 3 then
479479
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
483483
return duration
484484
end
485485
-- if br.UnitBuffID(Unit,BuffID,Source) ~= nil then
@@ -490,9 +490,9 @@ end
490490

491491
-- if br.getBuffRemain("target",12345) < 3 then
492492
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()
496496
return remain
497497
end
498498
-- if br.UnitBuffID(Unit,BuffID,Source) ~= nil then
@@ -503,9 +503,9 @@ end
503503

504504
-- if br.getBuffStacks(138756) > 0 then
505505
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
509509
end
510510
return 0
511511
-- if br.UnitBuffID(unit,BuffID,Source) then
@@ -676,41 +676,3 @@ function br.hasBloodLustRemain()
676676
return 0
677677
end
678678
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

Comments
 (0)