Help withe my Shambot.mac

KingArthur

AutoBots
Joined
Dec 15, 2009
Messages
525
Reaction score
31
Points
28
Here is my shambot.mac ,and i used it to duo with my mnk.

Code:
| ____________________________________________________________________________
| Shambot 
| MMOBugs Version 4.26 by Maskoi
| Last updated: 04/05/2010 
| ----------------------------------------------------------------------------
| -!- Basis of this script is
| -!- Version: v0.5c by Hubba 
| -!- Version 1.0c by Ranma 
| -!- Version 2.0c by thread_001 
| -!- Version 3.33 by ioncache, MQ2 AKA duskedge, MMOBugs 
| -!- Various Snippets from Booges, Hostagecs, Loonies and SuperSleeper MMOBugs & MQ2 VIP
| ----------------------------------------------------------------------------
| -!- This script Uses spell_routines.inc by Rusty, modified by A_Druid_00 
| -!- This script uses ninjadvloot.inc by A_Druid_00 (based on code from toomanynames) 
| -!- This script uses MQ2MoveUtils plugin by outlander 
| -!- This script uses MQ2Exchange
|
| Usage:
| 1.  If Main Tank & Puller roles are assigned, shambot will pick them up Pc or Merc
| 2. Target player/pet/merc you want to assist will select target if no Main Tank role found
| 3. Start the script with: /mac <scriptname> [main assist] [chat channel] [controller] overrides 1 & 2
|    i.e. /mac shambot bob 
| 4. Parameters are optional defaults are built in (make sure to change in macro)
|    will default to controller as assist with no target or parameter
|
| Features: Commands work in tells from ChatController or any Master or group i.e. /tell shammy sow 
| Will also recognize EQBC tells /bct shammy sow
| Echoes all non command word tells to controller
|
| The following commands will target the sender and cast the spells
| requested on the sender: [avatar] [sta] [agi] [dex] [str] [cha] [sow] [lev] [ac]
| [haste] [regen] [see] [pr] [grow] [shrink] [hot] [heal] [panther] [pan] [focus] [unity]
|
| The following commands will target the sender and cast the group versions
| on the sender's group: [gsta] [gagi] [gstr] [ghaste] [gregen] [gfocus] [gunity]
|
| The following commands will assist the sender and cast the spells
| requested on the target: [slow] [add] [root] [Dot] [nuke] [Dot2]
|
| The following commands will buff: 
| [bufftarget] will buff another person
| [buffpet] targets the senders pet and buffs
| [buff] [buffme] will buff a person
| [buffthem] will buff senders target with group buffs
|
| The following command: [autofollow] is for moving shaman
|
| The [add] or [slow] command are good in combat when there are adds
| Target the add and it will be malod and slowed
|
| During combat shaman will only do requests for heals, detrimentals, haste and panther
|
| [gatenow] [gate] will memorize the gate spell and gate to bind, must be a tell from controller
|
| Use "help" for more help
|
| Spells will be memmed in the listed order
| 1 canni
| 2 malo / nuke
| 3 slow 
| 4 cripple /  Dot-dot3
| 5 hot
| 6 heal
| 7 avatar 
| 8 lynx / misc / dot2-dot4
| 9 group heal 
| 10 wild growth 
| 11 listlessness 
| 12 lynx
|____________________________________________________________________________

#turbo 40

#chat group
#chat tell
#chat raid

#Event  ToggleVariable  "[MQ2] Toggle #1#"
#Event  ToggleVariable  "[MQ2] Toggle #1# #2#"
#Event  WriteAliases	"[MQ2] Shambot Aliases Exist"
#Event  OutDoor         "#*#outdoors#*#"
#Event  OutDoor         "You can not summon a mount here."
#Event  Zoning          "You have entered#*#"
#Event  Hungry          "#*#are hungry#*#"
#Event  Enrageon        "#*#|${Target.CleanName}| has become ENRAGED#*#"
#Event  Enrageoff       "#*#|${Target.CleanName}| is no longer enraged#*#"
#Event  Thirsty         "#*#are thirsty#*#"
#Event  ImDead          "You have been slain by#*#"
#Event  ImDead          "You died."
#event  ImDead          "#*#Returning to Bind Location#*#"
#Event  Invited         "#1# invites you to join a group."
#Event  Worn_off        "Your #1# spell has worn off of #2#."
#Event	Immune			"Your target does not meet the spell requirements.#*#"
#Event	Joined			"#1# has joined the group."
#Event	EQBC 			"<#1#> #2#"
#event 	EQBC 			"[#1#(msg)] #2#"

#include Spell_Routines.inc
#include ninjadvloot.inc

Sub Main
  /if (${Me.Class.ShortName.NotEqual[SHM]}) {
    /echo Sorry you are not a Shaman.
    /echo I'm afraid this macro to PC relationship just isn't going to work out.
    /echo I do hope we can still be friends though.
    /endmacro
  }
  	/declare gbuffs	outer
	/declare gobuffs outer	
	/declare sbuffs	outer
	/declare pbuffs	outer
	/declare pobuffs outer
	/declare rbuffs	outer
	
| ########### This is mainly for a 85th level shaman with Cannibalization ability
| ------------------ Cut & Paste Line Begin  ---------------------------|

| ################## Set up Chat stuff  1=ON and 0=OFF
| - In ChatChannel use your CHAT_CHANNEL:PASSWORD OR For EQBC use just the letters bc

	/declare ChatChannel		outer		CHAT_CHANNEL_HERE:PASSWORD_HERE
	/declare ChatController		outer		CONTROLLER_PC_NAME_HERE
	/declare DoChatChannel		int outer	1
	/declare GroupChatRelay		int outer	0 
	/declare RaidChatRelay		int outer	0 
	/declare Verbose		int outer	0
	/declare VerboseTell		int outer	0
	/declare DoGroupCommands	int outer	0
	
| ################## Setup Shambot runtime variables 
| - AssistAt is distance 90-100 recommended, CombatAt is Mob Health

	/declare AssistAt 		int outer	98 
	/declare CombatAt		int outer	98 
	/declare DoAllInvites    	int outer 	1
	/declare DoLoot			int outer	0
	/declare SecondAssist		outer 		SECOND_ASSIST_NAME_HERE
	
| ################## Setup your SHAMAN stuff here 

	/declare SpellCanni		outer		Ancestral Obligation Rk. III	
	/declare SpellPet		outer		Aina's Faithful Rk. III
	/declare SpellReincarnate	outer		Second Life Rk. II 
	/declare SpellInvisSelf		outer		Spirit Veil 
	/declare SpellGate		outer		Gate 
	/declare SpellFood		outer		Summon Food 
	/declare SpellDrink		outer		Summon Drink
	/declare Mount			outer		Mottled Worg Bridle 

	| ********** Shammy Do Stuff 

	/declare DoCanni		int outer	1 
	/declare DoCanniAA		int outer	1
	/declare DoPet			int outer	1
	/declare DoMount		int outer	0 
	/declare DoClickyItem		int outer 	1
	/declare DoPactAA 		int outer	1
	/declare DoCamp			int outer	1
	/declare DoEpic2         	int outer 	1
	/declare AcceptRez 		int outer	1
	
	| ********** Shammy % stuff
	
 	/declare SitAt			int outer	90 
	/declare DoEpic2Pct       	int outer 	90
	/declare CanniManaPct		int outer	50 
	/declare CanniMinHpPct		int outer	35 
	/declare CanniCombatPct		int outer	50
	
	| ********** Your Clicky Items for self buffs
	
	/declare ClickyItem[8]  	string outer
	/varset ClickyItem[1]		Cryostasis Fragment Ring
	/varset ClickyItem[2]		Taromani Eye
	/varset ClickyItem[3]		Ukun Rawhide Belt
	/varset ClickyItem[4]		Merciless Visage of Discord
	/varset ClickyItem[5]		NULL
	/varset ClickyItem[6]		NULL
	/varset ClickyItem[7]		NULL
	/varset ClickyItem[8]		NULL

| ################## Set up your Debuffs here 

	/declare SpellMalo		outer		Malis Rk. II
	/declare SpellHCSlow		outer		Healing Counterbias
	/declare SpellSlow		outer		Balance of Discord
	/declare SpellDiseaseSlow  	outer		Cloud of Grummas
	/declare SpellCripple		outer		Crippling Spasm
 
	| ********** Do Debuffs on 1=ON and 0=OFF 
	| DoMalo/DoSlow are master switches. They need to be on for any malo/slow option to work.

	/declare DoMalo			int outer	1
	/declare DoAAMalo		int outer	1
	/declare DoSlow			int outer	1 
	/declare DoHCSlow		int outer	1
	/declare DoAASlow		int outer	1
	/declare FastSlow		int outer	0
	/declare DoDiseaseSlow   	int outer 	0
	/declare DoCripple		int outer	0
	
| ################## Set up your HEAL stuff here 

	/declare MercHealerMode 	int outer	0
	/declare MercHealerMobLev	int outer	86

	/declare SpellHeal		outer		Dannal's Mending Rk. III
	/declare SpellHoT		outer		Halcyon Whisper Rk. III
	/declare SpellAIntervention 	outer  		Antecedent's Intervention Rk. III
	/declare SpellRemove        	outer 		Remove Greater Curse
	/declare ItemGHeal       		outer		Tainted Willsear Chain Coat

	| ********** Do heals on 1=ON and 0=OFF 

	/declare DoHeal			int outer	1 
	/declare DoHoT			int outer	1
	/declare DoGHeal    		int outer 	1
	/declare DoAIntervention    	int outer 	1 
	/declare DoUnionAA         	int outer 	1
	/declare HealTank		int outer	1
	/declare HealGroup		int outer	1 
	/declare HealPets		int outer	0
	/declare HealPuller		int outer	1

	| ********** Do heals at % health of 

	/declare TankHeal		int outer	60
	/declare TankHoT		int outer	88	
	/declare CasterHeal		int outer	65 
	/declare CasterHoT		int outer	85 
	/declare MeleeHeal		int outer	55
	/declare MeleeHoT		int outer	88 
	/declare PetHeal		int outer	65 
	/declare PetHoT			int outer	88
	/declare AInterventionHeal  	int outer 	20
	/declare UnionAAHeal  		int outer 	20
	/declare GHealGroupHealth  	int outer 	60
	
	| ********** How far to heal Non-FD Puller from shammy

	/declare PullerHealDistance 	int outer	20
	
| ################## Setup your DPS stuff here

	/declare SpellDot		outer		Blood of Jaled'Dar Rk. III
	/declare SpellDot2		outer		Nectar of the Slitheren Rk. III
	/declare SpellDot3		outer		Mojo Rk. III
	/declare SpellDot4		outer		Breath of Queen Malarian
	/declare SpellNuke 		outer		Bite of the Ukun Rk. III
	/declare SpellRoot		outer		Virulent Paralysis 

	| ********** Do DPS stuff on 1=ON and 0=OFF 

	/declare DoDot			int outer	1 
	/declare DoDot2			int outer	1
	/declare DoDot3			int outer	0 
	/declare DoDot4			int outer	0
	/declare DotRefresh      	int outer 	0
	/declare DoNuke			int outer	1 
	/declare DoRoot			int outer	0
	/declare DoSwarmPet     	int outer 	1

	| ********** Cast DPS at % health of and stop casting if less than % mana*

	/declare CastDotat		int outer	95
	/declare DotSkip          	int outer 	20
	/declare DotMana		int outer	40
	/declare NukeAt			int outer	90 
	/declare NukeMana		int outer	30
	/declare Rootat			int outer	30 
	/declare RootMana		int outer	40
	/declare DoSwarmPetPct    	int outer 	75

| ################## Setup your Attack spell stuff here	

	/declare SpellPanther		outer		Talisman of the Lynx Rk. III 
	/declare SpellGPanther		outer		Talisman of the Lynx Rk. III
	/declare SpellDefProc		outer		Listlessness Rk. III
	/declare SpellTempHP		outer		Wild Growth Rk. III
	
	| ********** Do Attack spell stuff on 1=ON and 0=OFF 	
	
	/declare DoPantherGroup		int outer	1
	/declare DoDefProc		int outer 	1
	/declare DoTempHP		int outer	1
	
	| ********** Attack spellmana & mob health % 
	
	/declare PantherMana		int outer	35 
	/declare PantherSkip		int outer	15 
	/declare DefProcMana		int outer	35
	/declare DefProcSkip		int outer	45	
	
