Sub DoPetStuff
/if (!${PetOn}) /return
/if (${AggroTargetID} || ${Me.Invis} || ${Me.Hovering}) /return
/declare PetSummonTimer timer local 60s
/doevents
/if (${Debug}) /echo \atDEBUG DoPetStuff Enter \agLine#: ${Macro.CurLine}
/declare FocusCurrent string local ${InvSlot[${PetFocus.Arg[2,|]}].Item.Name}
/declare FocusSlot string local ${PetFocus.Arg[2,|]} ${PetFocus.Arg[1,|]}
/declare FocusPet string local ${PetFocus.Arg[1,|]}
/declare FocusSwitch int local 0
/if (${Me.Pet.CleanName.Equal[${Me.Name}`s familiar]}) /pet get lost
| Swap pet focus in pet cast
/if (!${Me.Pet.ID} && ${Spell[${PetSpell}].Mana}<=${Me.CurrentMana}) {
| verbose
/echo I have no pet. ${Me.Class}s live longer when we have pets.
/varset PetActiveState 0
/if (${PetFocus.Arg[1,|].Length} && ${FindItemCount[=${FocusPet}]}) {
/if (!${Cursor.ID} && ${FocusPet.NotEqual[${FocusCurrent}]}) {
|/call CheckCasting 50
/exchange "${FocusPet}" ${FocusSlot}
/varset FocusSwitch 1
/delay 10
}
}
/doevents
/delay 3
| Pet spell mem check - Else try item like mage epic
/call CastWhat "${PetSpell}" ${Me.ID} DoPetStuff 0
| Summon Pet
|- If using suspended pet function.
/if (${PetSuspend}) {
|- If I have a suspended pet bust him out!
/if ((${PetTotCount}==1) && (${PetActiveState}==0) && (${PetSuspendState}==1)) {
/echo I have a suspended pet, summoning it now!
/call PetStateCheck
}
|- If I don't have a suspended or an active pet, make them.
/if (${PetTotCount}<2 && ${PetSuspendState}==0 && ${PetActiveState}==0 && ${Me.Book[${PetSpell}]} && ${Spell[${PetSpell}].Mana}<=${Me.CurrentMana}) {
|:MakeMyPet1
/while (1) {
/echo - Making pet now.
/echo ARISE ${PetSpell}
/call CastWhat "${PetSpell}" ${Me.ID} DoPetStuff 0
/if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
/echo You are missing components to make this pet. Ending macro.
/end
}
/delay 1s ${Me.Pet.ID}
/if (!${PetSummonTimer}) /break
/if (!${Me.Pet.ID}) /continue
/if (${Me.Pet.ID}) {
/echo My pet is now: ${Me.Pet.CleanName} from ${PetSpell}
/varset PetActiveState 1
/call CheckPetBuffs
/if (${PetToysOn}) {
/call PetToys ${Me.Pet.CleanName}
/if ((${PetSuspendState}==0) && (${PetActiveState}==1)) /varset PetToysDone 0
/if ((${PetSuspendState}==1) && (${PetActiveState}==1)) /varset PetToysDone 1
}
}
/call PetStateCheck
/if (${PetTotCount}==2 || !${PetSuspend} || !${PetSummonTimer}) /break
}
}
} else /if (${Me.Book[${PetSpell}]} && ${Spell[${PetSpell}].Mana}<=${Me.CurrentMana}) {
| Normal pet function for not using suspend pet.
/while (1) {
/echo ARISE ${PetSpell}
/call CastWhat "${PetSpell}" ${Me.ID} DoPetStuff 0
|/delay 10s !${Me.Casting.ID}
/if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
/echo You are missing components to make this pet. Ending macro.
/end
}
/delay 1s ${Me.Pet.ID}
/if (!${PetSummonTimer} || ${Me.Pet.ID}) /break
}
/if (${Me.Pet.ID}) {
/echo My pet is now: ${Me.Pet.CleanName} from ${PetSpell}
/varset PetActiveState 1
}
}
| Swap pet focus out for regular item
/if (${FocusSwitch} && !${Cursor.ID}) {
|/call CheckCasting
/exchange "${FocusCurrent}" ${FocusSlot}
/delay 10
}
| Reset PetToysGave in config after pet creation, as well as memory variable so we will pickup if our pet needs toys after death, under new condition checks.
/ini "${IniFileName}" "Pet" "PetToysGave" ""
/if (${Me.Pet.ID} && ${PetToysOn}) /varset PetToysGave "NULL"
/if (${Select[${Role},puller,pullertank,pettank,pullerpettank]} && ${Me.Pet.Distance}<=${CampRadius}) /pet guard
/if (${Select[${Role},puller,pullertank,pettank,pullerpettank]} && ${Me.Pet.Distance}>${CampRadius}) /pet follow
/if (${PetHoldOn}) /pet ${PetHold} on
/if (${Me.AltAbility[Pet Discipline]}>5) /pet focus on
/if (!${PetTauntOn} && ${Select[${Role},pettank,pullerpettank]}) /pet taunt on
}
/call CheckPetBuffs
| Pet Toy routines
| Condition revised to only call PetToys if I do not have my pet name in the PetToysGave string.
/if (${Me.Pet.ID} && ${PetToysOn} && (!${PetToysGave.Find[${Me.Pet.CleanName}]} || !${PetToysGave.Find[Summoned]})) /call PetToys ${Me.Pet.CleanName}
| Check to have pet come to owner if owner out of camp too long.
/if (${Select[${Role},pettank,hunterpettank]} && ${Math.Distance[${Me.Y},${Me.X}:${CampYLoc},${CampXLoc}]}>${CampRadius} && (${Math.Distance[${Me.Pet.Y},${Me.Pet.X}:${CampYLoc},${CampXLoc}]}<=${CampRadius}) && ${Me.Pet.Stance.Equal[GUARD]}) /pet follow
|/if (${Me.Pet.ID} && ${Me.Gem[${MiscGem}].Name.NotEqual[${ReMemMiscSpell}]}) /memorize "${ReMemMiscSpell}" gem${MiscGem}
/if (${Me.Pet.ID} && ${Me.Gem[${MiscGem}].Name.NotEqual[${ReMemMiscSpell}]} && ${MiscGemRemem}) {
/varset DontMoveMe 1
/call CastMemSpell "${ReMemMiscSpell}" ${MiscGem} 0 DoPetStuff
/varset DontMoveMe 0
}
/if (${Debug}) /echo \atDEBUG DoPetStuff Leave \agLine#: ${Macro.CurLine}
/return