Public feed #889867

Stuff

public text v1 · immutable
Raw Edit
·published 2008-02-03 07:46 UTC
rendered paste body
/*
======================================================================
RCore.iss - Routine Core 2.0* Put this in openbot/routines
======================================================================
*/
objectdef RCore inherits oBase
{
/*
======================================================================
Core Variables - Don't touch.
======================================================================
*/
	variable int TravelingForm = 0	;The Position on the shapeshift bar of the form to be used for Traveling
	variable int DPSForm = 0	;The Position on the shapeshift bar of the form to be used for DPS
	variable int SurvForm = 0	;The Position on the shapeshift bar of the form to be used for Survival
	variable int CurrentForm = 0	;The Position on the shapeshift bar of the form I am currently in. 0 if in no form
	variable int HealTarget = 0	;The Group number of the person I am trying to heal
	variable int MsgType = 1	;For RDebug. The level of the line I am checking to output.
	variable int TargetCD = 0	;For RTarget. How long left until I can switch targets, in pulses.
	variable int WaitTime = 0	;For RWait. How long to wait for.
	variable int ReqForm = 0	;For Usable checks. The form I need to be in to use the skill.
	variable int CurrentSpellSchool = 0	;For Immunties. The school of the last spell I tried to cast.
	variable int Immunity = 0	;For Immunties. Which spell school I am avoiding using.
	variable int CostMulti = 1	;For Usable checks. Set from whether you are currently using energy/rage/mana.
	variable int AssistTarget = 1	;The Group number of the person I am assisting. Usually either the tank or whoever is in combat.
	variable int NewForm = 0	;For RShift. The form I am trying to get to.
	variable int NewFormIndex = 0	;For RShift. The Position on the shapeshift bar of the form I am trying to use.
	variable int Random = 0	;Random number generated between 1-100 when a random decison is needed.
	variable int DangerLevel = 0	;The current level danger. Set from SetDanger.
	variable int Dangerlvl = 0	;Danger interpretation of the raw number for the routine to use.
	variable int i = 0	;Fixed.
	variable int j = 0	;Fixed.
	variable int ReleaseTime = 0
	variable int TrinketCooldown = 0
	variable int CombatTime = 0	;For checking if combat has gone on too long
	variable int CombatStart = ${LavishScript.RunningTime}	;For checking if combat has gone on too long
	variable int CurrentWait = 0 ;For RWait. The time remaining to wait.
	variable int PullTimer = 0	;For Pulling. Timer starts when I first attempt to pull. For checking for bad pulls or doing one off buffs.
	variable int PullTimeOut = 20000 ;For Pulling. How long before trying another pull? Def 20000.
	variable int RTraining = 0	;For Training at Moonglade. The stage through the training routine I am currently on.
	variable int Form1 = 1	;For Getting the positions of forms on the shapeshift bar.
	variable int Form2 = 2	;For Getting the positions of forms on the shapeshift bar.
	variable int Form3 = 3	;For Getting the positions of forms on the shapeshift bar.
	variable int Form4 = 4	;For Getting the positions of forms on the shapeshift bar.
	variable int Form5 = 5	;For Getting the positions of forms on the shapeshift bar.
	variable int Form6 = 6	;For Getting the positions of forms on the shapeshift bar.
	variable int Form7 = 7	;For Getting the positions of forms on the shapeshift bar.
	variable int Form8 = 8	;For Getting the positions of forms on the shapeshift bar.
	
	variable string CurrentSpell = "Nothing"	;For Immunities. The last spell I tried to cast.
	variable string Msg = ""	;For passing UI errors from the actual routine. The UI error string.
	variable string RealmChar = "${ISXWoW.RealmName}_${Me.Name}_${Me.Class}"
	
	variable bool Behind = FALSE ;For Energy routine. Am I behind the target?
	
	variable point3f TargetLoc = 0,0,0	;For Training at Moonglade. Where to move to next.
	
/*
======================================================================
Initialize
======================================================================
*/	
	method Initialize()
	{
		/*		Add extra pulses		*/
		Bot:AddPulse["RCore","CurePulse",${Class.CureCheck},TRUE,TRUE]
		if ${Class.JoinGroups}
		{
			Bot:AddPulse["RCore","GroupPulse",100,TRUE,TRUE]	
		}
		if ${Class.StartGroup} && ${Group.Members} == 0 && ${WoWScript[GetFriendInfo(1),5]}
		{
			WoWScript InviteUnit(\"${WoWScript[GetFriendInfo(1)]}\")
		}
		/*		Auto-start the routine if applicable		*/
		This:Output["Auto-start: ${Class.AutoStart}"]
		if ${Class.AutoStart}
		{
			Bot.PauseFlag:Set[FALSE]
		}
		This:LoadConfig
		This:Output[Ritz's Core Routine V2.0 Loaded.]
		This:Output[Algebraic!]
	}	
	
/*
======================================================================
Shut Down
======================================================================
*/	

	method ShutDown()
	{
		/*		Target myself to get any nearby bots running RCore to come to me		*/
		target ${Me}
	}	
	
/*
=====================================================================
Group Pulse (Only called if ${Class.JoinGroups} == TRUE)
=====================================================================
*/

	method GroupPulse()
	{
		if ${Group.Members} == 0 && ${Me.PctHPs} > 10
		{
			/*		If I'm not in a group, accept any invites		*/
			wowscript AcceptGroup()
			wowscript StaticPopup1:Hide()
		}
	}
					
/*
=====================================================================
Need Combat Idle
=====================================================================
*/

	member NeedCombatIdle()
		{
			/*		If I have no target, my target is not in combat, or I'm targetting myself or a friend, do CombatIdle		*/
			if ${Party.AssistType.Equal["ASSIST"]} && (!${Me.Target(exists)} || !${Me.Target.InCombat} || ${Me.Target.Name.Equal[${Me.Name}]} || ${Target.ReactionLevel} > 4)
			{
				This:RDebug["I need to do Idle in combat stuff",3]
				return TRUE
			}
			This:RDebug["I don't need to do Idle in combat stuff",3]
			return FALSE
		}
/*
=====================================================================
Combat Idle
=====================================================================
*/

	method CombatIdle()
	{
		Party:Assist
	}

			
/*
=====================================================================
Cure Pulse
=====================================================================
*/

	method CurePulse()
		{
			if !${Me.InCombat}
			{
				CombatStart:Set[${LavishScript.RunningTime}]
			}
			if ${Me.Buff[Drink](exists)} && ${Me.PctMana} < 90
			{
				return
			}
			if ${Me.PctMana} > 15 && !${Toon.Casting}
			{
				Party:CureAll()
			}
		}
		
/*
=====================================================================
Mana Buff Check
=====================================================================
*/

	method ManaBuffCheck()
		{
			if ${This.Usable[${Class.ManaBuffSpell},${Class.FManaBuffSpell}]}
			{
				Party:PartyCast[100, 100, 30, ${Class.ManaBuffSpell}, TRUE, FALSE]
			}
		}
		
/*
=====================================================================
Stealth (or Shadowmeld)
=====================================================================
*/		
	method Stealth()	
	{
		if ${Toon.IsDotted}
		{
			return
		}
		if !${Me.Buff[${Class.StealthSpell}](exists)} && ${This.Usable[${Class.StealthSpell},${Class.FStealthSpell}]}
		{
			Toon:CastSpell[${Class.StealthSpell}]
			return
		}
		if !${Me.Buff[${Class.StealthSpell}](exists)} && !${Me.Buff[Shadowmeld](exists)} && !${Movement.Speed} && ${This.Usable["Shadowmeld",${Class.FShadowmeld}]}
		{
			Toon:CastSpell[Shadowmeld]
			return
		}
		return		
	}
/*
=====================================================================
Need Buff
=====================================================================
*/
	member NeedBuff()
	{
		if ${This.NeedSelfBuff}
		{
			return TRUE
		}
		if !${Me.Buff[${Class.Buff1}](exists)} && ${This.Usable[${Class.Buff1},${Class.FBuff1}]}
		{
			return TRUE
		}
		if !${Me.Buff[${Class.Buff2}](exists)} && ${This.Usable[${Class.Buff2},${Class.FBuff2}]}
		{
			return TRUE
		}
		if !${Me.Buff[${Class.Buff3}](exists)} && ${This.Usable[${Class.Buff3},${Class.FBuff3}]}
		{
			return TRUE
		}
		if ${This.CurrentForm} == ${Class.FPotion} && !${This.checkForScrolls.Equal["NONE"]}
		{
			return TRUE
		}
		return FALSE
	}
	
/*
=====================================================================
Need Rest
=====================================================================
*/
	member NeedRest()
		{		
			if ${This.RWait} > 0
				{
					return TRUE
				}
			if ${This.RTraining} == 15 && ${POI.NeedClassTrainer} == TRUE
				{
					return FALSE
				}
			if ${This.RTraining} > 0
				{
					return TRUE
				}
			if (${Party.AssistType.Equal["REST"]} && (${POI.Type.Equal[HOTSPOT]} || ${POI.Type.Equal[MOB]})
				{
					return TRUE
				}				
			if ${Me.Buff[Drink](exists)} || ${Me.Buff[Food](exists)} || ${Me.Buff[Resurrection Sickness](exists)}
	        	{
		        	return TRUE
        		}      				  				
			if (${Me.PctHPs} < ${Class.RestHP}) || (${Me.PctMana} < ${Class.RestMana} && ${Me.Power.Equal["Mana"]})
	     		{
		     		return TRUE
	     		}	     			
	     							
	      	return FALSE
		}

/*
=====================================================================
Buff Pulse
=====================================================================
*/

	method BuffPulse()
	{
		This:CheckCurrentForm
		if ${This.NeedSelfBuff}
		{
			target ${Me}
			This:BuffRoutine
			return
		}
		if !${Me.Buff[${Class.Buff1}](exists)} && ${This.Usable[${Class.Buff1},${Class.FBuff1}]}
		{
			target ${Me}
			This:BuffRoutine
			return
		}
		if !${Me.Buff[${Class.Buff2}](exists)} && ${This.Usable[${Class.Buff2},${Class.FBuff2}]}
		{
			target ${Me}
			This:BuffRoutine
			return
		}
		if !${Me.Buff[${Class.Buff3}](exists)} && ${This.Usable[${Class.Buff3},${Class.FBuff3}]}
		{
			return TRUE
		}
		if ${This.CurrentForm} == ${Class.FPotion} && !${This.checkForScrolls.Equal["NONE"]}
		{
			This:RTarget[${Me.GUID},3]
			Consumable:UseScroll[${This.checkForScrolls}]
			return
		}
		return FALSE
	}
				
/*
=====================================================================
Rest Pulse
=====================================================================
*/

	method RestPulse()
		{
			This:CheckCurrentForm
			if ${This.CurrentWait} > 0
			{
				This:RWait[${This.CurrentWait}]
				return
			}
			if !${POI.NeedClassTrainer} && ${This.RTraining} == 16
			{
				RTraining:Set[0]
			}
			if ${Me.Casting}
			{
				This:DoubleCastCheck
				return
			}
			if (${Me.Buff[Drink](exists)} && ${Me.PctMana} < 95 && ${Me.Power.Equal["Mana"]}) || (${Me.Buff[Food](exists)} && ${Me.PctHPs} < 95)
			{
				This:Stealth
				return
			}
			else
			{
				if ${Me.Sitting}
				{
					wowpress jump
				}	
			}
			if ${Me.PctMana} < ${Class.RestMana}
			{
				if ${Consumable.HasDrink} && !${Me.Buff[Drink](exists)}
				{
					if ${Movement.Speed}
					{
						move -stop
						This:RWait[15]
					}
					else
					{
						This:RDebug["Rest - Need a drink",1]
						Consumable:useDrink
						This:RWait[5]
					}
				}
			}
			if ${Me.PctHPs} < ${Class.RestHP}
			{
				if ${Consumable.HasFood} && !${Me.Buff[Food](exists)}
				{
					if ${Movement.Speed}
					{
						move -stop
						This:RWait[15]
					}
					else
					{
						This:RDebug["Rest - Need food",1]
						Consumable:useFood
						This:RWait[5]
					}
				}
			}
			if ${POI.NeedClassTrainer} == TRUE && ${RTraining} == 0 && ${Spell["Teleport: Moonglade"](exists)} && ${Item[Hearthstone](exists)} && ${Class.UseMoonglade}
			{
				This:RShift[0]
				RTraining:Set[1]
				POI.NeedClassTrainer:Set[FALSE]
				return
			}
			if ${RTraining} > 0 && !${WoWScript["GetContainerItemCooldown(${Item[Hearthstone].Bag.Number}, ${Item[Hearthstone].Slot})", 2]}
			{
				This:RShift[0]
				This:RTrain
				return
			}
			if ${Me.Buff[Resurrection Sickness](exists)}
			{
				This:RDebug["Rest - Rez Sickness.. Waiting",2]
				move -stop
				This:Stealth
			}
			if ${Party.AssistType.Equal["REST"]} && (${POI.Type.Equal[HOTSPOT]} || ${POI.Type.Equal[MOB]})
			{
				target ${Group.Member[${Party.AssistTarget}]}
				if ${Group.Member[${Party.AssistTarget}].Distance} > 10
				{
					Navigator:MoveToLoc[${Group.Member[${Party.AssistTarget}].X},${Group.Member[${Party.AssistTarget}].Y},${Group.Member[${Party.AssistTarget}].Z}]
				}
				else
				{
					move -stop
					This:Stealth
				}
			}
			if ${Me.PctHPs} < ${Class.HealHP}
			{
				target ${Me}
				This:HealRoutine
				return
			}
			if ${Party.AssistType.Equal["ALONE"]} && (${POI.Type.Equal[HOTSPOT]} || ${POI.Type.Equal[MOB]})
			{
				This:RDebug["I'm all alone... Stopping",2]
				Target ${Me}
				Navigator:Clear
				move -stop
				This:Stealth
				return
			}
			return
		}
		
/*
=====================================================================
Pull Pulse
=====================================================================
*/

	method PullPulse()
		{	
			if ${Me.Sitting}
			{
				wowpress jump
			}	
			CurrentSpell:Set["Nothing"]
			CurrentSpellSchool:Set[0]
			This:CheckCurrentForm
			This:DangerLevel:Set[0]
			if !${Toon.TargetIsBestTarget} && ${Target.ReactionLevel} <= 4 && !${Me.Casting}
			{
				This:RDebug["Pull Pulse 1",3]
				This:RTarget[${Targeting.TargetCollection.Get[1].GUID},0]
			}
			if (${Me.Target(exists)} && ${Me.Target.ReactionLevel} > 4 && ${Me.Target.Target(exists)}) || !${Me.Target(exists)}
			{
				This:RDebug["Pull Pulse 2",3]
				This:RTarget[${Me.Target.Target.GUID},0]
			}
			if ${Me.Target(exists)} && ${Toon.ValidTarget[${Target.GUID}]}
			{
				Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			}
			if ${Class.StartGroup} && ${Group.Members} == 0 && ${WoWScript[GetFriendInfo(1),5]}
			{
				WoWScript InviteUnit(\"${WoWScript[GetFriendInfo(1)]}\") 
				return
			}
			if ${Class.SetLoot} && ${Group.Members} > 0 && ${Group.Leader.Name.Equal[${Me.Name}]}
			{
				if !${WoWScript[GetLootMethod()].Equal[freeforall]}
				{
					WoWScript SetLootMethod("freeforall")
				}
				if ${WoWScript[GetLootThreshold()]} != 4
				{
					WoWScript SetLootThreshold(4)
				}
			}
			if ${PullTimer} == 0
			{
				if ${CurrentForm} != ${DPSForm}
				{
					if ${CurrentForm} == ${SurvForm} && ${Me.PctMana} < 80
					{
						return
					}
					else
					{
						This:RShift[${DPSForm}]
						This:RDebug["Pull - Shifting to DPS form (${DPSForm})",1]
						return
					}
				}
				else
				{
					PullTimer:Set[${LavishScript.RunningTime} + ${PullTimeOut}]
				}
			}
			if ${Me.Target(exists)} && ${Target.CreatureType.Equal["Mechanical"]} || ${Target.Name.Find["Infernal"]} || ${Target.Name.Find["Imp"]} || ${Target.Name.Find["Earth"]}
			{
				Immunity:Set[8]
			}
			else
			{
				Immunity:Set[0]
			}
			if ${Party.Tanking} && ${Class.HealHP} != ${Class.SoloHealHP}
			{
				This:RDebug["Set Solo Config",0]
				Class.HealHP:Set[${Class.SoloHealHP}]
			}
			if !${Party.Tanking} && ${Class.HealHP} != ${Class.GroupHealHP}
			{
				This:RDebug["Set Party Config",0]
				Class.HealHP:Set[${Class.GroupHealHP}]
			}
			if ${Me.Power.Equal["Rage"]}
			{
				CostMulti:Set[0.1]
				This:BearPull
				return
			}
			if ${Me.Power.Equal["Energy"]}
			{
				CostMulti:Set[1]
				This:CatPull
				return
			}
			if ${Me.Power.Equal["Mana"]}
			{
				CostMulti:Set[1]
				This:BalancePull
			}
			return
	}
	
/*
=====================================================================
Attack Pulse
=====================================================================
*/
	method AttackPulse()
		{
			if ${Me.Sitting}
			{
				wowpress jump
			}	
			RTraining:Set[0]
			PullTimer:Set[0]
			Random:Set[${Math.Rand[100]}]
			This:CheckCurrentForm
			This:SetDanger
			CurrentSpell:Set["Nothing"]
			CurrentSpellSchool:Set[0]
			This:DoubleCastCheck
			if ${This.CurrentWait} > 0
			{
				This:RWait[${This.CurrentWait}]
				return
			}
			variable guidlist Aggros
			Aggros:Search[-units,-nearest,-aggro,-alive,-range 0-40]
			if (${Target.Tapped} && !${Target.TappedByMe})
			{
				This:RDebug["Abandoning the target",0]
				GlobalBlacklist:Insert[${Target.GUID},60000]
				if ${Target.Target.Name.Equal[${Me.Name}]}
				{
					Toon:Flee[TRUE]
					return
				}
				elseif ${Target.Target.Player(exists)} && ${Target.Target.Name.NotEqual[${Me.Name}]}
				{
					target ${Target.Target.GUID}
					return
				}
			}
			if ${Dangerlvl} >= 3
			{
				Toon:Flee[TRUE]
				return
			}
			if ${Me.Target(exists)} && !${Target.LineOfSight}
			{
				Navigator:MoveToMob[${Target.GUID}]
				This:RDebug["Attack - No Line of Sight, moveing to target",2]
				return
			}
			if ${Me.PctHPs} < ${Class.HealHP}
			{
				target ${Me}
				This:HealRoutine
				return
			}
			This:ManaRoutine
			This:CheckTarget
			if ${Dangerlvl} == 0
			{
				This:RDebug["Attack - Easy fight -  going to DPS form [${DPSForm}]",1]
				This:RShift[${DPSForm}]
			}
			elseif ${Dangerlvl} > 1
			{
				This:RDebug["Attack - Getting tricky -  Resorting to Survival form [${SurvForm}]",1]
				This:RShift[${SurvForm}]
			}
			/*		Trinkets		*/
			if ${Me.Equip[13](exists)} && ${Dangerlvl} >  ${Class.UseTrinket1}
			{
				TrinketCooldown:Set[${WoWScript[GetInventoryItemCooldown("player"\, 13)]}]
				This:RDebug["Attack - Trinket 1 Cooldown is ${TrinketCooldown},3]
				if ${TrinketCooldown} == 0
				{
					Me.Equip[13]:Use	
				}
			}
			if ${Me.Equip[14](exists)} && ${Dangerlvl} >  ${Class.UseTrinket2}
			{
				TrinketCooldown:Set[${WoWScript[GetInventoryItemCooldown("player"\, 14)]}]
				This:RDebug["Attack - Trinket 2 Cooldown is ${TrinketCooldown},3]
				if ${TrinketCooldown} == 0
				{
					Me.Equip[14]:Use	
				}
			}
			if ${Party.Tanking}
			{
				Party:Tank()
			}
			if !${Toon.TargetIsBestTarget}
			{
				This:RDebug["Attack Pulse 1",3]
				This:RTarget[${Targeting.TargetCollection.Get[1].GUID},0]
			}
			if ${Me.Power.Equal["Rage"]}
			{
				CostMulti:Set[0.1]
				This:BearRoutine
				return
			}
			if ${Me.Power.Equal["Energy"]}
			{
				CostMulti:Set[1]
				This:CatRoutine
				return
			}
			if ${Me.Power.Equal["Mana"]}
			{
				CostMulti:Set[1]
				if ${Dangerlvl} == 1 && ${CurrentForm}==0
				{
					This:RDebug["Attack - I'm in Caster form and in a bit of danger -  Resorting to Survival form [${SurvForm}]",1]
					This:RShift[${SurvForm}]
				}
				This:BalanceRoutine
			}
			return
		}

/*
=====================================================================
Double Cast Check
=====================================================================
*/
	method DoubleCastCheck()
		{
			if !${This.Healing}
			{
				return
			}
			Random:Set[${Math.Rand[100]}]
			if ${Group.Member[${HealTarget}].PctHPs} > ${Class.HealHP} * 1.3
			{
				if ${Random} < 50
				{
					wowpress JUMP
				}
				else
				{
					WoWScript SpellStopCasting()
				}
				This:RDebug["Stopping any double-cast heals",1]
				
			}
		}
		
/*
=====================================================================
RShift
=====================================================================
*/
	method RShift(int NewForm)
		{
			variable guidlist Aggros
			Aggros:Search[-units,-nearest,-aggro,-alive,-range 0-40]
			if ${Me.Power.Equal["Energy"]} && ${NewForm} != ${CurrentForm}
			{
				if ${Me.Target.Attackable} && ${This.Usable[${Class.InteruptAttack},${Class.FInteruptAttack},${Class.SInteruptAttack}]} && ${Target.Casting(exists)}
				{
					This:RDebug["RShift - ${Class.InteruptAttack}",1]
					Toon:CastSpell[${Class.InteruptAttack}]
					return
				}
			}
			if ${Me.Target.Attackable} && ${Me.Power.Equal["Rage"]} && ${NewForm} != ${CurrentForm}
			{
				if ${This.Usable[${Class.RageInterupt},${Class.FRageInterupt},${Class.SRageInterupt}]}
				{
					This:RDebug["RShift - ${Class.RageInterupt}",1]
					Toon:CastSpell[${Class.RageInterupt}]
					return
	 			}
			}
			if ${CurrentForm} == 0 && ${NewForm} != 0
			{
				This:ManaRoutine
				if ${Me.PctHPs} < 90 && ${Me.PctMana} > 40 && !${Me.Buff[${Class.HoTHeal}](exists)} && ${This.Usable[${Class.HoTHeal},${Class.FHoTHeal}]}
				{
					This:RTarget[${Me.GUID},2]
	        		Toon:CastSpell[${Class.HoTHeal}]
	        		This:RDebug["RShift - Casting ${Class.HoTHeal}",2]
					return
				}
				if ${Me.Target.Attackable} && ${Me.Target(exists} && ${Me.Target.ReactionLevel} < 4 && ${Me.Target.PctHPs} < 10 && ${Me.PctHPs} > 30 && ${This.Usable[${Class.KBSpell},${Class.FKBSpell},${Class.SKBSpell}]}
				{
					Toon:CastSpell[${Class.KBSpell}]
					This:RDebug["RShift - Casting ${Class.KBSpell}",2]
					return		
				}
			}
			if ${CurrentForm} != ${NewForm}
			{
				This:CancelAllForms
				if ${NewForm} != 0
				{
					This:RDebug["RShift - Shifting to ${NewForm}",2]
					if ${WoWScript[GetShapeshiftFormInfo(${NewForm}),2](exists)}
					{
						WoWScript CastShapeshiftForm(${NewForm})
					}
					elseif ${This.Usable[${Class.FormForDPS},0]}
					{
						Toon:CastSpell[${Class.FormForDPS}]
					}
				}
			}
		}
		
/*
=====================================================================
Balance Pull
=====================================================================
*/
	method BalancePull()
		{
			This:RWait[${CurrentWait}]
			if ${CurrentWait} > 0
			{
				return
			}
			if ${Me.InCombat}
			{
				return
			}
			if ${Me.Target(exists)} && ${Target.ReactionLevel} <= 4
			{
				Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			}
			if ${LavishScript.RunningTime} > ${PullTimer} && ${Party.Tanking}
			{
				This:RDebug["Balance Pull - Pull timeout -  Blackisting",1]
				GlobalBlacklist:Insert[${Target.GUID},3600000]
				PullTimer:Set[${LavishScript.RunningTime} + ${PullTimeOut}]
				return
			}
			if ${Target.Distance} > (${Class.MaxRange}-5) && !${Toon.Casting}
			{
				This:RDebug["Balance Pull - Out of range - moving closer",1]
				Navigator:MoveToMob[${Target.GUID}]
				return	
			}
			else
			{
			if ${Me.PctMana} < ${Class.MeleeMod}
			{
				This:RDebug["Balance Pull - Low mana, wanding",1]
				if ${Me.Equip[Ranged](exists)} && ${Spell[Shoot](exists)}
				{
					if ${Target.Distance} > 25 && !${Toon.Casting} && !${Me.Action[Shoot].AutoRepeat}
					{
						This:RDebug["Balance Pull - Wanding but out of range - moving closer",1]
						Navigator:MoveToMob[${Target.GUID}]
						if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
						{
							wowpress JUMP
						}
						return
					}
					else
					{
						move -stop
						This:RDebug["Balance Pull - Wanding",2]
						Toon:CastSpell[Shoot]
					}
				}
				else
				{
					if !${Me.Attacking}
					{
						This:RDebug["Balance Pull - Turning on autoattack",2]
						WoWScript AttackTarget()
					}
					Navigator:MoveToMob[${Target.GUID}]
				}
				return
				}
				elseif ${Movement.Speed}
				{
					move -stop
					return
				}
				if ${This.Usable[${Class.PullSpell1},${Class.FPullSpell1},${Class.SPullSpell1}]}
				{
					This:RDebug["Balance Pull - Pulling with ${Class.PullSpell1}",2]
					Toon:CastSpell[${Class.PullSpell1}]
					This:RWait[5]
					return
				}
				elseif ${This.Usable[${Class.PullSpell2},${Class.FPullSpell2},${Class.SPullSpell2}]}
				{
					This:RDebug["Balance Pull - Pulling with ${Class.PullSpell2}",2]
					Toon:CastSpell[${Class.PullSpell2}]
					This:RWait[5]
					return
				}
				elseif ${This.Usable[${Class.PullSpell3},${Class.FPullSpell3},${Class.SPullSpell3}]}
				{
					This:RDebug["Balance Pull - Pulling with ${Class.PullSpell3}",2]
					Toon:CastSpell[${Class.PullSpell3}]
					This:RWait[5]
					return
				}
				else
				{
					Navigator:MoveToMob[${Target.GUID}]
				}
			}
		}
		
/*
=====================================================================
Bear Pull
=====================================================================
*/
	method BearPull()
		{
			This:RWait[${CurrentWait}]
			if ${CurrentWait} > 0
			{
				return
			}
			if ${LavishScript.RunningTime} > ${PullTimer}
			{
				This:RShift[0]
				This:RDebug["Bear Pull - Nothings happening - Trying a Caster form pull.",1]
				PullTimer:Set[${LavishScript.RunningTime} + ${PullTimeOut}]
				return
			}
			if !${Me.Attacking}
			{
				This:RDebug["Bear Pull - Turning on Autoattack",2]
				WoWScript AttackTarget()
			}
			if ${This.Usable[${Class.PullAttack1},${Class.FPullAttack1},${Class.PullAttack1}]}
			{
				This:RDebug["Bear Pull - ${Class.PullAttack1}",2]
				Toon:CastSpell[${Class.PullAttack1}]
				return
			}
			if ${This.Usable[${Class.PullAttack2},${Class.FPullAttack2},${Class.SPullAttack2}]}
			{
				This:RDebug["Bear Pull - ${Class.PullAttack2}",2]
				Toon:CastSpell[${Class.PullAttack2}]
			}
			if ${Target.Distance}> 4.5
			{
				This:RDebug["Bear Pull - No pulling tecniques available - body pulling",2]
				Navigator:MoveToMob[${Target.GUID}]
			}
	}

/*
=====================================================================
Cat Pull
=====================================================================
*/

method CatPull()
	{
		This:RWait[${CurrentWait}]
		if ${CurrentWait} > 0
		{
			return
		}
		if ${LavishScript.RunningTime} > ${PullTimer}
		{
			This:RShift[0]
			This:RDebug["Cat Pull - Nothings happening - Trying a Caster form pull.",1]
			PullTimer:Set[${LavishScript.RunningTime} + ${PullTimeOut}]
			return
		}
		if !${Toon.IsDotted} && ${Target.Distance} < 20 && ${This.Usable[${Class.StealthSpell},${Class.FStealthSpell}]}
		{
			This:RDebug["Cat Pull - Nearly at the target - ${Class.StealthSpell}ing",1]
			Toon:CastSpell[${Class.StealthSpell}]
			This:RWait[5]
		}
		if (${Spell[${Class.StealthSpell}].Cooldown} && !${Me.Buff[${Class.StealthSpell}](exists)} && ${Me.GlobalCooldown} == 0) && ${Target.Distance} < 20
		{
			This:RDebug["Cat Pull - Waiting for Prowl CD/Energy",2]
			move -stop
			return
		}
		if ${Me.CurrentPower} > 90 && !${Me.Buff[${Class.PullBuff}](exists)} && ${Me.CurrentPower} == 100 && ${Me.Target.Distance} < 20 && ${Target.Distance} > 15 && ${This.Usable[${Class.PullBuff},${Class.FPullBuff},${Class.SPullBuff}]}
		{
			This:RDebug["Cat Pull - ${Class.PullBuff}",2]
			Toon:CastSpell[${Class.PullBuff}]
		}
		if ${Me.Target.Distance} < 20 && ${This.Usable[${Class.PullPrep},${Class.FPullPrep},${Class.SPullPrep}]}
		{
			This:RDebug["Cat Pull - ${Class.PullPrep}",2]
			Toon:CastSpell[${Class.PullPrep}]
		}
		This:CheckBehind
		if ${Me.Target.Distance} > 4
		{
			Navigator:MoveToMob[${Target.GUID}]
		}
		else
		{
			move -stop
		}
		if ${Behind}
		{
			if ${This.Usable[${Class.BackPull1},${Class.FBackPull1},${Class.SBackPull1}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.BackPull1}",2]
				Toon:CastSpell[${Class.BackPull1}]
				return
			}
			if ${This.Usable[${Class.BackPull2},${Class.FBackPull2},${Class.SBackPull2}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.BackPull2}",2]
				Toon:CastSpell[${Class.BackPull2}]
				return
			}
			if ${This.Usable[${Class.BackPull3},${Class.FBackPull3},${Class.SBackPull3}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.BackPull3}",2]
				Toon:CastSpell[${Class.BackPull3}]
				return
			}
			if ${This.Usable[${Class.FrontPull1},${Class.FFrontPull1},${Class.SFrontPull1}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.FrontPull1}",2]
				Toon:CastSpell[${Class.FrontPull1}]
				return
			}
		}
		else
		{
			if ${This.Usable[${Class.FrontPull1},${Class.FFrontPull1},${Class.SFrontPull1}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.FrontPull1}",2]
				Toon:CastSpell[${Class.FrontPull1}]
				return
			}
			if ${This.Usable[${Class.FrontPull2},${Class.FFrontPull2},${Class.SFrontPull2}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.FrontPull2}",2]
				Toon:CastSpell[${Class.FrontPull1}]
				return
			}
			if ${This.Usable[${Class.FrontPull3},${Class.FFrontPull3},{$Class.SFrontPull3}]}
			{
				move -stop
				This:RDebug["Cat Pull - Using ${Class.FrontPull3}",2]
				Toon:CastSpell[${Class.FrontPull3}]
				return
			}
		}
	}

	
/*
=====================================================================
Balance Routine
=====================================================================
*/
method BalanceRoutine()
	{
		variable guidlist PVEAggro
		variable guidlist PVPAggro
		variable guidlist SafeRange
		if ${Me.Target(exists)} && ${Me.Target.ReactionLevel} > 4
		{
			This:RDebug["Balance Routine",3]
			This:RTarget[${Me.Target.Target.GUID},0]
		}
		if ${Me.Target(exists)} && ${Target.ReactionLevel} <= 4
		{
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
		}
		if !${Me.Target(exists)} || ${Me.Target.ReactionLevel} > 4
		{
			if ${Party.AssistType.Equal["ASSIST"]}
			{
				Party:Assist
			}
			return
		}
		variable guidlist Aggros
		Aggros:Search[-units,-nearest,-aggro,-alive,-range 0-40]
		if !${Me.Attacking} && !${Me.Equip[Ranged](exists)}
		{
			This:RDebug["Balance Routine - Turning on Autoattack",2]
			WoWScript AttackTarget()
		}
		if ${Me.Buff[Feared](exists)} && ${This.Usable["Will of the Forsaken",${Class.FWilloftheForsaken}]}
		{
			Toon:CastSpell[Will of the Forsaken]
			return
		}
		if ${Target.Distance} > ${Class.MaxRange} && !${Toon.Casting}
		{
			This:RDebug["Balance Routine - out of range - moving closer",1]
			Navigator:MoveToMob[${Target.GUID}]
			if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
			{
				wowpress JUMP
			}
			return
		}
		if ${Target.Casting(exists)} && ${This.Usable[${Class.InteruptSpell},${Class.FInteruptSpell},${Class.SInteruptSpell}]}
		{
			WoWScript SpellStopCasting()
			Toon:CastSpell[${Class.InteruptSpell}]
 		}
 		if ${Target.Casting(exists)} && ${This.Usable["War Stomp",${Class.FWarStomp}]}
			{
				if ${Me.Target.Distance} < 8
				{
					This:RDebug["Balance Routine - War Stomp to interupt the spell",1]
					move -stop
					Toon:CastSpell[War Stomp]
				}	
 			}
		if ${Target.PctHPs} < 15 && ${Me.PctHPs} > 60 && ${Me.PctMana} > 40 && ${This.Usable[${Class.KBSpell},${Class.FKBSpell},${Class.SKBSpell}]}
		{
			Toon:CastSpell[${Class.KBSpell}]
			return
		}
		if ${Group.Member[${Party.AssistTarget}](exists)} && !${Target.Player(exists)} && ${Group.Member[${Party.AssistTarget}].Name.NotEqual[${Me.Name}]} && ${Group.Member[${Party.AssistTarget}].Distance} < 30 && ${Target.Target.Name.Equal[${Me.Name}]} && !${Party.Tanking} && ${This.Usable[${Class.AggroSpell},${Class.FAggroSpell},${Class.SAggroSpell}]}
		{
			WoWScript SpellStopCasting()
			Toon:CastSpell[${Class.AggroSpell}]
			return
		}
		PVPAggro:Search[-players, -pvp, -units, -alive, -aggro, -attackable, -range 0-8]
		This:RDebug["PvP aggro count = ${PVPAggro.Count}",3]
		if ${PVPAggro.Count} > 0 && ${This.Usable[${Class.PanicSpell},${Class.FPanicSpell},${Class.SPanicSpell}]}
		{
			if ${Me.Action[Shoot].AutoRepeat}
			{
				WoWScript SpellStopCasting()
			}
			This:RDebug["Balance Routine - Pvp! ${Class.PanicSpell}",1]
			move -stop
			Toon:CastSpell[${Class.PanicSpell}]
			return
		}
		PVEAggro:Search[-units, -targetingme, -alive, -range 0-8]
		SafeRange:Search[-units,-alive,-nonpvp,-nonfriendly,-nocritters,-untapped,-levels ${This.MinLvL}-100,-notflying,-attackable,-range 0-35]
		This:RDebug["PvE aggro count = ${PVEAggro.Count}",3]
		This:RDebug["Mobs within the safe range: ${SafeRange.Count}",3]
		if ${PVEAggro.Count} > (${SafeRange.Count} + 1) && ${This.Usable[${Class.PanicSpell},${Class.FPanicSpell},${Class.SPanicSpell}]}
		{
			WoWScript SpellStopCasting()
			This:RDebug["Balance Routine - ${Class.PanicSpell}",1]
			move -stop
			Toon:CastSpell[${Class.PanicSpell}]
			return
		}
		PVEAggro:Search[-units, -targetingme, -alive, -attackable, -range 0-30]
		PVPAggro:Search[-players, -targetingme, -alive, -attackable, -range 0-30]
		if (${PVEAggro.Count} > 1 || ${PVPAggro.Count} > 0) && ${Me.PctHPs} < 75 && ${This.Usable[${Class.DefSpell},${Class.FDefSpell}]}
		{
			WoWScript SpellStopCasting()
			This:RDebug["Balance Routine - ${Class.DefSpell}",1]
			Toon:CastSpell[${Class.DefSpell}]
			return
		}	
		if ${Target.Distance} <= 10 && (${This.IsRooted} || !${Target.Target.Name.Equal[${Me.Name}]}) && (((${Target.PctHPs} < ${Class.MeleeMod2}) || (${Me.PctMana} < ${Class.MeleeMod}) && ${Spell[Shoot](exists)})
		{
			Navigator:MoveBackward[1000]
			return
		}
		if ${Unit[${Target}].CreatureType.Equal[Totem]} || (!${Target.Type.Equal[Player]} && !${Me.Buff[${Class.ManaBuffSpell}](exists)} && ((${Target.PctHPs} < ${Class.MeleeMod2}) || (${Me.PctMana} < ${Class.MeleeMod}) || (${Me.Buff[Spirit Tap](exists)} && ${Me.PctMana} < 90)))
		{
			if ${Me.Equip[Ranged](exists)} && ${Spell[Shoot](exists)}
				{
					if ${Target.Distance} > 25 && !${Toon.Casting} && !${Me.Action[Shoot].AutoRepeat}
					{
						This:RDebug["Balance Routine - Wanding but out of range - moving closer",1]
						Navigator:MoveToMob[${Target.GUID}]
						if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
						{
							wowpress JUMP
						}
						return
					}
					elseif !${Me.Action[Shoot].AutoRepeat}
					{
						move -stop
						This:RDebug["Balance Routine - Wanding",2]
						Toon:CastSpell[Shoot]
					}
				}
				elseif ${Target.Distance} > 4.5
				{
					Navigator:MoveToMob[${Target.GUID}]
				}
				else
				{
					move -stop
				}
			return
		}
		elseif ${Movement.Speed}
		{
			move -stop
		}
		if ${Me.Action[Shoot].AutoRepeat}
		{
			WoWScript SpellStopCasting()
		}
		elseif !${Me.Attacking}
		{
			WoWScript AttackTarget()
		}
		if ${Toon.Casting}
		{
			return
		}
		This:ManaBuffCheck
		if ${This.IsRooted} && ${Me.Target.Distance} < 10 && ${Targeting.TargetCollection.Get[2](exists)}
		{
			This:RTarget[${Targeting.TargetCollection.Get[2].GUID},0]
			This:RDebug["Balance Routine - Switching to the non-rooted target",1]
		}
 		if ${Targeting.TargetCollection.Get[2](exists)} && !${Unit[${Targeting.TargetCollection.Get[2]}].Buff[${Class.CCSpell}](exists)} && ${Unit[${Targeting.TargetCollection.Get[2]}].CreatureType.Equal[${Class.CCType}]} && !${Unit[${Targeting.TargetCollection.Get[2]}].Buff[${Class.DoTSpell1}](exists)} && !${Unit[${Targeting.TargetCollection.Get[2]}].Buff[${Class.DoTSpell2}](exists)}
		{
			if ${This.Usable[${Class.CCSpell},${Class.FCCSpell},${Class.SCCSpell}]}
			{	
				This:RTarget[${Targeting.TargetCollection.Get[2].GUID},2]
				Toon:CastSpell[${Class.CCSpell}]
				This:RDebug["Balance Routine - ${Class.CCSpell} ${Target}",1]
				This:RTarget[${Targeting.TargetCollection.Get[1].GUID},0]
			}
		}
		if ${Me.Target(exists)} && ${Target.PctHPs} > 70 && (${Dangerlvl}>=1 || ${Target.Level} >= ${Me.Level}) && ${This.Usable[${Class.PetSpell},${Class.FPetSpell}]}
		{
		   if ${Math.Distance[${Me.X},${Me.Y},${Target.X},${Target.Y}]}< ${Class.MaxRange}
		   {
			This:RDebug["Balance Routine - ${Class.PetSpell}!",1]
		    Toon:CastSpell[${Class.PetSpell}]
		    ISXWoW:ClickTerrain[${Target.X}, ${Target.Y}, ${Target.Z}]
		   }
		}	
		if !${Me.Buff[${Class.MeleeBuffSpell}](exists)} && ${Target.Distance} < 10 && ${Me.Target.Target.Name.Equal[${Me.Name}]} && ${This.Usable[${Class.MeleeBuffSpell},${Class.FMeleeBuffSpell},${Class.SMeleeBuffSpell}]}
		{
			This:RDebug["Balance Routine - Buffing ${Class.MeleeBuffSpell}",2]
			Toon:CastSpell[${Class.MeleeBuffSpell}]
			return
		}
	
		if ${Target.PctHPs} > 60 && (${Group.Member[${Party.AssistTarget}].PctHPs} < 90 || ${Me.PctHPs} < 90) &&  !${Target.Buff[${Class.LeechSpell}](exists)} && ${This.Usable[${Class.LeechSpell},${Class.FLeechSpell},${Class.SLeechSpell}]} 
		{
			This:RDebug["Balance Routine - Applying ${Class.LeechSpell}",2]
			Toon:CastSpell[${Class.LeechSpell}]
			return
		}
		if ${Target.PctHPs} > 30 && !${Target.Buff[${Class.DoTSpell1}](exists)} && ${This.Usable[${Class.DoTSpell1},${Class.FDoTSpell1},${Class.SDoTSpell1}]}
		{
			This:RDebug["Balance Routine - Dotting ${Class.DoTSpell1}",2]
			Toon:CastSpell[${Class.DoTSpell1}]
			This:RWait[15]
			return
		}
		if ${Target.PctHPs} > 30 && !${Target.Buff[${Class.DoTSpell2}](exists)} && ${This.Usable[${Class.DoTSpell2},${Class.FDoTSpell2},${Class.SDoTSpell2}]}
		{
			This:RDebug["Balance Routine - Dotting ${Class.DoTSpell2}",2]
			Toon:CastSpell[${Class.DoTSpell2}]
			This:RWait[5]
			return
		}
		if ${Target.PctHPs} > 30 && !${Target.Buff[${Class.DoTSpell3}](exists)} && ${This.Usable[${Class.DoTSpell3},${Class.FDoTSpell3},${Class.SDoTSpell3}]}
		{
			This:RDebug["Balance Routine - Dotting ${Class.DoTSpell3}",2]
			Toon:CastSpell[${Class.DoTSpell3}]
			This:RWait[5]
			return
		}
		if !${Me.Buff[Focused Casting](exists)} && ${Me.Target.Distance} < 5 && ${This.Usable[${Class.NukeSpell1},${Class.FNukeSpell1},${Class.SNukeSpell1}]} && ${Target.PctHPs} > 70 && !${Me.Buff[${Class.ProtectSpellDebuff}](exists)} && ${Target.PctHPs} > 80 && ${This.Usable[${Class.ProtectSpell},${Class.FProtectSpell}]}
		{
			This:RDebug["Balance Routine - Buffing ${Class.ProtectSpell} so I can keep spamming ${Class.NukeSpell1}",2]
			Toon:CastSpell[${Class.ProtectSpell}]
			return
		}
		if !${Movement.Speed} && ${Target.PctHPs} > 10 && (${Target.Distance} > 10 || ${Me.Buff[${Class.ProtectSpell}](exists)} || !${Me.Target.Target.Name.Equal[${Me.Name}]}) && ${This.Usable[${Class.NukeSpell1},${Class.FNukeSpell1},${Class.SNukeSpell1}]}
		{
			This:RDebug["Balance Routine - Casting ${Class.NukeSpell1}",2]
			Toon:CastSpell[${Class.NukeSpell1}]
			return
		}
		if ${This.Usable[${Class.NukeSpell2},${Class.FNukeSpell2},${Class.SNukeSpell2}]}
		{
			This:RDebug["Balance Routine - Casting ${Class.NukeSpell2}",2]
			Toon:CastSpell[${Class.NukeSpell2}]
			return
		}
		if ${This.Usable[${Class.NukeSpell3},${Class.FNukeSpell3},${Class.SNukeSpell3}]}
		{
			This:RDebug["Balance Routine - Casting ${Class.NukeSpell3}",2]
			Toon:CastSpell[${Class.NukeSpell3}]
			return
		}
		if ${Target.CurrentMana} > 0 && ${This.Usable["Mana Tap",${Class.FManaTap}]}
		{
			Toon:CastSpell[Mana Tap]
			return
		}
		if ${Me.PctMana} < 85 && ${Me.Buff[Mana Tap].Application} == 3 && ${This.Usable["Arcane Torrent"],${Class.FArcaneTorrent}}
		{
			Toon:CastSpell[Arcane Torrent]
			return
		}
		return
	}
	
/*
=====================================================================
Bear Routine
=====================================================================
*/
	method BearRoutine()
		{
			if ${Me.Target(exists)} && ${Me.Target.ReactionLevel} > 4 && ${Me.Target.Target(exists)}
			{
				This:RDebug["Bear Routine 1",3]
				This:RTarget[${Me.Target.Target.GUID},0]
			}
			if ${Me.Target.ReactionLevel} > 4
			{
				return
			}
			if ${Me.Target(exists)}&& ${Target.ReactionLevel} <= 4
			{
				Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			}
			variable guidlist Aggros
			Aggros:Search[-units,-nearest,-aggro,-alive,-range 0-40]
			if !${Targeting.TargetCollection.Get[1](exists)} && ${Me.Buff[${Class.RageBoost}](exists)} && ${DangerLevel} < 3
			{
				This:RDebug["Bear Routine - Removing ${Class.RageBoost} so I can get out of combat",1]
				Me.Buff[${Class.RageBoost}]:Remove
				return
			}
			if !${Me.Attacking}
			{
				This:RDebug["Bear Routine - Turning on Autoattack",2]
				WoWScript AttackTarget()
			}
			if ${Target.Distance} > 4.5
			{
				This:RDebug["Bear Routine - Getting into Melee range"],1
				Navigator:MoveToMob[${Target.GUID}]
				if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
				{
					wowpress JUMP
				}
				if ${This.Usable[${Class.InterceptAttack},${Class.FInterceptAttack},${Class.SInterceptAttack}]}
				{
					This:RDebug["Bear Routine - Using ${Class.InterceptAttack}",2]
					Toon:CastSpell[${Class.InterceptAttack}]
					return
				}
			}
			else
			{
				if ${Movement.Speed}
				{
					move -stop
				}	
			}
			if ${Me.PctHPs} < 70 && ${This.Usable[${Class.RagePanic},${Class.FRagePanic},${Class.SRagePanic}]}
			{
				This:RDebug["Bear Routine - In Bear form - using ${Class.RagePanic}",2]
				Toon:CastSpell[${Class.RagePanic}]
			}
			if !${Me.Action[${Class.RageAttackBase}].Active} && ${Me.CurrentRage} > 10 && ${This.Usable[${Class.RageAttackBase},${Class.FRageAttackBase},${Class.SRageAttackBase}]}
				{
					This:RDebug["Bear Routine - Getting ${Class.RageAttackBase} ready",2]
					Toon:CastSpell[${Class.RageAttackBase}]
				}
			if ${Target.Casting(exists)} && ${This.Usable[${Class.RageInterupt},${Class.FRageInterupt},${Class.SRageInterupt}]}
				{
					This:RDebug["Bear Routine - ${Class.RageInterupt} to interupt cast",1]
					Toon:CastSpell[${Class.RageInterupt}]
	 			}
	 		if ${Target.Target.Name.NotEqual[${Me}]} && !${Target.Player(exists)} && ${Party.Tanking} && ${This.Usable[${Class.AggroTaunt},${Class.FAggroTaunt},${Class.SAggroTaunt}]} 
				{
					This:RDebug["Bear Routine - ${Class.AggroTaunt}",2]
					Toon:CastSpell[${Class.AggroTaunt}]
				}
	 		if ${Aggros.Count} < 3 && ${Me.PctHPs} > ${Class.EnrageMod} && ${This.Usable[${Class.RageBoost},${Class.FRageBoost}]}
				{
					This:RDebug["Bear Routine - ${Class.RageBoost}",2]
					Toon:CastSpell[${Class.RageBoost}]
				}
			if !${Target.Buff[${Class.ShoutDebuff}](exists)} && ${Target.PctHPs} > 20 && ${Me.Target.Distance} < 10 && ${Me.InCombat} && ${Toon.ValidTarget[${Target.GUID}]} && ${This.Usable[${Class.ShoutDebuff},${Class.FShoutDebuff},${Class.SShoutDebuff}]}
				{
					This:RDebug["Bear Routine - Using ${Class.ShoutDebuff}",2]
					Toon:CastSpell[${Class.ShoutDebuff}]
				}
			if ${Me.PctRage} > 15 && ${This.Usable[${Class.RageAttack1},${Class.FRageAttack1},${Class.SRageAttack1}]}
				{
					This:RDebug["Bear Routine - ${Class.RageAttack1}",2]
					Toon:CastSpell[${Class.RageAttack1}]
				}
			if !${Target.Buff[${Class.RageDoTAttack1}](exists)} && ${This.Usable[${Class.RageDoTAttack1},${Class.FRageDoTAttack1},${SClass.RageDoTAttack1}]}
				{
					This:RDebug["Bear Routine - ${Class.RageDoTAttack1}",2]
					Toon:CastSpell[${Class.RageDoTAttack1}]
				}
			if !${Target.Buff[${Class.RageDoTAttack2}](exists)} && ${Target.PctHPs} > 30 && ${This.Usable[${Class.RageDoTAttack2},${Class.FRageDoTAttack2},${SClass.RageDoTAttack2}]}
				{
					This:RDebug["Bear Routine - ${Class.RageDoTAttack2}",2]
					Toon:CastSpell[${Class.RageDoTAttack2}]
				}
			if !${Target.Buff[${Class.RageDoTAttack3}](exists)} && ${Me.CurrentRage} > 30 && ${This.Usable[${Class.RageDoTAttack3},${Class.FRageDoTAttack3},${SClass.RageDoTAttack3}]}
				{
					This:RDebug["Bear Routine - ${Class.RageDoTAttack3}",2]
					Toon:CastSpell[${Class.RageDoTAttack3}]
				}
			if ${Me.CurrentRage} > ${SwipeMod} && ${Targeting.TargetCollection.Get[2](exists)} && ${This.Usable[${Class.RageAoE},${Class.FRageAoE},${Class.SRageAoE}]}
				{
					This:RDebug["Bear Routine - ${Class.RageAoE} at adds",2]
					Toon:CastSpell[${Class.RageAoE}]
				}
		}
		
/*
=====================================================================
Cat Routine
=====================================================================
*/
	method CatRoutine()
		{
			This:CheckBehind
			if ${Me.Target(exists)} && ${Me.Target.ReactionLevel} > 4 && ${Me.Target.Target(exists)}
			{
				This:RDebug["Cat 1",3]
				This:RTarget[${Me.Target.Target.GUID},0]
			}
			if ${Me.Target.ReactionLevel} > 4 || ${Me.Target.Dead}
			{
				return
			}
			if !${Me.Target.Target.Name.Equal[${Me.Name}]} && !${Behind} && ${Target.Distance} < 5
			{
				move forward 1000
				return
			}
			if ${Me.Target(exists)} && ${Target.ReactionLevel} <= 4
			{
				Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			}
			if ${Target.Buff[Maim](exists)} || ${Target.Buff[Gouge](exists)}
			{
				if ${Me.Attacking}
				{
					This:RDebug["Cat Routine - Turning off Autoattack",2]
					WoWScript AttackTarget()
				}
				if !${Behind}
				{
					move forward 1000
					return
				}
				else
				{
					move -stop
				}
				if ${Me.CurrentPower} < 90
				{
					return
				}
				
			}
			if !${Me.Attacking}
			{
				This:RDebug["Cat Routine - Turning on Autoattack",2]
				WoWScript AttackTarget()
			}
			if ${Target.Player(exists)}
			{
				if ${Target.Distance} > 2
				{
					This:RDebug["Cat Routine - PVP! - Getting into Melee Range",1]
					Navigator:MoveToMob[${Target.GUID}]
					if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
					{
						wowpress JUMP
					}
					if ${Target.Distance} > 20 && ${This.Usable[${Class.SpeedBoost},${Class.FSpeedBoost}]}
					{
						Toon:CastSpell[${Class.SpeedBoost}]
					}
				}
				else
				{
					if ${Movement.Speed}
					{
						move -stop
					}	
				}
			}
			else
			{
				if ${Target.Distance} > 4.5
				{
					This:RDebug["Cat Routine - Getting into Melee Range",1]
					Navigator:MoveToMob[${Target.GUID}]
					if ${Random} < ${Class.JumpFreq} && ${Target.Distance} > 10
					{
						wowpress JUMP
					}
					if ${Target.Distance} > 20 && ${This.Usable[${Class.SpeedBoost},${Class.FSpeedBoost}]}
					{
						Toon:CastSpell[${Class.SpeedBoost}]
					}
				}
				else
				{
					if ${Movement.Speed}
					{
						move -stop
					}	
				}
			}
			if ${Target.Casting(exists)} && ${This.Usable[${Class.InteruptAttack},${Class.FInteruptAttack},${Class.SInteruptAttack}]}
			{
				This:RDebug["Cat Routine - ${Class.InteruptAttack} to stop Casting",1]
				Toon:CastSpell[${Class.InteruptAttack}]
				return
			}
			if ${Target.Casting(exists)} && ${This.Usable[${Class.InteruptAttack2},${Class.FInteruptAttack2},${Class.SClass.InteruptAttack2}]}
			{
				This:RDebug["Cat Routine - ${Class.InteruptAttack2} to stop Casting",1]
				Toon:CastSpell[${Class.InteruptAttack2}]
				return
			}
			if ${Group.Member[${Party.AssistTarget}](exists)} && !${Target.Player(exists)} && ${Group.Member[${Party.AssistTarget}].Name.NotEqual[${Me.Name}]} < 30 && ${Group.Member[${Party.AssistTarget}].Distance} < 30 && ${Group.Member[${Party.AssistTarget}].Distance} > 5 && ${Target.Target.Name.Equal[${Me.Name}]} && !${Party.Tanking} && ${Group.Members} > 0 && ${This.Usable[${Class.AggroAttack},${Class.FAggroAttack},${Class.SAggroAttack}]}
			{
				Toon:CastSpell[${Class.AggroAttack}]
				return
			}
			if ${Me.ComboPoints} == 5 || (${Me.ComboPoints} > 2 && ${Target.Casting(exists)}) || (${Me.ComboPoints}*7 > ${Target.PctHPs})
			{
				if ${This.Usable[${Class.KBFinish},${Class.FKBFinish},${Class.SKBFinish}]}
				{
					This:RDebug["Cat Routine - Using ${Class.KBFinish}",2]
					Toon:CastSpell[${Class.KBFinish}]
					return
				}	
			}
			if ${Behind} && ${This.Usable[${Class.BackAttack},${Class.FBackAttack},${Class.SBackAttack}]}
			{
				This:RDebug["Cat Routine - I'm behind the target - using ${Class.BackAttack}",2]
				Toon:CastSpell[${Class.BackAttack}]
				return
			}
			if ${Behind} && ${Spell[${Class.BackAttack}](exists)} && ${Class.FocusBack}
			{
				This:RDebug["Behind the target - saving energy for ${Class.BackAttack}",2]
				return
			}
			if !${Target.Buff[${Class.DoTAttack1}](exists)} && ${This.Usable[${Class.DoTAttack1},${Class.FDoTAttack1},${Class.SDoTAttack1}]}
			{
				This:RDebug["Cat Routine - ${Class.DoTAttack1}",2]
				Toon:CastSpell[${Class.DoTAttack1}]
				return
			}
			if !${Target.Buff[${Class.DoTAttack2}](exists)} && ${This.Usable[${Class.DoTAttack2},${Class.FDoTAttack2},${Class.SDoTAttack2}]}
			{
				This:RDebug["Cat Routine - ${Class.DoTAttack2}",2]
				Toon:CastSpell[${Class.DoTAttack2}]
				return
			}
			if !${Target.Buff[${Class.DoTAttack3}](exists)} && ${This.Usable[${Class.DoTAttack3},${Class.FDoTAttack3},${Class.SDoTAttack3}]}
			{
				This:RDebug["Cat Routine - ${Class.DoTAttack3}",2]
				Toon:CastSpell[${Class.DoTAttack3}]
				return
			}
			if ${Target.PctHPs}<(${Me.ComboPoints}*15)
			{
				if ${This.Usable[${KBAttack},${FKBAttack},${SKBAttack}]}
				{
					This:RDebug["Cat Routine - Using ${KBAttack}",2]
					Toon:CastSpell[${KBAttack}] 
					return
				}
			}
			if ${Target.PctHPs}<(${Me.ComboPoints}*20)
			{
				if !${Target.Buff[${Class.DoTFinish}](exists)} && ${This.Usable[${Class.DoTFinish},${Class.FDoTFinish},${Class.SDoTFinish}]}
				{
					This:RDebug["Cat Routine - Using ${Class.DoTFinish}",2]
					Toon:CastSpell[${Class.DoTFinish}] 
					return
				}
			}
			if ${This.Usable[${Class.FrontAttack1},${Class.FFrontAttack1},${Class.SFrontAttack1}]}
			{
				This:RDebug["Cat Routine - Using ${Class.FrontAttack1}",2]
				Toon:CastSpell[${Class.FrontAttack1}]
				return
			}
			if ${This.Usable[${Class.FrontAttack2},${Class.FFrontAttack2},${Class.SFrontAttack2}]}
			{
				This:RDebug["Cat Routine - Using ${Class.FrontAttack2}",2]
				Toon:CastSpell[${Class.FrontAttack2}]
				return
			}
		}
/*
=====================================================================
Heal Routine
=====================================================================
*/
	method HealRoutine()
		{
			This:CheckCurrentForm
			if ${Me.Sitting}
			{
				wowpress jump
			}	
			if ${Target.Distance} > 35
			{
				Navigator:MoveToMob[${Target.GUID}]
				return
			}
			if ${Movement.Speed}
			{
				move -stop
			}
			if ${CurrentForm} != ${Class.FCheapHeal}
			{
				This:RShift[${Class.FCheapHeal}]
				return
			}
			target ${Group.Member[${Party.AssistTarget}]}
			variable guidlist Aggros
			Aggros:Search[-units,-nearest,-aggro,-targetingme,-alive,-range 0-5]
			This:PotRoutine
		 	if ${This.Usable["War Stomp",${Class.FWarStomp}]}
			{
				if ${Me.Target.Distance} < 8
				{
					This:RDebug["Balance Routine - War Stomp before healing",1]
					move -stop
					Toon:CastSpell[War Stomp]
				}	
	 		}
	 		if !${Me.Buff[Focused Casting](exists)} && !${Me.Buff[${Class.ProtectSpellDebuff}](exists)} && ${Aggros.Count} > 0 && ${This.Usable[${Class.ProtectSpell},${Class.FProtectSpell}]}
			{
				This:RDebug["Balance Routine - Buffing ${Class.ProtectSpell} before I heal",2]
				Toon:CastSpell[${Class.ProtectSpell}]
			}
			if ${This.Usable[${Class.HealBuffSpell},${Class.FHealBuffSpell}]}
			{
				Toon:CastSpell[${Class.HealBuffSpell}]
		       	This:RDebug["Heal Routine - Casting ${Class.HealBuffSpell}",2]
			}
			This:RDebug["Heal Routine on ${Group.Member[${Party.AssistTarget}].Name}",2]
			if ${Group.Member[${Party.AssistTarget}].PctHPs} < ${Class.SaveMod} && (!${Target.Buff[${Class.SaveHeal}](exists)} | !${Target.Buff[${Class.SaveHealDebuff}](exists)}) && ${Me.InCombat} && ${This.Usable[${Class.SaveHeal},${Class.FSaveHeal}]}
			{
		   		HealTarget:Set[${Party.AssistTarget}]
        		Toon:CastSpell[${Class.SaveHeal}]
        		This:RDebug["Heal Routine - Casting ${Class.SaveHeal}",2]
      		}
	      	if (${Me.PctHPs} < ${Class.HealHP} && ${Target.PctHPs} < ${Class.HealHP} && !${Target.Name.Equal[${Me.Name}]} && !${Target.Buff[${Class.GroupHeal}](exists)}) && ${Me.Target.Distance} > 3 && ${Me.Target.Distance} < 30 && ${This.Usable[${Class.GroupHeal},${Class.FGroupHeal}]}
      		{
        		Toon:CastSpell[${Class.GroupHeal}]
        		HealTarget:Set[${Party.AssistTarget}]
        		
        		This:RDebug["Heal Routine - Casting ${Class.GroupHeal}",2]
        		This:RWait[3]
      		}
	      	if ${Target.PctHPs} < ${Class.FastHealHP} && !${Target.Buff[${Class.FastHeal}](exists)} && ${This.Usable[${Class.FastHeal},${Class.FFastHeal}]}
	   		{
	       		Toon:CastSpell[${Class.FastHeal}]
	       		HealTarget:Set[${Party.AssistTarget}]
	       		
	       		This:RDebug["Heal Routine - Casting ${Class.FastHeal}",2]
	       		This:RWait[3]
	   		}
	      	if ${Target.PctHPs} < ${Class.BigHealHP} && !${Target.Buff[${Class.BigHeal}](exists)} && ${Aggros.Count} == 0 && ${This.Usable[${Class.BigHeal},${Class.FBigHeal}]}
	   		{
	       		Toon:CastSpell[${Class.BigHeal}]
	       		HealTarget:Set[${Party.AssistTarget}]
	       		
	       		This:RDebug["Heal Routine - Casting ${Class.BigHeal}",2]
	       		This:RWait[3]
	   		}
	   		This:HotRoutine
			if !${Target.Buff[${Class.SmallHeal}](exists)} && ${This.Usable[${Class.SmallHeal},${Class.FSmallHeal}]}
	   		{
	       		Toon:CastSpell[${Class.SmallHeal}]
	       		HealTarget:Set[${Party.AssistTarget}]
	       		
	       		This:RDebug["Heal Routine - Casting ${Class.SmallHeal}",2]
	       		This:RWait[3]
	   		}
	      	if !${Target.Buff[${Class.CheapHeal}](exists)} && ${This.Usable[${Class.CheapHeal},${Class.FCheapHeal}]}
	   		{
	       		Toon:CastSpell[${Class.CheapHeal}]
	       		HealTarget:Set[${Party.AssistTarget}]
	       		
	       		This:RDebug["Heal Routine - Casting ${Class.CheapHeal}",2]
	       		This:RWait[3]
	   		}
	  	}
		
/*
=====================================================================
Buff Routine
=====================================================================
*/
	method BuffRoutine()
		{
			This:CheckCurrentForm
			if ${Me.Sitting}
			{
				wowpress jump
			}	
			if ${Target.Distance} > 30
			{
				Navigator:MoveToMob[${Target.GUID}]
				return
			}
			if ${Movement.Speed}
			{
				move -stop
			}
			This:RDebug["RCore - Buff Routine on ${Group.Member[${Party.AssistTarget}].Name}",4]
			if !${Me.Buff[Shadowguard](exists)} && ${This.Usable["Shadowguard",${Class.FShadowguard}]}
			{
				Toon:CastSpell[Shadowguard]
				return
			}
			if !${Me.Buff[Touch of Weakness](exists)} && ${This.Usable["Touch of Weakness",${Class.FTouchofWeakness}]}
			{
				Toon:CastSpell[Touch of Weakness]
				return
			}
			if !${Group.Member[${Party.AssistTarget}].Buff[Fear Ward](exists)} && ${This.Usable["Fear Ward",${Class.FFearWard}]}
			{
				Toon:CastSpell[Fear Ward]
				return
			}
			if !${Me.Buff[${Class.SelfBuff1}](exists)} && ${This.Usable[${Class.SelfBuff1},${Class.FSelfBuff1}]}
			{
				Toon:CastSpell[${Class.SelfBuff1}]
				return
			}
			if !${Me.Buff[${Class.SelfBuff2}](exists)} && ${This.Usable[${Class.SelfBuff2},${Class.FSelfBuff2}]}
			{
				Toon:CastSpell[${Class.SelfBuff2}]
				return
			}
			target ${Group.Member[${Party.AssistTarget}]}
			if ${CurrentForm} != ${Class.FBuff1}
			{
				This:RShift[${Class.FBuff1}]
			}
			if !${Group.Member[${Party.AssistTarget}](exists)} || ${Me.InCombat} || ${Me.Target.GUID.NotEqual[${Group.Member[${Party.AssistTarget}].GUID}]}
			{
				return
			}
			if !${Group.Member[${Party.AssistTarget}].Buff[${Class.Buff1}](exists)} && ${This.Usable[${Class.Buff1},${Class.FBuff1}]}
			{
				Toon:CastSpell[${Class.Buff1}]
				return
			}
			if !${Group.Member[${Party.AssistTarget}].Buff[${Class.Buff2}](exists)} && ${This.Usable[${Class.Buff2},${Class.FBuff2}]}
			{
				Toon:CastSpell[${Class.Buff2}]
				return
			}
			if !${Group.Member[${Party.AssistTarget}].Buff[${Class.Buff3}](exists)} && ${This.Usable[${Class.Buff3},${Class.FBuff3}]}
			{
				Toon:CastSpell[${Class.Buff3}]
				return
			}
		}
	
/*
=====================================================================
Correct Form
=====================================================================
*/
	member CorrectForm(int ReqForm)
		{
			if ${CurrentForm} == 0 && (${ReqForm} == 0 || ${ReqForm} == 3 || ${ReqForm} == 4 || ${ReqForm} == 5)
			{
				return TRUE
			}
			if ${CurrentForm} == ${This.DPSForm} && (${ReqForm} == 2 || ${ReqForm} == 3 || ${ReqForm} == 5 || ${ReqForm} == 6)
			{
				return TRUE
			}
			if ${CurrentForm} == ${This.SurvForm} && (${ReqForm} == 1 || ${ReqForm} == 3 || ${ReqForm} == 4 || ${ReqForm} == 6)
			{
				return TRUE
			}
		return FALSE
		}
		
/*
=====================================================================
Mana Routine
=====================================================================
*/
	method ManaRoutine()
		{
			if ${Target.InCombat} && ${This.Usable[${Class.ManaRegen}]}
			{
				This:RShift[${Class.FManaRegen}]
				Party:PartyCast[${Class.InnervateMod}, 100, 30, ${Class.ManaRegen}, FALSE, FALSE]
			}
		}

/*
=====================================================================
Pot Routine
=====================================================================
*/
		method PotRoutine()
			{
				if ${Me.PctMana} < ${Class.PotMana} && ${Consumable.HasMPot} && !${Me.Buff[${Class.ManaRegen}](exists)}
					{
						This:RShift[${Class.FPotion}]
						Consumable:useMPot()
						return
					}
				if ${Me.PctHPs} < ${Class.PotHP} && ${Consumable.HasMPot}
					{
						This:RShift[${Class.FPotion}]
						Consumable:useHPot()
						return
					}
			}
			
/*
=====================================================================
Hot Routine
=====================================================================
*/
	method HotRoutine()
		{
			if ${Me.Target.PctHPs} < ${This.HoTHealHP}
	 		{
		      	if !${Me.Target.Buff[${Class.HoTHeal}](exists)} && ${This.Usable[${Class.HoTHeal},${Class.FHoTHeal}]}
		      	{
					Toon:CastSpell[${Class.HoTHeal}]
	        		This:RDebug["Heal Routine - Casting ${Class.HoTHeal}",2]
					return
		      	}
		  	}
		}

/*
=====================================================================
Sort Forms
=====================================================================
*/
	method SortForms()
		{
			This.TravelingForm:Set[0]
			This.DPSForm:Set[0]
			This.SurvForm:Set[0]
			for (i:Set[1]; ${i}<=${WoWScript[GetNumShapeshiftForms()]}; i:Inc)
			{
				if ${WoWScript[GetShapeshiftFormInfo(${i}),2](exists)}
				{
					if ${WoWScript[GetShapeshiftFormInfo(${i}),2].Find[${Class.FormForTraveling}]}
					{
						This.TravelingForm:Set[${i}]
					}
					if ${WoWScript[GetShapeshiftFormInfo(${i}),2].Find[${Class.FormForDPS}]}
					{
						This.DPSForm:Set[${i}]
					}
					if ${WoWScript[GetShapeshiftFormInfo(${i}),2].Find[${Class.FormForSurv}]}
					{
						This.SurvForm:Set[${i}]
					}	
				}
			}
			if ${This.DPSForm} == 0 && ${Spell[${Class.FormForDPS}](exists)}
			{
				This:RDebug["DPS Form: ${Class.FormForDPS}",0]
				This.DPSForm:Set[1]
			}
			else
			{
				This:RDebug["DPS Form: ${WoWScript[GetShapeshiftFormInfo(${DPSForm}),2]} (Slot ${DPSForm})",0]
			}
			
			if ${This.SurvForm} == 0 && ${Spell[${Class.FormForSurv}](exists)}
			{
				This:RDebug["Surv Form: ${Class.FormForSurv}",0]
				This.SurvForm:Set[1]
			}
			else
			{
				This:RDebug["Surv Form: ${WoWScript[GetShapeshiftFormInfo(${SurvForm}),2]} (Slot ${SurvForm})",0]
			}
			
			if ${This.TravelingForm} == 0 && ${Spell[${Class.FormForTraveling}](exists)}
			{
				This:RDebug["Traveling Form: ${Class.FormForTraveling}",0]
				This.TravelingForm:Set[1]
			}
			else
			{
				This:RDebug["Traveling Form: ${WoWScript[GetShapeshiftFormInfo(${TravelingForm}),2]} (Slot ${TravelingForm})",0]
			}
		}
		
/*
=====================================================================
Check Current Form
=====================================================================
*/
	method CheckCurrentForm()
		{
			CurrentForm:Set[${WoWScript[GetShapeshiftForm()]}]
			This:RDebug["Current Form: ${CurrentForm}",3]
		}
		
/*
=====================================================================
Usable
=====================================================================
*/

	member Usable(string thisSpell, int ReqForm, int SpellSchool)
		{
			if !${thisSpell.Equal["Nothing"]}
			{
				This:RDebug["Trying to cast ${CurrentSpell} - School ${CurrentSpellSchool}",3]
				if ${Spell[${thisSpell}](exists)} && !${Spell[${thisSpell}].Cooldown} && (${Me.CurrentPower} > (${Spell[${thisSpell}].Mana}*${CostMulti}) || ${Me.Buff[Clearcasting](exists)} || ${Me.Buff[Inner Focus](exists)}) && (${Immunity} != ${SpellSchool} || ${Immunity} == 0) && ${This.CorrectForm[${ReqForm}]} && ${Me.Action[${thisSpell}].Usable} && !${Target.Buff["Banish"](exists)}
				{
					CurrentSpell:Set[${thisSpell}]
					CurrentSpellSchool:Set[${SpellSchool}]
					return TRUE
				}
			}
			return FALSE
		}
		
/*
=====================================================================
Check behind
=====================================================================
*/
	method CheckBehind()
		{
			if ${Me.Target.Distance} < 10
			{
				if ${Math.Abs[${Target.Heading} - ${Me.HeadingTo[${Target.X},${Target.Y}]}]} < 90
				{
					This.Behind:Set[TRUE]
				}
				else
				{
					This.Behind:Set[FALSE]
				}
			}
		}
		
/*
=====================================================================
Set Danger
=====================================================================
*/
	method SetDanger()
		{
			if !${Me.InCombat}
			{
				CombatStart:Set[${LavishScript.RunningTime}]
				This:RDebug["${CombatStart}"]
			}
			variable guidlist Aggros
			This.DangerLevel:Set[${DangerLevel} * 0.5]
			if ${Party.Tanking}
			{
				Aggros:Search[-units,-nearest,-aggro,-alive,-range 0-40]
				This.DangerLevel:Set[${DangerLevel} + ${Aggros.Count}*6.5]
			}
			else
			{
				Aggros:Search[-units,-nearest,-targettingme,-alive,-range 0-40]
				This.DangerLevel:Set[${DangerLevel} + ${Aggros.Count}*6.5]
			}
			if ${Me.PctMana} > 0 && !${Party.Tanking}
			{
				This.DangerLevel:Set[${DangerLevel} + ((100 - ${Me.PctMana})*0.1)]
			}
			This.CombatTime:Set[${Math.Calc[(${LavishScript.RunningTime} - ${CombatStart})/1000]}]
			This.DangerLevel:Set[${DangerLevel} + (${CombatTime}/5)]
			if ${Math.Calc[${CombatTime}%5]} == 0
			{
				This:RDebug["I've been in combat for ${CombatTime} seconds increasing the danger by ${Math.Calc[${CombatTime}/5]}.",3]
			}
			if ${Target.Level} > ${Me.Level}
			{
				This.DangerLevel:Set[${DangerLevel} + ((${Target.Level} - ${Me.Level})*2)]
			}
			elseif ${Me.Level} > ${Target.Level}
			{
				This.DangerLevel:Set[${DangerLevel} + ((${Target.Level} - ${Me.Level})*1)]
			}
			if ${Target.Classification.Equal[Elite]} || ${Target.Classification.Equal[RareElite]}
			{
				This.DangerLevel:Set[${DangerLevel} + 20]
			}
			if ${Target.Player(exists)} && ${Target.Attackable}
			{
				This.DangerLevel:Set[${DangerLevel} + 20]
			}
			if ${DangerLevel} < 0
			{
				This.DangerLevel:Set[0]
			}
			UIElement[lblDangerLvl@ClassGUI]:SetText[Danger Level: ${DangerLevel}]
			UIElement[sldDangerLvl@ClassGUI]:SetValue[${Math.Calc[(${DangerLevel}/(${Class.DangerVeryHigh}*2.5))*100]}]
			if ${DangerLevel} > (${Class.DangerVeryHigh}*2.5)
			{
				This:RDebug["Danger - Very High ${DangerLevel}",0]
				This.Dangerlvl:Set[3]
				return
			}
			if ${DangerLevel} > ${Class.DangerHigh}
			{
				This:RDebug["Danger - High ${DangerLevel}",1]
				This.Dangerlvl:Set[2]
				return
			}
			if ${DangerLevel} > ${Class.DangerMedium}
			{
				This:RDebug["Danger - Medium ${DangerLevel}",2]
				This.Dangerlvl:Set[1]
				return
			}
			This:RDebug["Danger - Low ${DangerLevel}",3]
			This.Dangerlvl:Set[0]
			return
		}
		
/*
=====================================================================
RDebug
=====================================================================
*/
	method RDebug(string RMsg, int MsgType = 0)
	{
		if ${Class.DebugLevel} >= ${MsgType}
		{	
			This:Output[${RMsg}]
		}
	}
	
/*
=====================================================================
Cancel All Forms
=====================================================================
*/
	method CancelAllForms()
	{
		if ${WoWScript[GetShapeshiftForm()]} != 0
		{
			if ${WoWScript[GetShapeshiftFormInfo(${WoWScript[GetShapeshiftForm()]}),2](exists)}
			{
				WoWScript CastShapeshiftForm(${WoWScript[GetShapeshiftForm()]})
			}
			else
			{
				Me.Buff[${Class.FormForDPS}]:Remove
			}
		}
	}

/*
=====================================================================
RWait
=====================================================================
*/
	method RWait(int WaitTime)
		{
			if ${CurrentWait} == 0
			{
				This.CurrentWait:Set[${WaitTime}]
				return
			}
			elseif ${CurrentWait} > 0
			{
				if ${Toon.Casting}
				{
				return
				}
				else
				{
					CurrentWait:Dec
					This:RDebug["Waiting... ${CurrentWait} Pulse left.",3]			
				}
			}
		}
/*
=====================================================================
Immune
=====================================================================
*/
	method CombatEvent()
		{
		   	This:RDebug["Immune! (${CurrentSpell}) - Stopping same-school spells",1]
		   	Immunity:Set[${CurrentSpellSchool}]
		}
/*
=====================================================================
UI Error Message
=====================================================================
*/

	method UIErrorMessage()
		{
			This:RDebug["UI Error! ${Msg}",1]
			if ${Msg.Equal[You are facing the wrong way!]} && !${Toon.Casting}
			{
				if ${Me.Target(exists)}&& !${Me.Target.Name.Equal[${Me.Name}]}
				{
					Navigator:MoveToMob[${Target.GUID}]
				}
				Navigator:MoveBackward[2000]
				return				
			}
			if ${Msg.Equal[You can't take a taxi while shapeshifted!]} || ${Msg.Equal[Can't use items while shapeshifted.]}
			{
				This:CancelAllForms
				return				
			}
			if ${Msg.Equal[You are in shapeshift form]}
			{
				;This:CancelAllForms
				return				
			}
			if ${Msg.Equal[Target not in line of sight]}
			{
				if !${Movement.Speed}
				{
					Random:Set[${Math.Rand[100]}]
					if ${Random} < 50
					{
						move Left 1000 Forward 500
					}
					else
					{
						move Right 1000 Forward 500
					}
				}
				return				
			}
			if ${Msg.Equal[You must be behind your target]}
			{
				if !${Movement.Speed}
				{
					Random:Set[${Math.Rand[100]}]
					if ${Random} < 50
					{
						move Left 1000 Backward 500
					}
					else
					{
						move Right 1000 Backward 500
					}
				}
				return				
			}
			if ${Msg.Equal[Can only use outside]}
			{
				Immunity:Set[${CurrentSpellSchool}]
				return				
			}
			if ${Msg.Equal[Invalid Target]}
			{
				WoWScript ClearTarget()
				return				
			}
		}	
		
/*
=====================================================================
Check for Scrolls
=====================================================================
*/
	member checkForScrolls()
		{
			if ${Consumable.HasScroll[Strength]} && !${Me.Buff[Strength](exists)}
			{
						This:RDebug["Scroll Pulse: Using Scroll of Strength",1]
					return "Strength"
			}
			if ${Consumable.HasScroll[Agility]} && !${Me.Buff[Agility](exists)}
			{
							This:RDebug["Scroll Pulse: Using Scroll of Agility",1]
					return "Agility"
			}
			if ${Consumable.HasScroll[Stamina]} && !${Me.Buff[Stamina](exists)} && !${Me.Buff[Power Word: Fortitude](exists)} 
			{
						This:RDebug["Scroll Pulse: Using Scroll of Stamina",1]
					return "Stamina"
			}
			if ${Consumable.HasScroll[Protection]} && !${Me.Buff[Armor](exists)}
			{
						This:RDebug["Scroll Pulse: Using Scroll of Protection",1]
					return "Protection"
			}
			if ${Consumable.HasScroll[Spirit]} && !${Me.Buff[Spirit](exists)} && !${Me.Buff[Divine Spirit](exists)} 
			{
					This:RDebug["Scroll Pulse: Using Scroll of Spirit",1]
					return "Spirit"
			}
			if ${Consumable.HasScroll[Intellect]} && !${Me.Buff[Intellect](exists)} && !${Me.Buff[Arcane Intellect](exists)} 
			{
					This:RDebug["Scroll Pulse: Using Scroll of Intellect",1]
					return "Intellect"
			}
			return "NONE"
		}
		
/*
=====================================================================
IsRooted
=====================================================================
*/
	member IsRooted()
		{
			if ${Target.Buff[Entangling Roots](exists)} || ${Target.Buff[Frost Nova](exists)}
			{
				return TRUE
			}
			return FALSE
		}
		
/*
=====================================================================
Need Self Buff
=====================================================================
*/

	member NeedSelfBuff()
		{
			variable guidlist PVPAggro
			PVPAggro:Search[-players, -pvp, -units, -alive, -attackable, -range 0-30]
			if ${PVPAggro.Count} == 0 && !${Me.Buff[${Class.SelfBuff1}](exists)} && ${Spell[${Class.SelfBuff1}](exists)}
			{
				This:RDebug["I needs Buffing",2]
				return TRUE
			}
			if ${PVPAggro.Count} == 0 && !${Me.Buff[${Class.SelfBuff2}](exists)} && ${Spell[${Class.SelfBuff2}](exists)}
			{
				This:RDebug["I needs Buffing",2]
				return TRUE
			}
			return FALSE
		}
/*
=====================================================================
RTarget
=====================================================================
*/
	method RTarget(string NewTargetID, int TargetType)
		{
			if !${NewTargetID(exists)} || ${NewTargetID.Equal[${Me.Target.GUID}]}
			{
				return
			}
			if ${TargetCD} > 0
			{
				if ${TargetType} == 0
				{
					if ${Me.Power.Equal["Energy"]} && ${Me.ComboPoints} > 0 && ${Me.Target(exists)}
					{
						if ${This.Usable[${Class.KBFinish},${Class.FKBFinish},${Class.SKBFinish}]} && ${Target.PctHPs} < (${Me.ComboPoints}*8)
						{
							This:RDebug["Targetting Routine - Using ${Class.KBFinish}",2]
							Toon:CastSpell[${Class.KBFinish}]
							return
						}
						elseif ${This.Usable[${Class.DoTFinish},${Class.FDoTFinish},${Class.SDoTFinish}]}
						{
							This:RDebug["Targetting Routine - Using ${Class.KDoTinish}",2]
							Toon:CastSpell[${Class.KDoTinish}]
							return
						}
					}
					This:RDebug["(Normal) Target Switch Cooldown - ${TargetCD} Left",3]
					if ${Group.Member[${Party.AssistTarget}].Target.ReactionLevel} < 4 && !${Group.Member[${Party.AssistTarget}].Target.Dead} && ${Group.Member[${Party.AssistTarget}].Target.InCombat}
					{
						NewTargetID:Set[${Group.Member[${Party.AssistTarget}].Target.GUID}]
					}
					elseif ${Targeting.TargetCollection.Get[1].GUID(exists)}
					{
						NewTargetID:Set[${Targeting.TargetCollection.Get[1].GUID}]
					}
					else
					{
						NewTargetID:Set[${Group.Member[${Party.AssistTarget}].GUID}]
					}
				}
				if ${TargetType} == 1
				{
					This:RDebug["(Fast) Target Switch Cooldown - ${TargetCD} Left",3]
					TargetCD:Dec
					return
				}
				if ${TargetType} == 2
				{
					This:RDebug["(Very Fast) Target Switch Cooldown - ${TargetCD} Left",3]
					TargetCD:Dec[3]
				}
				if ${TargetType} == 3
				{
					This:RDebug["(Instant) Target Switch Cooldown - ${TargetCD} Left",3]
					TargetCD:Set[0]
				}
				if ${TargetCD} > 0
				{
					TargetCD:Dec
					return
				}
			}
			This:RDebug["Switching Targets: ${Me.Target.Name} -> ${Object[${NewTargetID}].Name}",1]
			target ${NewTargetID}
			TargetCD:Set[${Class.TargetLimit}]
			return
		}
		
/*
=====================================================================
Flee Pulse
=====================================================================
*/
	method FleePulse()
		{
			This:SetDanger
			This:CheckCurrentForm
			This:RDebug["Danger: ${DangerLevel}",0]
			if ${Currentform} != ${TravelingForm}
			{
				This:RShift[${TravelingForm}]
				This:RDebug["Flee - Shifting to Travel Form",1]
			}
			else
			{
				if ${This.Usable[${Class.SpeedBoost},${Class.FSpeedBoost}]}
				{
					Toon:CastSpell[${Class.SpeedBoost}]
				}
				variable guidlist PVEAggro
				PVEAggro:Search[-units, -alive, -range 0-8]
				if ${PVEAggro.Count} > 0 && ${This.Usable[${Class.PanicSpell},${Class.FPanicSpell}]}
				{
					Toon:CastSpell[${Class.PanicSpell}]
				}
				if ${PVEAggro.Count} > 0 && ${This.Usable[${Class.MeleeBuffSpell},${Class.FMeleeBuffSpell}]}
				{
					Toon:CastSpell[${Class.MeleeBuffSpell}]
				}
				if ${This.Usable[${Class.ProtectSpell},${Class.FProtectSpell}]}
				{
					Toon:CastSpell[${Class.Protectpell}]
				}
				if ${This.Usable[${Class.RagePanic},${Class.RagePanic}]}
				{
					Toon:CastSpell[${Class.RagePanic}]
				}			
			}
		}
		
/*
=====================================================================
Check Target
=====================================================================
*/
	method CheckTarget()
		{
			if ${Target.GUID.NotEqual[${Targeting.TargetCollection.Get[1]}]} && ${Unit[${Targeting.TargetCollection.Get[1]}](exists)}
			{
				This:RDebug["CheckTarget",3]
				This:RTarget[${Targeting.TargetCollection.Get[1].GUID},0]
				return
			}
		}
		
/*
=====================================================================
Healing
=====================================================================
*/

	member Healing()
	{
		if !${Toon.Casting}
		{
			return FALSE
		}
		if (${Me(unit).Casting.Name.Find[Heal]} || ${Me(unit).Casting.Name.Find[Holy]} || ${Me(unit).Casting.Name.Find[Regrowth]} ||${Me(unit).Casting.Name.Find[Naaru]}) && !${Me(unit).Casting.Name.Find[Holy Fire]}
		{
			return TRUE
		}
		else
		{
			return FALSE
		}
	}
		
/*
=====================================================================
RTrain
=====================================================================
*/
	method RTrain()
		{
			if ${RTraining} == 0 || ${Toon.Casting}
			{
				return
			}
			if ${RTraining} == 1
			{
				move -stop
				Toon:Standup
				if ${CurrentForm} == 0
				{
					Toon:CastSpell["Teleport: Moonglade",1]
					if ${Toon.Casting}
					{
						RTraining:Set[2]
					}
					This.TargetLoc:Set[7992,-2680,512]
					This:RDebug["Stage 1 - Teleporting to Moonglade",1]
				}
				else
				{
					This:RShift[0]
				}
				return
			}
			if ${RTraining} == 2
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[3]
					This.TargetLoc:Set[8006,-2655,512]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 3
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[4]
					This.TargetLoc:Set[8014,-2648,512]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 4
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[5]
					This.TargetLoc:Set[8012,-2629,508]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 5
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[6]
					This.TargetLoc:Set[8010,-2614,503]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 6
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[7]
					This.TargetLoc:Set[8002,-2600,495]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 7
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[8]
					This.TargetLoc:Set[7976,-2602,491]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 8
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[9]
					This.TargetLoc:Set[7955,-2590,490]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 9
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[10]
					This.TargetLoc:Set[7935,-2577,488]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 10
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[11]
					This.TargetLoc:Set[7910,-2569,488]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 11
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[12]
					This.TargetLoc:Set[7888,-2579,487]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 12
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 2 - Checking I've arived (${RTraining})",2]
					return
				}
				else
				{
					RTraining:Set[13]
					This.TargetLoc:Set[7869,-2590,486]
					This:RDebug["Stage 3 - Walking to Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 13
			{
				if ${Math.Distance[${Me.X},${Me.Y},${TargetLoc.X},${TargetLoc.Y}]} > 3
				{
					Navigator:MoveToLoc[${TargetLoc}]
					This:RDebug["Stage 4 - Heading to Trainer",2]
					return
				}
				else
				{
					RTraining:Set[14]
					This:RDebug["Stage 5 - Arrived at Trainer",1]
					return
				}
				return
			}
			if ${RTraining} == 14
			{
				move -stop
				POI.NeedClassTrainer:Set[TRUE]
				This:RDebug["Stage 6 - Training",1]
				RTraining:Set[15]
				return
			}
			if ${RTraining} == 15
			{
				This:TweakConfig
				move -stop
				if !${POI.NeedClassTrainer}
				{
					This:RDebug["Stage 8 - Hearthing",1]
					Item[Hearthstone]:Use
					RTraining:Set[0]
					This:RWait[50]
					return
				}
				return
			}
		}
		
/*
=====================================================================
Siiiiigh
=====================================================================
*/
method LoadConfig()
{
   Class.FormForTraveling:Set[${Config.GetSetting["${RealmChar}","FormForTraveling"]}]
   Class.FormForSurv:Set[${Config.GetSetting["${RealmChar}","FormForSurv"]}]
   Class.FormForDPS:Set[${Config.GetSetting["${RealmChar}","FormForDPS"]}]
   UIElement[TravelForm@ClassGUI]:SetText[${Class.FormForTraveling}]
   UIElement[SurvForm@ClassGUI]:SetText[${Class.FormForSurv}]
   UIElement[DPSForm@ClassGUI]:SetText[${Class.FormForDPS}]
   This:SortForms
}
		
method SaveConfig()
{
	Config:SetSetting["${RealmChar}","FormForTraveling",${UIElement[TravelForm@ClassGUI].Text}]
	Config:SetSetting["${RealmChar}","FormForSurv",${UIElement[SurvForm@ClassGUI].Text}]
	Config:SetSetting["${RealmChar}","FormForDPS",${UIElement[DPSForm@ClassGUI].Text}]
	This:LoadConfig
}

member NeedDead()
{
	Party:AssistCheck
	if ${Group.Member[${Party.AssistTarget}].InCombat}
	{
		This.ReleaseTime:Set[100]
		return TRUE
	}
	if !${Group.Member[${Party.AssistTarget}].Dead}
	{
		This.ReleaseTime:Set[100]
		return TRUE
	}
	if ${This.ReleaseTime} > 0
	{
		This.ReleaseTime:Dec
		return TRUE
	}
	return FALSE
}
method DeadPulse()
{
	WoWScript AcceptResurrect()
	WoWScript UseSoulstone()
	This:Output[Waiting on ${Group.Member[${Party.AssistTarget}]} (${ReleaseTime})]
}

/*
=====================================================================
END
=====================================================================
*/
}