| ################## Setup BUFFS here ** UNITY AUTOMATICALLY DETECTED **

	| ********** Single Buffs ** UNITY AUTOMATICALLY DETECTED **

	/declare SpellFocus		outer		Unity of the Spirits Rk. III 
	/declare SpellStr		outer		Spirit of Might 
	/declare SpellAgi		outer		Preternatural Foresight Rk. II 
	/declare SpellSta		outer		Spirit of Vehemence Rk. II
	/declare SpellHaste		outer		Celerity 
	/declare SpellAvatar		outer		Champion 
	/declare SpellRegen		outer		Spirit of the Resolute
	/declare SpellDex		outer		Mortal Deftness 
	/declare SpellShrink		outer		Shrink 
	/declare SpellPR		outer		Resist Poison
	
	| ********** Group Buffs ** UNITY AUTOMATICALLY DETECTED **
	
	/declare SpellGFocus      	outer 		Talisman of the Unity Rk. III
  	/declare SpellGStr		outer		Talisman of Might 
	/declare SpellGAgi		outer		Talisman of Foresight 
	/declare SpellGSta		outer		Talisman of Vehemence
	/declare SpellGHaste		outer		Talisman of Celerity 
	/declare SpellGAvatar		outer		Champion 
	/declare SpellGRegen		outer		Talisman of the Resolute Rk. III
	/declare SpellGShrink		outer		Tiny Terror
	/declare SpellGPR		outer		Talisman of the Tribunal 

	| ********** Misc Buffs 
	
	/declare SpellCha		outer		Unfailing Reverence 
	/declare SpellAC		outer		Ancestral Bulwark
	/declare SpellGrow 		outer		Grow
	/declare SpellSow		outer		Spirit of Bih`Li 
	/declare SpellLev		outer		Levitation 
	/declare SpellSee		outer		Acumen of Dar Khura 
	/declare SpellInvis		outer		Invisibility 

	| ********** Do Buffs 

	/declare DoGroupBuffs		int outer	1
	/declare DoRebuffs		int outer	1
	/declare DoShrink		int outer	1 
	/declare DoPetBuffs		int outer	0

	| ********** Buffs mana % and range 

	/declare BuffMana		int outer	30 
	/declare GroupBuffRange	    	int outer	50 

| - Welcome to the BuffoMatic
| - g=group go=groupother s=single p=mypet po=petother r=rebuff
| - 1=on 0=off don't worry about spacing as long 1 or 0 is the between | 1 |
| - FOR UNITY FOCUS MUST BE SET TO 1
| - Rebuffs if ON are based on their current buff list assignment below
| - Group rebuffs listens to the shammys current buffs so make sure none are blocked
| - Single Rebuffs are only cast on group members/pets, chat controller, main tank, added masters
| - You can always buff any target with chat commands see top for complete list

                |--------------------------------------------------------------|
|   Buff Name   | focus | str | sta | agi | haste | regen | avatar | sow | pr  |
                |--------------------------------------------------------------|
/varset gbuffs	|   1   |  1  |  1  |  1  |   1   |   0   |   1    |  0  |  0  |
/varset gobuffs	|   1   |  1  |  1  |  1  |   1   |   0   |   0    |  0  |  1  |
/varset sbuffs	|   1   |  1  |  1  |  1  |   1   |   0   |   0    |  0  |  1  |
/varset pbuffs	|   1   |  1  |  1  |  1  |   1   |   0   |   0    |  0  |  0  |
/varset pobuffs	|   1   |  1  |  1  |  1  |   1   |   0   |   0    |  0  |  0  |
                |--------------------------------------------------------------|

| ------------------ Cut & Paste Line End---------------------------|

  | This is a delay for how long Panther will hold. (1min about 669)
  /declare PantherDelay    outer 669

| ########### ** STOP EDITING! ** No Changesb Past Here Are Needed !
	/declare MiscGem              int outer 8
    /declare AssistDelay    int outer 3
	/declare CastRetryTime  string outer 5s
	/declare ResistCounterSlow int outer 0
	/declare MaxResistSlow     int outer 3
	/declare CanniDmgAA     int outer 
	/declare CanniMana 		int outer
	/if (${Me.AltAbility[Cannibalization]}>=5)	/multiline ; /varset CanniDmgAA 1924 ; /varset CanniMana 1066
	/if (${Me.AltAbility[Cannibalization]}>=10)	/multiline ; /varset CanniDmgAA 4051 ; /varset CanniMana 2248
	/if (${Me.AltAbility[Cannibalization]}>=18)	/multiline ; /varset CanniDmgAA 5000 ; /varset CanniMana 3000 
	/if (${Me.AltAbility[Cannibalization]}>=26)	/multiline ; /varset CanniDmgAA 6000 ; /varset CanniMana 3600
	/if (${Me.AltAbility[Cannibalization]}>=34)	/multiline ; /varset CanniDmgAA 8000 ; /varset CanniMana 4800
	/declare CanniDmgSpell  int outer 1324
	/declare CanniHoT       int outer 75
	/declare CanniHeal      int outer 40
    /declare DoPetHold       int outer 1
	/declare DoPetFocus      int outer 1
  	/declare DoGuildInvites  int outer 0
	/declare TempHPID  			int outer 0
	/declare DefProcID			int outer 0	
	/declare PullPC				int outer	
	/declare AutoFollow		int outer	0 
	/declare AutoFollowPC  	outer 
	/declare AFDist			int outer	25
	/declare varDead	int outer 0
	/declare ver outer 	Shambot ver 4.26 by Maskoi - 04/05/2010
	/declare DetectForesight int outer 0
	/declare DoForesight  int outer 0
	/declare DoGForesight  int outer 0
	/declare PLMode int outer 0
	/declare DoUnity  int outer 0
	/declare DoGUnity  int outer 0
	/declare SpellUnity outer
	/declare SpellGUnity outer
	/declare OnOff	outer
	/declare MercClericID int outer  
	/declare MercCleric int outer
	/declare WoRefresh int outer 0
	/declare SlowHCOn int outer 0
	/declare AASlowOn int outer 0
	/declare spellbookopen int outer 0
	/declare spellbooktimer timer outer 0
	/declare GroupShrunk int outer 0
	/declare M_Assist_type string outer
	/declare SAAsigned int outer 0
	/declare MADead	outer
	/declare ChatHere outer
	/declare SBAliases int outer 0
	/declare oDoHoT int outer ${DoHoT} 
	/declare oHealTank int outer ${HealTank}
	/declare MHMobDead int outer 0

| - Detect & set Unity spell line variables
	/call Detectomatic
	
| - Single Buff List. Do not change
	/declare SingleBuff[9] string outer 
	/varset SingleBuff[1] ${SpellFocus} 
	/varset SingleBuff[2] ${SpellStr}
	/varset SingleBuff[3] ${SpellSta}
	/varset SingleBuff[4] ${SpellAgi}
	/varset SingleBuff[5] ${SpellHaste}
	/varset SingleBuff[6] ${SpellRegen}
	/varset SingleBuff[7] ${SpellAvatar}
	/varset SingleBuff[8] ${SpellSow}
	/varset SingleBuff[9] ${SpellPR}

| - Group Buff List. Do not change
	/declare GroupBuffs[9] string outer 
	/varset GroupBuffs[1] ${SpellGFocus}
	/varset GroupBuffs[2] ${SpellGStr}
	/varset GroupBuffs[3] ${SpellGSta}
	/varset GroupBuffs[4] ${SpellGAgi}
	/varset GroupBuffs[5] ${SpellGHaste}
	/varset GroupBuffs[6] ${SpellGRegen}
	/varset GroupBuffs[7] ${SpellGAvatar}
	/varset GroupBuffs[8] ${SpellSow}
	/varset GroupBuffs[9] ${SpellGPR}

| - Detect AA spell gems
| ################## Setup AA Extra gem slot variables 

	/if (${Me.AltAbility[Mnemonic Retention]}>=3) /multiline ;	/declare  Gem9 int outer  1 ; /declare Gem9Spell	outer	
	/if (${Me.AltAbility[Mnemonic Retention]}>=9) /multiline ;	/declare  Gem10 int outer 1 ; /declare Gem10Spell	outer	
	/if (${Me.AltAbility[Mnemonic Retention]}>=15) /multiline ;	/declare  Gem11 int outer 1 ; /declare Gem11Spell	outer	
	/if (${Me.AltAbility[Mnemonic Retention]}>=21) /multiline ;	/declare  Gem12 int outer 1 ; /declare Gem12Spell	outer
	
| - Mem Spell Array
/declare mspell[12] string outer
	/varset mspell[1] ${SpellCanni}
	/varset mspell[2] ${SpellMalo}
	/if (${DoAAMalo} || !${DoMalo}) /varset mspell[2] ${SpellNuke}
	/varset mspell[3] ${SpellSlow}
	/if (${DoHCSlow}) /varset mspell[3] ${SpellHCSlow}
	/varset mspell[4] ${SpellCripple}
	/if (!${DoCripple} && ${DoDot}) /varset mspell[4] ${SpellDot}
	/varset mspell[5] ${SpellHoT}
	/varset mspell[6] ${SpellHeal}
	/varset mspell[7] ${SpellGAvatar}
	/varset mspell[8] ${SpellGPanther}
	/if (${Spell[${SpellGPanther}].ID}==0) /varset mspell[8] ${SpellPanther}
	/if (${Gem12}) /varset mspell[8] ${SpellDot2}
	/if (${Gem9}) /varset mspell[9] ${Gem9Spell}
	/if (${Gem9} && ${DoAIntervention}) /varset mspell[9] ${SpellAIntervention}
	/if (${Gem10}) /varset mspell[10] ${Gem10Spell}
	/if (${Gem10} && ${DoTempHP}) /varset mspell[10] ${SpellTempHP}
	/if (${Gem11}) /varset mspell[11] ${Gem11Spell}
	/if (${Gem11} && ${DoDefProc}) /varset mspell[11] ${SpellDefProc}
	/if (${Gem12}) /varset mspell[12] ${Gem12Spell}
	/if (${Gem12} && ${DoPantherGroup}) /varset mspell[12] ${SpellGPanther}
	
	/docommand /sb
	/doevents
	/if (!${SBAliases}) {
		/echo Writing aliases this can take up to 1 min
		| ### Do Toggles
		/squelch /alias /buffpet 		/echo toggle DoPetBuffs
		/squelch /alias /buffs 			/echo toggle DoGroupBuffs
		/squelch /alias /canni 			/echo toggle DoCanni
		/squelch /alias /cripple 		/echo toggle DoCripple
		/squelch /alias /defproc 		/echo toggle DoDefProc
		/squelch /alias /temphp 		/echo toggle TempHP
		/squelch /alias /domount 		/echo toggle DoMount
		/squelch /alias /dot 			/echo toggle DoDot
		/squelch /alias /dot2 			/echo toggle DoDot2
		/squelch /alias /dot3			/echo toggle DoDot3
		/squelch /alias /dot4			/echo toggle DoDot4
		/squelch /alias /groupcommands 	/echo toggle DoGroupCommands
		/squelch /alias /heal 			/echo toggle DoHeal
		/squelch /alias /hot 			/echo toggle DoHoT
		/squelch /alias /lootmobs 		/echo toggle DoLoot
		/squelch /alias /malo 			/echo toggle DoMalo
		/squelch /alias /nuke 			/echo toggle DoNuke
		/squelch /alias /panthergroup 	/echo toggle DoPantherGroup
		/squelch /alias /rebuffs 		/echo toggle DoRebuffs
		/squelch /alias /root 			/echo toggle DoRoot
		/squelch /alias /shrink 		/echo toggle DoShrink
		/squelch /alias /shrink 		/echo toggle DoShrink
		/squelch /alias /slow 			/echo toggle DoSlow
		| ### Misc Toggles
		/squelch /alias /buffbot 		/echo toggle BuffBot
		/squelch /alias /fastslow 		/echo toggle FastSlow
		/squelch /alias /groupchat 		/echo toggle GroupChatRelay
		/squelch /alias /healgroup 		/echo toggle HealGroup
		/squelch /alias /healpets 		/echo toggle HealPets
		/squelch /alias /healtank 		/echo toggle HealTank
		/squelch /alias /raidchat 		/echo toggle RaidChatRelay
		/squelch /alias /verbose 		/echo toggle Verbose
		/squelch /alias /verbosetell 	/echo toggle VerboseTell
		/squelch /alias /debug 			/echo toggle debug
		| ### Toggles with 2nd Command
		/squelch /alias /assistat 		/echo toggle AssistAt
		/squelch /alias /Dotat 			/echo toggle CastDotat
		/squelch /alist /doepic2pct 	/echo DoEpic2Pct
		/squelch /alias /combatat 		/echo toggle CombatAt
		/squelch /alias /healcastersat 	/echo toggle CasterHeal
		/squelch /alias /healmeleeat 	/echo toggle MeleeHeal
		/squelch /alias /healpetsat 	/echo toggle PetHeal
		/squelch /alias /healtankat 	/echo toggle TankHeal
		/squelch /alias /hotcastersat 	/echo toggle CasterHoT
		/squelch /alias /hotmeleeat 	/echo toggle MeleeHoT
		/squelch /alias /hotpetsat 		/echo toggle PetHoT
		/squelch /alias /hottankat 		/echo toggle TankHoT
		/squelch /alias /nukeat 		/echo toggle NukeAt
		/squelch /alias /rootat 		/echo toggle RootAt
		/squelch /alias /setma 			/echo toggle M_Assist
		/squelch /alias /sitat 			/echo toggle SitAt
		/squelch /alias /setpuller 		/echo toggle PullPC
		/squelch /alias /sb 			/echo Shambot Aliases Exist
		/squelch /alias /bias 			/echo toggle DoHCSlow
		/squelch /alias /merc 			/echo toggle MercHealerMode
		| ### Customized Commands
		/squelch /alias /addmaster 		/echo toggle AddMaster
		/squelch /alias /autofollow 	/echo toggle SetAutoFollow
		/squelch /alias /clearmasters 	/echo toggle ClearMasters
		/squelch /alias /docamp 		/echo toggle SetDoCamp
		/squelch /alias /GHeal			/echo toggle GHeal
		/squelch /alias /dopet 			/echo toggle DoPetStuff
		/squelch /alias /help 			/echo toggle Help
		/squelch /alias /listmasters 	/echo toggle ListMasters
		/squelch /alias /removemaster 	/echo toggle RemoveMaster
		/squelch /alias /resetvars 		/echo toggle ResetVariables
		/squelch /alias /status 		/echo toggle Show
	}
		
	/declare BuffBot int outer 0
	/declare MasterArray[5]string outer NULL
	/declare TargetArray[4]string outer NULL
	/declare TargetSlow[5] string outer NULL
	/declare TargetDebuff[5] string outer NULL
	/declare TargetCripple[5] string outer NULL
	/declare TargetUnity[6] 	string outer NULL
	/declare MobMaloed 	int outer 0
	/declare MobSlowed 	int outer 0
	/declare MobCrippled 	int outer 0
	/declare PetOn 	int outer 0
	/declare PetHeld 	int outer 0
	/declare PetFocused	int outer 0
	/declare MobRooted 	int outer 0
	/declare MobDoted	int outer 0
	/declare MobDoted2 	int outer 0
	/declare MobDoted3	int outer 0
	/declare MobDoted4 	int outer 0
	/declare CombatOn	int outer 0
	/declare Engaged 	int outer 0
	/declare LowMana 	int outer 0
	/declare PetSuspended	int outer 0
	/declare TankHoTOn		int outer 0
	/declare ChatText			outer
	/declare debug 			int outer 0
	/declare GroupHoT[6]	int outer 0
	/declare GroupHoTPet[6] 	int outer 0
	/declare M_Assist 	string outer
	/declare OutDoors 	outer 1
	/declare Exper 			float outer
	/declare AAExp 			float outer
	/varset Exper 			${Me.Exp}
	/varset AAExp 			${Me.AAExp}
	/declare GroupBuffTimer timer outer 0
	/declare M_Assist_ID int outer 0
	/declare JoinedParty int outer 0

| = Declare misc timers loop
	/declare i int local 
  	/for i 0 to 5
	/declare ATKBuffed${i}	timer outer 0
	/declare PanGrp${i} 	timer outer 0
	/declare PanPet${i} 	timer outer 0
	/next i 

	/declare noInvis int outer 1
	/call SetupAdvLootVars
	/echo ${ver}

	| - Find Main Assist from command line parameter, targeted player, Main Tank Role or fallback to default 
	/if (!${Defined[Param0]}) {
		/for i 1 to ${Group}
			/if (${Group.Member[${i}].MainTank} && ${Spawn[${Group.Member[${i}]}].ID}) {
				/varset M_Assist ${Group.Member[${i}]}
				/echo  +++ Found Main Tank role. +++
				/goto :setM_Assist
			}
		/next i
	} 
	/if (${Defined[Param0]}) {
		/varset M_Assist ${Param0} 
		/goto :setM_Assist
	}
	/if (!${Spawn[${Target}].ID} || !${Select[${Target.Type},Mercenary,PC,Pet]}) {
		/echo You do not have a Mercenary, PC or Pet targeted using default controller: ${ChatController}.
		/echo To reset MA do: /setma <PC Name> 
		/varset M_Assist ${ChatController}
		/goto :setM_Assist
    }
	/if (${Target.CleanName.Equal[${Me.CleanName}]}) { 
		/echo You cannot assist yourself!
		/echo To reset MA do: /setma <PC Name> 
		/varset M_Assist ${ChatController}
		/goto :setM_Assist
	} 
	/varset M_Assist ${Target.CleanName}
	:setM_Assist
	/target ${M_Assist}
	/varset M_Assist_type ${Target.Type}
	/varset M_Assist_ID ${Target.ID}
	/echo Assist set to >> ${M_Assist} <<
    /call CheckRoles
	/if (${Defined[Param1]}) /varset ChatChannel ${Param1} 
	/leaveall 
	/if (${ChatChannel.Find[bc]}) {
		/varset ChatHere bc
	} else {
		/varset ChatHere 1
		/join ${ChatChannel}
	}
	 /if (${DoChatChannel}) /${ChatHere} I am here!
    /echo Joined channel ${ChatChannel}
	/if (${Defined[Param2]}) /varset ChatController ${Param2} 
	/vtell ${ChatController} 005 
	/tell ${ChatController} I am here! 
	/echo My master is ${ChatController} 
	/call memSpells
	/declare SpellsMemmed int outer 1

| ############### Main Loop Starts
:Main_Loop
| -- Nothing to see here hurry up and finish. 
	:HurryUp
	/doevents
	/if (${Me.Stunned} || ${Me.Ducking} || ${Cast.Status.NotEqual[I]}) /goto :HurryUp
	/if (${spellbookopen}) {
		/if (!${spellbooktimer}) {
			/if (${Window[SpellBookWnd]}) /keypress ctrl+b
			/varset spellbookopen 0
		}
	} else {
		/if (${Window[SpellBookWnd]}) {
			/varset spellbookopen 1
			/varset spellbooktimer 30s
		}
	}
 	/if (${Window[MerchantWnd]} || ${Window[TradeWnd]} || ${Window[GiveWnd]} || ${Window[LootWnd]} || ${Window[SpellBookWnd]} || ${Window[BigBankWnd]} || ${Window[LootWnd]} || ${Window[BankWnd]} || ${Window[TributeMasterWnd]} || ${Window[GuildTributeMasterWnd]}) {
		/delay 2
		/goto :HurryUp
	}
	/if (${Window[CastingWindow]}) {
		/delay 2
		/goto :HurryUp
	}
| - Not in game end macro
	/if (${MacroQuest.GameState.Equal[CHARSELECT]}) /end
| - Do Pact of the Wolf
	/if (!${DoMount} && ${DoPactAA} && !${Me.Buff[Pact of the Wolf].ID} && ${Me.AltAbilityReady[Pact of the Wolf]}) /call cast "707" alt ${CastRetryTime}
| - Auto Follow
	/if (${AutoFollow}) /call AutoFollow
| - Canni
	/if (!${Me.Invis}) /call LowOnMana
| - Pet
	/if (!${Engaged} && ${DoPet} && !${Me.Invis}) /call PetRoutines
| - Buffbot loop	
	/if (${Me.Invis} || ${BuffBot}) /goto :Main_Loop
| - Check for Standing if less than sitat then sit
	/if (${Me.State.Equal[Stand]} && ${Me.PctMana}<${SitAt} && !${Engaged} && !${Me.Casting.Name.Equal[NULL]}) /sit
| - Summon Mount if outdoors && DoMount=1 && DoPact==0
	/if (!${Me.Mount.ID} && ${OutDoors} && ${DoMount} && !${DoPactAA}) /call Mount 
| - Am I dead
	/if (${AcceptRez} && ${Window[RespawnWnd].Open}) /call Accept_rez	
| - Checks for Heals/Events
	/call CombatChecks
| - Check for mobs and do combat stuff
	/call GetTarget
	/if (${CombatOn} && ${TargetArray[4].NotEqual[NULL]}) /call Combat
| - Do we move?
  :Hold_Main
	/if (${Me.Moving}) /goto :Hold_Main
| - Check for Standing if less than sitat then sit
	/if ( ${Me.State.Equal[Stand]} && ${Me.PctMana}<${SitAt} && !${Engaged}) /sit
| - Check Clicky Buffs
	/if (!${Engaged} && ${DoClickyItem}) /call Buffomatic ClickyItem ${Me} 0 item
| - Group Buffs if more than BuffMana mana
	/if (${Me.PctMana}>=${BuffMana} && ${DoGroupBuffs} && !${Engaged}) /call Buffomatic GroupBuffs ${Me} 0 ${MiscGem} g gbuffs
| - Cast Reincarnate self buff	
	/if (!${Engaged} && !${Me.Buff[${SpellReincarnate}].ID} && ${Me.Book[${SpellReincarnate}]} && !${WoRefresh}) /call CastReincarnate
| - Shrink group	
	/if (${DoShrink} && !${GroupShrunk}) /call Shrink_Group
| - Loot mobs
	/if (!${Engaged} && ${DoLoot} && !${Me.Moving}) /call LootMobs
| - Check for Puller role and Merc Healer	
	/call CheckRoles
	
	/goto :Main_Loop
/return

| ################### Read Memorize Spells Array
Sub memSpells 
	/if (!${SpellsMemmed}) /echo Memming spells. Hang on. 

	/declare i int local 
	/for i 1 to 12	
	/if (!${Me.Book[${mspell[${i}]}]}) {
		/echo Can't memorize ${mspell[${i}]} in >> Gem ${i} << Check for spelling errors or not in my spellbook.
		/goto :SkipMem
	}
	/if ((!${Gem9} && ${i}==9) || (!${Gem10} && ${i}==10) || (!${Gem11} && ${i}==11) || (!${Gem12} && ${i}==12)) /goto :SkipMem
	/if (${Me.Gem[${i}].Name.NotEqual[${mspell[${i}]}]} || ${Me.Gem[${i}].ID}<1) {
		/if (!${Me.Sitting}) /sit 
		/if (!${SpellsMemmed}) /echo Memorizing Spell ${mspell[${i}]} in Gem ${i}
		/memspell ${i} "${mspell[${i}]}"
		/delay 30
	}
	:SkipMem
	/next i
	/if (${Window[SpellBookWnd].Open}) /windowstate SpellBookWnd close 
	/if (!${SpellsMemmed}) /echo Spells are memmed. 
	/if (${Me.Sitting}) /stand
	/return

| ################### Check target and do stuff like slow, Dot, pet attack etc.
Sub Combat
  /declare i int local

  /if (${Target.ID}==${TargetArray[4]}) {
		/if (${Me.Sitting}) /stand
		/face

	| - Malo & Slow
		/if (${CombatOn} && !${MobSlowed} && ${DoSlow}) /call Slow
		/if (${CombatOn} && ((!${MobMaloed} && ${DoMalo}) || (!${MobCrippled} && ${DoCripple}))) /call DeBuff
		/if (${CombatOn} && !${PetOn} && ${Target.ID}==${TargetArray[4]} && ${Target.Distance}<=${AssistAt}) {
			/squelch /pet attack
			/varset PetHeld 0
			/varset PetOn 1
			/varset Engaged 1
		}

| - Checks for Heals/Events
		/call CombatChecks
| - Check Roles
		/call CheckRoles
| - Epic 1.5/2.0 checks
		/if (${DoEpic2} && ${Target.PctHPs}>=${DoEpic2Pct} && (${FindItem[Crafted Talisman of Fates].Timer}==0 || ${FindItem[Blessed Spiritstaff of the Heyokah].Timer}==0)) {
			/if (${FindItem[Crafted Talisman of Fates].Timer}==0) {
			/call cast "Crafted Talisman of Fates" item ${CastRetryTime}
		} else /if (${FindItem[Blessed Spiritstaff of the Heyokah].Timer}==0) {
			/call cast "Blessed Spiritstaff of the Heyokah" item ${CastRetryTime}
		}
	}
| - Do panther stuff
    /if (${CombatOn} && ${Engaged} && ${Me.PctMana}>=${PantherMana} && ${Target.PctHPs}>=${PantherSkip} &&  ${DoPantherGroup}) /call CastPanther
 
| - Check for Defensive Proc stuff
    /if (${CombatOn} && ${Engaged} && ${Me.PctMana}>=${DefProcMana} && ${Target.PctHPs}>=${DefProcSkip} && ${DoDefProc} && !${DefProcID} && ${Spawn[${M_Assist}].ID}) /call CastDefProc

| - Check for TempHP
	/if (${CombatOn} && ${Engaged} && ${DoTempHP} && !${TempHPID} && ${Spawn[${M_Assist}].ID}) /call CastTempHP

| - Do Dots
   /if (${CombatOn} && ((${DoDot} && !${MobDoted}) || (${DoDot2} && !${MobDoted2}) || (${DoDot3} && !${MobDoted3}) || (${DoDot4} && !${MobDoted4})) && ${Me.PctMana}>=${DotMana} && ${Target.PctHPs}<=${CastDotat} && ${Target.PctHPs}>=${DotSkip}) /call CastDot

| - Check Heals
	/call CombatChecks
 
| - Do Nukes
   /if (${CombatOn} && ${DoNuke} && ${Me.PctMana}>=${NukeMana} && ${Target.PctHPs}<=${NukeAt} && ${Target.Type.Equal[NPC]}) /call cast "${SpellNuke}" gem2 ${CastRetryTime} CheckTarget

 | - Checks for Combat AAs
     /if (${CombatOn} && ${Me.AltAbilityReady[Spirit Call]} && ${DoSwarmPet} && ${Target.PctHPs}>=${DoSwarmPetPct} && ${Target.Type.Equal[NPC]}) /call cast "177" alt ${CastRetryTime} CheckTarget

| - Rooting code
    /if (${CombatOn} && ${DoRoot} && ${Me.PctMana}>=${RootMana} && ${Target.PctHPs}<=${RootAt} && !${MobRooted} && ${Target.Type.Equal[NPC]}) {
      /call cast "${SpellRoot}" gem${MiscGem} {$CastRetryTime} CheckTarget
      /if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset MobRooted 1
    }
  }
| - EndCombat - Check for new events in chat etc etc...
| - Checks for Heals/Events	
	/call CombatChecks

	/squelch /target ${TargetArray[3]}

	/if (!${Target.Name.Equal[${TargetArray[3]}]} || !${Target.ID}) {
		/if (${TargetArray[1].NotEqual[NULL]}) /echo ${TargetArray[1]} is dead
		/varset MobRooted 0
		/varset MobMaloed 0
		/varset MobSlowed 0
		/varset MobCrippled 0
		/varset PetOn 0
		/varset MobDoted 0
		/varset MobDoted2 0
		/varset MobDoted3 0
		/varset MobDoted4 0
		/varset CombatOn 0
		/varset Engaged 0
		/varset SlowHCOn 0
		/varset AASlowOn 0

		/if (${DoPetHold} && ${Me.AltAbility[Pet Discipline]}) {
			/pet hold on
			/varset PetHeld 1
		}
		/call RemoveFrom "Slow" ${TargetArray[4]}
		/call RemoveFrom "Debuff" ${TargetArray[4]}
		/call RemoveFrom "Cripple" ${TargetArray[4]}
		/varset TargetArray[1] NULL	
		/varset TargetArray[2] NULL
		/varset TargetArray[3] NULL
		/varset TargetArray[4] NULL
		/call memSpells
	}
/return

Sub CombatChecks
| - Tank Heals
	/if (${HealTank}) /call CheckHPs Tank
| - Heal Group
	/if (${HealGroup}) /call CheckHPs Group
| - Heal Pets
	/if (${HealPets}) /call CheckHPs Pet
| - Check for new events in chat
	/doevents
/return
| - Sub cast Dots
Sub CastDot 
	/if (${Target.Type.NotEqual[NPC]}) /return
		/if (${Target.Distance}<${Spell[${SpellDot}].Range} && !${MobDoted} && ${DoDot}) { 
			/call cast "${SpellDot}" Gem4 ${CastRetryTime}
			/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset MobDoted 1 
			/if (${DoDot3} && ${MobDoted} && !${MobDoted3} && !${Me.Gem["${SpellDot3}"]}) { 
				/memspell 4 "${SpellDot3}" 
				/delay 30 ${Me.Gem["${SpellDot3}"]}
			}
	/return
	}
	/if (${Target.Distance}<${Spell["${SpellDot2}"].Range} && ${MobDoted} && !${MobDoted2} && ${DoDot2}) { 
			/call cast "${SpellDot2}" gem${MiscGem} ${CastRetryTime} 
			/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset MobDoted2 1 
			/if (${DoDot4} && ${MobDoted} && ${MobDoted2} && !${MobDoted4} && !${Me.Gem[${SpellDot4}]}) { 
				/memspell 8 "${SpellDot4}" 
				/delay 30 ${Me.Gem["${SpellDot4}"]}
			}
	/return			
	} 
		/if (${Target.Distance}<${Spell["${SpellDot3}"].Range} && ${MobDoted} && ${MobDoted2} && !${MobDoted3} && ${DoDot3}) { 
			/call cast "${SpellDot3}" gem${MiscGem} ${CastRetryTime} 
			/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset MobDoted3 1 
			/if (!${Me.Gem[${SpellDot1}]}) { 
				/memspell 4 "${SpellDot1}" 
				/delay 30 ${Me.Gem["${SpellDot1}"]}
			} 
	/return
	}
		/if (${Target.Distance}<${Spell["${SpellDot4}"].Range} && ${MobDoted} && ${MobDoted2} && ${MobDoted3} && !${MobDoted4} && ${DoDot4}) { 
			/call cast "${SpellDot4}" gem${MiscGem} ${CastRetryTime} 
			/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset MobDoted4 1 
			/if (!${Me.Gem[${SpellDot2}]}) { 
				/if (!${DoCripple} && ${DoDot2} && ${DoAASlow} && !${Gem12}) /memspell 4 "${SpellDot2}" 
				/if (${Gem12}) /memspell 8 "${SpellDot2}" 
				/delay 30 ${Me.Gem["${SpellDot2}"]}
			}
	/return		
	}
/return
| ############## Check for Puller, Tank Watch and Merc Healers
Sub CheckRoles
	/declare i int local 
  	/for i 1 to ${Group.Members}
	/if (${Group.Member[${i}].Puller} && ${Group.Member[${i}].CleanName.NotEqual[${M_Assist}]} && !${PullPC}) { 
		/varset PullPC ${Group.Member[${i}].ID}
		/echo  +++ Puller role found! Puller set to >> ${Group.Member[${i}]} <<. +++
	}
	/if (${MercHealerMode} && !${MercCleric} && ${Group.Member[${i}].ID} && ${Group.Member[${i}].Type.Equal[Mercenary]} && ${Select[${Group.Member[${i}].Class.ShortName},CLR]} && ${Int[${TargetArray[2]}]}<${MercHealerMobLev}) {
		/varset DoHoT 0 
		/varset HealTank 0 
		/varset MercCleric 1
		/varset MercClericID ${Spawn[${Group.Member[${i}]}].ID}
		/if (${MercCleric} && !${MHMobDead}) /echo  +++ Detected mercenary cleric switching to Merc Healer Mode. +++
		/if (${MercCleric} && ${MHMobDead}) {
			/echo  +++ Level ${MercHealerMobLev} mob dead switching to Merc Healer Mode. +++
			/varset MHMobDead 0
		}
		/echo  +++ I will no longer heal Main Assist or cast HoT spells. +++
	}
	/if (${MercHealerMode} && ${MercCleric} && (!${Spawn[${MercClericID}].ID}  || (${Spawn[${MercClericID}].ID} && ${TargetArray[2]}>=${MercHealerMobLev}))) {
		/If (!${Spawn[${MercClericID}].ID}) /echo *** Uh Oh! Our merc healer is gone.   ***
		/If (${TargetArray[2]}>=${MercHealerMobLev}) {
			/echo *** Detected mob higher level than ${MercHealerMobLev}.   ***
			/varset MHMobDead 1
		}
		/echo *** Reverting to original settings for healing Main Assist and HoT Spells  ***
		/varset DoHoT ${oDoHoT} 
		/varset HealTank ${oHealTank} 
		/varset MercCleric 0
		/varset MercClericID 0
	}
	/if (!${SAAsigned} && ${SecondAssist.NotEqual[NULL]} && ${Spawn[${SecondAssist}].ID} && (!${Spawn[${M_Assist}].ID} || ${Spawn[${M_Assist}].Type.Equal[Corpse]}) || ${Spawn[${M_Assist}].Hovering}) {
		/echo +++ Tank's gone switching to Secondary Assist >> ${SecondAssist} << +++	
		/varset MADead	${M_Assist}
		/varset SAAsigned 1
		/varset M_Assist ${SecondAssist}
		/varset M_Assist_type ${Spawn[${SecondAssist}].Type}
		/varset TempHPID 0
		/varset DefProcID 0
	}
	/if (!${Engaged} && ${SAAsigned} && ${Spawn[${MADead}].ID}) {
		/if (!${Spawn[${MADead}].ID} && !${Spawn[${SecondAssist}].ID}) /return
		/echo +++ Tank's back dropping ${SecondAssist} for >> ${MADead} << +++	
		/varset SAAsigned 0
		/varset M_Assist ${MADead}
		/varset M_Assist_type ${Spawn[${MADead}].Type}
	}
	/next i
	/return
| ############## CastMount
Sub Mount
	/if (${DoPactAA} &&  ${Me.Buff[Pact of the Wolf].ID}) {
		/nomodkey /notify BuffWindow buff${Math.Calc[${Me.Buff[Pact of the Wolf].ID}-1].Int} leftmouseup
		/varset DoPactAA 0
		/echo DoPactAA has now been set to off.
	}
	/if (${DoLoot}) /multiline ; /varset DoLoot 0 ; /echo DoLoot has been set to off
	/call cast "${Mount}" item ${CastRetryTime}
	/return
| ############## Cast Reincarnate spell
Sub CastReincarnate	
	/if (${CombatOn}) /return
	/if (!${Me.Gem[${SpellReincarnate}]}) /memspell ${MiscGem} "${SpellReincarnate}"
	/varset WoRefresh 1
	/timed 200 /varset WoRefresh 0
	/echo Waiting 20s for >> ${SpellReincarnate} << to refresh
	/if (${Verbose} && ${WoRefresh}) /gsay Hold pulls please. Waiting for my self buff to refresh.
	:WaitToCast
	/doevents
	/if (${Me.SpellReady[${SpellReincarnate}]}) /call Castomatic ${Me} PC 0 "${SpellReincarnate}" ${MiscGem}
	/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset WoRefresh 0
	/if (${WoRefresh}) /goto :WaitToCast
	/if (${Verbose}) /gsay All set
	/return
| ############## Cast Defensive Proc spell
Sub CastDefProc
	/if (${HealTank}) /call CheckHPs Tank

	/call Castomatic ${M_Assist} ${M_Assist_type} 0 "${SpellDefProc}" ${MiscGem}
	/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
	/if (${Verbose}) /gsay << ${SpellDefProc} >> on ${M_Assist}.
	/varset DefProcID ${Target.ID}
	}
/return
| - Temp HP Wild growth 
Sub CastTempHP
	/if (${Spawn[${M_Assist}].Distance}>=${Spell[${SpellTempHP}].Range}) /return
    /if (${HealTank}) /call CheckHPs Tank
	/call AcquireTarget ${M_Assist} ${M_Assist_type} 0
	/call Cast "${SpellTempHP}" ${MiscGem} ${CastRetryTime}
	/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
	/if (${Verbose}) /gsay << ${SpellTempHP} >> on ${M_Assist}.
	/varset TempHPID ${Target.ID}
	}
/return
| ############## CastPanther Line on group
Sub CastPanther
    /if (${HealTank}) /call CheckHPs Tank
	/declare i int local
	/if ((${DoSlow} && !${MobSlowed}) || (${DoCripple} && !${MobCrippled}) || ${Target.Type.NotEqual[NPC]}) /return
	/if (${DoPantherGroup} && ${SpellGPanther.NotEqual[NULL]} && !${Me.Buff[${SpellGPanther}].ID}) {
      /if (${Target.PctHPs}<=${PantherSkip}) /return
      /call AcquireTarget ${Me} PC 0
      /delay ${AssistDelay}
      /echo Buffing ${SpellGPanther} on group now.
      /call cast "${SpellGPanther}" gem8 ${CastRetryTime}
      /return
	} else /if (${SpellGPanther.Equal[NULL]}) {
    /for i ${Group.Members} downto 0
      /if (${Target.PctHPs}<=${PantherSkip}) /return
      /if (${Group.Member[${i}].ID}) {
        /if (${PanGrp${i}}==0 && ${Select[${Group.Member[${i}].Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${DoPantherGroup}) {
         /call AcquireTarget ${Group.Member[${i}]} ${Spawn[${Group.Member[${i}]}].Type} 0
         /if (${Me.CurrentMana}>${Spell[${SpellPanther}].Mana} && ${Target.Distance}<${Spell[${SpellPanther}].Range}) {
            /call cast "${SpellPanther}" gem8 ${CastRetryTime} CheckTankHealth
            /if (${Macro.Return.Equal["CAST_OUTOFRANGE"]}) /varset PanGrp${i} 200
            /if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset PanGrp${i} ${PantherDelay}
          }
          /return
        }
        /if (${PanPet${i}}==0 && ${Group.Member[${i}].Pet.ID} && ${Select[${Group.Member[${i}].Class.ShortName},BST,MAG,NEC,SHM]}) {
          /call AcquireTarget "${Group.Member[${i}].Pet}" PET 0
          /if (${Me.CurrentMana}>${Spell[${SpellPanther}].Mana} && ${Target.Distance}<${Spell[${SpellPanther}].Range}) {
            /call cast "${SpellPanther}" gem8 ${CastRetryTime}
            /if (${Macro.Return.Equal["CAST_OUTOFRANGE"]}) /varset PanPet${i} 200
            /if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset PanPet${i} ${PantherDelay}
          }
          /return
        }
      }
    /next i
  }
/return

| ############## Cast_Shrink
Sub Shrink_Group
	/if  (${GroupShrunk}) /return
	/if (${Verbose}) /gsay Shrinking Group
	/if (${Me.AltAbility[9503]}>0 && ${Me.AltAbilityReady[9503]}) {
		/call Castomatic ${Me} PC 0 9503 alt
		/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
			/varset GroupShrunk 1
			/return
		}
	} else 	/if (${Me.Book[${SpellGShrink}]} && !${GroupShrunk}) {
		/call Castomatic ${Me} PC 0 "${SpellGShrink}" gem${MiscGem}
		/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
			/varset GroupShrunk 1
			/return
		}
	} else /if (${SpellShrink.Equal[Shrink]} && !${GroupShrunk}) {
    /declare i int local
    /for i 0 to ${Group.Members}
      /if (${Group.Member[${i}].ID}) {
       /call AcquireTarget ${Group.Member[${i}]} ${Spawn[${Group.Member[${i}]}].Type} 0
        /if (${Target.Distance}<=${AssistAt}) {
          /call cast "${SpellShrink}" gem${MiscGem} ${CastRetryTime}
        }
      }
    /next i
	/varset GroupShrunk 1
   } 
/return

| ############### Debuff
Sub DeBuff
  /if (!${MobMaloed} && ${DoMalo}) {
| - check to see if in TargetDebuff array
    /declare i int local
    /for i 1 to ${TargetDebuff.Size}
      /if (${Target.ID}==${TargetDebuff[${i}]}) {
      /echo ${Target.CleanName} has already been debuffed with ${SpellMalo}
      /varset MobMaloed 1
      /return
    }
    /next i
    :DeBuff_Loop
      /if (${Target.PctHPs}<=${CombatAt} && ${Target.ID}==${TargetArray[4]}) {
	     /if (${DoAAMalo} && ${Me.AltAbilityReady[1041]}) {
         /call cast "1041" alt ${CastRetryTime} CheckLevels
         /if (${Macro.Return.Equal["CAST_SUCCESS"]}) { 
		 /if (${Verbose}) /gsay << %t >> has been Malo'd.
		 /varset SpellMalo Malosinete
		 /call AddTo "Debuff"
         /varset MobMaloed 1 
        }
       } else /if (${Me.CurrentMana}<${Spell[${SpellMalo}].Mana}) {
          /echo Not enough mana to cast << ${SpellMalo} >> on %t
        } else {
          /call cast "${SpellMalo}" gem2 ${CastRetryTime} CheckTarget
          /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) /goto :DeBuff_Loop
          /call AddTo "Debuff"
          /varset MobMaloed 1
        }
      }
    /if (${DoCripple} && !${Me.Gem[${SpellCripple}]}) {
      /memspell Gem4 ${SpellCripple}
      /delay 30
    }
  } else /if (!${MobCrippled} && ${DoCripple}) {
    /if (${DoSlow}) {
      /if (!${MobSlowed}) /return
    }
| - check to see if in TargetCripple array
	/call CombatChecks
    /declare i int local
    /for i 1 to ${TargetCripple.Size}
      /if (${Target.ID}==${TargetCripple[${i}]}) {
        /echo ${Target.CleanName} has already been Crippled with ${SpellCripple}
        /varset MobCrippled 1
        /return
      }
      /next i
      /if (${Target.PctHPs}<=${CombatAt} && ${Target.ID}==${TargetArray[4]}) {
        /if (${Me.CurrentMana}<${Spell[${SpellCripple}].Mana}) {
          /echo Not enough mana to --> Cripple %t
        } else {
          :Cripple_Loop
            /call cast "${SpellCripple}" gem4 ${CastRetryTime} CheckTarget
            /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) {
              /goto :Cripple_Loop
			} else /if (${Macro.Return.Equal["CAST_IMMUNE"]}) {
		      /if (${Verbose}) /gsay << %t >> is IMMUNE to ${SpellCripple}.
              /call AddTo "Cripple"
              /varset MobCrippled 1
            } else /if (${Macro.Return.Equal["CAST_RESISTED"]}) {
              /call AddTo "Cripple"
              /varset MobCrippled 1
            } else /if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
              /if (${Verbose}) /gsay << %t >> has been CRIPPLED with ${SpellCripple}.
              /call AddTo "Cripple"
              /varset MobCrippled 1
            }
        }
      }
    /if (${DoMalo} && !${Me.Gem[${SpellMalo}]}) {
      /memspell Gem2 ${SpellMalo}
      /delay 30
    }
  }
/return

| ############### Slowing
Sub Slow
| - check to see if in TargetSlow array
  /declare i int local
  /declare SlowUsed local
  /for i 1 to ${TargetSlow.Size}
   /if (${Target.ID}==${TargetSlow[${i}]}) {
    /echo ${Target.CleanName} has already been slowed with ${SpellSlow}
    /varset MobSlowed 1
    /varset ResistCounterSlow 0
    /return
   }
  /next i
  /if (${Target.PctHPs}<=${CombatAt} && ${Target.ID}==${TargetArray[4]}) {
    /if (${Me.CurrentMana}<${Spell[${SpellSlow}].Mana}) {
      /echo Not enough mana to --> Slow %t
    } else {
    :Slow_Loop
	/if (!${SlowHCOn} && ${DoHCSlow}) {
			/call cast "${SpellHCSlow}" gem3 ${CastRetryTime} CheckTarget
			/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset SlowHCOn 1
			/varset SlowUsed ${SpellHCSlow}
			/goto :SlowCast
		} else /if (${DoAASlow} && ${Me.AltAbilityReady[Turgur's Swarm]}) {
			/call cast "3729" alt ${CastRetryTime} CheckTarget
			/varset AASlowOn 1
			/varset SlowUsed "Turgur's Swarm"
			/goto :SlowCast
		} else /if (${MobSlowed} || ${SlowHCOn} || ${AASlowOn})  {
			/goto :SlowCast
		} else {
			/call cast "${SpellSlow}" gem3 ${CastRetryTime} CheckTarget
			/varset SlowUsed ${SpellSlow}
		}
		:SlowCast
      /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) {
        /goto :Slow_Loop
      } else /if (${Macro.Return.Equal["CAST_IMMUNE"]}) {
        /if (${Verbose}) /gsay << %t >> is IMMUNE to slow.
        /call AddTo "Slow"
        /varset MobSlowed 1
        /varset ResistCounterSlow 0
        /return
      } else /if (${Macro.Return.Equal["CAST_RESIST"]}) {
        /varset ResistCounterSlow ${Math.Calc[${ResistCounterSlow}+1]}
        /if (${ResistCounterSlow}==${MaxResistSlow}) {
          /if (${DoDiseaseSlow}) {
            /call cast "${SpellDiseaseSlow}" gem3 ${CastRetryTime} CheckTarget
            /if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
              /if (${Verbose}) /gsay << %t >> has been SLOWED with ${SpellDiseaseSlow}.
            } else /if (${Macro.Return.Equal["CAST_RESIST"]}) {
              /if (${Verbose}) /gsay << %t >> has RESISTED disease slow. Giving up.
              /call AddTo "Slow"
              /varset MobSlowed 1
              /varset ResistCounterSlow 0
              /return
            }
          } else {
            /if (${Verbose}) /gsay << %t >> has RESISTED slow ${MaxResistSlow} times. Giving up.
          }
          /call AddTo "Slow"
          /varset MobSlowed 1
          /varset ResistCounterSlow 0
          /return
        } else /if (!${FastSlow}) {
          /if (${Verbose}) /gsay << %t >> has RESISTED slow. Trying again.
          /goto :Slow_Loop
        } else {
          /call AddTo "Slow"
          /varset MobSlowed 1
          /varset ResistCounterSlow 0
        }
      } else /if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
        /if (${Verbose}) /gsay << %t >> has been SLOWED with ${SlowUsed}.
        /call AddTo "Slow"
		/if (${DoHCSlow}) /timed 500 /varset SlowHCOn 0
        /varset MobSlowed 1
        /varset ResistCounterSlow 0
      }
    }
  }
/return
| ###############  Add to slow, cripple, debuff arrays
Sub AddTo(string AddType)
	/declare i int local
	/for i 1 to ${Target${AddType}.Size}
    /if (${Target.ID}==${Target${AddType}[${i}]}) /return
	/next i
	/for i ${Target${AddType}.Size} downto 2
    /varset Target${AddType}[${i}] ${Target${AddType}[${Math.Calc[${i}-1]}]}
	/next i
	/varset Target${AddType}[1] ${Target.ID}
	/if (${debug}) /echo Target${AddType}[1] ${Target.ID}
/return
| ###############  Remove from slow, cripple, debuff arrays
Sub RemoveFrom(string RemoveType, int TargetID)
	/declare i int local
	/declare index int local 0
	/for i 1 to ${Target${RemoveType}.Size}
    /if (${TargetID}==${Target${RemoveType}[${i}]}) {
	/varset index ${i}
	/varset Target${RemoveType}[${i}] NULL
    }
	/next i
	/if (${index}==0) /return
	/for i ${Math.Calc[${index}+1]} to ${Target${RemoveType}.Size}
    /varset Target${RemoveType}[${Math.Calc[${i}-1]}] ${Target${RemoveType}[${i}]}
  /next i
/return
| ###############  GetTarget - Grab the MAs target
Sub GetTarget
  /call AcquireTarget ${M_Assist} NPC 1
  /if (${Target.Type.Equal[NPC]} && ${Target.Distance}<=${AssistAt} && ${Target.ID}!=${TargetArray[4]} && ${Target.PctHPs}<=${CombatAt}) {
    /varset TargetArray[1] ${Target.CleanName}
    /varset TargetArray[2] ${Target.Level}
    /varset TargetArray[3] ${Target.Name}
    /varset TargetArray[4] ${Target.ID}
    /varset CombatOn 1
    /varset MobRooted 0
    /varset MobMaloed 0
    /varset MobSlowed 0
    /varset MobCrippled 0
    /varset PetOn 0
    /varset MobDoted 0
    /varset MobDoted2 0
	/varset MobDoted3 0
	/varset MobDoted4 0
	/varset SlowHCOn 0
	/varset AASlowOn 0
    /varset AAExp ${Math.Calc[${Me.PctAAExp}-${AAExp}]}
    /varset Exper ${Math.Calc[${Me.PctExp}-${Exper}]}
    /echo EXP: ${Exper}:${Me.PctExp}% - AAXP: ${AAExp}:${Me.PctAAExp}% - ${Math.Calc[${Macro.RunTime}/60]} minutes
    /popup EXP: ${Exper}:${Me.PctExp}% - AAXP: ${AAExp}:${Me.PctAAExp}% - ${Math.Calc[${Macro.RunTime}/60]} minutes
    /varset Exper ${Me.PctExp}
    /varset AAExp ${Me.PctAAExp}
  }
/return
| ### NewTarget is the name of the PC/NPC/PET/Merc you want to target
| ### TargetType is one of PC/NPC/PET/Merc
| ### AssistYN indicates whether you want to assist the NewTarget or you want it to be your target
Sub AcquireTarget(string NewTarget, string TargetType, int AssistYN)
/declare loopcount int local 0
	/if (${TargetType.Equal[Mount]}) /varset TargetType PC
  :LoopAcquireTarget 
    /varcalc loopcount ${loopcount}+1
	 /if (${debug}) /echo ${loopcount} ${TargetType} ${NewTarget} ${AssistYN} ${Spawn[${TargetType} ${NewTarget}].ID} 
    /if (${AssistYN}) { 
      /if (!${Spawn[${NewTarget}].ID}) /return 
      /assist ${NewTarget} 
    } else { 
      /if (!${Spawn[${TargetType} ${NewTarget}].ID}) /return 
      /squelch /target id ${Spawn[${TargetType} ${NewTarget}].ID} 
    } 
	/if (${loopcount}>=3) /return
    /delay ${AssistDelay} 
  /if (!${AssistYN} && ${Target.ID}!=${Spawn[${TargetType} ${NewTarget}].ID}) /goto :LoopAcquireTarget 
  /if (${debug}) /echo debug: Sub AcquireTarget leaving
/return 

| ################## Spell Interrupt Nukes and Dots
sub CheckTarget
  /if (!${Target.ID} || ${Target.Type.NotEqual[NPC]} || (${Target.PctHPs}<=${DotSkip} && (${Me.Casting.Name.Equal[${SpellDot}]} || ${Me.Casting.Name.Equal[${SpellDot2}]}))) /call Interrupt
/return

| ################## Spell Interrupt Subs
Sub CheckLevels
	/if (${Me.Casting.Name.Equal[${SpellCanni}]} && ${Math.Calc[(${Me.CurrentHPs}-${CanniDmgSpell})/${Me.MaxHPs}*100]}<${Math.Calc[${CanniMinPct}-5]}) {
		/call Interrupt
	} else /if (${Me.Casting.Name.Equal[Cannibalization]} && ${Math.Calc[(${Me.CurrentHPs}-${CanniDmgAA})/${Me.MaxHPs}*100]}<${Math.Calc[${CanniMinPct}-5]}) {
		/call Interrupt
	} else /if (${Me.Casting.Name.Equal[${SpellHeal}]} && ${Target.Name.Equal[${M_Assist}]}) {
		/return
	} else /if (${Me.Casting.Name.Equal[${SpellHeal}]} && ((${Select[${Target.Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]} && ${Target.PctHPs}>=(${CasterHeal}+10)) || (${Select[${Target.Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${Target.PctHPs}>=(${MeleeHeal}+10)))) {
		/call Interrupt
	} else /if (${Me.Casting.Name.Equal[${SpellHoT}]} && ((${Select[${Target.Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]} && ${Target.PctHPs}>=(${CasterHoT}+10)) || (${Select[${Target.Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${Target.PctHPs}>=(${MeleeHoT}+10)))) {
		/call Interrupt
	} else /if (${Me.Casting.Name.Equal[${SpellHoT}]} && ((${Select[${Target.Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]} && ${Target.PctHPs}<=(${CasterHeal}-8)) || (${Select[${Target.Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${Target.PctHPs}<=(${MeleeHeal}-8)))) {
		/call Interrupt
  }
/return
| ################## Check Tank Health for spell interrupt
Sub CheckTankHealth
 /if (${Spawn[${M_Assist}].ID} && ${Spawn[${M_Assist}].Distance}<${Spell[${SpellHeal}].Range} && ${Spawn[${M_Assist}].PctHPs}<=${TankHeal} && ${DoHeal} && ${HealTank}) {
  /call Interrupt 
  /if (${HealTank}) /call CheckHPs Tank
  } 
/return 
| ################## Check for all Healing - pass Tank/Group/Pet parameter to select type
Sub CheckHPs(string HealType) 
	/declare CheckHPsCounter int local 
	/declare HealTarget string local 
	/declare HealTargetType string local 
	/declare GroupHealth int local 0
	/declare i int local
	/declare j int local 
	/declare HealStart int local
	/declare OldTarget int local ${Target.ID}
  
	/if (${HealType.Equal[Tank]} && !${JoinedParty} && ${Spawn[${M_Assist}].ID}) {
		/if (${DoAIntervention} && ${Me.SpellReady[${SpellAIntervention}]} && ${Spawn[${M_Assist}].PctHPs}<=${AInterventionHeal} && ${Spawn[${M_Assist}].Distance}<${Spell[${SpellAIntervention}].Range}) {
			/call Castomatic ${M_Assist} ${M_Assist_type} 0 "${SpellAIntervention}" 10 ${CastRetryTime}
			/if (${Verbose}) /gsay  ${SpellAIntervention} for ${M_Assist}
		} else /if (${DoUnionAA} && ${Me.AltAbilityReady[Union of Spirits]} && ${Spawn[${M_Assist}].PctHPs}<=${UnionAAHeal} && ${Spawn[${M_Assist}].Distance}<${Me.AltAbility[Union of Spirits].Spell.Range}) {
			/call Castomatic ${M_Assist} ${M_Assist_type} 0 "662" alt ${CastRetryTime}
			/if (${Verbose}) /gsay Casting Union of Spirits AA on ${M_Assist}
		}
	}
	/if (${HealType.Equal[Group]}) {
		/for i 0 to ${Group.Members}
			/if (!${JoinedParty} && ${Group.Member[${i}].ID}) {
				/if (${DoAIntervention} && ${Me.SpellReady[${SpellAIntervention}]} && ${Group.Member[${i}].PctHPs}<=${AInterventionHeal} && ${Group.Member[${i}].Distance}<${Spell[${SpellAIntervention}].Range}) {
					/call Castomatic ${Group.Member[${i}]} ${Group.Member[${i}].Type} 0 "${SpellAIntervention}" 10 ${CastRetryTime}
					/if (${Verbose}) /gsay  ${SpellAIntervention} for ${Group.Member[${i}]}
				} else /if (${DoUnionAA} &&  ${Me.AltAbilityReady[Union of Spirits]} && ${Group.Member[${i}].PctHPs}<=${UnionAAHeal} && ${Group.Member[${i}].Distance}<${Me.AltAbility[Union of Spirits].Spell.Range}) {
					/call Castomatic ${Group.Member[${i}]} ${Group.Member[${i}].Type} 0 "662" alt ${CastRetryTime}
					/if (${Verbose}) /gsay Casting Union of Spirits AA on ${Group.Member[${i}]}
				}
			}
			/if (!${JoinedParty} && ${Group.Member[${i}].ID}) {
				/varcalc GroupHealth ${GroupHealth}+${Group.Member[${i}].PctHPs}
			} else {
				/varcalc GroupHealth ${GroupHealth}+100
			}
		/next i
		/if (${DoGHeal}) {
			/if  (${GroupHealth}/(${Group}+1)<${GHealGroupHealth} && (${Me.AltAbilityReady[Ancestral Aid]} || ${FindItem[${ItemGHeal}].Timer}==0)) {
				/if (${FindItem[${ItemGHeal}].Timer}==0) {
					/if (${Verbose}) /gsay Group heal incoming get close!
					/call cast "${ItemGHeal}" item ${CastRetryTime}
				} else /if (${Me.AltAbilityReady[Ancestral Aid]}) { 
					/if (${Verbose}) /gsay Group heal AA incoming get close!
					/call cast "447" alt ${CastRetryTime}
				}
			}
		}
	}
| - Set heal loop number 
	/if (${HealType.Equal[Tank]}) { 
		/varset HealStart 1
		/varset CheckHPsCounter 1
	} else /if (${HealType.Equal[Group]}) {
		/varset HealStart 1
		/varset CheckHPsCounter ${Group.Members}
	} else /if (${HealType.Equal[Pet]}) { 
	    /varset HealStart 0
		/varset CheckHPsCounter ${Group.Members} 
	} else /return
	
	/for j ${HealStart} to ${CheckHPsCounter}
	
		| - Set heal variables
		/if (${HealType.Equal[Tank]}) {
			/varset HealTarget ${M_Assist}  
			/varset HealTargetType ${M_Assist_type}
		} else /if (${HealType.Equal[Group]}) {
			/if (${HealTank} && ${Group.Member[${j}].Name.Equal[${M_Assist}]}) /next j
			/if (!${HealPuller} && ${Group.Member[${j}].Name.Equal[${PullPC}]}) /next j
			/varset HealTarget ${Group.Member[${j}]}
			/varset HealTargetType ${Group.Member[${j}].Type}
		} else  /if (${HealType.Equal[Pet]}) { 
			/varset HealTargetType Pet
			/varset HealTarget ${Group.Member[${j}].Pet} 
		} 

		/if (${DoHeal}) {
			/if ((${HealType.Equal[Tank]} && ${Spawn[${M_Assist}].ID} && ${Spawn[${M_Assist}].PctHPs}<=${TankHeal}) || (${HealType.Equal[Group]} && ${Group.Member[${j}].ID} && ((!${Group.Member[${j}].Name.Equal[${PullPC}]} && (${Select[${Group.Member[${j}].Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]} && ${Group.Member[${j}].PctHPs}<=${CasterHeal}) || (${Select[${Group.Member[${j}].Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${Group.Member[${j}].PctHPs}<=${MeleeHeal})) || (${Group.Member[${j}].Name.Equal[${PullPC}]} && ${Group.Member[${j}].Distance}<${HealPullerDistance} && ${Group.Member[${j}].State.NotEqual[feign]}))) || (${HealType.Equal[Pet]} && ${Group.Member[${j}].Pet.ID} && ${Group.Member[${j}].Pet.PctHPs}<=${PetHeal})) { 
				/if (${Me.CurrentMana}<${Spell[${SpellHeal}].Mana}) { 
					/echo >>> Not enough mana to --> heal ${HealTarget}
					/next j
				} else { 
					/call AcquireTarget ${HealTargetType} ${HealTarget} 0
					/if (!${Target.ID} || ${Target.Type.Equal[Corpse]} || ${Select[${Target.Type},Mercenary,PC,Pet]}==0 || ${Target.Distance}>${Spell[${SpellHeal}].Range}) /next j
					/call cast "${SpellHeal}" Gem6 ${CastRetryTime} CheckLevels 
					/if (${Macro.Return.Equal["CAST_SUCCESS"]} && ${Verbose}) /gsay << ${SpellHeal} >> on ${HealTarget}
				} 
			}
		}
		
		/if (${DoHoT}) {
			/if ((${HealType.Equal[Group]} && ${Group.Member[${j}].ID} && ((!${Group.Member[${j}].Name.Equal[${PullPC}]} && (${Select[${Group.Member[${j}].Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]} && ${Group.Member[${j}].PctHPs}<=${CasterHoT}) || (${Select[${Group.Member[${j}].Class.ShortName},BER,BRD,BST,MNK,PAL,RNG,ROG,SHD,WAR]} && ${Group.Member[${j}].PctHPs}<=${MeleeHoT})) || (${Group.Member[${j}].Name.Equal[${PullPC}]} && ${Group.Member[${j}].Distance}<${HealPullerDistance} && ${Group.Member[${j}].State.NotEqual[feign]})) && ${GroupHoT[${j}]}==0) || (${HealType.Equal[Pet]} && ${Group.Member[${j}].Pet.ID}  && ${Group.Member[${j}].Pet.PctHPs}<=${PetHoT} && ${GroupHoTPet[${j}]}==0) || (${HealType.Equal[Tank]} && ${Spawn[${M_Assist}].ID} && ${Spawn[${M_Assist}].PctHPs}<=${TankHoT} && ${TankHoTOn}==0)) { 
				/if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) 	{
					/echo >>> Not enough mana to --> HoT ${HealTarget}
					/next j
				} else {
					/call AcquireTarget ${HealTargetType} ${HealTarget} 0
					/if (!${Target.ID} || ${Target.Type.Equal[Corpse]}  || ${Select[${Target.Type},Mercenary,PC,Pet]}==0 || ${Target.Distance}>${Spell[${SpellHoT}].Range}) /next j
					/call cast "${SpellHoT}" Gem5 ${CastRetryTime} CheckLevels 
					/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
						/if (${Verbose}) /gsay << ${SpellHoT} >> on ${HealTarget}
						/if (${HealType.Equal[Tank]} && ${Target.CleanName.Equal[${M_Assist}]})  /varset TankHoTOn 1
						/if (${HealType.Equal[Group]}) /varset GroupHoT[${j}] 1
						/if (${HealType.Equal[Pet]}) /varset GroupHoTPet[${j}] 1 
					}
				}
			} 
		}	
			
	/next j
	/if (${Target.ID}!=${OldTarget} && ${Spawn[${OldTarget}].ID}) /target ID ${OldTarget}
/return
| ################## Canni check
Sub Cannibalization
  /if (${Math.Calc[${Me.CurrentHPs}-${CanniDmgAA}]}<${Math.Calc[${CanniDmgAA}+(${Me.MaxHPs}*.15)]}) { 
    /call CheckMyHPs
  } else /if (${DoCanniAA}) {
    /if (${Verbose}) /gsay Cannibalization time -- don't be afraid I only eat myself.
    /call cast "47" alt ${CastRetryTime} CheckLevels
    /call CheckMyHPs
  }
/return
| ################## controls healing of Shaman
Sub CheckMyHPs
  /if (${Me.PctHPs}<${CanniHeal}) {
    /if (${Me.CurrentMana}<${Spell[${SpellHeal}].Mana}) {
      /echo >>> I don't have mana to cast ${SpellHeal} on myself
    } else {
      /call AcquireTarget ${Me} PC 0
      /call cast "${SpellHeal}" gem6 ${CastRetryTime}
    }
  }
  /if (!${Me.Song[${SpellHoT}].ID} && ${Me.PctHPs}<${CanniHoT}) {
      /if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) {
        /echo >>> I don't have mana to cast ${SpellHoT} on myself
      } else {
        /call AcquireTarget ${Me} PC 0
        /call cast "${SpellHoT}" gem5 ${CastRetryTime}
      }
    }
  /return
| ################## This will Check to see if I am Low on Mana
Sub LowOnMana
	/if (${Engaged} && ${Me.PctMana}>=${CanniCombatPct}) /return
	/if (${Me.PctHPs}<${CanniHoT}) /call CheckMyHPs
	/if (${DoCanni} && (${Me.PctMana}<=${CanniManaPct}) && ${Me.SpellReady[${SpellCanni}]} && (${Me.PctHPs}>=${CanniMinHpPct})) /call cast "${SpellCanni}" gem1 ${CastRetryTime}
	/if (${DoCanni} && ${DoCanniAA} && ${Me.AltAbilityReady[47]} && ${Me.CurrentMana}<${Math.Calc[${Me.MaxMana}-${CanniMana}]} && ${Me.CurrentHPs}>${Math.Calc[${CanniDmgAA}+${Math.Calc[${Me.MaxHPs}*.15]}]}) /call Cannibalization
/return

| ################## Cast_Haste casts haste spell or item if defined
Sub Cast_HASTE
    /call cast "${SpellHaste}" gem${MiscGem} ${CastRetryTime}
/return
| ################## Summon pet and buff with spells from PetBuffs array
Sub PetRoutines
    /if (${Me.Pet.CleanName.Equal[${Me.Name}`s familiar]}) /pet get lost
    /if (!${Me.Pet.ID} && ${Me.AltAbility[Suspended Minion]} && ${Me.AltAbility[Persistent Minion]}) {
      /call cast "176" alt ${CastRetryTime}
      /delay 6s ${Me.Pet.ID}
      /if (${Me.Pet.ID}) /varset PetSuspended 0
    }
    /if (!${Me.Pet.ID} && ${Spell[${SpellPet}].Mana}<=${Me.CurrentMana}) {
      /delay 3
      /if (${Me.Pet.ID}) /return
      /call cast "${SpellPet}" gem${MiscGem} ${CastRetryTime}
      /delay 30 ${Me.SpellReady[${SpellPet}]}
      /echo My pet is now: ${Me.Pet.CleanName} - ${SpellPet}
    } else /if (${DoPetBuffs} && ${Me.Pet.ID}) {
    /call Buffomatic SingleBuff ${Spawn[pc ${ChatSender}].Pet.Name} PET 0 ${MiscGem} 
	}
    /if (${DoPetFocus} && !${PetFocused} && ${Me.AltAbility[Advanced Pet Discipline]}) {
      /pet focus on
      /varset PetFocused 1
      /if (${DoPetHold} && ${Me.AltAbility[Pet Discipline]}) {
        /pet hold on
        /varset PetHeld 1
      }
    }
