Code:
--Buffs/Procs--
PQ_DivinePurpose = 90174
PQ_AvengingWrath = 31884
PQ_ArtOfWar = 59578
PQ_SealOfTruth = 31801
PQ_SealOfRight = 20154
PQ_Inquisition = 90174
PQ_Buffs = {
[PQ_DivinePurpose] = {check = true, hasBuff = false, endTime = nil},
[PQ_AvengingWrath] = {check = true, hasBuff = false, endTime = nil},
[PQ_ArtOfWar] = {check = true, hasBuff = false, endTime = nil},
[PQ_SealOfTruth] = {check = true, hasBuff = false, endTime = nil},
[PQ_SealOfRight] = {check = true, hasBuff = false, endTime = nil},
[PQ_Inquisition] = {check = true, hasBuff = false, endTime = nil}
}
function PallyBuffHandler(spellID, hasBuffNow)
-- {
if (PQ_Buffs[spellID].check) then
PQ_Buffs[spellID] = hasBuffNow
if (hasBuffNow) then
PQ_Buffs[spellID].endTime = select(7, UnitBuffID("player", spellID))
end
end
end
-- }
-- To check if I have divine purpose you would write If (PQ_Buffs[PQ_DivinePurpose].hasBuff) return true end
-- Which just involves checking a local boolean instead of a wow api call to check a list of buffs....
--Debuffs--
--booleans
PQ_HasMovementImpair = false
--59752--[[Every Man for Himself]]
PQ_HasEveryManSpell = IsSpellKnown(59752)
PQ_DebuffList.BreakOnDamage = {
19503--[[Scatter Shot]],
1499--[[Freezing Trap]],
6358--[[Seduction]],
9484--[[Shackle Undead]],
6770--[[Sap]],
118--[[Polymorph]],
51514--[[Hex]],
2094--[[Blind]],
2637--[[Hibernate]],
76780--[[Bind Elemental]]
}
PQ_DebuffList.Fear = {
5782--[[Fear]],
5484--[[Howl of Terror]],
8122--[[Psychic Scream]],
1513--[[Scare Beast]],
10326--[[Turn Evil]],
5246--[[Intimidating Shout]]
}
PQ_DebuffList.Root = {
339--[[Entangling Roots]],
122--[[Frost Nova]],
45524--[[Chains of Ice]],
16979--[[Feral Charge - Bear]]
}
PQ_DebuffList.Raid = {}
PQ_DebuffList.MovementImpairing = {
5116--[[Concussive Shot]],
2974--[[Wing Clip]],
13809--[[Ice Trap]],
116--[[Frostbolt]],
120--[[Cone of Cold]],
11113--[[Blast Wave]],
31589--[[Slow]],
15407--[[Mind Flay]],
3408--[[Crippling Poison]],
26679--[[Deadly Throw]],
8056--[[Frost Shock]],
2484--[[Earthbind Totem]],
18223--[[Curse of Exhaustion]],
1715--[[Hamstring]],
12323--[[Piercing Howl]]
}
--Only check for Fear/Root/BreakOnDamage only if player has Every Mand for Himself since Hand of Freedom only breaks Movement Impairing effects--
PQ_Debuffs = {
['Fear'] = {check = PQ_HasEveryManSpell, debuffList = PQ_DebuffList.Fear , spellid = nil, hasDebuff = false, endTime = nil},
['Root'] = {check = PQ_HasEveryManSpell, debuffList = PQ_DebuffList.Root , spellid = nil, hasDebuff = false, endTime = nil},
['BreakOnDamage'] = {check = PQ_HasEveryManSpell, debuffList = PQ_DebuffList.BreakOnDamage , spellid = nil, hasDebuff = false, endTime = nil},
['MovementImpairing'] = {check = true, debuffList = PQ_DebuffList.MovementImpairing , spellid = nil, hasDebuff = false, endTime = nil},
['Raid'] = {check = false, debuffList = PQ_DebuffList.Raid , spellid = nil, hasDebuff = false, endTime = nil}
}
--So in Hand of Freedom ability just check `if (PQ_Debuffs['MovementImpairing'].hasDebuff == true) then return true end`
function PallyDebuffHandler(spellID, hasDebuffNow)
-- {
for type, debuffInfo in pairs(PQ_Debuffs) do
-- {
if (debuffInfo.check) then
-- {
for k, debuff in pairs(debuffInfo.debuffList) do
-- {
if (debuff == spellID) then
PQ_Debuffs[type].hasDebuff = hasDebuffNow
if (hasDebuffNow) then --Has debuff spellID of type
PQ_Debuffs[type].spellid = spellID
PQ_Debuffs[type].endTime = select(7, UnitDebuffID("player", spellID))
else --Debuff being removed
PQ_Debuffs[type].spellid = nil
PQ_Debuffs[type].endTime = nil
end --end If debuff is being applied(true) or removed(false)
return --return so we only match once and don't search lists we don't need to
end --end check if spellid matched in list
end--End for loop that looped through the spellid list of a certain type
-- }
end--End If that checked to make sure we want to catch debuffs of this type
-- }
end--End For Loop that looped through debuff types
-- }
end--End function PallyDebuffHandler
-- }
So with that code in place then I can write: