Decided to make this with my hunter. It is mainly for cat as it's the only pet I have right now

Just read over it and let me know what you think about it. Just add it to the top somewhere.
Name: Pet Actions
SpellID: 0
Delay: 0
Code:
--Spell Checks
local petActive = HasPetSpells()
local ClawEnabled = select(7,GetPetActionInfo(4))
local DashEnabled = select(7,GetPetActionInfo(5))
local ProwlEnabled = select(7,GetPetActionInfo(6))
local RoarEnabled = select(7,GetPetActionInfo(7))
--Target Checks
local petTarget = UnitIsEnemy("Target","Pet")
local pTarget = UnitExists("Target")
local isEnemy = UnitIsEnemy("Target","Player")
--Combat Checks
local inCombat = UnitAffectingCombat("Player")
local inCombatPet = UnitAffectingCombat("Pet")
--Buff Checks
local Prowl = UnitBuffID("Pet", 24450)
--Tables
local agiBuff = {
57330, --Horn of Winter
93435, --Roar of Courage
6673 --Battle Shout
}
--End Tables
--Stance Dance
----Combat Locals
local Attack = select(5,GetPetActionInfo(1))
----Stance Locals
local Assist = select(5,GetPetActionInfo(8))
local Defensive = select(5,GetPetActionInfo(9))
local Passive = select(5,GetPetActionInfo(10))
----End Stance Locals
----Passive if not in Combat
if inCombat == 1 then
if Assist == nil then
PetAssistMode()
end
elseif (inCombat and inCombatPet) == nil then
if Passive == nil then
PetPassiveMode()
end
end
--End Stance Dance/Attack & Follow
--Pet Target Switcher
if petTarget == 1 then
if petTarget ~= isEnemy then
PetAttack("Target")
end
end
if pTarget == nil then
if Attack == 1 then
PetFollow()
end
end
--End Pet Target Switcher
--Functions
function AgiBuff(unit)
for i=1,#agiBuff do
local Buff = UnitBuffID(unit, agiBuff[i])
if Buff ~= nil then
return true
end
end
return false
end
--End Functions
--Function Calls
----Function Locals
local AgiBuff = AgiBuff("Player")
----Function Locals End
if AgiBuff == false and petActive ~= nil then
CastPetAction(7)
end
--Function Calls End
--Toggle Claw on if inCombat.
if (inCombat or inCombatPet) == 1 and ClawEnabled == nil and petActive ~= nil then
TogglePetAutocast(4)
end
--Toggle Spells off if not in combat.
----Claw
if ClawEnabled ~= nil and (inCombat or inCombatPet) == nil and petActive ~= nil then
TogglePetAutocast(4)
end
----Dash
if DashEnabled ~= nil and (inCombat or inCombatPet) == nil and petActive ~= nil then
TogglePetAutocast(5)
end
----Prowl
if ProwlEnabled ~= nil and (inCombat or inCombatPet) == nil and petActive ~= nil then
TogglePetAutocast(6)
end
----Roar of Courage
if RoarEnabled ~= nil and (inCombat or inCombatPet) == nil and petActive ~= nil then
TogglePetAutocast(7)
end
--End Toggle Spells
--Dash if in combat.
if (pTarget and isEnemy and inCombat or inCombatPet) == 1 and petActive ~= nil then
CastPetAction(5, "Target")
end
--Prowl if not in combat.
if Prowl ~= nil then
return false
elseif inCombatPet == nil then
CastPetAction(6, "Pet")
end
Sadly, they don't have a IsSpellKnown() for Pet spells or I would be able to make it Universal for all beasts
EDIT* You might have to comment some of the code out. For example, the prowl code as I didnt get a check coded in. I'll have to do that. Anyways, make sure for your pet spell slots, the 1st one is Claw or the pets attack spell, 2nd is Dash, 3rd is Prowl if pet has it (if not, remove it from the Pet Spell Bar), and the 4th one is the pets Roar of Courage (again, if pet doesn't have it, remove it or change the code around to match the beasts type).
I'll get it more perfected as time comes along. It's only the way it is as it's the most Universal. If someone can tell me a way to make pet Names Universal, let me know and I'll ad some more functionality for all beast types and Buffs.