/return

| ################# Autofollow ChatController
Sub AutoFollow
   /if (!${Spawn[${AutoFollowPC}].ID} || ${Me.Moving} || ${Spawn[${AutoFollowPC}].Distance}<(${AFDist}-1)) /return
   /call AcquireTarget ${AutoFollowPC} PC 0
   /if (${Me.Mount.ID} && ${Spawn[${AutoFollowPC}].Distance}>(${AFDist}+1)) /dismount
   :FollowLoop
	/if (!${AutoFollow}) /return
     /if (!${Target.Name.Equal[${AutoFollowPC}]}) /call AcquireTarget ${AutoFollowPC} PC 0
     /face fast
     /if (${Spawn[${AutoFollowPC}].Distance}>${AFDist}) /keypress forward hold
     /if (${Spawn[${AutoFollowPC}].Distance}<(${AFDist}-1)) /keypress back
     /doevents
   /if (${Spawn[${AutoFollowPC}].ID} && ${AutoFollow} && ${Spawn[${AutoFollowPC}].Distance}>${AFDist}) /goto :FollowLoop
   /keypress forward
   /keypress back
   /delay 5
   /if (${Spawn[${AutoFollowPC}].Distance}>${AFDist}) /goto :FollowLoop
/return
| ################# Resets Variables for Zoning/dying etc.
Sub ResetAllVariables
  /declare i int local
  | ### HoT variables
  /varset  TankHoTOn 0
  /for i 1 to ${GroupHoT.Size}
    /varset GroupHoT[${i}] 0
    /varset GroupHoTPet[${i}] 0
  /next i
  | ### Combat Arrays
  /for i 1 to ${DebuffArray.Size}
    /varset TargetSlow[${i}] NULL
    /varset TargetDebuff[${i}] NULL
    /varset TargetCripple[${i}] NULL
  /next i
  | ### Misc Variables
  /varset TargetArray[1] NULL
  /varset TargetArray[2] NULL
  /varset TargetArray[3] NULL
  /varset TargetArray[4] NULL
  /varset CombatOn 0
  /varset Engaged 0
  /varset MobRooted 0
  /varset MobMaloed 0
  /varset MobSlowed 0
  /varset MobCrippled 0
  /varset PetOn 0
  /varset MobDoted 0
  /varset MobDoted2 0
  /varset MobDoted3 0
  /varset MobDoted4 0
  /varset AutoFollow 0
  /varset PetFocused 0
  /varset PetHeld 0
  /varset SlowHCOn 0
  /varset AASlowOn 0
