Sub CheckPetBuffs
/if (!${Me.Pet.ID}) /return
/if (!${PetOn}) /return
/if (!${PetBuffsOn}) /return
/if (${CombatStart}) /return
/if (${Pulling}) /return
/if (${PetBuffCheck}) /return
/if (${Me.Invis}) /return
DEBUGN CheckPetBuffs Enter
/declare PTempBuff string local
/declare PTempSpell string local
/declare i int local
/declare j int local
/declare 1stPart string local 0
/declare 2ndPart string local 0
/declare 3rdPart string local 0
/declare FoundPetBuff int local 0
/declare CondNo int local 0
/varset PetBuffCheck 60s
/for i 1 to ${PetBuffs.Size}
/doevents
| Stop pet buffing if aggro detected
/if (${AggroTargetID}) /return
/if (${PetBuffs[${i}].Equal[Null]}) /continue
/varset 1stPart ${PetBuffs[${i}].Arg[1]}
/varset 2ndPart ${PetBuffs[${i}].Arg[2]}
/varset 3rdPart ${PetBuffs[${i}].Arg[3]}
/if (${2ndPart.NotEqual[dual]}) /varset 3rdPart ${1stPart}
/if (${ConOn} && ${PetBuffs[${i}].Find[|cond]}) {
/varset CondNo ${PetBuffs[${i}].Mid[${Math.Calc[${PetBuffs[${i}].Find[|cond]}+5]},3]}
} else {
/varset CondNo 0
}
| Check for pet spells in book to prevent double casting of items
/if (${Me.Book[${1stPart}]} || ${Me.AltAbility[${1stPart}]}) {
/if (${1stPart.Find[ Rk.]}) {
/varset PTempSpell ${1stPart.Left[${Math.Calc[${1stPart.Find[ Rk.]}-1]}]}
} else {
/varset PTempSpell ${1stPart}
}
/if (${3rdPart.Find[ Rk.]}) {
/varset PTempBuff ${3rdPart.Left[${Math.Calc[${3rdPart.Find[ Rk.]}-1]}]}
} else {
/varset PTempBuff ${3rdPart}
}
DEBUGN CheckPetBuffs ${i} ${Me.PetBuff[${PTempBuff}]} ${PetBuffs[${i}]} ${PTempBuff}
/for j 1 to 50
/if (${Me.PetBuff[${j}].Name.Find[${PTempBuff}]}) /varset FoundPetBuff 1
/next j
/if (!${FoundPetBuff}) {
| Vebrose
/call CastWhat "${1stPart}" ${Me.Pet.ID} Pet-nomem ${CondNo}
/delay 20
/if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Buffing ${Me.Pet.CleanName}, my pet, with ${1stPart}
/varset FoundPetBuff 0
/continue
}
} else /if (${FindItem[=${1stPart}].ID}) {
/varset PTempSpell ${1stPart}
/varset PTempBuff ${3rdPart}
DEBUGN CheckPetBuffs ${FindItem[=${1stPart}].Spell} ${Me.PetBuff[${FindItem[=${1stPart}].Spell}]} ${Me.PetBuff[${3rdPart}]}
/if (${Me.PetBuff[${FindItem[=${PTempSpell}].Spell}]}>0) /continue
/if (${Me.PetBuff[${PTempBuff}]}>0) /continue
DEBUGN CheckPetBuffs - Dual - ${1stPart} - ${3rdPart}
/for j 1 to 50
/if (${Me.PetBuff[${j}].Name.Find[${PTempBuff}]}) /varset FoundPetBuff 1
/next j
/if (!${FoundPetBuff}) {
|Vebrose
/call CastWhat "${1stPart}" ${Me.Pet.ID} Pet ${CondNo}
/delay 20
/if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Buffing ${Me.Pet.CleanName}, my pet, with (${3rdPart})
/varset FoundPetBuff 0
/continue
}
}
|- Cast item clicky buff (ItemName and PetBuff = SAME)
|/if (${FindItem[=${1stPart}].ID}) {
| /call CastWhat "${1stPart}" ${Me.Pet.ID} Pet ${CondNo}
|}
/varset FoundPetBuff 0
/next i
DEBUGN CheckPetBuffs Pet Height: ${Me.Pet.Height}
/if (${Me.Pet.Height}>1.35 && ${PetShrinkOn}) {
/call CastWhat "${PetShrinkSpell}" ${Me.Pet.ID} Pet 0
/delay 20
}
/if (${Target.ID}==${Me.Pet.ID}) /squelch /target clear
DEBUGN CheckPetBuffs Leave
/return