All pastes #922875 Raw Edit

Mine

public text v1 · immutable
#922875 ·published 2008-02-29 02:13 UTC
rendered paste body
/*
======================================================================
Ritz's Complete Druid Routine; V5.2
----------------------------------------------------------------------
Version 5.2

Bug Fixes

Changes:
» Less Spamming about ranged pulls
» Stopped Double casting of roots/overhealing
» Fixed Moonkin mounting troubles

Issues:
» ?

ToDo:
» Automatic form selection depending on spec
» A GUI. Maybe. If I get really bored.
» More switches for stuff like potions/ranged pulling
» Improve Balance/Low level logic
» Improve trinket handling

======================================================================
*/
objectdef oClass inherits oBase
{
	
	/*	Custom Variables	*/
	variable int RestHP = 50	;Rest if I'm below this HP
	variable int RestMana = 35	;Rest if I'm below this Mana
	variable int HealHP = 35	;Heal if I fall below this HP
	variable int HealToHP = 50	;Once i've started healing, keep going till I get above this %
	variable int LowMana = 15	;Pot/Innervate if I fall below this mana
	variable int CastPrecision = 250	;How good the routine is at timing spells in MS. Lower is more accurate.
	variable bool BarkskinForHeals = TRUE	;Save Barkskin for when you need to heal?
	variable int PullTimer = 15000	;How long in MS before declaring a failed pull
	variable int CureDelay = 10	;How often to check for debuffs to cure. Lower is more often.
	
	
	/*	Forms	*/
	/*	Kitty|Bear|Travel|Moonkin|Caster	*/
	variable string DangerLow = Kitty
	variable string DangerMedium = Bear
	variable string DangerHigh = Bear
	variable string DangerVeryHigh = Travel
	
	/*	Hooks	*/
	variable bool needUIHook = TRUE	;Don't Touch
	variable bool needCombatHook = TRUE	;Don't Touch
	variable bool HookFlee = TRUE	;Don't Touch
	variable collection:string UIErrorMsgStrings
	
	/*	Fixed Variables		*/
	variable int HP = ${Me.PctHPs}
	variable int Mana = ${Me.PctMana}
	variable int CD
	variable string CurrentForm
	variable int CombatStart = ${LavishScript.RunningTime}
	variable bool Healing = FALSE
	variable bool Caster = FALSE
	variable string OldTargetGUID
	variable bool ArcaneImmune
	variable bool NatureImmune
	variable bool BleedImmune
	variable bool RangedPull
	variable int PullTimeOut = 0
	variable int MWait
	
	method Initialize()
	{
		This:Output[======================================================================]
		This:Output[Ritz's Druid routine V5.2 Loaded]
		LavishScript:RegisterEvent[UNIT_MODEL_CHANGED]
		Event[UNIT_MODEL_CHANGED]:AttachAtom[Class:SetCurrentForm]
		Class:SetCurrentForm
		Bot:AddPulse["Class","CureAll",${CureDelay},TRUE,TRUE] 
		Class:CreateUIErrorStrings
		This:Output[======================================================================]
	}

	method CreateUIErrorStrings()
	{
		This.UIErrorMsgStrings:Set["You are facing the wrong way!"]
		This.UIErrorMsgStrings:Set["Target not in line of sight"]
		This.UIErrorMsgStrings:Set["Can't use items while shapeshifted."]
		This.UIErrorMsgStrings:Set["You can't take a taxi while shapeshifted!"]
		This.UIErrorMsgStrings:Set["You are in shapeshift form"]
		This.UIErrorMsgStrings:Set["You are too far away!"]
		This.UIErrorMsgStrings:Set["There is nothing to attack."]
		This.UIErrorMsgStrings:Set["You must be behind your target"]
		This.UIErrorMsgStrings:Set["Invalid target"]
		This.UIErrorMsgStrings:Set["Can only use outside"]
		This.UIErrorMsgStrings:Set["Can't do that while moving"]
		This.UIErrorMsgStrings:Set["You can't mount while shapeshifted."]
		This:Output["UI Error Hooks created"]
	}
	
	method UIErrorMessage(string Id, string Msg)
	{
		if ${This.UIErrorMsgStrings.Element[${Msg}](exists)} && !${Bot.PauseFlag} 
		{
			This:Output[UI Error: ${Msg}]
			if ${Msg.Equal["Can't use items while shapeshifted."]} || ${Msg.Equal["You are in shapeshift form"]} || ${Msg.Equal["You can't take a taxi while shapeshifted!"]} || ${Msg.Equal["You can't mount while shapeshifted."]}
			{
				Class:Shapeshift[Caster]
			}
			if ${Msg.Equal["You must be behind your target"]}
			{
				move forward 100
				if ${Math.Rand[100]} > 50
				{
					move left 300
				}
				else
				{
					move right 300
				}
			}
			if ${Msg.Equal["Target not in line of sight"]}
			{
				if !${Class.MoveWait}
				{
					Toon:ToMelee
				}
			}
			if ${Msg.Equal["Can't do that while moving"]}
			{
				move -stop
				MWait:Set[${LavishScript.RunningTime} + 1500]
				
			}
		}
	}
	
	member DoubleCast()
	{
		if ${Me(unit).Casting.Name.Find["Entangling Roots"]} && ${Class.TargetRooted}
		{
			return TRUE
		}
		if ${Class.IsHeal[${Me(unit).Casting.Name}]}
		{
		if ${Me.InCombat} && ${Me.PctHPs} > ${Math.Calc[${HealToHP}*1.1]}
			{
				return TRUE
			}
			if ${Me.PctHPs} > 95
			{
				return TRUE
			}
		}			
		return FALSE
	}
	
	member NeedRest()
	{
		if !${Me.InCombat}
		{
			CombatStart:Set[${LavishScript.RunningTime}]
		}
		if (${Me.Buff[Drink](exists)} && ${Me.PctMana} < 95) || (${Me.Buff[Food](exists)} && ${Me.PctHPs} < 95)
		{
			return TRUE
		}
		if ${Me.PctHPs} < ${RestHP} || ${Me.PctMana} < ${RestMana}
		{
			return TRUE
		}
		if ${Me.Buff["Ressurection Sickness"](exists)}
		{
			return TRUE
		}
		return FALSE
	}
	
	method RestPulse()
	{
		if ${Class.DoubleCast}
		{
			This:Output["Stopping Double Cast of ${Me(unit).Casting.Name}"]
			Class:StopCasting
		}
		if ${Me.Target(exists)}
		{
			WoWScript ClearTarget()
		}
		if ${Me.Buff["Ressurection Sickness"](exists)} && ${Class.OutputTimer}
		{
			This:Output["Rest - Rez Sickness: Waiting (${Me.Buff["Ressurection Sickness"].Duration.Round})"]
			if !${Class.MoveWait}
			{
				move -stop
			}
			if ${This.Usable["Shadowmeld"]} && ${CurrentForm.Equal["Caster"]}
			{
				Class:Cast[Shadowmeld]
			}
			return
		}
		if (${Me.Buff[Drink](exists)} && ${Me.PctMana} < 95) || (${Me.Buff[Food](exists)} && ${Me.PctHPs} < 95)
		{
			if ${This.Usable["Shadowmeld"]} && ${CurrentForm.Equal["Caster"]}
			{
				Class:Cast[Shadowmeld]
			}
			return
		}
		if ${Class.NeedHeal} || ${Class.NeedMana}
		{
			return
		}
	}

	member NeedBuff()
	{
		if !${Me.Buff["Mark of the Wild"](exists)}
		{
			if ${This.Usable["Mark of the Wild"]}
			{
				return TRUE
			}
		}
		if !${Me.Buff["Thorns"](exists)}
		{
			if ${This.Usable["Thorns"]}
			{
				return TRUE
			}
		}
		if !${Me.Buff["Omen of Clarity"](exists)}
		{
			if ${This.Usable["Omen of Clarity"]}
			{
				return TRUE
			}
		}
		if ${Toon.canUseScroll}
		{
			return TRUE
		}			
		return FALSE
	}
	
	method BuffPulse()
	{
		if ${Me.Target(exists)}
		{
			WoWScript ClearTarget()
		}
		if !${Me.Buff["Mark of the Wild"](exists)}
		{
			if ${This.Usable["Mark of the Wild"]}
			{
				Class:Cast[Mark of the Wild]
			}
		}
		if !${Me.Buff["Thorns"](exists)}
		{
			if ${This.Usable["Thorns"]}
			{
				Class:Cast[Thorns]
			}
		}
		if !${Me.Buff["Omen of Clarity"](exists)}
		{
			if ${This.Usable["Omen of Clarity"]}
			{
				Class:Cast[Omen of Clarity]
			}
		}
		if ${Toon.canUseScroll}
		{
			Toon:UseScroll
			return
		}
	}
	
	method StopCasting()
	{
		variable int Random = ${Math.Rand[100]}
		CD:Set[0]
		if ${Random} > 80
		{
			move left 50
			return
		}
		if ${Random} > 60
		{
			move right 50
			return
		}
		if ${Random} > 40
		{
			move backward 50
			return
		}
		if ${Random} > 20
		{
			move forward 50
			return
		}
		if ${Random} > 0
		{
			WoWScript SpellStopCasting()
			return
		}
	}
	
	method PullPulse()
	{
		if ${Class.DoubleCast}
		{
			This:Output["Stopping Double Cast of ${Me(unit).Casting.Name}"]
			Class:StopCasting
		}
			
		if ${Me.Casting}
		{
			if ${Class.GotNewTarget} && !${Class.IsHeal[${Me(unit).Casting.Name}]}
			{
				This:Output[Switching Pull targets]
				Class:StopCasting
			}
			return
		}
		
		Class:Shapeshift
		if ${PullTimeOut} == 0
		{
			PullTimeOut:Set[${LavishScript.RunningTime} + ${PullTimer}]
		}
		elseif ${LavishScript.RunningTime} > ${PullTimeOut}
		{
			This:Output[Failed Pull! Pull time out exceeded.]
			if !${RangedPull}
			{
				This:Output[Trying Ranged Pull]
				RangedPull:Set[TRUE]
				PullTimeOut:Set[0]
			}
			else
			{
				This:Output[Blacklisting Mob]
				GlobalBlacklist:Insert[${Target.GUID},3600000]
				WoWScript ClearTarget()
				PullTimeOut:Set[0]
				return
			}	
		}
		if ${Class.GotNewTarget}
		{
			This:Output[New Target Aquired]
			if !${Target.InCombat}
			{
				return
			}
		}
		if ${CurrentForm.Equal["Caster"]}
		{
			Class:CasterPull
		}
		if ${CurrentForm.Equal["Moonkin"]}
		{
			Class:MoonkinPull
		}
		if ${RangedPull}
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
			if ${Class.OutputTimer}
			{
				This:Output["Trying a ranged pull"]
			}
			if ${Target.Distance} > ${Toon.MinRanged}
			{
				if ${Spell["Faerie Fire (Feral)"](exists)}
				{
					Class:Cast[Faerie Fire (Feral)]
				}
				elseif ${Spell["Moonfire"](exists)}
				{
					Class:Cast[Moonfire]
					return
				}
			}
			return
		}
		if ${CurrentForm.Equal["Bear"]}
		{
			Class:BearPull
		}
		if ${CurrentForm.Equal["Kitty"]}
		{
			Class:KittyPull
		}
		if ${CurrentForm.Equal["Travel"]}
		{
			Class:TravelPull
		}
	}
	
	member OutputTimer()
	{
		if ${Math.Calc[${LavishScript.RunningTime}%5]} == 0
		{
			return TRUE
		}
		return FALSE
	}
	
	member NeedInterupt()
	{
		if !${Target.Buff[Maim](exists)} && !${Target.Buff[Bash](exists)} && !${Target.Buff[War Stomp](exists)} && !${Target.Buff[Cyclone](exists)} && !${Target.Buff[Cyclone](exists)}
		{
			if ${Target.Casting(exists)}
			{
				if ${Class.Usable[Maim]} || ${Class.Usable[Bash]} || ${Class.Usable[War Stomp]} || ${Class.Usable[Cyclone]} || ${Class.Usable[Feral Charge]}
				{
					return TRUE
				}
			}
			if ${Me.PctHPs} < ${HealHP}
			{
				if ${CurrentForm.Equal[Kitty]}
				{
					if ${Class.Usable[Maim]}
					{
						return TRUE
					}
				}
				if ${CurrentForm.Equal[Bear]}
				{
					if ${Class.Usable[Bash]}
					{
						return TRUE
					}
					if ${Class.Usable[Feral Charge]}
					{
						return TRUE
					}
				}
				if ${Class.Usable[War Stomp]} && ${Target.Distance} < 8
				{
					return TRUE
				}
				if ${Class.Usable[Cyclone]}
				{
					return TRUE
				}
			}
		}
		return FALSE
	}
	
	method Interupt()
	{
		if ${CurrentForm.Equal[Kitty]}
		{
			if ${Class.Usable[Maim]}
			{
				Class:Cast[Maim]
			}
		}
		if ${CurrentForm.Equal[Bear]}
		{
			if ${Class.Usable[Bash]}
			{
				Class:Cast[Bash]
			}
			if ${Class.Usable[Feral Charge]}
			{
				Class:Cast[Feral Charge]
			}
		}
		if ${Class.Usable[War Stomp]} && ${Target.Distance} < 8
		{
			Class:Cast[War Stomp]
		}
		if ${Class.Usable[Cyclone]}
		{
			Class:Cast[Cyclone]
		}
	}
	
	method AttackPulse()
	{
		if ${Class.DoubleCast}
		{
			This:Output["Stopping Double Cast of ${Me(unit).Casting.Name}"]
			Class:StopCasting
		}
		
		if ${Me.Casting}
		{
			return
		}
		if (${Target.TappedByMe} && !${Target.Target.Name.Equal[${Me.Name}]} && ${Target.Target.Player(exists)}) || (!${Target.TappedByMe} && ${Target.Tapped} && ${Target.InCombat})
		{
			GlobalBlacklist:Insert[${Target.GUID},3600000]
		}
		if !${Target.Buff[Maim](exists)}
		{
			Toon:AutoAttack
		}
		if ${Class.NeedInterupt}
		{
			Class:Interupt
			return
		}
		if ${Class.NeedMana}
		{
		}
		if ${Class.NeedHeal}
		{
			return
		}
		if !${Toon.TargetIsBestTarget} && ${Target.PctHPs} > 20
		{
			Toon:BestTarget
		}
		if ${Class.GotNewTarget}
		{
			This:Output[New Target Aquired]
		}
		if ${Toon.ValidTarget[${Target.GUID}]}
		{
			Class:Shapeshift
		}
		if ${Me.Equip[13](exists)}
		{
			if ${WoWScript[GetInventoryItemCooldown("player"\, 13)]} == 0
			{
				Me.Equip[13]:Use       
			}
		}
		if ${Me.Equip[14](exists)}
		{
			if ${WoWScript[GetInventoryItemCooldown("player"\, 14)]} == 0
			{
				Me.Equip[14]:Use   
			}
		}
		if ${CurrentForm.Equal["Caster"]}
		{
			Class:CasterPulse
		}
		if ${CurrentForm.Equal["Bear"]}
		{
			Class:BearPulse
		}
		if ${CurrentForm.Equal["Kitty"]}
		{
			Class:KittyPulse
		}
		if ${CurrentForm.Equal["Moonkin"]}
		{
			Class:MoonkinPulse
		}
		if ${CurrentForm.Equal["Travel"]}
		{
			Class:TravelPulse
		}
	}
	
	member NeedMana()
	{
		Mana:Set[${Me.PctMana}]
		if !${Me.InCombat}
		{
			if ${Mana} < ${RestMana}
			{
				This:Output["Need more Mana! (${Mana}/${RestMana})"]
				Class:RegMana
				return TRUE
			}
		}
		elseif ${Mana} < ${LowMana} && ${Me.Power.Equal["Mana"]}
		{
			This:Output["Need more Mana! (${Mana}/${LowMana})"]
			Class:RegMana
			return TRUE
		}
		return FALSE
	}
	
	member MoveWait()
	{
		if ${MWait} > ${LavishScript.RunningTime}
		{
			return TRUE
		}
		MWait:Set[${LavishScript.RunningTime} + 500]
		return FALSE
	}
	
	method RegMana()
	{
		if ${Me.Casting} || ${Me.Buff[Innervate](exists)}
		{
			return
		}
		if ${Me.InCombat}
		{
			variable string PotionName = ${Item[-inventory,"Mana Potion"].Name}
			if ${Class.Usable[Innervate]}
			{
				Class:Cast[Innervate]
			}
			if ${Mana} < 5 && ${Item[${PotionName}](exists)} && ${Item[${PotionName}].Usable} && !${WoWScript["GetContainerItemCooldown(${Item[${PotionName}].Bag.Number}, ${Item[${PotionName}].Slot})", 2]}
			{
				Item[${PotionName}]:Use
				This:Output[Using ${Item[-inventory,"Mana Potion"].Name}]
				CD:Set[${LavishScript.RunningTime} + (${CastPrecision}/2)]
			}
		}
		else
		{
			if ${Movement.Speed}
			{
				if !${Class.MoveWait}
				{
					move -stop
					return
				}
			}
			if ${Consumable.HasDrink} && !${Me.Buff[Drink](exists)}
			{
				Consumable:useDrink
				CD:Set[${LavishScript.RunningTime} + 1000]
			}
		}
	}
	
	member NeedHeal()
	{
		if !${Me.Casting}
		{
			HP:Set[${Me.PctHPs}]
		}
		if ${HP} > 10
		{
			HP:Inc[${Me.Buff[Lifebloom].Application}*2]
			HP:Inc[${Me.Buff[Regrowth].Duration}*0.4]
			HP:Inc[${Me.Buff[Rejuvenation].Duration}*0.5]
		}
		if ${Healing}
		{
			if ${HP} < ${HealToHP}
			{
				This:Output["Need more healing! (${HP}/${HealToHP})"]
				Class:Heal
			}
			else
			{
				This:Output["Fully healed to ${HealToHP}% (${HP}/${HealToHP})"]
				Healing:Set[FALSE]
			}
			return TRUE
		}
		else
		{
			if !${Me.InCombat} && ${HP} < ${RestHP} || ${HP} < ${HealHP}
			{
				Healing:Set[TRUE]
			}
		}
		return FALSE
	}

	
	method Heal()
	{
		variable string PotionName = ${Item[-inventory,"Healing Potion"].Name}
		if ${Me.Casting} || ${Me.Buff[Food](exists)}
		{
			return
		}
		if !${Me.InCombat}
		{
			if ${Movement.Speed}
			{
				if !${Class.MoveWait}
				{
					move -stop
					return
				}
			}
			if ${Consumable.HasFood} && !${Me.Buff[Food](exists)}
			{
				Consumable:useFood
				CD:Set[${LavishScript.RunningTime} + 1000]
			}
		}
		if ${HP} < 10 && ${Class.Usable[Regrowth]} && !${Me.Buff[Regrowth](exists)}
		{
			Class:Cast[Regrowth]
		}
		if ${HP} < 80 && ${Class.Usable[Rejuvenation]} && !${Me.Buff[Rejuvenation](exists)}
		{
			Class:Cast[Rejuvenation]
		}
		if ${HP} > 25 && ${Class.Usable[Lifebloom]} && (${Me.Buff[Lifebloom].Application} < 3 || ${Me.Buff[Lifebloom].Duration} < 1)
		{
			Class:Cast[Lifebloom]
		}
		if ${Class.Usable[Healing Touch]}
		{
			Class:Cast[Healing Touch]
		}
		if ${Class.Usable[Lifebloom]} && (${Me.Buff[Lifebloom].Application} < 3 || ${Me.Buff[Lifebloom].Duration} < 1)
		{
			Class:Cast[Lifebloom]
		}
		if ${HP} < 5 && ${Item[${PotionName}](exists)} && ${Item[${PotionName}].Usable} && !${WoWScript["GetContainerItemCooldown(${Item[${PotionName}].Bag.Number}, ${Item[${PotionName}].Slot})", 2]}
		{
			Item[${PotionName}]:Use
			This:Output[Using ${Item[-inventory,"Healing Potion"].Name}]
			CD:Set[${LavishScript.RunningTime} + (${CastPrecision}/2)]
		}
	}
	
	method Cast(string SpellName)
	{
		if ${Spell[${SpellName}].CastTime} > 0
		{
			if ${Movement.Speed}
			{
				if !${Class.MoveWait}
				{
					move -stop
				}
			}
		}
		if ${Spell[${SpellName}].CastTime} > 1 && ${Class.Usable[Barkskin]} && ${Toon.AggroWithin[10,TRUE]} > 0
		{
			if ${BarkskinForHeals}
			{
				if ${Class.IsHeal[${SpellName}]}
				{
					This:Output["Casting Barkskin to protect ${SpellName}"]
					Cast "Barkskin"
					CD:Set[${LavishScript.RunningTime} + (${CastPrecision}/2)]
					return
				}
			}
			else
			{
				This:Output["Casting Barkskin to protect ${SpellName}"]
				Cast "Barkskin"
				CD:Set[${LavishScript.RunningTime} + (${CastPrecision}/2)]
				return
			}
		}
		This:Output["Casting ${SpellName}"]
		Cast "${SpellName}"
		CD:Set[${LavishScript.RunningTime} + ${Spell[${SpellName}].CastTime} + ${CastPrecision}]
		return
	}
	
	member Ready(string thisSpell)
	{
		if ${Spell[${thisSpell}](exists)} && !${Spell[${thisSpell}].Cooldown}
		{
			return TRUE
		}
		return FALSE
	}
	
	method CombatEvent(string unitID, string unitAction, string isCrit, string amtDamage, string damageType)
	{
		if ${unitID.Equal["target"]} && ${unitAction.Equal["immune"]}		
		{
			if ${damageType.Equal["6"]}
			{
				ArcaneImmune:Set[TRUE]
				This:Output["Immune! Stopping Arcane spells."]
			}
			if ${damageType.Equal["3"]}
			{
				NatureImmune:Set[TRUE]
				This:Output["Immune! Stopping Nature spells."]
			}
		}
	}
	
	variable string Arcane = Moonfire/Starfire/
	variable string Nature = Wrath/Insect Swarm/Faerie Fire/Faerie Fire(feral)/Thorns/Nature's Grasp/Entangling Roots/Cyclone/
	variable string Bleed = Rake/Lacerate/Rip/
	
	member Usable(string thisSpell)
	{
		variable int CostMulti = 1
		variable int SpellSchool = 0
		if ${LavishScript.RunningTime} > ${CD}
		{
			if ${Me.Power.Equal["Rage"]}
			{
				CostMulti:Set[0.1]
			}
			if ${Arcane.Find[${thisSpell}/]}
			{
				SpellSchool:Set[1]
			}
			elseif ${Nature.Find[${thisSpell}/]}
			{
				SpellSchool:Set[2]
			}
			elseif ${Bleed.Find[${thisSpell}/]}
			{
				SpellSchool:Set[3]
			}
			if ${Spell[${thisSpell}](exists)} && !${Spell[${thisSpell}].Cooldown} && ${Me.Action[${thisSpell}].Usable} && !${Me.Action[${thisSpell}].Active}
			{
				if (${Class.PowerIsMana[${thisSpell}]} && ${Me.CurrentMana} > ${Spell[${thisSpell}].Mana}) ||${Me.CurrentPower} > (${Spell[${thisSpell}].Mana}*${CostMulti}) || ${Me.Buff[Clearcasting](exists)}
				{
					if ${IsDot[${thisSpell}]} && ${Target.PctHPs} < ${StopDots}
					{
						return FALSE
					}
					if (${ArcaneImmune} && ${SpellSchool} == 1) || (${NatureImmune} && ${SpellSchool} == 2) || (${BleedImmune} && ${SpellSchool} == 3)
					{
						return FALSE
					}
					return TRUE
				}
			}
		}
		return FALSE
	}
	
	member CheckDebuff(string DebuffName)
	{
		variable int i = 0
		do
		{
			if ${DebuffName.Equal[${WoWScript["UnitDebuff("target",${i})",1]}]}
			{
				return ${WoWScript["UnitDebuff("target",${i})",7]}
			}
			i:Inc
		}
		while ${WoWScript["UnitDebuff("target",${Math.Calc[${i}+1]})",7](exists)}
		return 0
	}
	
	method SetCurrentForm()
	{
		if ${WoWScript[GetShapeshiftForm()]} == 0
		{
			CurrentForm:Set[Caster]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Bear"]}
		{
			CurrentForm:Set[Bear]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Cat"]}
		{
			CurrentForm:Set[Kitty]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Moonkin"]}
		{
			CurrentForm:Set[Moonkin]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Flight"]}
		{
			CurrentForm:Set[Flight]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Travel"]}
		{
			CurrentForm:Set[Travel]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
		if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2].Find["Tree"]}
		{
			CurrentForm:Set[Tree]
			This:Output[Shapeshifted to ${CurrentForm} Form!]
			return
		}
	}
	
	member TargetRooted()
	{
		if ${Target.Buff[Entangling Roots](exists)} || ${Target.Buff[Frost Nova](exists)}
		{
			return TRUE
		}
		return FALSE
	}
	
	variable string Heals = Healing Touch/Regrowth/Rejuvenation/Lifebloom/Tranquillity/Nature's Swiftness/Thorns/Mark of the Wild/Omen of Clarity
	
	member IsHeal(string SpellName)
	{
		if ${Heals.Find[${SpellName}]}
		{
			return TRUE
		}
		return FALSE
	}
	
	variable string ManaSpells = Wrath/Starfire/Moonfire/Insect Swarm/Force of Nature/Faerie Fire/Hurricane/Barkskin/Hibernate/Soothe Beast/Teleport: Moonglade/Entangling Roots/Cyclone/Innervate/Abolish Poison/Cure Poison/Remove Curse/Rebirth/Gift of the Wild/Healing Touch/Regrowth/Rejuvenation/Lifebloom/Tranquillity/Nature's Swiftness/Thorns/Mark of the Wild/Omen of Clarity/
	
	member PowerIsMana(string SpellName)
	{
		if ${ManaSpells.Find[${SpellName}/]}
		{
			return TRUE
		}
		return FALSE
	}
	
	method CasterPull()
	{
		cast "Bear Form"
		This:Output[Shapeshifted to ${CurrentForm} Form!]
		return
		Class:BearPulse
		if ${Class.Usable[Entangling Roots]} && !${Class.TargetRooted} && !${Mount.IsIndoors} && !${Class.IsCaster}
		{
			Class:Cast[Entangling Roots]
		}
		if ${Class.Usable[Starfire]}
		{
			Class:Cast[Starfire]
		}
		if ${Class.Usable[Wrath]}
		{
			Class:Cast[Wrath]
		}
		if !${Me.Casting}
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
		}
	}
	
	method KittyPull()
	{
		if !${Toon.DetectAdds[${Target.GUID},1,25]} || ${Target.Distance} < ${Toon.MaxMelee} + 5
		{
			if ${Target.Distance} < ${Toon.MaxMelee} + 5
			{
				if ${Me.PctPower} > 80
				{
					if ${Toon.isFacingAway}
					{
						if ${Class.Usable[Pounce]}
						{
							Class:Cast[Pounce]
							return
						}
						if ${Class.Usable[Ravage]}
						{
							Class:Cast[Ravage]
							return
						}
						if ${Class.Usable[Shred]}
						{
							Class:Cast[Shred]
							return
						}
					}
					else
					{
						if ${Class.Usable[Pounce]}
						{
							Class:Cast[Pounce]
							return
						}
						if ${Class.Usable[Claw]}
						{
							Class:Cast[Claw]
						}
					}
					if !${Class.MoveWait}
					{
						Toon:ToMelee
					}
				}
				else
				{
					if !${Class.MoveWait}
					{
						move -stop
					}
				}
			}
			elseif ${Target.Distance} < 20
			{
				if ${Class.Usable[Prowl]}
				{
					Class:Cast[Prowl]
				}
				else
				{
					if ${Class.Usable[Tiger's Fury]} && !${Me.Buff[Tiger's Fury](exists)} && ${Me.PctPower} > 80
					{
						Class:Cast[Tiger's Fury]
					}
					if ${Me.PctPower} > 75
					{
						if !${Class.MoveWait}
						{
							Toon:ToMelee
						}
					}
					else
					{
						if !${Class.MoveWait}
						{
							move -stop
						}
					}
				}
			}
			else
			{
				if !${Class.MoveWait}
				{
					Toon:ToMelee
				}
			}
		}
		else
		{
			This:Output[Hostile Adds Detected!]
			RangedPull:Set[TRUE]
		}
	}
	
	method BearPull()
	{
		Toon:AutoAttack
		if !${Toon.DetectAdds[${Target.GUID},1,25]}
		{
			if !${Class.MoveWait}
			{
				Toon:ToMelee
			}
			if ${Class.Usable[Enrage]}
			{
				Class:Cast[Enrage]
			}
			if ${Class.Usable[Maul]}
			{
				Class:Cast[Maul]
			}
			if ${Class.Usable[Feral Charge]}
			{
				Class:Cast[Feral Charge]
			}
			if ${Class.Usable[Faerie Fire (Feral)]}
			{
				Class:Cast[Faerie Fire (Feral)]
			}
		}
		else
		{
			This:Output[Hostile Adds Detected!]
			RangedPull:Set[TRUE]
		}
	}
	
	method KittyPulse()
	{
		if ${Target.Distance} > 30
		{
			if ${Class.Usable[Dash]}
			{
				Class:Cast[Dash]
			}
		}
		if ((${Target.Target(exists)} && ${Target.Target.Name.NotEqual[${Me.Name}]}) || ${Class.CheckDebuff[Maim]} > 0.5 || ${Class.CheckDebuff[Bash]} > 0.5 || ${Class.CheckDebuff[Cyclone]} > 0.5 || ${Class.CheckDebuff[Pounce]} > 0.5) && ${Target.PctHPs} > 10
		{
			if ${Math.Abs[${Target.Heading} - ${Me.HeadingTo[${Target.X},${Target.Y}]}]} < 90
			{
				if ${Target.Buff[Maim](exists)} && ${Me.PctPower} < 80
				{
					if !${Class.MoveWait}
					{
						Toon:ToMelee
					}
					if ${Class.OutputTimer}
					{
						This:Output[Behind my Target: Waiting for energy]
					}
					return
				}
			}
			elseif ${Target.Distance} < 10
			{
				if ${Class.OutputTimer}
				{
					This:Output[Moving behind my target]
				}
				move forward 1500
				return
			}
			else
			{
				if !${Class.MoveWait}
				{
					Toon:ToMelee
					return
				}
			}
		}
		if !${Toon.DetectAdds[${Target.GUID},1,25]} && ${Target.Distance} > 10 && !${Class.IsCaster}
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
			if ${Class.Usable[Faerie Fire (Feral)]} && !${Target.Buff[Faerie Fire (Feral)](exists)} && !${Target.Buff[Faerie Fire](exists)}
			{
				Class:Cast[Faerie Fire (Feral)]
			}
		}
		else
		{
			if !${Class.MoveWait}
			{
				Toon:ToMelee
			}
			if ${Me.ComboPoints}*3.5 > ${Target.PctHPs}
			{
				if ${Me.PctPower} >= 65
				{
					if ${Class.Usable[Tiger's Fury]} && !${Me.Buff[Tiger's Fury](exists)}
					{
						Class:Cast[Tiger's Fury]
					}
				}
				if ${Class.Usable[Ferocious Bite]}
				{
					Class:Cast[Ferocious Bite]
				}
			}
			if ${Me.ComboPoints} > 1 && (30 + (${Me.ComboPoints}*10) > ${Target.PctHPs} && ${Toon.AggroWithin[40,TRUE]} < 2 && ${Target.PctHPs} > 10
			{
				if ${Me.PctPower} >= 65
				{
					if ${Class.Usable[Tiger's Fury]} && !${Me.Buff[Tiger's Fury](exists)}
					{
						Class:Cast[Tiger's Fury]
					}
				}
				if ${Class.Usable[Maim]}
				{
					Class:Cast[Maim]
				}
			}
			if ${Class.Usable[Mangle (Cat)]} && !${Target.Buff[Mangle (Cat)](exists)} && !${Target.Buff[Mangle (Bear)](exists)}
			{
				Class:Cast[Mangle (Cat)]
			}
			if ${Me.ComboPoints} > 3 && ${Target.PctHPs} > 75
			{
				if ${Me.PctPower} >= 60
				{
					if ${Class.Usable[Tiger's Fury]} && !${Me.Buff[Tiger's Fury](exists)}
					{
						Class:Cast[Tiger's Fury]
					}
				}
				if ${Class.Usable[Rip]}
				{
					Class:Cast[Rip]
				}
			}
			if ${Toon.isFacingAway}
			{
				if ${Class.Usable[Shred]}
				{
					Class:Cast[Shred]
				}
				if !${Class.Ready[Shred]} && ${Class.Usable[Claw]}
				{
					Class:Cast[Claw]
				}
			}
			else
			{
				if ${Class.Usable[Rake]} && !${Target.Buff[Rake](exists)}
				{
					Class:Cast[Rake]
				}
				if ${Class.Usable[Mangle (Cat)]}
				{
					Class:Cast[Mangle (Cat)]
				}
				if ${Class.Usable[Claw]}
				{
					Class:Cast[Claw]
				}
			}
			if ${Class.Usable[Faerie Fire (Feral)]} && !${Target.Buff[Faerie Fire (Feral)](exists)} && !${Target.Buff[Faerie Fire](exists)}
			{
				Class:Cast[Faerie Fire (Feral)]
			}
		}
	}
	
	method TravelPulse()
	{
		if ${Class.OutputTimer}	
		{
			This:Output[Danger too high, Fleeing!]
		}
		Toon:Flee
	}
	
	method TravelPulse()
	{
		if ${Class.OutputTimer}	
		{
			This:Output[Danger too high, Fleeing!]
		}
		Toon:Flee
	}
	
	method FleePulse()
	{
		if ${Me.Attacking}
		{
			WoWScript AttackTarget()
			return
		}
		if ${Class.Danger.Equal["MEDIUM"]} || ${Class.Danger.Equal["LOW"]}
		{
			Toon:Flee[FALSE]
		}
		if ${Class.Usable[Frenzied Regeneration]}
		{
			Class:Cast[Frenzied Regeneration]
		}
		if ${Class.Usable[Dash]}
		{
			Class:Cast[Dash]
		}
	}
	
	method BearPulse()
	{
		if !${Toon.DetectAdds[${Target.GUID},1,25]} && ${Target.Distance} > 10 && !${Class.IsCaster}
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
			if ${Class.Usable[Faerie Fire (Feral)]} && !${Target.Buff[Faerie Fire (Feral)](exists)} && !${Target.Buff[Faerie Fire](exists)}
			{
				Class:Cast[Faerie Fire (Feral)]
			}
		}
		else
		{
			if !${Class.MoveWait}
			{
				Toon:ToMelee
			}
			if ${Me.PctHPs} > 30 && ${Class.Usable[Enrage]}
			{
				Class:Cast[Enrage]
			}
			if ${Me.Buff[Frenzied Regeneration](exists)}
			{
				return
			}
			if !${Class.IsCaster} || (${Class.IsCaster} && ${Target.Casting(exists)})
			{
				if ${Class.Usable[Feral Charge]}
				{
					Class:Cast[Feral Charge]
				}
			}
			if ${Class.Usable[Mangle (Bear)]}
			{
				Class:Cast[Mangle (Bear)]
			}
			if ${Me.PctHPs} < 70
			{
				if ${Class.Usable[Frenzied Regeneration]}
				{
					Class:Cast[Frenzied Regeneration]
				}
			}
			if ${Class.Usable[Maul]}
			{
				Class:Cast[Maul]
			}
			if ${Class.Usable[Demoralizing Roar]} && !${Target.Buff[Demoralizing Roar](exists)} && ${Target.Distance} < 8
			{
				Class:Cast[Demoralizing Roar]
			}
			if ${Me.PctPower} > 10 && ${Class.Usable[Swipe]} && ${Toon.AggroWithin[8,TRUE]} > 1
			{
				Class:Cast[Swipe]
			}
			if ${Me.PctPower} > 35 && ${Class.Usable[Lacerate]}
			{
				Class:Cast[Lacerate]
			}
			if ${Class.Usable[Faerie Fire (Feral)]} && !${Target.Buff[Faerie Fire (Feral)](exists)} && !${Target.Buff[Faerie Fire](exists)}
			{
				Class:Cast[Faerie Fire (Feral)]
			}
		}
	}
	
	member GotNewTarget()
	{
		if ${Me.Target(exists)} && ${Target.GUID.NotEqual[${OldTargetGUID}]}
		{
			OldTargetGUID:Set[${Target.GUID}]
			Caster:Set[FALSE]
			ArcaneImmune:Set[FALSE]
			NatureImmune:Set[FALSE]
			if ${Target.CreatureType.Equal[Undead]} || ${Target.CreatureType.Equal[Mechanical]} || ${Target.CreatureType.Equal[Elemental]}
			{
				BleedImmune:Set[TRUE]
			}
			else
			{
				BleedImmune:Set[FALSE]
			}
			PullTimeOut:Set[0]
			RangedPull:Set[FALSE]
			return TRUE
		}
		if ${Me.Target(exists)}
		{
			OldTargetGUID:Set[${Target.GUID}]
		}
		return FALSE
	}
	
	method CasterPulse()
	{
		if ${Class.IsCaster} && ${Me.PctMana} < 10 && !${Toon.DetectAdds[${Target.GUID},1,25]}
		{
			if !${Class.MoveWait}
			{
				Toon:ToMelee
			}
		}
		elseif ${Target.Distance} > 10 || ${Class.TargetRooted}
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
		}
		else
		{
			if !${Class.MoveWait} && !${Toon.DetectAdds[${Target.GUID},1,20]}
			{
				Toon:ToMelee
			}
		}
		if ${Toon.AggroWithin[8,TRUE]} > 0
		{
			if !${Target.Buff[Entangling Roots](exists)} && ${Target.PctHPs} > 30 && !${Mount.IsIndoors} && ${Class.Usable[Nature's Grasp]}
			{
				Class:Cast[Nature's Grasp]
			}
		}
		if (${Toon.AggroWithin[30,TRUE]} > 1 || ${Class.IsCaster}) && ${Class.Usable[Force of Nature]}
		{
			Class:Cast[Force of Nature]
			ISXWoW:ClickTerrain[${Target.X}]}, ${Target.Y}]}, ${Target.Z}]
		}
		if ${Class.Usable[Entangling Roots]} && !${Target.Buff[Entangling Roots](exists)} && ${Target.PctHPs} > 30 && !${Mount.IsIndoors} && !${Class.IsCaster}
		{
			Class:Cast[Entangling Roots]
		}
		if ${Class.Usable[Moonfire]} && !${Target.Buff[Moonfire](exists)} && ${Me.PctMana} > 40
		{
			Class:Cast[Moonfire]
		}
		if ${Class.Usable[Insect Swarm]} && !${Target.Buff[Insect Swarm](exists)} && ${Target.PctHPs} > 30
		{
			Class:Cast[Insect Swarm]
		}
		if ${Class.Usable[Starfire]} && ${Target.PctHPs} > 25 && (${Target.Distance} > 20 || ${Me.Buff[Barkskin].Duration} > ${Spell[Starfire].CastTime})
		{
			Class:Cast[Starfire]
		}
		if ${Class.Usable[Wrath]}
		{
			Class:Cast[Wrath]
		}
	}
	
	method MoonkinPulse()
	{
		if (${Target.Distance} > 10 || ${Class.TargetRooted}) && ${Target.PctHPs} > 20
		{
			if !${Class.MoveWait}
			{
				Toon:ToRanged
			}
		}
		else
		{
			if !${Class.MoveWait}
			{
				Toon:ToMelee
			}
		}
		if ${Toon.AggroWithin[8,TRUE]} > 0
		{
			if !${Target.Buff[Entangling Roots](exists)} && ${Target.PctHPs} > 30 && !${Mount.IsIndoors} && ${Class.Usable[Nature's Grasp]}
			{
				Class:Cast[Nature's Grasp]
			}
		}
		if ${Toon.AggroWithin[30,TRUE]} > 1 && ${Class.Usable[Force of Nature]}
		{
			Class:Cast[Force of Nature]
			ISXWoW:ClickTerrain[${Target.X}]}, ${Target.Y}]}, ${Target.Z}]
		}
		if ${Class.Usable[Entangling Roots]} && !${Target.Buff[Entangling Roots](exists)} && ${Target.PctHPs} > 30 && !${Mount.IsIndoors} && !${Class.IsCaster}
		{
			Class:Cast[Entangling Roots]
		}
		if ${Class.Usable[Moonfire]} && !${Target.Buff[Moonfire](exists)} && ${Me.PctMana} > 40
		{
			Class:Cast[Moonfire]
		}
		if ${Class.Usable[Insect Swarm]} && !${Target.Buff[Insect Swarm](exists)} && ${Target.PctHPs} > 30
		{
			Class:Cast[Insect Swarm]
		}
		if ${Class.Usable[Starfire]} && ${Target.PctHPs} > 25 && (${Target.Distance} > 20 || ${Me.Buff[Barkskin].Duration} > ${Spell[Starfire].CastTime})
		{
			Class:Cast[Starfire]
		}
		if ${Class.Usable[Wrath]}
		{
			Class:Cast[Wrath]
		}
	}
	
	member Danger()
	{
		variable int CombatTime
		variable guidlist Aggros
		variable int DangerLevel
		Aggros:Search[-units,-nearest,-attackable,-aggro,-alive,-range 0-40]
		DangerLevel:Set[${DangerLevel} * 0.5]
		DangerLevel:Inc[${Aggros.Count}*6.5]
		DangerLevel:Inc[(100 - ${Me.PctMana})*0.1]
		CombatTime:Set[${Math.Calc[${LavishScript.RunningTime} - ${CombatStart}].Round}]
		DangerLevel:Inc[${CombatTime}/5000]
		if ${Target.Level} > ${Me.Level}
		{
			DangerLevel:Inc[(${Target.Level} - ${Me.Level})*2]
		}
		elseif ${Me.Level} > ${Target.Level}
		{
			DangerLevel:Inc[(${Target.Level} - ${Me.Level})*1]
		}
		if ${WoWScript[UnitIsPlusMob(unit)]}
		{
			DangerLevel:Inc[20]
		}
		if ${Target.Player(exists)} && ${Target.Attackable}
		{
			DangerLevel:Inc[20]
		}
		if ${Inventory.NeedRepair}
		{
			DangerLevel:Inc[30]	
		}
		if ${DangerLevel} < 0
		{
			DangerLevel:Set[0]
		}
		if ${DangerLevel} > 100
		{
			return VERYHIGH
		}
		if ${DangerLevel} > 30
		{
			return HIGH
		}
		if ${DangerLevel} > 15
		{
			return MEDIUM
		}
		return LOW
	}
		
	method Shapeshift(string Form)
	{
		if ${Form.Length} == 0
		{
			if ${Class.Danger.Equal["LOW"]}
			{
				Form:Set[${DangerLow}]
			}
			elseif ${Class.Danger.Equal["MEDIUM"]}
			{
				Form:Set[${DangerMedium}]
			}
			elseif ${Class.Danger.Equal["HIGH"]}
			{
				Form:Set[${DangerHigh}]
			}
			elseif ${Class.Danger.Equal["VERYHIGH"]}
			{
				Form:Set[${DangerVeryHigh}]
			}
		}
		if ${Class.CurrentForm.NotEqual[${Form}]}
		{
			if ${Form.Equal[Bear]}
			{
				if ${Spell[Dire Bear Form](exists)}
				{
					cast "Dire Bear Form"
				}
				elseif ${Spell[Bear Form](exists)}
				{
					cast "Bear Form"
				}
			}
			if ${Form.Equal[Kitty]}
			{
				if ${Spell[Cat Form](exists)}
				{
					cast "Cat Form"
				}
				return
			}
			if ${Form.Equal[Moonkin]}
			{
				if ${Spell[Moonkin Form](exists)}
				{
					cast "Moonkin Form"
				}
				return
			}
			if ${Form.Equal[Travel]}
			{
				if ${Spell[Travel Form](exists)} && !${Mount.IsIndoors}
				{
					cast "Travel Form"
				}
			}
			if ${Form.Equal[Caster]}
			{
				if ${WoWScript[GetShapeshiftForm()]} != 0
				{
					 WoWScript CastShapeshiftForm(${WoWScript[GetShapeshiftForm()]})
				}
			}
			return
		}
	}
	
	member IsCaster()
	{
		if ${Caster}
		{
			return TRUE
		}
		if ${Target.Casting(exists)}
		{
			Caster:Set[TRUE]
			return TRUE
		}
		return FALSE
	}
	
	method CureAll()
	{
		if ${Me.PctMana} < 15
		{
			return
		}
		variable int i
		for (i:Set[0]; ${i} <= 10; i:Inc)
		{
			if ${Me.Buff[${i}].Harmful} && ${Me.Buff[${i}].Duration} > 15
			{
				if ${Me.Buff[${i}].DispelType.Equal[Curse]}
				{
					if ${Class.Usable[Remove Curse]}
					{
						This:Output["Removing Curse: ${Me.Buff[${i}].Name}"]
						Class:Cast[Remove Curse]
						return
					}
				}
				if ${Me.Buff[${i}].DispelType.Equal[Poison]}
				{
					if !${Me.Buff[Abolish Poison](exists)}
					{
						if ${Class.Usable[Abolish Poison]}
						{
							This:Output["Removing Poison: ${Me.Buff[${i}].Name}"]
							Class:Cast[Abolish Poison]
							return
						}
						if ${Class.Usable[Cure Poison]}
						{
							This:Output["Removing Poison: ${Me.Buff[${i}].Name}"]
							Class:Cast[Cure Poison]
							return
						}
					}
				}
				if ${Me.Buff[${i}].DispelType.Equal[Root]} && ${Me.PctMana} > 25
				{
					if ${WoWScript[GetShapeshiftForm()]} != 0
					{
						This:Output["Shapeshifting out of immobilize: Caster Form"]
						WoWScript CastShapeshiftForm(${WoWScript[GetShapeshiftForm()]})
					}
					else
					{
						if ${Spell[Travel Form](exists)} && !${Mount.IsIndoors}
						{
							This:Output["Shapeshifting out of immobilize: Travel Form"]
							cast "Travel Form"
						}
						elseif ${Spell[Bear Form](exists)}
						{
							This:Output["Shapeshifting out of immobilize: Bear Form"]
							cast "Bear Form"
						}
					}
				}
			}
		}
	}
	
	
	
}