/return
| ################## Sub Accept Rez
Sub Accept_rez
	/if (!${AcceptRez}) /return
	/timed 7000 /varset varDead 0
	:wait
	/doevents
	/delay 5s ${Window[ConfirmationDialogBox].Open}
	/if (!${Window[ConfirmationDialogBox].Open} && ${varDead}) /goto :wait
	/if (${Window[ConfirmationDialogBox].Open}) {
		/nomodkey /notify ConfirmationDialogBox Yes_Button leftmouseup
		/varset varDead 0
	}
	/delay 5s
	/if (${Window[RespawnWnd].Open}) /nomodkey /notify RespawnWnd RW_OptionsList listselect 2
	/delay 5s
	/if (${Window[RespawnWnd].Open}) /nomodkey /notify RespawnWnd RW_SelectButton leftmouseup 
/return 
| ################## Hungry
Sub Event_Hungry
  /if (${Engaged}) /return
  /echo I am Hungry
  /if (${Verbose}) /gsay Summoning Food, hold pulls for 30 secs.
  /declare i int local
  /for i 1 to 8
     /call cast "${SpellFood}" gem${MiscGem} ${CastRetryTime}
	/delay 1
	   /autoinventory
    /delay 1
  /next i
  /if (${Verbose}) /gsay Ready for pulls again.
/return
| ################## Thirsty
Sub Event_Thirsty
  /if (${Engaged}) /return
  /echo I am Thirsty
  /if (${Verbose}) /gsay Summoning Drink, hold pulls for 30 secs.
  /declare i int local
  /for i 1 to 8
    /call cast "${SpellDrink}" gem${MiscGem} ${CastRetryTime}
	/delay 1
    /autoinventory
    /delay 1
  /next i
  /if (${Verbose}) /gsay Ready for pulls again.
/return
| ##################  ENRAGE ON
Sub Event_Enrageon
   /if (${PetOn}) {
     /echo Mob is ENRAGED!
     /pet back off
     /if (${DoPetHold} && ${Me.AltAbility[Pet Discipline]}) {
       /pet hold on
       /varset PetHeld 1
     }
   }
/return
| ##################  Skip Writing Aliases if they exist
Sub Event_WriteAliases
/varset SBAliases 1
/return
| ##################  ENRAGE OFF
Sub Event_Enrageoff
   /if (${PetOn}) {
     /echo Mob is no longer Enraged!
     /if (${DoPetHold} && ${Me.AltAbility[Pet Discipline]}) {
       /varset PetHeld 0
     }     /pet attack
   }
/return
| ################## Outdoors
Sub Event_OutDoor
  /echo This is an indoor zone. Sorry.
  /varset OutDoors 0
/return
| ################## Joined Party
Sub Event_Joined(string ChatType,string ChatSender)
/echo ${ChatSender} has joined the party.
/varset JoinedParty 1
/timed 20s /varset JoinedParty 0
| Space for healing fix when characters join group
/return
| ##################  Zoning
Sub Event_Zoning
  /delay 10s ${Me.ID}
  /if (${DoShrink} && !${varDead}) {
    /echo I zoned, time to shrink
	/varset GroupShrunk 0
    /call Shrink_Group
  }
  /call ResetAllVariables
  /if (${DoPetFocus} && ${Me.AltAbility[Advanced Pet Discipline]}) {
    /pet focus on
    /varset PetFocused 1
  }
  /if (${DoPetHold} && ${Me.AltAbility[Pet Discipline]}) {
    /pet hold on
    /varset PetHeld 1
  }
/return

| ##################  Group Invite
Sub Event_Invited(string ChatType,string ChatSender)
  /if (!${BuffBot}) {
    /if (${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
      /invite
    } else /if (${DoGuildInvites}) {
      /call AcquireTarget ${ChatSender} PC 0
      /if (${Target.Guild.Equal[${Me.Guild}]}) {
        /invite
      }
    } else /if (${DoAllInvites}) {
      /invite
    }
  }
/return
| ################## I Died
Sub Event_ImDead
	/echo I have died. And the Angels wept. 
	/call ResetAllVariables
	/varset varDead 1
	/call Accept_rez
/return
| ################# EQBC Chat handler
Sub Event_EQBC(EQBCSay,EQBCSender,EQBCCommand) 
	/if (!${Defined[EQBCSender]}) /declare EQBCSender string local LOCAL
	/call Event_Chat eqbc ${EQBCSender} ${EQBCCommand}
	/return
	

| ################# Tells n Hells
Sub Event_Chat(string ChatType,string ChatSender,string ChatTextRaw)
	/if (${ChatType.Equal[TELL]} && ${Select[${Spawn[${ChatSender}].Type},NPC,PET]}) /return
	/if (${ChatSender.Equal[local]}) /varset ChatSender ${Me.Name}
	/if (${ChatType.Equal[TELL]} && ${ChatSender.Left[1].Compare[ ]}<0) /varset ChatSender ${ChatSender.Right[-2].Left[-1]}
	/if (!${BuffBot} && ${Select[${ChatType},eqbc,GROUP,TELL,RAID]}>0 && ${Select[${ChatSender},${Me},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}>0) 	/varset ChatText ${ChatTextRaw}
	/if (${debug}) /echo debug:  buffbot: ${BuffBot}  ChatType ${Select[${ChatType},eqbc,GROUP,TELL,RAID]}  Chatcontroller: ${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]} ${ChatText} ${ChatTextRaw}
	/if (!${Select[${ChatType},eqbc,GROUP,TELL,RAID]} || ${ChatSender.Equal[${Me.Pet.CleanName}]} || (${Me.Invis} && !${Select[${ChatText},autofollow,breakinvis]}) || ${Select[${ChatText},I,NULL]} || (!${Spawn[${ChatSender}].ID} && !${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]})) /return
	/if (!${BuffBot}) {
		/if (!${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
			/if (${ChatType.Equal[TELL]}) {
				/if (${DoChatChannel}) /${ChatHere} <TELL> [${ChatSender}]: ${ChatTextRaw}
				/return
			}
		/if (${ChatType.Equal[GROUP]} && ${GroupChatRelay}) {
			/if (${DoChatChannel}) /${ChatHere} <GROUP CHAT> [${ChatSender}]: ${ChatTextRaw}
			/if (${DoGroupCommands}) /return /varset ChatText ${ChatTextRaw}
			/if (!${DoGroupCommands}) /return
			}
		/if (${ChatType.Equal[RAID]} && ${RaidChatRelay})  {
			/if (${DoChatChannel}) /${ChatHere} <RAID CHAT> [${ChatSender}]: ${ChatTextRaw}
        /return
      }
    }
  }
  /if (${Select[${ChatText},breakinvis]} && ${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
    /call AcquireTarget ${Me} PC 0
    /if (${Target.Type.Equal[PC]}) {
	/echo I am here
      /cast "${SpellHoT}" gem5 
      /call Interrupt
    }
    /return
  }
    /if (${Select[${ChatText},domount]} && ${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) /multiline ; /echo /domount ; /call Mount

| ################# Heal Requests
	/if (${Select[${ChatText},heal,healme]})  /call Castomatic ${ChatSender} PC 0 "${SpellHeal}" 6
	/if (${Select[${ChatText},hot,hotme]}) /call Castomatic ${ChatSender} PC 0 "${SpellHoT}" 5
	/if (${Select[${ChatText},gheal,healgroup,groupheal]})  /call Castomatic ${ChatSender} PC 0 "${SpellAIntervention}" 9
	/if (${Select[${ChatText},aid,aidme]} && ${Me.AltAbilityReady[447]}) /call Castomatic ${ChatSender} PC 0 447 alt
	/if (${Select[${ChatText},rc,radiant]} && ${Me.AltAbilityReady[153]}) /call Castomatic ${ChatSender} PC 0 153 alt
| ################# Mob Requests
    /if (${Select[${ChatText},slow,add]}) {
      /call AcquireTarget ${ChatSender} NPC 1
      /if (${Target.Type.Equal[NPC]} && ${Target.Distance}<=${AssistAt}) {
        /if (${DoMalo}) /call cast "${SpellMalo}" gem2 ${CastRetryTime} CheckTarget
        /if (${DoMalo} && ${VerboseTell}) /tell ${ChatSender} %t has had ${SpellMalo} cast on it.
        :Slow_Loop2
          /call cast "${SpellSlow}" gem3 ${CastRetryTime} CheckTarget
          /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) /goto :Slow_Loop2
          /if (${Macro.Return.Equal["CAST_IMMUNE"]}) {
            /if (${VerboseTell}) /tell ${ChatSender} << %t >> is IMMUNE to slow.
            /call AddTo "Slow"
          }
          /if (${Macro.Return.Equal["CAST_RESISTED"]}) {
            /if (!${FastSlow}) {
              /if (${VerboseTell}) /tell ${ChatSender} << %t >> has RESISTED slow..
            }
          }
          /if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
            /if (${VerboseTell}) /tell ${ChatSender} << %t >> has had ${SpellSlow} cast on it.
            /call AddTo "Slow"
          }
      }
      /return
    }
    /if (${Select[${ChatText},root]} && ${Me.AltAbilityReady[Virulent Paralysis]}) /call Castomatic ${ChatSender} NPC 1 171 alt
	/if (${Select[${ChatText},root]} && !${Me.AltAbilityReady[Virulent Paralysis]}) /call Castomatic ${ChatSender} NPC 1 "${SpellRoot}" ${MiscGem}
	/if (${Select[${ChatText},nuke,boom]}) /call Castomatic ${ChatSender} NPC 1 "${SpellNuke}" 2	
	/if (${Select[${ChatText},Dot]}) /call Castomatic ${ChatSender} NPC 1 "${SpellDot}" 4
	/if (${Select[${ChatText},Dot2]}) /call Castomatic ${ChatSender} NPC 1 "${SpellDot2}" ${MiscGem}
	/if (${Select[${ChatText},epic]}) /call Castomatic ${ChatSender} NPC 1 "Spear of Fate" item
	/if (${Select[${ChatText},epic1]}) /call Castomatic ${ChatSender} PC 0 "Crafted Talisman of Fates" item
	/if (${Select[${ChatText},epic2]}) /call Castomatic ${ChatSender} PC 0 "Blessed Spiritstaff of the Heyokah" item
	/if (${Select[${ChatText},aeslow]} && ${Me.AltAbilityReady[Tigir's Insect Swarm]}) /call Castomatic ${ChatSender} NPC 1 856 alt
| ################# buffs ok to ask for in combat
    /if (${Select[${ChatText},panther,pan]})  /call Castomatic ${ChatSender} PC 0 "${SpellPanther}" ${MiscGem}
    /if (${Select[${ChatText},haste]}) /call Castomatic ${ChatSender} PC 0 "${SpellHaste}" ${MiscGem}
	/if (${Select[${ChatText},wg,wild,temphp]}) /call Castomatic ${ChatSender} PC 0 "${SpellTempHP}" ${MiscGem}
| #################  autofollow request & MakeCamp
  /if (${Select[${ChatText},autofollow]} && ${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
    /varset AutoFollowPC ${ChatSender}
    /if (${AutoFollow}==0) {
      /varset AutoFollow 1
	/if (${DoChatChannel}) /${ChatHere} Auto Follow: On
      /if (${DoCamp}) /makecamp off
    } else {
      /varset AutoFollow 0
	  /if (${DoChatChannel}) /${ChatHere} Auto Follow: Off
      /if (${DoCamp}) /makecamp on
    }
    /echo Auto Follow: ${AutoFollow}
    /return
  }

  /if (${Select[${ChatText},camphere]} && ${ChatSender.Equal[${ChatController}]} && ${DoCamp}) {
    /makecamp on
    /echo New Camp Set
    /return
  }
| ################### Go Home
 /if (${Select[${ChatText},gatenow,gate]} && ${ChatType.Equal[TELL]} && ${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
   /call cast "${SpellGate}" gem${MiscGem}
   /return
 }
 /if (${Engaged}) /return
| ################# Buff Requests
    /if (${Select[${ChatText},invis]}) /call Castomatic ${ChatSender} PC 0 "${SpellInvis}" ${MiscGem} 
	/if (${Select[${ChatText},selfinvis]} && ${Me.AltAbilityReady[859]}) /call Castomatic ${Me} PC 0 859 alt
	/if (${Select[${ChatText},selfinvis]}) /call Castomatic ${Me} PC 0 "${SpellInvisSelf}" ${MiscGem}
    /if (${Select[${ChatText},focus,wunshi]}) /call Castomatic ${ChatSender} PC 0 "${SpellFocus}" ${MiscGem}
	/if (${Select[${ChatText},cha]}) /call Castomatic ${ChatSender} PC 0 "${SpellCha}" ${MiscGem}
	/if (${Select[${ChatText},sow]}) /call Castomatic ${ChatSender} PC 0 "${SpellSow}" ${MiscGem}
    /if (${Select[${ChatText},grow]}) /call Castomatic ${ChatSender} PC 0 "${SpellGrow}" ${MiscGem}
    /if (${Select[${ChatText},shrink,shrinkme]}) /call Castomatic ${ChatSender} PC 0 "${SpellShrink}" ${MiscGem}
    /if (${Select[${ChatText},acumen]})	/call Castomatic ${ChatSender} PC 0 "${SpellSee}" ${MiscGem}
	/if (${Select[${ChatText},laq,lanquor,sloth,listlessness]}) /call Castomatic ${ChatSender} PC 0 "${SpellDefProc}" ${MiscGem}
	/if (${Select[${ChatText},str,might,strength]}) /call Castomatic ${ChatSender} PC 0 "${SpellStr}" ${MiscGem}
	/if (${Select[${ChatText},dex]}) /call Castomatic ${ChatSender} PC 0 "${SpellDex}" ${MiscGem}
	/if (${Select[${ChatText},sta,fort,fortitude]}) /call Castomatic ${ChatSender} PC 0 "${SpellSta}" ${MiscGem}
	/if (${Select[${ChatText},sense,agi]}) /call Castomatic ${ChatSender} PC 0 "${SpellAgi}" ${MiscGem}
    /if (${Select[${ChatText},regen]}) /call Castomatic ${ChatSender} PC 0 "${SpellRegen}" ${MiscGem}
	/if (${Select[${ChatText},ac]}) /call Castomatic ${ChatSender} PC 0 "${SpellAC}" ${MiscGem}
	/if (${Select[${ChatText},unity]}) /call Castomatic ${ChatSender} PC 0 "${SpellUnity}" ${MiscGem}
	/if (${Select[${ChatText},lev,levitate]} && ${Me.AltAbilityReady[Perfected Levitation]}) /call Castomatic ${ChatSender} PC 0 "Perfected Levitation" alt
	/if (${Select[${ChatText},lev,levitate]}) /call Castomatic ${ChatSender} PC 0 "${SpellLev}" ${MiscGem}
	/if (${Select[${ChatText},res,rez,resme,rezme]} && ${Me.AltAbilityReady[Call of the Wild]}) {
      /squelch /target clear
	  /call Castomatic ${ChatSender} CORPSE 0 "404" alt
      /if (${Target.Type.Equal[CORPSE]} && ${Target.Distance}<=${AssistAt}) {
         /if (${VerboseTell}) /tell ${ChatSender} incoming SHAMAN rez, DO NOT LOOT ALL OF YOUR CORPSE!
      }
      /return
    }

| ################# Group Buff Requests
    /if (${Select[${ChatText},ghaste,grouphaste,marshmallows,marshmallow]}) /call Castomatic ${ChatSender} PC 0 "${SpellGHaste}" ${MiscGem}
	/if (${Select[${ChatText},gfocus,groupfocus,gwunshi,groupwunshi]}) 	/call Castomatic ${ChatSender} PC 0 "${SpellGFocus}" ${MiscGem}
	/if (${Select[${ChatText},gsta,groupsta,gfort,groupfort]}) /call Castomatic ${ChatSender} PC 0 "${SpellGSta}" ${MiscGem} 
	/if (${Select[${ChatText},gagi,groupagi,gsense,groupsense]}) /call Castomatic ${ChatSender} PC 0 "${SpellGAgi}" ${MiscGem}
	/if (${Select[${ChatText},gregen,groupregen]}) /call Castomatic ${ChatSender} PC 0 "${SpellGRegen}" ${MiscGem} 
	/if (${Select[${ChatText},gstr,groupstr,gmight,groupmight]}) /call Castomatic ${ChatSender} PC 0 "${SpellGStr}" ${MiscGem} 
	/if (${Select[${ChatText},gunity]}) /call Castomatic ${ChatSender} PC 0 "${SpellGUnity}" ${MiscGem} 
	/if (${Select[${ChatText},gshrink,groupshrink]} && ${Me.AltAbility[9503]}>0 && ${Me.AltAbilityReady[9503]}) /call Castomatic ${Me} PC 0 9503 alt
	/if (${Select[${ChatText},gshrink,groupshrink]}&& !${Me.AltAbility[9503]}) /call Castomatic ${ChatSender} PC 1 "${SpellGShrink}" ${MiscGem}
	/if (${Select[${ChatText},avatar,champion,champ]}) /call Castomatic ${ChatSender} PC 0 "${SpellGAvatar}" ${MiscGem} 
    /if (${Select[${ChatText},pr,tribunal,trib]}) /call Castomatic ${ChatSender} PC 0 "${SpellPR}" ${MiscGem}
	
| ################# All Buffs Request for Target (ChatController or Masters only)
	/if (${Select[${ChatSender},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) {
		/if (${Select[${ChatText},bufftarget,bufftar]}) {
			/echo Request for Buffing Sender's Target
			/call Buffomatic SingleBuff ${ChatSender} 1 ${MiscGem} sb sbuffs
			/doevents flush Worn_off
			/return
		}
| ################# All Buffs Request
		/if (${Select[${ChatText},buff,buffme,buffs]}) {
			/echo Request for Single Buff
			/call Buffomatic SingleBuff ${ChatSender} 0 ${MiscGem} sb sbuffs
			/doevents flush Worn_off
			/return
		}
| ################# Group Buff other group
		/if (${Select[${ChatText},buffthem]}) {
			/echo Request to buff others group
			/call Buffomatic GroupBuffs ${ChatSender} 1 ${MiscGem} bgo gobuffs
			/doevents flush Worn_off
			/return
		}
| ################# Group shaman's group
		/if (${Select[${ChatText},buffgroup]}) {
			/echo Request to Buff shaman's group
			/call Buffomatic GroupBuffs ${Me} 0 ${MiscGem} bg gbuffs
			/doevents flush Worn_off
			/return
		}
| ################# Other Pet Buffing
		/if (${Select[${ChatText},buffpet]}) {
			/echo Request to Buff other's pet
			/call Buffomatic SingleBuff ${Spawn[pc ${ChatSender}].Pet.Name} 0 ${MiscGem} sb pobuffs
			/doevents flush Worn_off
			/return
		}
	}	
/return
| ################### Resets slow/malo arrays - resets HoT flags - rebuffs if DoRebuffs 1 
Sub Event_Worn_off(string Line, string myspell, string mytarget)
	/if (${myspell.Equal[${SpellGPanther}]} || ${myspell.Equal[${SpellPanther}]} || ${myspell.Equal[${SpellGAvatar}]} || ${myspell.Equal[${SpellAvatar}]}) /return
	/declare OldTarget string local
	/varset OldTarget ${Target.ID}
	/declare i int local

	/echo ${myspell} on ${mytarget} has worn off
	}
	/if (${myspell.Equal[${SpellHoT}]}) {
    /if (${M_Assist.Equal[${mytarget}]}) /varset TankHoTOn 0
    /for i 1 to ${Group.Members}
      /if (${Group.Member[${i}].CleanName.Equal[${mytarget}]}) {
        /varset GroupHoT[${i}] 0
      } else /if (${Group.Member[${i}].Pet.CleanName.Equal[${mytarget}]}) {
        /varset GroupHoTPet[${i}] 0
      }
    /next i
    /return
  } else /if (${myspell.Equal[${SpellSlow}]} || ${myspell.Equal[${SpellMalo}]} || ${myspell.Equal["Turgur's Swarm"]} || ${myspell.Equal[${SpellCripple}]}) {  
    /if (${myspell.Equal[${SpellMalo}]}) {
		/echo removing ${TargetArray[1]}[${TargetArray[4]}] from Debuff Array
		/call RemoveFrom "Debuff" ${Target.ID}
		/varset MobMaloed 0
		/call Debuff
		/squelch /target id ${OldTarget}
		/return
    } else /if (${myspell.Equal[${SpellSlow}]} || ${myspell.Equal["Turgur's Swarm"]} || || ${myspell.Equal[${SpellHCSlow}]}) {
       /echo removing ${TargetArray[1]}[${TargetArray[4]}] from Slow Array
       /call RemoveFrom "Slow" ${Target.ID}
	   /varset SlowHCOn 0
       /varset MobSlowed 0
       /squelch /target id ${OldTarget}
       /return
    } else /if (${myspell.Equal[${SpellCripple}]}) {
		/echo removing ${TargetArray[1]}[${TargetArray[4]}] from Cripple Array
		/call RemoveFrom "Cripple" ${Target.ID}
		/varset MobCrippled 0
		/call Debuff
		/squelch /target id ${OldTarget}
		/return
    }
	} else /if (${myspell.Equal[${SpellDot}]} || ${myspell.Equal[${SpellDot2}]}) {
		/varset OldTarget ${Target.ID}
		/call AcquireTarget "${mytarget}" NPC 0
		/if (${Target.CleanName.Equal[${mytarget}]} && ${Target.Distance}<${Spell[${myspell}].Range}) {
			/call cast "${myspell}" gem4 ${CastRetryTime} CheckTarget
		}
	| - Sloth/Listlessness rebuff
	} else /if (${myspell.Equal[${SpellDefProc}]}) {
		/varset DefProcID 0
		/return
	| - Wild growth rebuff
	} else /if (${myspell.Equal[${SpellTempHP}]}) {
		/varset TempHPID 0
		/return
	} else /if (${DoRebuffs} && !${Engaged}) {
		/call AcquireTarget "${mytarget}" ${Spawn[${mytarget}].Type} 0
		/if (${Target.CleanName.Equal[${mytarget}]} && ${Target.Distance}<${AssistAt} && ${Select[${Spawn[${Target}].Type},Mercenary,PC,PET]}>0 && (${Group.Member[${mytarget}]} || ${${mytarget}.Pet.ID})) {
			/if (!${DoUnity} || !${DoGUnity}) /call Castomatic ${mytarget} ${Spawn[${mytarget}].Type} 0 "${myspell}" ${MiscGem}
				/if (${DoUnity} || ${DoGUnity}) {
					/if (!${DoGroupBuffs} && (${myspell.Equal[${SpellStr}]} || ${myspell.Equal[${SpellAgi}]} || ${myspell.Equal[${SpellFocus}]} || ${myspell.Equal[${SpellSta}]})) {
						/call Castomatic ${mytarget} ${Spawn[${mytarget}].Type} 0 "${SpellUnity}" ${MiscGem} 
						/delay 3s !${Me.Casting.ID}
					/doevents flush Worn_off
				} else 	/if (${DoGroupBuffs} && (${myspell.Equal[${SpellGStr}]} || ${myspell.Equal[${SpellGAgi}]} || ${myspell.Equal[${SpellGFocus}]} || ${myspell.Equal[${SpellGSta}]})) {
					/call Castomatic ${mytarget} ${Spawn[${mytarget}].Type} 0 "${SpellGUnity}" ${MiscGem} 
					/delay 3s !${Me.Casting.ID}
					/if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
						/doevents flush Worn_off
						}
				} else {
				/call Castomatic ${mytarget} ${Spawn[${mytarget}].Type} 0 "${myspell}" ${MiscGem}
				}
			}
		}
		/squelch /target id ${OldTarget}
		/if (${debug}) /echo leaving grab ${OldTarget}
		/call memSpells
		/return
    }
	/return
| - Find and Assign multi part spells Foresight and Unity 
Sub Detectomatic
	/if (${Me.Level}<=70 || ${PLMode}) /return
	/declare FVar int local
	/declare GFVar int local
	/declare UVar int local
	/declare GUVar int local
	/declare a  local , , Rk. II , Rk. III ,
	/declare b  local Preternatural Foresight|Talisman of Foresight|Unity of the Spirits|Talisman of Unity|
	/declare c  local Mammoth's Strength|Transcendent Foresight|Darkpaw Focusing|Spirit of Determination|
	/declare d 	local SpellStr|SpellAgi|SpellFocus|SpellSta|SpellGStr|SpellGAgi|SpellGFocus|SpellGSta|
	/declare e  local
	/declare f  local
	/declare g  local
	/declare i int local
	/declare j int local
	/declare k int local 0
	/declare l int local 0
		:FindUnity
	/for k 1 to 4
	/for i 1 to 3
	/varset e ${b.Arg[${k},|]}${a.Arg[${i},,].Left[-1]}
	/if (${Me.Book[${e}]} && ${k}==1 && (!${Me.Book[${e}]} && ${k}==3) && ${Me.Level}>=71) /varset SpellAgi ${e}
	/if (${Me.Book[${e}]} && ${k}==2 && (!${Me.Book[${e}]} && ${k}==4) && ${Me.Level}>=74) /varset SpellGAgi ${e}
	/if (${Me.Book[${e}]} && ${k}==3 && ${Me.Level}>=81) /varset SpellUnity ${e}
	/if (${Me.Book[${e}]} && ${k}==4 && ${Me.Level}>=85) /varset SpellGUnity ${e}
	/next i
	/next k
	/varset FVar ${Select[${Spell[${SpellAgi}].ID},9959,9960,9961]}
	/if (${FVar}>0) /varset DoForesight 1
	/varset GFVar ${Select[${Spell[${SpellGAgi}].ID},10011,10012,10013]}
	/if (${GFVar}>0) /varset DoGForesight 1
	/varset UVar ${Select[${Spell[${SpellUnity}].ID},19472,19473,19474]}
	/if (${UVar}>0) /varset DoUnity 1
	/varset GUVar ${Select[${Spell[${SpellGUnity}].ID},19475,19476,19477]}
	/if (${GUVar}>0) /varset DoGUnity 1
		:AssignSBVars
	/for j 1 to 4
	/varcalc l ${l}+1
	/for i 1 to 3
	/varset g ${c.Arg[${j},|]}${a.Arg[${i},,].Left[-1]}
	/if (${FVar}==${i} && ${j}==1) /varset ${d.Arg[${l},|]} ${g}
	/if (${GFVar}==${i} && ${j}==1) /varset ${d.Arg[${Math.Calc[${l}+4]},|]} ${g}
	/if (${UVar}==${i} && ${j}==${l}) /varset ${d.Arg[${l},|]} ${g}
	/if (${GUVar}==${i} && ${j}==${l}) /varset ${d.Arg[${Math.Calc[${l}+4]},|]} ${g}
	/next i
	/next j
	/return
	
| ################### Check & Cast ALL Buffs Here
| - The Buffomatic for Shamans
Sub Buffomatic(string buffSet,string buffTarget,int buffAssist,string buffType,string buffKey,string buffOnOff)
	/if (${Engaged}) /return
	/declare i int local
	/declare TheBuff local
	/for i 1 to ${${buffSet}.Size}
	/varset TheBuff ${${buffSet}[${i}]}
	| ---- Clicky Items
	/if (${Select[${buffSet},ClickyItem]}) {
		/if (${FindItemCount[${TheBuff}]}<=0 || ${Me.Buff[${FindItem[${TheBuff}].Spell}].ID}) /goto :Skipbuff
		/if (${FindItem[${TheBuff}].Spell.Stacks} && !${Me.Buff[${FindItem[${TheBuff}].Spell}].ID}) /goto :StartBuffing
	}
	| - Check matrix is buff on/off
	/if (${${buffOnOff}.Arg[${i},|].Find[0]}) {
		/goto :Skipbuff
		| ---- Group Buffs
		} else /if (${Select[${buffSet},GroupBuffs]} && (!${Me.Buff[${TheBuff}].ID} || ${Select[${buffKey},bg,bgo]})) {
			/if (!${DoGUnity}) {
				/if (!${DoGForesight}) {
					/goto :StartBuffing 
				| ---- Shaman's Group Buffs Lv 74 to 81	Peternatural Foresight handler
				} else /if (${DoGForesight} && ${TheBuff.Equal[${SpellGStr}]}) {
					/varset TheBuff ${SpellGAgi} 
					/goto :StartBuffing
					} else {
					 /goto :StartBuffing
				 }
				} 
			| ---- Group Buffs Talisman of Unity handler
			/if (${DoGUnity} && (${TheBuff.Equal[${SpellGStr}]} || ${TheBuff.Equal[${SpellGAgi}]} || ${TheBuff.Equal[${SpellGFocus}]} || ${TheBuff.Equal[${SpellGSta}]})) {
				| ---- Buff Shamans or Other Group
				/if ((${i}<=1 && ${Select[${buffKey},bgo,bg]}) || (${i}<=4 && !${Me.Buff[${TheBuff}].ID})) {
					/varset TheBuff ${SpellGUnity}
					/goto :StartBuffing
					}
				}
			/if (${i}>=5 && ${TheBuff.Equal[${SpellSow}]} && !${OutDoors}) /goto :Skipbuff
			/if (${i}>=5) /goto :StartBuffing
		}
		| ---- Single Buffs
		/if (${Select[${buffSet},SingleBuff]} && (!${Me.Buff[${TheBuff}].ID} || ${Select[${buffKey},sb]})) {
			| ---- Single Buffs < Lv 70
			/if (!${DoUnity}) {
				/if (!${DoForesight}) {
					/goto :StartBuffing 
				| ---- Single Buffs < Lv 80	Peternatural Foresight handler
				} else /if (${DoForesight} && ${TheBuff.Equal[${SpellStr}]}) {
					/varset TheBuff ${SpellGAgi} 
					/goto :StartBuffing
				} else {
					/goto :StartBuffing
				}
			}
		| ---- Single Buffs Unity handler
		/if (${DoUnity} && (${TheBuff.Equal[${SpellStr}]} || ${TheBuff.Equal[${SpellAgi}]} || ${TheBuff.Equal[${SpellFocus}]} || ${TheBuff.Equal[${SpellSta}]})) {
			/if (${i}<=1 && ${Select[${buffKey},sb]}) { 
				/varset TheBuff ${SpellUnity} 
				/goto :StartBuffing
				}
			}
		/if (${i}>=5 && ${TheBuff.Equal[${SpellHaste}]} && ${Select[${Target.Class.ShortName},CLR,DRU,SHM,ENC,MAG,NEC,WIZ]}>0) /multiline ; /echo Skipping haste on caster type ; /goto :Skipbuff
		/if (${i}>=5 && ${TheBuff.Equal[${SpellSow}]} && !${OutDoors}) /goto :Skipbuff
		/if (${i}>=5) /goto :StartBuffing
	}
	}
	/goto :Skipbuff
	:StartBuffing
	/call Castomatic ${buffTarget} ${Spawn[${buffTarget}].Type} ${buffAssist} "${TheBuff}" ${buffType}
	:SkipBuff
	/next i
	/return
	
| - The CastoMatic  
	Sub Castomatic(string at1, string at2, int at3, string cspell, string ctype)
	/if (${debug}) /echo Castomatic ${at1} ${at2} ${at3} ${cspell} ${ctype}
	| - Error control NULL value sent, mispelled or not in spell book
	/if (${cspell.Equal[NULL]}) /multiline ; /echo NULL value sent to CastoMatic ; /return
	/if (!${Select[${ctype},alt,item]}) {
	/if (!${Me.Book[${cspell}]}) /multiline ; /echo Can't cast >> ${cspell} << Check spelling or not in my spellbook. ; /return 	
	}
	/call AcquireTarget "${at1}" ${at2} ${at3}
	/if (${debug}) /echo after  ${at1} ${at2} ${at3} ${cspell} ${ctype}
	/if (!${Select[${ctype},alt,item]})	/varset ctype Gem${Int[${ctype}]}
	/if (${Select[${ctype},alt]}) /varset cspell ${Me.AltAbility[${cspell}].Name}
	/if (${Target.Type.Equal[${at2}]} && ${Target.Distance}<=${AssistAt}) {
		/if (${VerboseTell} && ${at1.NotEqual[${Me}]} && ${Select[${at1},${ChatController},${MasterArray[1]},${MasterArray[2]},${MasterArray[3]},${MasterArray[4]},${MasterArray[5]}]}) /tell ${at1} Casting << ${cspell} >> on ${Spawn[${Target}].CleanName}. 
		/if (${Verbose}) /echo Casting << ${cspell} >> on ${Target.CleanName}. 
		/call cast "${cspell}" ${ctype} ${CastRetryTime}
		/if (${Macro.Return.Equal["CAST_SUCCESS"]}) /return CAST_SUCCESS
	}
    /return
| ################### This will check whenever the player is changing any variable via /echo
Sub Event_ToggleVariable(string Line, string Command, string Command2)
    /declare i int local

    | ### Toggle Variables & Set Variables
    /if (${Defined[${Command}]}) {
      /if (${Command2.NotEqual[NULL]}) {
        /varset ${Command} ${Command2}
      } else /if (${${Command}}) {
        /varset ${Command} 0
		/varset OnOff Off
      } else {
        /varset ${Command} 1
		/varset OnOff On
      }
      /echo Set ${Command}: ${OnOff}
      /if (${DoChatChannel}) /${ChatHere} Set ${Command}: ${OnOff}
      /return
    }

    | ### Customized Commands
    /if (${Command.Equal[DoPetStuff]}) {
      /if (${DoPet}) {
        /varset DoPet 0
        /echo Set DoPet Off
        /if (${DoChatChannel}) /${ChatHere} Set DoPet Off
        /if (${Me.Pet.ID} && ${Me.AltAbility[Suspended Minion]} && ${Me.AltAbility[Persistent Minion]} && !${PetSuspended}) {
          /call cast "176" alt ${CastRetryTime}
          /delay 7s !${Me.Pet.ID}
          /if (${Me.Pet.ID}) /pet get lost
          /varset PetSuspended 1
        }
      } else {
        /varset DoPet 1
        /echo Set DoPet On
        /if (${DoChatChannel}) /${ChatHere} Set DoPet On
      }
    }
    /if (${Command.Equal[SetDoCamp]}) {
        /if (${DoCamp}) {
          /varset DoCamp 0
          /makecamp off
        } else {
          /varset DoCamp 1
        }
        /echo Set ${Command}: ${${Command}}
        /if (${DoChatChannel}) /${ChatHere} Set ${Command}: ${${Command}}
        /return
    }
    /if (${Command.Equal[SetAutoFollow]}) {
        /if (${Command2}) {
          /if (${Command2}<10) {
            /varset AFDist 10
          } else /if (${Command2}>100) {
            /varset AFDist 100
          } else /if ((${Command2}>9) && (${Command2}<101)) {
            /varset AFDist ${Command2}
          }
        } else /if (${AutoFollow}==0) {
          /varset AutoFollow 1
        } else {
          /varset AutoFollow 0
        }
		/if (${DoChatChannel}) /${ChatHere} Auto Follow:  ${AutoFollow}
		/if (${DoChatChannel}) /${ChatHere} AF Distance:  ${AFDist}
        /echo Auto Follow:  ${AutoFollow}
        /echo AF Distance:  ${AFDist}
        /return
    }
    /if (${Command.Equal[AddMaster]}) {
      /for i 1 to 5
        /if (${MasterArray[${i}].Equal[NULL]}) {
          /varset MasterArray[${i}] ${Command2}
          /echo ${Command2} added as a Master
          /if (${DoChatChannel}) /${ChatHere} ${Command2} added as a Master
          /return
        } else /if (${MasterArray[${i}].Equal[${Command2}]}) {
          /echo ${Command2} is already a Master
          /if (${DoChatChannel}) /${ChatHere} ${Command2} is already a Master
          /return
        }
      /next i
      /echo Master List full, ${Command2} was not added.
      /if (${DoChatChannel}) /${ChatHere} Master List full, ${Command2} was not added.
      /return
    }
    /if (${Command.Equal[RemoveMaster]}) {
      /for i 1 to 5
        /if (${MasterArray[${i}].Equal[${Command2}]}) {
          /varset MasterArray[${i}] NULL
          /echo ${Command2} has been removed from the master list.
          /if (${DoChatChannel}) /${ChatHere} ${Command2} has been removed from the master list.
          /return
        }
      /next i
      /echo ${Command2} was not listed in the master list.
      /if (${DoChatChannel}) /${ChatHere} ${Command2} was not listed in the master list.
      /return
    }
    /if (${Command.Equal[ClearMasters]}) {
      /for i 1 to ${MasterArray.Size}
        /varset MasterArray[${i}] NULL
      /next i
	  /echo All masters have been cleared.
      /return
    }
    /if (${Command.Equal[ListMasters]}) {
      /echo Current Masters are:
      /if (${DoChatChannel}) /${ChatHere} Current Masters are:
      /for i 1 to ${MasterArray.Size}
        /if (${MasterArray[${i}].NotEqual[NULL]}) {
          /echo ${MasterArray[${i}]}
          /if (${DoChatChannel}) /${ChatHere} ${MasterArray[${i}]}
        }
      /next i
      /return
    }
    /if (${Command.Equal[ResetVariables]}) {
      /call ResetAllVariables
      /return
    }

/if (${Command.Equal[Show]}) {
        /echo ---------------------------
        /echo Do Malo:..............${DoMalo} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /echo Do Slow:..............${DoSlow} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /echo Do Cripple:...........${DoCripple} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /echo Do Fastslow:..........${FastSlow} - (Will only try to slow once!)
        /echo Do Nuke:..............${DoNuke} - Casting at: ${NukeAt}% (Will chain nuke mob to death)
        /echo Do Dot:...............${DoDot} - Casting at: ${CastDotat}%
        /echo Do Pet:...............${DoPet}
        /echo Do Buffs:.............${DoGroupBuffs}
        /echo Do Rebuffs:...........${DoRebuffs}
        /echo Do Root:..............${DoRoot} - Casting at: ${Rootat}%
        /echo Do Heal:..............${DoHeal}
        /echo Do HoT:...............${DoHoT}
        /echo Heal Tank:............${HealTank}
        /echo Heal Group:...........${HealGroup}
        /echo Heal Pets:............${HealPets}
        /echo Do Buff Pet:..........${DoPetBuffs}
        /echo Do Shrink:............${DoShrink}
        /echo Do Panther Group:.....${DoPantherGroup} - Casts ${SpellPanther} on melee members of group during combat
        /echo Auto Follow:..........${AutoFollow} - Following at distance of: ${AFDist}
        /echo Do Cannibalization:...${DoCanniAA}
        /echo Do Mount:.............${DoMount}
        /echo ---------------------------
        /echo Assist range: ${AssistAt}
        /echo Assisting: ${M_Assist}
        /echo Heal MA at: ${TankHeal}%
        /echo HoT MA at: ${TankHoT}%
        /echo Heal Casters at: ${CasterHeal}%
        /echo HoT Casters at: ${CasterHoT}%
        /echo Heal Melee at: ${MeleeHeal}%
        /echo HoT Melee at: ${MeleeHoT}%
        /echo Initiate Combat: ${CombatAt}%
        /echo Verbose: ${Verbose}
        /echo Casting Dots at: ${CastDotat}
        /echo Stop Casting Dots at: ${DotMana}% mana
        /echo Root Mob at: ${Rootat}
        /echo Nuke Mob at: ${NukeAt}
        /echo Stop Nuking at: ${NukeMana}% mana
        /echo Stop Casting Panther/Leopard at: ${PantherSkip}% of mobs health
        /echo Healing Pets at: ${PetHeal}
        /echo HoT Pets at: ${PetHoT}
        /echo Autofollow distance is: ${AFDist}
        /echo
        /echo help - Will show help to set variables.
        /if (${DoChatChannel}) /${ChatHere} ---------------------------
        /if (${DoChatChannel}) /${ChatHere} Do Malo:..............${DoMalo} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /if (${DoChatChannel}) /${ChatHere} Do Slow:..............${DoSlow} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /if (${DoChatChannel}) /${ChatHere} Do Cripple:...........${DoCripple} - Casting at: ${CombatAt}% (Initiate Combat*, higher then 99 is no good)
        /if (${DoChatChannel}) /${ChatHere} Do Fastslow:..........${FastSlow} - (Will only try to slow once!)
        /if (${DoChatChannel}) /${ChatHere} Do Nuke:..............${DoNuke} - Casting at: ${NukeAt}% (Will chain nuke mob to death)
        /if (${DoChatChannel}) /${ChatHere} Do Dot:...............${DoDot} - Casting at: ${CastDotat}%
        /if (${DoChatChannel}) /${ChatHere} Do Pet:...............${DoPet}
        /if (${DoChatChannel}) /${ChatHere} Do Buffs:.............${DoGroupBuffs}
        /if (${DoChatChannel}) /${ChatHere} Do Rebuffs:...........${DoRebuffs}
        /if (${DoChatChannel}) /${ChatHere} Do Root:..............${DoRoot} - Casting at: ${Rootat}%
        /if (${DoChatChannel}) /${ChatHere} Do Heal:..............${DoHeal}
        /if (${DoChatChannel}) /${ChatHere} Do HoT:...............${DoHoT}
        /if (${DoChatChannel}) /${ChatHere} Heal Tank:............${HealTank}
        /if (${DoChatChannel}) /${ChatHere} Heal Group:...........${HealGroup}
        /if (${DoChatChannel}) /${ChatHere} Heal Pets:............${HealPets}
        /if (${DoChatChannel}) /${ChatHere} Do Buff Pet:..........${DoPetBuffs}
        /if (${DoChatChannel}) /${ChatHere} Do Shrink:............${DoShrink}
        /if (${DoChatChannel}) /${ChatHere} Do Panther Group:.....${DoPantherGroup} - Casts ${SpellPanther} on melee members of group during combat
        /if (${DoChatChannel}) /${ChatHere} Auto Follow:..........${AutoFollow} - Following at distance of: ${AFDist}
        /if (${DoChatChannel}) /${ChatHere} Do Cannibalization:...${DoCanniAA}
        /if (${DoChatChannel}) /${ChatHere} Do Mount:.............${DoMount}
        /if (${DoChatChannel}) /${ChatHere} ---------------------------
        /if (${DoChatChannel}) /${ChatHere} Assist range: ${AssistAt}
        /if (${DoChatChannel}) /${ChatHere} Assisting: ${M_Assist}
        /if (${DoChatChannel}) /${ChatHere} Heal MA at: ${TankHeal}%
        /if (${DoChatChannel}) /${ChatHere} HoT MA at: ${TankHoT}%
        /if (${DoChatChannel}) /${ChatHere} Heal Casters at: ${CasterHeal}%
        /if (${DoChatChannel}) /${ChatHere} HoT Casters at: ${CasterHoT}%
        /if (${DoChatChannel}) /${ChatHere} Heal Melee at: ${MeleeHeal}%
        /if (${DoChatChannel}) /${ChatHere} HoT Melee at: ${MeleeHoT}%
        /if (${DoChatChannel}) /${ChatHere} Initiate Combat: ${CombatAt}%
        /if (${DoChatChannel}) /${ChatHere} Verbose: ${Verbose}
        /if (${DoChatChannel}) /${ChatHere} Casting Dots at: ${CastDotat}
        /if (${DoChatChannel}) /${ChatHere} Stop Casting Dots at: ${DotMana}% mana
        /if (${DoChatChannel}) /${ChatHere} Root Mob at: ${Rootat}
        /if (${DoChatChannel}) /${ChatHere} Nuke Mob at: ${NukeAt}
        /if (${DoChatChannel}) /${ChatHere} Stop Nuking at: ${NukeMana}% mana
        /if (${DoChatChannel}) /${ChatHere} Stop Casting Panther/Leopard at: ${PantherSkip}% of mobs health
        /if (${DoChatChannel}) /${ChatHere} Healing Pets at: ${PetHeal}
        /if (${DoChatChannel}) /${ChatHere} HoT Pets at: ${PetHoT}
        /if (${DoChatChannel}) /${ChatHere} Autofollow distance is: ${AFDist}
        /if (${DoChatChannel}) /${ChatHere}
        /if (${DoChatChannel}) /${ChatHere} help - Will show help to set variables.
    }
    /if (${Command.Equal[help]}) {
        /echo Commands that will turn ON or OFF
        /echo heal, hot, malo, slow, fastslow, root, pet, buffpet, Dot, nuke, buffs, rebuffs, sow, verbose, shrink
        /echo panthergroup, avatar, shrink, HealGroup, HealPets, HealTank, lootmobs, group chat
        /echo raidchat, cripple, clearmasters
        /echo
        /echo autofollow #: Will toggle 1/0 if no paramater is given.
        /echo              Will set Auto Follow distance if # paramater is given (minimum=100, maximum=100).
        /echo
        /echo addmaster <pc name> - adds a person to the master list and this person is able to manipulate bot
        /echo removemaster <pc name> - removes a single person from the master list
        /echo
        /echo Commands to change values, ie: assistat 50 (Will start the combat routine when mob is in range 50)
        /echo assistat <range> - Most spells don't go longer then 100
        /echo combatat <% hps> - Initiate Combat when mob is at % HPs
        /echo healtankat <% hps>
        /echo healmeeleat <% hps>
        /echo healcastersat <% hps>
        /echo hottankat <% hps>
        /echo hotmeeleat <% hps>
        /echo at <% hps>
        /echo setma <PC Name>
        /echo nukeat <% hps>
        /echo Dotat <% hps>
        /echo rootat <% hps>
        /echo healpetsat <% hps>
        /echo hotpetsat <% hps>
        /if (${DoChatChannel}) /${ChatHere} <<< Shambot V4.0 Script Help >>>
        /if (${DoChatChannel}) /${ChatHere}
        /if (${DoChatChannel}) /${ChatHere} Commands that will turn ON or OFF
        /if (${DoChatChannel}) /${ChatHere} heal, hot, malo, slow, fastslow, root, pet, buffpet, Dot, nuke, buffs, rebuffs, sow, verbose, shrink
        /if (${DoChatChannel}) /${ChatHere} panthergroup, avatar, shrink, HealGroup, HealPets, HealTank, lootmobs, group chat
        /if (${DoChatChannel}) /${ChatHere} raidchat, cripple, clearmasters
        /if (${DoChatChannel}) /${ChatHere}
        /if (${DoChatChannel}) /${ChatHere} autofollow #: Will toggle 1/0 if no paramater is given.
        /if (${DoChatChannel}) /${ChatHere}              Will set Auto Follow distance if # paramater is given (minimum=10, maximum=100).
        /if (${DoChatChannel}) /${ChatHere}
        /if (${DoChatChannel}) /${ChatHere} addmaster <pc name> - adds a person to the master list and this person is able to manipulate bot
        /if (${DoChatChannel}) /${ChatHere} removemaster <pc name> - removes a single person from the master list
        /if (${DoChatChannel}) /${ChatHere}
        /if (${DoChatChannel}) /${ChatHere} Commands to change values, ie: assistat 50 (Will start the combat routine when mob is in range 50)
        /if (${DoChatChannel}) /${ChatHere} assistat <range> - Most spells don't go longer then 100
        /if (${DoChatChannel}) /${ChatHere} combatat <% hps> - Initiate Combat when mob is at % HPs
        /if (${DoChatChannel}) /${ChatHere} healtankat <% hps>
        /if (${DoChatChannel}) /${ChatHere} healmeeleat <% hps>
        /if (${DoChatChannel}) /${ChatHere} healcastersat <% hps>
        /if (${DoChatChannel}) /${ChatHere} hottankat <% hps>
        /if (${DoChatChannel}) /${ChatHere} hotmeeleat <% hps>
        /if (${DoChatChannel}) /${ChatHere} hotcastersat <% hps>
        /if (${DoChatChannel}) /${ChatHere} setma <PC Name>
        /if (${DoChatChannel}) /${ChatHere} nukeat <% hps>
        /if (${DoChatChannel}) /${ChatHere} Dotat <% hps>
        /if (${DoChatChannel}) /${ChatHere} rootat <% hps>
        /if (${DoChatChannel}) /${ChatHere} healpetsat <% hps>
        /if (${DoChatChannel}) /${ChatHere} hotpetsat <% hps>
    }
/return

It basically works fine,just had 4 problems:

1.It not always slow,sometimes it slows fast,but sometimes, it cast HC slow very late,even not doing it..

So , I wanna change it to cast AA slow (Turgur's Swarm),and make sure that cast slow is always comes the first ,at the very begining of combat..

ps: I've tried editing the

/declare DoHCSlow int outer 1
To 0, but seems still not work,and it wont slow anymore if i did that change..

2. I dont wanna it do hot heal,but a fast heal when mt under 80%,much as the merc type "Reactive". What should I do?

3.Now the bot use pet to add a tiny dps,but it turns out sometimes the pet will go attack the mob before it inc (for example, a mnk pulled 2 and fding to split them ,but the pet just went on one and caused a train...)

How can I avoid situation like that without turn off the pet ?

4.It never clicky the ep2.0 .Need fix that.

Thx much for any infos & ideas.
 
Last edited:
I'll someone else figure out the AAslow thing, so I'm moving on to the rest.

2. I dont wanna it do hot heal,but a fast heal when mt under 80%,much as the merc type "Reactive". What should I do?

Here is the part that controls when to heal what:

Code:
| ********** Do heals at % health of 

	/declare TankHeal		int outer	60
	/declare TankHoT		int outer	88	
	/declare CasterHeal		int outer	65 
	/declare CasterHoT		int outer	85 
	/declare MeleeHeal		int outer	55
	/declare MeleeHoT		int outer	88 
	/declare PetHeal		int outer	65 
	/declare PetHoT		int outer	88
	/declare AInterventionHeal  	int outer 	20
	/declare UnionAAHeal  	int outer 	20
	/declare GHealGroupHealth  	int outer 	60

You are doing TankHoT at 88% and TankHeal at 60% now. just change those percentanges to what you want them to be. If you don't want to use HoTs at all (which for a shaman, that wouldn't be the best idea), go to the area in the code just above the heal percentages.

Code:
| ********** Do heals on 1=ON and 0=OFF 

	/declare DoHeal		int outer	1 
	/declare DoHoT		int outer	[COLOR="Yellow"]0[/COLOR]
	/declare DoGHeal    		int outer 	1
	/declare DoAIntervention    	int outer 	1 
	/declare DoUnionAA         	int outer 	1
	/declare HealTank		int outer	1
	/declare HealGroup		int outer	1 
	/declare HealPets		int outer	0
	/declare HealPuller		int outer	1

Change that DoHoT to 0, as shown above.

3.Now the bot use pet to add a tiny dps,but it turns out sometimes the pet will go attack the mob before it inc (for example, a mnk pulled 2 and fding to split them ,but the pet just went on one and caused a train...)

How can I avoid situation like that without turn off the pet ?

Don't quote me on this, but I think if you want to delay sending the pet without turning the pet off all together, try altering the % that you attack at. Here is the code.

Code:
| ################## Setup Shambot runtime variables 
| - AssistAt is distance 90-100 recommended, CombatAt is Mob Health

	/declare AssistAt 		int outer	98 
	/declare CombatAt		int outer	98 
	/declare DoAllInvites    	int outer 	1
	/declare DoLoot			int outer	0
	/declare SecondAssist		outer 		SECOND_ASSIST_NAME_HERE

Maybe change the AssistAt or CombatAt to like 95 or maybe 90.

As far as Epic goes, I'm not sure. My shaman doesn't have his epic, so I can't test it.
 
Thx a lot Cuda~

Still need someone help me with the AA slow thing...Waiting..
 
Thx a lot Cuda~

Still need someone help me with the AA slow thing...Waiting..

1. Please ask for Shambot help is in macro section under Shambot 4.22. I just saw this post by chance.

2. For AAslow

Code:
	/declare DoSlow			int outer	1 
	/declare DoHCSlow		int outer	0
	/declare DoAASlow		int outer	1

3. Epic 2.0 Nord posted a fix in shambot thread. I will be including that in ver 4.28. If you are comfortable editing macros the fix is here
 
Last edited: