Cleric Bot (Updated 05/08/05)

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Cleric Bot (Updated 05/08/05)

Post by guest_01 » Mon May 02, 2005 2:32 pm

Maintains buffs... heals... nukes and melees.... etc...

Spells set for a level 65 currently, change as necessary...

Make sure to tweak the heal levels at the very BOTTOM of the script...

Main benefits over other scripts I've seen on here:
Dynamic determination of who needs heal most
Automatically realizes when a hard pull comes in and temporarily adjusts heal thresholds
Smart swapping of horse/yaulp in melee mode based on mana/actions


Yes, I know some of the things are named strange (such as Mark of the Righteous being next to a Slow variable)... adjusted from my shamans mac, and I'm too lazy to change all the names around... it gets the job done. Maybe I'll get around to changing the names eventually, but really it's just semantics.

To get Mark of the Righteous to work properly, you need a small plugin (located at the bottom of the mac on the following thread: http://www.macroquest2.com/phpBB2/viewtopic.php?t=11109 )
Last edited by guest_01 on Sun May 08, 2005 3:59 am, edited 3 times in total.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Mon May 02, 2005 2:32 pm

Code: Select all

| -!- This Script Uses spell_routines.inc by Rusty 
| -!- This Script Uses advpath.inc 
| -!- Wait4Rez snippet from wait4rez.mac by fantum409 
| -!- Original core script from Hubba's shaman mac

#chat group 
#chat tell 

#event Invite "#1# invites you to join a group."

#Event   ToggleVariable   "[MQ2] Toggle #1#" 
#Event   ToggleVariable   "[MQ2] Toggle #1# #2#" 
#Event   Zoned   "LOADING, PLEASE WAIT..." 
#Event   OutDoor         "#*#outdoors#*#" 
#Event   NoMount         "You can not summon a mount here." 
#Event   ImDead         "You have been slain by#*#" 
#Event   Invited         "#*#To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel#*#" 

#Event   UnderAttack         "#*#YOU for#*#points of damage." 
#Event   UnderAttack         "#*#YOU, but YOU#*#!" 
#Event   UnderAttack         "#*#YOU, but misses!" 

| GM's and Guides ALWAYS open conversation saying who they are
#event GMInZone "#*#tells you,#*# GM #*#"
#event GMInZone "#*#tells you,#*# Guide #*#"
#event GMInZone "#*#tells you,#*# gamemaster #*#"
#event GMInZone "#*#tells you,#*# Game Master #*#"
#event GMInZone "#*#tells you,#*# Customer Service #*#"
#event GMInZone "#*#tells you,#*# CSR #*#"

/declare noInvis int outer 1

#include Spell_Routines.inc 
#include advpath.inc 


#define DEBUG_1 "/squelch /echo"

Sub Main 

/call InitAPFVars 1 15 40 


| ########### Make changes in spells as you need. 

   | The % of your spell duration bonus. 
   /declare SpellDurationBonus   outer 0 
    
   |- If you have no focus item, leave it blank. 
   /declare BuffFocusItem       outer "" 

   /declare SpellSlow          outer Mark of the Righteous
   /declare SpellSlowGem          outer 8

   /declare SpellDoT         outer 
   /declare SpellDoTGem         outer 2

   /declare SpellNuke         outer Condemnation
   /declare SpellNukeGem         outer 8


|Pet doesn't work yet
   /declare SpellPet           outer 
   /declare SpellPetGem           outer 8

   /declare SpellDeBuff        outer Mark of Kings
   /declare SpellDeBuffGem        outer 8

   /declare SpellGroupHeal           outer Ethereal Elixir
   /declare SpellGroupHealGem           outer 4

   /declare SpellCompleteHeal           outer Complete Healing
   /declare SpellCompleteHealGem           outer 3

   /declare SpellHeal          outer Supernal Light
   /declare SpellHealGem          outer 1

   /declare SpellHoT           outer Supernal Elixir
   /declare SpellHoTGem           outer 2

   /declare SpellInvulnerability          outer Divine Barrier
   /declare SpellInvulnerabilityGem          outer 5

   /declare SpellYaulp          outer Yaulp VI
   /declare SpellYaulpGem          outer 8

   /declare HammerSpell          outer Hammer of Damnation
   /declare HammerSpellGem          outer 8

   

   /declare SpellRoot          outer Root
   /declare SpellRootGem          outer 4

   /declare Mount             outer Tan Rope Bridle


   /declare SpellBuffsGem          outer 8




| ############ The Magic of single spell buffs... 
| ############ 
| ############ /declare SpellBuff[2,2] string outer 
| ############  Do only change the 1st number in [#,#] 
| ############  If you have three single spells to cast change the 1st number to 3. 
| ############ /declare SpellBuff[3,2] string outer 
| ############ 
| ############ /varset SpellBuff[1,1] "Spirit of Sense" 
| ############  This is the 1st line that is needed, Here you write your spell name 
| ############ /varset SpellBuff[1,2] "Warrior,Monk,Cleric,Shaman,Enchanter," 
| ############  The 2nd line is for the classes who gets the buff. 
| ############ NOTE: Only classes in group will get buffed 
| ############ NOTE: End the class line with a , If not you can BLOW up your computer. ;P 


|   /declare SpellBuff[9,4] string outer 
   /declare SpellBuff[5,3] string outer 
    
   /varset SpellBuff[1,1] Armor of the Zealot
   /varset SpellBuff[1,2] "Cleric," 
   /varset SpellBuff[1,3] TRUE

   /varset SpellBuff[2,1] Virtue
   /varset SpellBuff[2,2] "Bard,Beastlord,Berserker,Cleric,Druid,Enchanter,Magician,Monk,Necromancer,Paladin,Ranger,Rogue,Shadowknight,Shaman,Warrior,Wizard," 
   /varset SpellBuff[2,3] TRUE

   /varset SpellBuff[3,1] Symbol of Kazad
   /varset SpellBuff[3,2] "Bard,Beastlord,Berserker,Cleric,Druid,Enchanter,Magician,Monk,Necromancer,Paladin,Ranger,Rogue,Shadowknight,Shaman,Warrior,Wizard," 
   /varset SpellBuff[3,3] TRUE

   /varset SpellBuff[4,1] Faith
   /varset SpellBuff[4,2] "Bard,Beastlord,Berserker,Cleric,Druid,Enchanter,Magician,Monk,Necromancer,Paladin,Ranger,Rogue,Shadowknight,Shaman,Warrior,Wizard," 
   /varset SpellBuff[4,3] FALSE

   /varset SpellBuff[5,1] Blessing of Reverence
   /varset SpellBuff[5,2] "Beastlord,Cleric,Druid,Enchanter,Magician,Necromancer,Paladin,Ranger,Shadowknight,Shaman,Wizard," 
   /varset SpellBuff[5,3] TRUE






| Automatically click the following buffs off

   /declare BounceBuff[11] string outer 
    
|   /varset BounceBuff[1] "Speed of Vallon"
|   /varset BounceBuff[2] "Spiritual Vigor"
|   /varset BounceBuff[3] "Spirit of the Predator"
|   /varset BounceBuff[4] "Spirit of the Hunter"
   /varset BounceBuff[5] "Talisman of Kragg"
   /varset BounceBuff[6] "Focus of Soul"
   /varset BounceBuff[7] "Focus of Spirit"
   /varset BounceBuff[8] "Khura's Focusing"
   /varset BounceBuff[9] "Focus of the Seventh"
   /varset BounceBuff[10] "Talisman of Wunshi"
   /varset BounceBuff[11] "Wunshi's Focusing"



| ############ Group buffs... 

   /declare SpellGrpBuff[0] string outer 

|   /varset SpellGrpBuff[1] Hand of Virtue




   /declare DoSingleBuffs      outer TRUE
    
   /declare AssistAt      int   outer 100 
   /declare CombatAt      int   outer 99 
   /declare CastDoTat      int   outer 98 
   /declare MinDoTat       int   outer 40
   /declare MinNukeat       int   outer 15
   /declare MinManaForNuke       int   outer 80
   /declare Rootat         int   outer 30 
   /declare NukeAt         int   outer 90 
   /declare CasterHeals   int   outer 90 
   /declare MeleeHeals      int   outer 75 
   /declare TankHeal      int outer 45 
   /declare DelayBetweenNukes	int outer 0
   

   /declare DoMelee		outer FALSE
   /declare Closeness 		int outer 50
   
   /declare DoMalo             outer FALSE
   /declare DoSlow             outer FALSE 
   /declare FastSlow         outer FALSE 
   /declare DoRoot             outer FALSE 
   /declare DoRootParking      outer FALSE
   /declare SummonPet          outer FALSE
   /declare ShouldBuffPet         outer FALSE
   /declare HealPets         outer TRUE
   /declare DoDoT             outer FALSE
   /declare DoBuffs          outer TRUE 
   /declare DoNuke            outer TRUE
   /declare DoGroupHeal            outer TRUE 
   /declare DoCompleteHeal            outer TRUE 
   /declare DoHeal            outer TRUE 
   /declare DoHoT            outer TRUE
   /declare Verbose         outer TRUE 
   /declare BuffInBattle         outer TRUE 

   /declare AnnounceLOM         outer TRUE 

   /declare quitOnZone		outer FALSE



   /declare AutoMove         outer TRUE
   /declare AllowAutoFollow         outer TRUE

   /declare NoMount         outer FALSE 


|**
ClassHeals<class> array:
1: Complete heal - if HP drops below this, cast a cheal
2: Quick Heal - if HP drops below this, cast a quick heal
3: HOT - if HP drops below this, cast a HOT

Will always try to cast the one set to the LOWEST value first,
so if you have HOT set to 80, and CHeal set to 70, and tank01's
hp is at 60, it will cast CHeal, not HOT... 
Likewise, if HOT is 70, and CHEAL is 80, it would cast HOT first
and cheal after.

If it starts casting a CHEAL and has to interupt for a quick heal
(determined by f(HP < QHeal*0.66 && (TimeTilChealLands) > 5seconds))
then it will perform a temporary adjustment on cheal for that class,
making it cast cheal earlier next time... this is handy for greater
efficiency on named pulls and such, since it provides better efficiency
and will slowly scale cast time back to preset values over time without
user interaction.

4 & 5 are for internal program usage for dynamic heal adjustments


Adjust the values for 1, 2, and 3 in the function below...
Separated into functions so that you can easily add more functions for
different zones, and just comment out the function call to switch zones.
**|

/declare i int local

/declare ClassHeals[5] string outer

/for i 1 to 17
	/declare ClassHeals${i}[5] string outer
/next i



   /call SetHealsPrimaryHealer
|   /call SetHealsSupportHealer
|   /call SetHealsSupportHealerTemp



|**---------------------TrickyDA Config---------------------| 
The following are HP buffs cleric will click off, in order, 
to get above 40% HP and avoid low HP aggro. Clr will then 
click off DA and resume duties, beg new buffs, etc. To 
enable, set trickyda to 1, 0 will disable 
|---------------------------------------------------------**| 
   /declare trickyda int outer 1 
   /if (${trickyda}==1) { 
      /declare intcount int outer 0 
      /declare trickybuff[20] string outer 
      /varset trickybuff[1] Virtue 
      /varset trickybuff[2] Hand of Virtue 
      /varset trickybuff[3] Conviction 
      /varset trickybuff[4] Hand of Conviction 
      /varset trickybuff[5] Focus of Soul 
      /varset trickybuff[6] Focus of the Seventh 
      /varset trickybuff[7] Wunshi's Focusing 
      /varset trickybuff[8] Talisman of Wunshi 
      /varset trickybuff[9] Protection of the 9 
      /varset trickybuff[10] Blessing of the Nine 
      /varset trickybuff[11] Steeloak Skin 
      /varset trickybuff[12] Blessing of Steeloak 
      /varset trickybuff[13] Symbol of Kazad 
      /varset trickybuff[14] Kazad`s Mark 
      /varset trickybuff[15] Symbol of Balikor 
      /varset trickybuff[16] Balikor's Mark 
      /varset trickybuff[17] Brell's Stalwart Shield 
      /varset trickybuff[18] Brell's Brawny Bulwark 
      /varset trickybuff[19] Spiritual Vigor 
      /varset trickybuff[20] Spiritual Vitality 
   } 
|-------------------End TrickyDA Config---------------------| 



| ########### ! No Changes Are Needed From Here ! 
| ########### ! No Changes Are Needed From Here ! 
| ########### ! No Changes Are Needed From Here ! 
| ########### ! No Changes Are Needed From Here ! 
| ########### ! No Changes Are Needed From Here ! 

   /squelch /alias /domalo /echo toggle malo 
   /squelch /alias /doslow /echo toggle slow 
   /squelch /alias /dofastslow /echo toggle fastslow 
   /squelch /alias /doroot /echo toggle root 
   /squelch /alias /dopet /echo toggle pet 
   /squelch /alias /dodot /echo toggle dot 
   /squelch /alias /donuke /echo toggle nuke 
   /squelch /alias /nukeat /echo toggle nukeat    
   /squelch /alias /dobuffs /echo toggle buffs 
   /squelch /alias /dosow /echo toggle sow 
   /squelch /alias /assistat /echo toggle assistat 
   /squelch /alias /dotat /echo toggle dotat 
   /squelch /alias /rootat /echo toggle rootat 
   /squelch /alias /combatat /echo toggle combatat 
   /squelch /alias /healmeleeat /echo toggle healmeleeat 
   /squelch /alias /healcastersat /echo toggle healcastersat 
   /squelch /alias /healtankat /echo toggle healtankat 
   /squelch /alias /doassist /echo toggle assist 
   /squelch /alias /healat /echo toggle healat 
   /squelch /alias /status /echo toggle show 
   /squelch /alias /show /echo toggle show    
   /squelch /alias /bothelp /echo toggle help 
   /squelch /alias /verbose /echo toggle verbose    
   /squelch /alias /resetbuffs /echo toggle resetbuffs 
   /squelch /alias /clearpathing /echo toggle clearpathing
   /squelch /alias /dohot /echo toggle dohot
   /squelch /alias /doheal /echo toggle doheal
   /squelch /alias /HealPets /echo toggle HealPets
   /squelch /alias /DoRootParking /echo toggle DoRootParking
   /squelch /alias /buff /echo toggle buff
   /squelch /alias /DoMelee /echo toggle DoMelee
   /squelch /alias /pause /echo toggle pause
   /squelch /alias /CastATK /echo toggle CastATK
   /squelch /alias /dofollow /echo toggle dofollow
   /squelch /alias /ClearBuffees /echo toggle ClearBuffees


    
   /declare M_Assist   string   outer 
   /declare OutDoors         outer TRUE 
    
   /declare SpDuration         outer 
   /declare SpCastTime         outer 
   /declare SpDurBonus         outer 
    
   /declare MainItem         outer 
    
   /declare MeLoM            outer FALSE 
    
   /declare TargetArray[4] string outer 
   /declare MobMaloed         outer FALSE 
   /declare MobSlowed         outer FALSE 
   /declare PetOn            outer FALSE 
   /declare MobRooted         outer FALSE 
   /declare MobDoTed         outer FALSE 
   /declare CombatOn         outer TRUE


   /declare Exper float outer 
   /declare AAExp float outer 
       
   /varset Exper ${Me.Exp} 
   /varset AAExp ${Me.AAExp} 


   /squelch /declare ATKBuffed0 timer global 0 
   /squelch /declare ATKBuffed1 timer global 0 
   /squelch /declare ATKBuffed2 timer global 0 
   /squelch /declare ATKBuffed3 timer global 0 
   /squelch /declare ATKBuffed4 timer global 0 
   /squelch /declare ATKBuffed5 timer global 0 

   /declare CallManaTmr timer outer 0 

   /varset MobRooted FALSE 
   /varset MobMaloed FALSE 
   /varset MobSlowed FALSE 
   /varset PetOn FALSE 
   /varset MobDoTed FALSE 

      /varset MobRooted FALSE 
      /varset MobMaloed FALSE 
      /varset MobSlowed FALSE 
      /varset PetOn FALSE 
      /varset MobDoTed FALSE 
      /varset CombatOn FALSE 
    
      /varset TargetArray[1] NULL 
      /varset TargetArray[2] NULL 
      /varset TargetArray[3] NULL 
      /varset TargetArray[4] NULL 

	/declare GroupMemHoTTime timer outer 0
	/declare GroupMemHoTTime0 timer outer 0
	/declare GroupMemHoTTime1 timer outer 0
	/declare GroupMemHoTTime2 timer outer 0
	/declare GroupMemHoTTime3 timer outer 0
	/declare GroupMemHoTTime4 timer outer 0
	/declare GroupMemHoTTime5 timer outer 0

	/declare GroupMemPetHoTTime0 timer outer 0
	/declare GroupMemPetHoTTime1 timer outer 0
	/declare GroupMemPetHoTTime2 timer outer 0
	/declare GroupMemPetHoTTime3 timer outer 0
	/declare GroupMemPetHoTTime4 timer outer 0
	/declare GroupMemPetHoTTime5 timer outer 0

	/declare DebuffTimers[10] int outer

	/declare grpBuffTimer timer outer

	/declare grpBuffTimesAttempted int outer

	/declare j int local 1

	/declare following string outer FALSE

	/declare tookAction int outer 0
	/declare WaitingOnSpell int outer 0

	/declare didCanni int outer 0
	/declare noMoveCount int outer 0

	/declare underAttack timer outer 0
	/declare underAttackBy int outer NULL

	/declare LastSLAdded int outer

	/squelch /declare SafeLocs[20,2] float global

	/declare PrevLoc[2] float outer

	/varset PrevLoc[1] 0
	/varset PrevLoc[2] 0


	/declare DotTime timer outer

	/declare MoveToTmr timer outer

	/declare DoingMove outer 0

	/declare PrevMana outer 0

	/squelch /declare otherBuffees[0] string global

	/declare nukeTimer timer outer 0


	/declare delayMoveTimer timer outer 0
    
	/declare paused outer 0
	
	/declare Healing[2] int outer
	/declare castTimer timer outer
	
	/declare healTimer timer outer
	
	/declare buffsDone int outer
	
	/declare theTarget int outer
    	
	/declare tmpBuff string local
	
	/declare Sticking int outer 0

	
	
	/for i 1 to 17
		/varset ClassHeals${i}[4] 0
	/next i


|   /call MemSpells 
    
| ############### Target a player as Main Assist 
    
    /if (!${Target.ID} || ${Target.Type.NotEqual[PC]}) { 
      /echo Your target is NOT a player, make sure its a player character! 
        /endmacro 
    } else { 
      /varset M_Assist ${Target.CleanName} 
      /echo Assist set to ${M_Assist} 
      /assist off 
    } 

:Main_Loop 

	/varset Healing[1] 0
	/varset Healing[2] 0

   /varset tookAction 0
   /varset WaitingOnSpell 0

/if (${paused}) {
	/doevents
	/delay 5
	/goto :Main_Loop 
}

/call BounceBuffs

DEBUG_1 Checkpoint 1

   |- Check for new events in chat etc etc... 
   /doevents 
    
    /if (!${MoveToTmr} && !${FollowFlag}) {
	|/if (${TargetArray[4]} && ${Target.ID}==${TargetArray[4]}) /face fast

	/if (${TargetArray[4]}) /target id ${TargetArray[4]}
	/if (!${underAttack} && (${Me.PctMana} < 60 || !${CombatOn} || !${DoMelee} || !${buffsDone} || (${Target.ID} != ${TargetArray[4]} || ${Target.Distance} >= 100 || ${Target.Type.Equal[Corpse]}))) {
		
		/if (!${Me.State.Equal[SIT]}) /sit on
		/varset DoingMove 0
		/attack off
	} else {

		/if (${Me.PctHPs} <= 30) /if (${Me.SpellReady[${SpellInvulnerability}]}) {

			/call FullStop
			
			/call cast "${SpellInvulnerability}" gem${SpellInvulnerabilityGem} 2s

			/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
				/g I am INVULNERABLE - no heals for 18 seconds!
				/varset underAttack 0
				/sit on
				/varset DoingMove 0
			}
		}
	}
    }


   /if (${PrevLoc[1]}!=${Me.X} || ${PrevLoc[2]}!=${Me.Y}) /if (!${DoingMove}) {
	/varset PrevLoc[1] ${Me.X}
	/varset PrevLoc[2] ${Me.Y}
	/call AddSafeLoc
   }


DEBUG_1 Checkpoint 2

   /call GetTarget 

DEBUG_1 Checkpoint 3

	/if (!${MoveToTmr} && !${FollowFlag}) /if (${DoingMove}) {
		
		/call StickOff
	}


	/if (${FollowFlag}) {

		/if (${CombatOn}) {
        		/varset FollowFlag 0
        		/echo Combat Detected. No longer following. Resuming program.
			/keypress FORWARD
			/goto :Main_Loop
		}

		
		/call StickOff
		

		| -------- You need to add this call to your loop section in Main. ------------------------------------------ 
		/call AdvPathPoll 

		/delay 1

   		/if (!${Me.Moving}) {
			/if (${Me.State.Equal[Stand]} && !${underAttack}) /sit 
			/vardata noMoveCount Math.Calc[${noMoveCount}+1]
		}

   		/if (${noMoveCount} > 30) {
			/varset noMoveCount 0
			/goto :Hold_Main 
			
		}


		/goto :Main_Loop 

	}	


    |- Do we move? 
:Hold_Main 

   
    /if (!${FollowFlag} && ${Me.Moving}) /goto :Main_Loop 
    
    
|**
    /if (${Me.State.Equal[Stand]} && !${MoveToTmr} && !${FollowFlag} && !${Me.Moving}) {
	|/if (${TargetArray[4]} && ${Target.ID}==${TargetArray[4]}) /face fast

	/if (!${underAttack} && (${Me.PctMana} < 60 || !${CombatOn} || !${DoMelee} || !${buffsDone})) {
		/call StickOff
		/sit on
		/varset DoingMove 0
	} else /if (${CombatOn}) /if (${DoMelee} && !(${DoRootParking} && ${underAttack})) {
		/stand
		/attack on
		/call StickOn
	}
    }
**|
    |- Let the group know Im LOM 
    /if (${Me.PctMana} <= 30 && ${CallManaTmr} <= 0) { 
       /if (${Verbose} || ${AnnounceLOM}) /gsay I'm LOM - ${Me.PctMana}% Mana 
       /varset CallManaTmr 900 
    } 

    |- Am I LoM? 
    /if (${Me.PctMana} < 25) /varset MeLoM TRUE 
    /if (${MeLoM}) /if (${Me.PctMana} > 35) /varset MeLoM FALSE 

	/if (${underAttackBy} && ${DoRootParking}) {
		/target id ${underAttackBy}

		/call FullStop
				
		/call cast "${SpellRoot}" gem${SpellRootGem} 0 CheckForHeal

		/if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_CANNOTSEE]} || ${Macro.Return.Equal[CAST_IMMUNE]}) {
			/echo Rooted ${Target.CleanName}
		}
		/call AttemptAvoid
   		/goto :Main_Loop 
	}



DEBUG_1 Checkpoint 4

   |- Wait until spells are ready it doesn't think it can cast slow yet if it's been chain healing
   /if (!${Me.SpellReady[1]} && !${Me.SpellReady[2]} && !${Me.SpellReady[3]} && !${Me.SpellReady[4]}) /goto :Main_Loop

   /if ((${trickyda}==1)&&(${Me.Buff[${SpellInvulnerability}].ID})) /call TrickyDA 
   
DEBUG_1 Checkpoint 5

   |- Group Heals 
   /call Check_grpHPs 
   /if (${tookAction}) /goto :Main_Loop 

DEBUG_1 Checkpoint 6

   /if (${HealPets}) /call Check_grpPetHPs
   /if (${tookAction}) /goto :Main_Loop  

DEBUG_1 Checkpoint 7

   /if (${DoSlow}) /call CheckDebuffTimers
   /if (${tookAction} && !${WaitingOnSpell}) /goto :Main_Loop 

DEBUG_1 Checkpoint 8

   /if (${DoSlow}) /call CheckSlowRadius
   /if (${tookAction} && !${WaitingOnSpell}) /goto :Main_Loop 

   |/if (${Me.CurrentHPs} < ${Math.Calc[${Me.MaxHPs}-900]}) /call CheckMyHPs 
   |/if (${tookAction}) /goto :Main_Loop 




   /if (${CombatOn} && !${MobMaloed} && ${DoMalo} && ${Target.ID}==${TargetArray[4]}) {
	/call DeBuff
   	/if (${tookAction}) /goto :Main_Loop 
   }
 

	/if (${TargetArray[4]}) /target id ${TargetArray[4]}
	/if (!${underAttack} && (${Me.PctMana} < 60 || !${CombatOn} || !${DoMelee} || !${buffsDone} || (${Target.ID} != ${TargetArray[4]} || ${Target.Distance} >= 100 || ${Target.Type.Equal[Corpse]}))) {

	} else {


		/if (!${Me.Mount.ID}) {
			/varset tmpBuff "Speed of Vallon"
			/if (${Me.Buff[${tmpBuff}].ID}) /nomodkey /notify BuffWindow BW_Buff${Int[${Math.Calc[${Me.Buff[${tmpBuff}].ID}-1]}]}_Button leftmouseup 

			/varset tmpBuff "Spiritual Vigor"
			/if (${Me.Buff[${tmpBuff}].ID}) /nomodkey /notify BuffWindow BW_Buff${Int[${Math.Calc[${Me.Buff[${tmpBuff}].ID}-1]}]}_Button leftmouseup 

			/varset tmpBuff "Spirit of the Predator"
			/if (${Me.Buff[${tmpBuff}].ID}) /nomodkey /notify BuffWindow BW_Buff${Int[${Math.Calc[${Me.Buff[${tmpBuff}].ID}-1]}]}_Button leftmouseup 

			/varset tmpBuff "Spirit of the Hunter"
			/if (${Me.Buff[${tmpBuff}].ID}) /nomodkey /notify BuffWindow BW_Buff${Int[${Math.Calc[${Me.Buff[${tmpBuff}].ID}-1]}]}_Button leftmouseup 

			/if (!${Me.Buff["${SpellYaulp}"].ID}) /if (${Me.SpellReady["${SpellYaulp}"]}) {
				
				/call FullStop
				
				/call cast "${SpellYaulp}" gem${SpellYaulpGem}
			}

		}
		

		/if (${CombatOn}) /if (${DoMelee} && !(${DoRootParking} && ${underAttack}) && (${Target.ID} == ${TargetArray[4]} && ${Target.Distance} < 100) && !${Target.Type.Equal[Corpse]}) {
			/if (${Me.Mount.ID}) {
				/dismount
			}
			/stand
			/attack on
			/call StickOn
		}
	}
    }

   |- Summon drogmore 
   /if ((!${CombatOn} || !${DoMelee} || (${DoMelee} && ${Me.PctMana} < 60) || !${buffsDone}) && (!${Me.Mount.ID} && ${OutDoors} && !${NoMount})) {
	
	/call FullStop

	/call cast "${Mount}" item 4s CheckForHeal
   	/goto :Main_Loop 
   }
    
   /if (!${CombatOn} && ${Me.Hunger} < 1000) {

	/call FullStop

	/call cast "Abundant Food" gem8 0 CheckForHeal
	/delay 1s
	/autoinventory

	/goto :Main_Loop 
   }

   /if (!${CombatOn} && ${Me.Thirst} < 1000) {
	
	/call FullStop
	

	/call cast "Abundant Drink" gem8 0 CheckForHeal
	/delay 1s
	/autoinventory

	/goto :Main_Loop 
   }

DEBUG_1 Checkpoint 9

   /varset buffsDone 0

   /if (${Me.PctMana} < 60) {
   	/goto :Main_Loop 
   }



   /if (!${Me.Inventory[13].ID}) {
	
	/call FullStop
	

	/call cast "${HammerSpell}" gem${HammerSpellGem}
	/sit on
	/delay 2s
	/autoinventory

   }


DEBUG_1 Checkpoint 10

   |- Group Buffs 
   /if (${Me.PctMana} > 40) /if (!${grpBuffTimer}) /if (!${CombatOn} || ${BuffInBattle} || (${CombatOn} && !(!${MobMaloed} && ${DoMalo}) && !(!${MobSlowed} && ${DoSlow}))) /if (${DoBuffs}) /call GrpBuffs 
   /if (${WaitingOnSpell}) /goto :FollowingBuffs
   /if (${tookAction}) /goto :Main_Loop 
   
DEBUG_1 Checkpoint 11

    |- Single Buff ! 
    /if (${Me.PctMana} > 40) /if (!${CombatOn} || ${BuffInBattle} || (${CombatOn} && !(!${MobMaloed} && ${DoMalo}) && !(!${MobSlowed} && ${DoSlow}))) /if (${DoSingleBuffs}) /call SingleBuffs 
    /if (${WaitingOnSpell}) /goto :FollowingBuffs
    /if (${tookAction}) /goto :Main_Loop 

DEBUG_1 Checkpoint 12

   |- Pet 
   
   /varset buffsDone 1

   |- Check for mobs and do combat stuff 
   /if (${CombatOn}) /call Combat   
   /if (${tookAction}) /goto :Main_Loop  


:FollowingBuffs



DEBUG_1 Checkpoint 13

   /goto :Main_Loop 
/return 

Sub MemSpells 

   /echo Memming spells. Hang on. 
   /if ( !${Me.Gem["${SpellCanni}"]} ) { 
      /memspell ${SpellCanniGem} "${SpellCanni}"
      /delay 25 
   } 
   /if ( !${Me.Gem["${SpellSlow}"]} ) { 
      /memspell ${SpellSlowGem} "${SpellSlow}"
      /delay 20 
   } 
   /if ( !${Me.Gem["${SpellATK}"]} ) { 
      /memspell ${SpellATKGem} "${SpellATK}"
      /delay 20 
   } 
   /if ( !${Me.Gem["${SpellHeal}"]} ) { 
      /memspell ${SpellHealGem} "${SpellHeal}"
      /delay 20 
   } 
   /if ( !${Me.Gem["${SpellHoT}"]} ) { 
      /memspell ${SpellHoTGem} "${SpellHoT}"
      /delay 20 
   } 
   /if ( !${Me.Gem["${SpellDoT}"]} ) { 
      /memspell ${SpellDoTGem} "${SpellDoT}"
      /delay 30 
   } 
   |/if ( ${Window[SpellBookWnd].Open} ) /windowstate SpellBookWnd close 
   /echo Spells are memmed. 

/return 



| ################# Ensures that the spell is memmed and ready to cast,
| # so we're not waiting for 5 minutes for the recast timer to tick down

Sub checkCanCast(string spellName,string spellGem)

	/if ( ${Me.SpellReady[${spellName}]} ) /return 1
	
	/if ( !${Spell[${spellName}].ID} ) {
		/echo ${spellName} not found in spellbook!
	}

	/if ( !${Me.Gem[${spellName}]} ) { 
   		:mem_spell 
      		/if ( ${Cursor.ID} ) { 
        	 	/autoinventory 
      		   	/delay 5 
     		    	/goto :mem_spell  
      		} 
		/call StickOff
     	   	/memspell ${spellGem.Right[1]} "${spellName}" 
     		/delay 6s ${Me.Gem[${spellName}]} 
	}
   	/varset tookAction 1
	/varset WaitingOnSpell 1

/return 0



Sub FullStop


:WaitForStop
	/call StickOff

	/keypress forward
	/keypress right
	/keypress left
	/keypress back
	/keypress strafe_left
	/keypress strafe_right


	/delay 1

	/if (${Me.Moving}) /goto :WaitForStop

/return


Sub StickOff

	/if (${Sticking}) {
		/keypress forward
		/keypress right
		/keypress left
		/keypress back
		/keypress strafe_left
		/keypress strafe_right

		/squelch /stick off
		/squelch /moveto off
	}
	/varset Sticking 0

/return

Sub StickOn

	/squelch /stick ${Closeness}% pin moveback
	/varset Sticking 1

/return

| ################# Checks for expired slow/debuff timers

Sub CheckDebuffTimers

	/declare i int local 1

	/for i 1 to ${DebuffTimers.Size}

		/if (${DebuffTimers[${i}]}) /if (!${Spawn[${DebuffTimers[${i}]}].ID} || ${Spawn[${DebuffTimers[${i}]}].State.Equal[DEAD]}) {
			/if (${Defined[DebuffTimer${DebuffTimers[${i}]}]}) {
				/deletevar DebuffTimer${DebuffTimers[${i}]}
			}

			/varset DebuffTimers[${i}] 0

		}

		/if (${DebuffTimers[${i}]}) /if (${Defined[DebuffTimer${DebuffTimers[${i}]}]}) /if (${DebuffTimer${DebuffTimers[${i}]}}<=6) {
			
			/target id ${DebuffTimers[${i}]}
			/call Slow
		}

	/next i

/return


Sub SetDebuffTimer(int id,timer t)

	/declare i int local 1

	/for i 1 to ${DebuffTimers.Size}
		/if (!${DebuffTimers[${i}]}) {

			/varset DebuffTimers[${i}] ${id}

			/if (!${Defined[DebuffTimer${DebuffTimers[${i}]}]}) {
				/declare DebuffTimer${DebuffTimers[${i}]} timer outer ${t}
			} else {
				/varset DebuffTimer${DebuffTimers[${i}]} ${t}
			}
			/return

		}
	/next i

/return


Sub CheckSlowRadius

	/declare s string local

	/declare sID int local

	/declare i int local 1
	/declare g int local 1
	/declare h int local 1

	/for i 1 to 10
		

:CheckSlowRadiusLoop1

		/varset s ${Me.NearestSpawn[${i},npc].ID}

		/if (${Spawn[${s}].Distance}>${Spell[${SpellSlow}].Range}) /next i
		/if ((${DoMalo} && !${MobMaloed} && ${Spawn[${s}].ID}==${TargetArray[4]}) || (${Me.CurrentMana}<${Spell[${SpellSlow}].Mana})) /next i

		/call CheckAttacking ${Spawn[${s}].ID}

   		/if (${Target.Type.Equal[NPC]} && ${Macro.Return}) { 



      /for g 0 to ${Math.Calc[${Group.Members}+${otherBuffees.Size}]}

	 /if (${g}<=${Group.Members}) {
	 	/varset sID ${Group.Member[${g}].ID}
	 } else {
	 	/varset sID ${Spawn[pc ${otherBuffees[${Math.Calc[${g}-${Group.Members}]}]}].ID}
	 }

				/if (${Spawn[${sID}].ID}) /if (${Math.Distance[${Spawn[${s}].X},${Spawn[${s}].Y}:${Spawn[${sID}].X},${Spawn[${sID}].Y}]} <= 50) {

					/for h 1 to ${DebuffTimers.Size}

						/if (${DebuffTimers[${h}]}==${s}) {
							/varset i ${Math.Calc[${i}+1]}
							/if (${i}>10) /return
							/goto :CheckSlowRadiusLoop1
						|	/next i
						}

					/next h


					|/if (${LineOfSight[${Me.X},${Me.Y},${Me.Z}:${Spawn[${s}].X},${Spawn[${s}].Y},${Spawn[${s}].Z}]}) {
					|	/if (${LineOfSight[${Spawn[${sID}].X},${Spawn[${sID}].Y},${Spawn[${sID}].Z}:${Spawn[${s}].X},${Spawn[${s}].Y},${Spawn[${s}].Z}]}) {

							/target id ${s}

							/delay 5

							|/if (${DoMalo} && ${Target.Type.Equal[NPC]}) {
							|	/call DeBuff
							|}

							/if (${DoSlow} && ${Target.Type.Equal[NPC]}) {

								/call Slow
							}
							/if (${tookAction}) /return
					|	}
					|}
				}
			
			/next g
		}
	/next i

/return


| ################# This will check what Main Assist has in target. 

Sub GetTarget 

   /declare temp int inner 0

   |/squelch /target clear

   /assist ${M_Assist} 
   /delay 10 
|${Target.ID}

   /if (${Target.ID} != ${TargetArray[4]} || ${Target.Distance} > 100) /call StickOff

   /if (${Target.Type.Equal[NPC]}) /if (${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 TRUE 
       
      /varset MobRooted FALSE 
      /varset MobMaloed FALSE 
      /varset MobSlowed FALSE 
      /varset PetOn FALSE 
      /varset MobDoTed FALSE 
      /varset DotTime 0
    

   } 
/return 

| ################### Check target and do stuff like slow, dot, pet attack etc. 

Sub Combat 

   /target id ${TargetArray[4]}

   /delay 3 ${Target.ID}==${TargetArray[4]}

DEBUG_1 Checkpoint 12.1

   /if (${Target.ID}==${TargetArray[4]}) /if (${Target.PctHPs}<=${CombatAt} && ${Target.Type.Equal[NPC]}) { 

	/if (${DoSlow}) /if (${Target.Distance}>${Spell[${SpellSlow}].Range}) /call AttemptAvoid

   }

DEBUG_1 Checkpoint 12.2

   /if (!(${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 60) && ${DoSlow}) /call SetDebuffTimer ${underAttackBy}  0


DEBUG_1 Checkpoint 12.3


|   /if (${CombatOn} && !${MobSlowed} && ${DoSlow} && ${Target.ID}==${TargetArray[4]}) {
|	/call Slow 
|	/return
|   }

   /if (${CombatOn} && !${PetOn} && ${Target.ID}==${TargetArray[4]}) { 
	/pet back off
      	/pet attack 
      	/varset PetOn TRUE 
   } 

DEBUG_1 Checkpoint 12.4

   /if (${CombatOn} && ${DoDoT}) /if (!${underAttack}) /if ((${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 60) || !${DoSlow}) /if (${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 0) /if (${DotTime}<=0) /if (${Me.PctMana} > 65) /if (${Target.PctHPs}<=${CastDoTat} && ${Target.PctHPs}>=${MinDoTat}) { 
      	
	DEBUG_1 Checkpoint 12.5

	
        /call checkCanCast "${SpellDoT}" gem${SpellDoTGem}
        /if (!${Macro.Return}) /return

	/call FullStop


	/call cast "${SpellDoT}" gem${SpellDoTGem} 0 CheckForHeal

	/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
		/varset DotTime ${Math.Calc[${Spell["${SpellDoT}"].Duration}*60-${Spell["${SpellDoT}"].CastTime}*10]}
	} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
		/call AttemptAvoid
	} else {
		/varset DotTime 50
	}

   	/varset tookAction 1

	/return
   } 
   
DEBUG_1 Checkpoint 12.6
 
   /if (!${underAttack}) /if ((${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 60) || !${DoSlow}) /if (${Me.PctMana} > ${MinManaForNuke}) /if (!${nukeTimer}) /if (${CombatOn} && ${DoNuke} && ${Target.PctHPs}<=${NukeAt} && ${Target.PctHPs}>=${MinNukeat}) { 
        
	DEBUG_1 Checkpoint 12.7

        
        /call checkCanCast "${SpellNuke}" gem${SpellNukeGem} 
        /if (!${Macro.Return}) /return

	/call FullStop


      	/call cast "${SpellNuke}" gem${SpellNukeGem} 0 CheckForHeal

	/if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_RESISTED]}) {
		/varset nukeTimer ${DelayBetweenNukes}
	} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
		/call AttemptAvoid
	}

   	/varset tookAction 1

	/return
   } 
    
    DEBUG_1 Checkpoint 12.8

  /if ((${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 0) || !${DoSlow}) /if (!${MobRooted} && ${CombatOn} && ${DoRoot} && ${Target.PctHPs}<=${Rootat}) { 
        
	DEBUG_1 Checkpoint 12.9

        /call checkCanCast "${SpellRoot}" gem${SpellRootGem} 
        /if (!${Macro.Return}) /return

	/call FullStop


      /call cast "${SpellRoot}" gem${SpellRootGem} 0 CheckForHeal
      /varset tookAction 1
      /varset MobRooted TRUE 
   } 

DEBUG_1 Checkpoint 12.10

|- EndCombat 

   /target id ${TargetArray[4]} 
    
   /if (!${Target.Name.Equal[${TargetArray[3]}]} || !${Target.ID}) { 
      /varset MobRooted FALSE 
      /varset MobMaloed FALSE 
      /varset MobSlowed FALSE 
      /varset PetOn FALSE 
      /varset MobDoTed FALSE 
      /varset CombatOn FALSE 
      /varset DotTime 0
    
      /varset TargetArray[1] NULL 
      /varset TargetArray[2] NULL 
      /varset TargetArray[3] NULL 
      /varset TargetArray[4] NULL 

      /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} 


      /if (!${following.Equal[FALSE]}) {
          /echo Combat over. Resume following ${following}.
          /call FollowFunction "${following}"

      }
    
   } 

/return 

Sub DeBuff 
:DeBuff_Loop 
   /if (${Target.PctHPs}<=${CombatAt} && ${Target.Type.Equal[NPC]}) { 
      /if (${Me.CurrentMana}<${Spell[${SpellDeBuff}].Mana}) { 
         |/echo *** Shid ! I don't have mana to Malo %T 
      } else { 
        /call checkCanCast "${SpellDeBuff}" gem${SpellDeBuffGem}
        /if (!${Macro.Return}) /return

	/call FullStop


         /call cast "${SpellDeBuff}" gem${SpellDeBuffGem} 6s
	 |/varset underAttack 80
         /varset tookAction 1
         /if (!${Macro.Return.Equal["CAST_SUCCESS"]}) {
		/return
	 } else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
		/call AttemptAvoid
	 }
         /varset MobMaloed TRUE 
      } 
   } 
/return 

Sub Slow 

   /if (${DoMalo} && !${MobMaloed} && ${Target.ID}==${TargetArray[4]}) /return
   |/if (${Target.PctHPs}<=${CombatAt} && ${Target.Type.Equal[NPC]}) { 
      /if (${Me.CurrentMana}<${Spell[${SpellSlow}].Mana}) { 
         |/echo Shid ! I don't have mana to Malo %T 
      } else { 
:Slow_Loop 
        /call checkCanCast "${SpellSlow}" gem${SpellSlowGem}
        /if (!${Macro.Return}) /return

	/call FullStop


         /call cast "${SpellSlow}" gem${SpellSlowGem} 6s
	 /varset underAttack 80
         /varset tookAction 1
         /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) /return
         /if (${Macro.Return.Equal["CAST_IMMUNE"]}) { 
            |/if (${Verbose}) 


		|/gsay < %T > is IMMUNE to slow ! 

          	/call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*6000-100]}
            /varset MobSlowed TRUE 
         } 
         /if (${Macro.Return.Equal["CAST_RESISTED"]}) { 
            /if (!${FastSlow}) { 
               |/if (${Verbose}) 


		|/gsay < %T > RESISTED slow ! Trying again...


          	/call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*6000-100]}
                /return 
             } 
            /varset MobSlowed TRUE 
          } 
         /if (${Macro.Return.Equal["CAST_SUCCESS"]}) { 
            |/if (${Verbose}) 


		|/gsay < %T > is SLOWED 


            /varset MobSlowed TRUE 

	    /call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*60-100]}
          }  else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]} || ${Macro.Return.Equal[CAST_CANNOTSEE]}) {
		/call AttemptAvoid ${Target.ID}
	 }
         /if (${Macro.Return.Equal["CAST_CANNOTSEE"]}) { 
	    /call SetDebuffTimer ${Target.ID} 150
		/echo Cannot See: ${Target.CleanName}
          } 

      } 
   |} 
/return 
Last edited by guest_01 on Sun May 08, 2005 3:55 am, edited 4 times in total.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Mon May 02, 2005 2:32 pm

Code: Select all

| ################### Buff the group with buffs from the SpellGrpBuff array 
| ################### It will NOT cast any single target spells 

Sub GrpBuffs 
   /declare i int local 1 
   /declare j int local 1

   /if (!${SpellGrpBuff.Size}) /return

   /for i 1 to ${SpellGrpBuff.Size} 
      /if (${Spell[${SpellGrpBuff[${i}]}].Mana} > ${Me.CurrentMana}) /return 
      /if ( !${Me.Buff[${SpellGrpBuff[${i}]}].ID} ) { 

         /target id ${Me.ID} 
         /delay 1s ${Target.ID} 

	/call AttemptAvoid

	/if (${grpBuffTimesAttempted}<1) {
      
		/for j 1 to 5
			/if (${Group.Member[${j}].Distance} > ${Spell[${SpellGrpBuff[${i}]}].AERange}) {
				/echo *** Need to rebuff ${SpellGrpBuff[${i}]}, but group members are too far away!

				/gsay Will cast ${SpellGrpBuff[${i}]} in approx 15 seconds - get close people.
				
				/varset grpBuffTimer 150
				/varset grpBuffTimesAttempted ${Math.Calc[${grpBuffTimesAttempted}+1]}
				/call AttemptAvoid ${Spawn[pc ${M_Assist}].ID} ${Spell[${SpellGrpBuff[${i}]}].AERange}
				/return
			}
		/next j
	}

        /call checkCanCast "${SpellGrpBuff[${i}]}" gem${SpellBuffsGem}
        /if (!${Macro.Return}) /return

         /echo *** Hang on ! Rebuffing ${SpellGrpBuff[${i}]} 
         /gsay INC ${SpellGrpBuff[${i}]}, Stay close or miss out!
         /call EquipItem ${BuffFocusItem} 
         /varset MainItem ${Macro.Return} 

	/call FullStop


         /call cast "${SpellGrpBuff[${i}]}" gem${SpellBuffsGem} 5s CheckForHeal
         /varset tookAction 1
         /call EquipItem ${MainItem} 
	 /varset grpBuffTimesAttempted 0
	 /return
      } 
   /next i 
/return 







Sub RateHealPriority(int pcID, int whatHeal)
	
	/declare toReturn int local 0
	/declare gClass string local
	
	/varset gClass ${Spawn[pcID].Class.ID}
	
	/varcalc toReturn 100-${Spawn[${pcID}].PctHPs}

	/if (${Spawn[pc ${M_Assist}].ID}==${pcID}) /varcalc toReturn ${toReturn}+40
	/if (${Me.ID}==${pcID}) /varcalc toReturn ${toReturn}+25
	
	/if (${whatHeal}==1) {
		/if (${ClassHeals${gClass}[2]} > ${ClassHeals${gClass}[1]}) /varcalc toReturn ${toReturn}+1
		/if (${ClassHeals${gClass}[3]} > ${ClassHeals${gClass}[1]}) /varcalc toReturn ${toReturn}+1
	}

	/if (${whatHeal}==2) {
		/if (${ClassHeals${gClass}[1]} > ${ClassHeals${gClass}[2]}) /varcalc toReturn ${toReturn}+1
		/if (${ClassHeals${gClass}[3]} > ${ClassHeals${gClass}[2]}) /varcalc toReturn ${toReturn}+1
	}

	/if (${whatHeal}==3) {
		/if (${ClassHeals${gClass}[1]} > ${ClassHeals${gClass}[3]}) /varcalc toReturn ${toReturn}+1
		/if (${ClassHeals${gClass}[2]} > ${ClassHeals${gClass}[3]}) /varcalc toReturn ${toReturn}+1
	}

/return ${toReturn}





|################### Check if any group member needs healing

Sub Check_grpHPs 
	/declare i int local 1
	/declare g int local 1 
	/declare gClass string local
	/declare Priorities[6,3] int local
	/declare groupHealRating int local
	/declare toHeal[2] int local

	/if (${healTimer}<=0) {
		/varset healTimer 60

		/for i 1 to 17
			/if (${ClassHeals${i}[4]}) /varcalc ClassHeals${i}[4] ${ClassHeals${i}[4]}-1
			/if (${ClassHeals${i}[4]}<0) /varset ClassHeals${i}[4] 0
		/next i


	}

	
	/for g 0 to ${Group.Members} 

		/if (${Group.Member[${g}].ID} && !${Group.Member[${g}].Type.Equal[CORPSE]}) {

			/varset gClass ${Group.Member[${g}].Class.ID}

			/if (${DoGroupHeal}) /if (${Group.Member[${g}].PctHPs}<80 && ${Group.Member[${g}].Distance}<${Spell[${SpellGroupHeal}].AERange}) /varcalc groupHealRating ${groupHealRating}+1


			/if ((${DoCompleteHeal} || !${g}) && ${ClassHeals${gClass}[1]} && ${Group.Member[${g}].PctHPs}<=(${Math.Calc[${ClassHeals${gClass}[1]}+${ClassHeals${gClass}[4]}]})) { 

				/call SpellInformation "${SpellCompleteHeal}"

				/if (${Me.CurrentMana}<${Spell[${SpellCompleteHeal}].Mana}) { 
					|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
				} else /if (${Group.Member[${g}].Distance}<=${Spell[${SpellCompleteHeal}].Range}) { 

					/call RateHealPriority ${Group.Member[${g}].ID} 1
					/varset Priorities[${Math.Calc[${g}+1]},1] ${Macro.Return}

				} else {
					/call AttemptAvoid ${Group.Member[${g}].ID} ${Spell[${SpellCompleteHeal}].Range}
				}

			}


			/if ((${DoHeal} || !${g}) && ${ClassHeals${gClass}[2]} && ${Group.Member[${g}].PctHPs}<=${ClassHeals${gClass}[2]}) { 

				/call SpellInformation "${SpellHeal}"

				/if (${Me.CurrentMana}<${Spell[${SpellHeal}].Mana}) { 
					|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
				} else /if (${Group.Member[${g}].Distance}<=${Spell[${SpellHeal}].Range}) { 

					/call RateHealPriority ${Group.Member[${g}].ID} 2
					/varset Priorities[${Math.Calc[${g}+1]},2] ${Macro.Return}

				} else {
					/call AttemptAvoid ${Group.Member[${g}].ID} ${Spell[${SpellHeal}].Range}
				}

			}


			/if ((${DoHoT} || !${g}) && ${ClassHeals${gClass}[3]} && ${Group.Member[${g}].PctHPs}<=${ClassHeals${gClass}[3]}) { 

				/if (!${GroupMemHoTTime${g}}) {

					/call SpellInformation "${SpellHoT}"

					/if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) { 
						|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
					} else /if (${Group.Member[${g}].Distance}<=${Spell[${SpellHoT}].Range}) { 

						/call RateHealPriority ${Group.Member[${g}].ID} 3
						/varset Priorities[${Math.Calc[${g}+1]},3] ${Macro.Return}

					} else {
						/call AttemptAvoid ${Group.Member[${g}].ID} ${Spell[${SpellHoT}].Range}
					}
				}
			}
		}

	/next g

:HealLoop

	/for g 1 to ${Math.Calc[${Group.Members}+1]}

		/if (${Priorities[${g},1]} > ${toHeal[2]}) {
			/varcalc toHeal[1] ${g}-1
			/varset toHeal[2] ${Priorities[${g},1]}
		}

		/if (${Priorities[${g},2]} > ${toHeal[2]}) {
			/varcalc toHeal[1] ${g}-1
			/varset toHeal[2] ${Priorities[${g},2]}
		}
		
		/if (${Priorities[${g},3]} > ${toHeal[2]}) {
			/varcalc toHeal[1] ${g}-1
			/varset toHeal[2] ${Priorities[${g},3]}
		}
	/next g
		
	
	/if (${groupHealRating}>=3) /if (${DoGroupHeal}) /if (${GroupMemHoTTime} <= 0) {

		/call SpellInformation "${SpellGroupHeal}"

		/call FullStop


		/squelch /target clear

		/if (${Verbose}) /gsay ${SpellGroupHeal} inc on Group!
		
		/varset Healing[1] 0
		/varset Healing[2] 4
		/varset castTimer ${SpCastTime}

		/call cast "${SpellGroupHeal}" gem${SpellGroupHealGem} ${SpCastTime}
		/varset tookAction 1 
		/varset GroupMemHoTTime 50
		/varcalc GroupMemHoTTime ${GroupMemHoTTime}*((${SpellDurationBonus}/100)+1)
		/echo ${GroupMemHoTTime}

		/return
	}
   
   
   	/if (${toHeal[2]}>0) {
   		/varset g ${toHeal[1]}

		/if (${Priorities[${Math.Calc[${g}+1]},3]} >= ${toHeal[2]}) {

			/call SpellInformation "${SpellHoT}"

			/varset GroupMemHoTTime${g} ${SpDuration}
			
			/call FullStop
			

			/squelch /target clear

			/target pc ${Group.Member[${g}]} 
			/delay 1s ${Target.ID}==${Group.Member[${g}].ID} 
			
			/if (${Verbose}) /gsay ${SpellHoT} on < %T >

			/varset Healing[1] ${Group.Member[${g}].ID}
			/varset Healing[2] 3
			/varset castTimer ${SpCastTime}
			
			/call cast "${SpellHoT}" gem${SpellHoTGem} ${SpCastTime} CheckHP 
			/varset tookAction 1
			/if (!${Macro.Return.Equal[CAST_SUCCESS]}) {
				/varset GroupMemHoTTime${g} 50
				/varcalc GroupMemHoTTime${g} ${GroupMemHoTTime${g}}*((${SpellDurationBonus}/100)+1)
			} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
				/call AttemptAvoid ${Group.Member[${g}].ID} ${Spell[${SpellHoT}].Range}
			}

			/if (${Priorities[${Math.Calc[${g}+1]},1]}) {

				/echo Before: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

				/varcalc ClassHeals${Spawn[${Healing[1]}].Class.ID}[4] ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]}+10

				/echo After: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

			}

			/return
		}

		/if (${Priorities[${Math.Calc[${g}+1]},2]} >= ${toHeal[2]}) {

			/call SpellInformation "${SpellHeal}"

			/call FullStop


			/squelch /target clear

			/target pc ${Group.Member[${g}]} 
			/delay 1s ${Target.ID}==${Group.Member[${g}].ID} 
			
			/if (${Verbose}) /gsay ${SpellHeal} on < %T >

			/varset Healing[1] ${Group.Member[${g}].ID}
			/varset Healing[2] 2
			/varset castTimer ${SpCastTime}
			
			/call cast "${SpellHeal}" gem${SpellHealGem} ${SpCastTime} CheckHP 
			/varset tookAction 1 

			/if (${Priorities[${Math.Calc[${g}+1]},1]}) {

				/echo Before: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

				/varcalc ClassHeals${Spawn[${Healing[1]}].Class.ID}[4] ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]}+10

				/echo After: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

			}

			/return

		}

		/if (${Priorities[${Math.Calc[${g}+1]},1]} >= ${toHeal[2]}) {

			/call SpellInformation "${SpellCompleteHeal}"

			/call FullStop


			/squelch /target clear

			/target pc ${Group.Member[${g}]} 
			/delay 1s ${Target.ID}==${Group.Member[${g}].ID} 
			
			/if (${Verbose}) /gsay ${SpellCompleteHeal} on < %T >

			/varset Healing[1] ${Group.Member[${g}].ID}
			/varset Healing[2] 1
			/varset castTimer ${SpCastTime}
			
			/call cast "${SpellCompleteHeal}" gem${SpellCompleteHealGem} ${SpCastTime} CheckHP 
			/varset tookAction 1 
			
			/return

		}
   	}
   
   
/return 


|################### Check if any group member's Pets need healing

Sub Check_grpPetHPs 
	/declare i int local 1
	/declare g int local 1 
   	/declare gClass string local
   	/declare Priorities[6,3] int local
   	/declare groupHealRating int local
   	/declare toHeal[2] int local

	/if (${healTimer}<=0) {
		/varset healTimer 60

		/for i 1 to 17
			/if (${ClassHeals${i}[4]}) /varcalc ClassHeals${i}[4] ${ClassHeals${i}[4]}-1
			/if (${ClassHeals${i}[4]}<0) /varset ClassHeals${i}[4] 0
		/next i


	}

   
   	
   	/for g 0 to ${Group.Members} 
   
   		/if (${Group.Member[${g}].Pet.ID} && !${Group.Member[${g}].Pet.Type.Equal[CORPSE]}) {
   
   			/varset gClass ${Group.Member[${g}].Pet.Class.ID}
   
   			/if ((${DoCompleteHeal} || !${g}) && ${ClassHeals${gClass}[1]} && ${Group.Member[${g}].Pet.PctHPs}<=(${Math.Calc[${ClassHeals${gClass}[1]}+${ClassHeals${gClass}[4]}]})) { 
   
   				/call SpellInformation "${SpellCompleteHeal}"
   
   				/if (${Me.CurrentMana}<${Spell[${SpellCompleteHeal}].Mana}) { 
   					|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}].Pet} 
   				} else /if (${Group.Member[${g}].Pet.Distance}<${Spell[${SpellCompleteHeal}].Range}) { 
   
   					/call RateHealPriority ${Group.Member[${g}].Pet.ID} 1
   					/varset Priorities[${Math.Calc[${g}+1]},1] ${Macro.Return}
   
   				} else {
   					/call AttemptAvoid ${Group.Member[${g}].Pet.ID} ${Spell[${SpellCompleteHeal}].Range}
   				}
   
   			}
   
   
   			/if ((${DoHeal} || !${g}) && ${ClassHeals${gClass}[2]} && ${Group.Member[${g}].Pet.PctHPs}<=${ClassHeals${gClass}[2]}) { 
   
   				/call SpellInformation "${SpellHeal}"
   
   				/if (${Me.CurrentMana}<${Spell[${SpellHeal}].Mana}) { 
   					|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}].Pet} 
   				} else /if (${Group.Member[${g}].Pet.Distance}<${Spell[${SpellHeal}].Range}) { 
   
   					/call RateHealPriority ${Group.Member[${g}].Pet.ID} 2
   					/varset Priorities[${Math.Calc[${g}+1]},2] ${Macro.Return}
   
   				} else {
   					/call AttemptAvoid ${Group.Member[${g}].Pet.ID} ${Spell[${SpellHeal}].Range}
   				}
   
   			}
   
   
   			/if ((${DoHoT} || !${g}) && ${ClassHeals${gClass}[3]} && ${Group.Member[${g}].Pet.PctHPs}<=${ClassHeals${gClass}[3]}) { 
   
   				/if (!${GroupMemPetHoTTime${g}}) {
   
   					/call SpellInformation "${SpellHoT}"
   
   					/if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) { 
   						|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}].Pet} 
   					} else /if (${Group.Member[${g}].Pet.Distance}<${Spell[${SpellHoT}].Range} && ${Target.ID}==${Group.Member[${g}].Pet.ID}) { 
   
   						/call RateHealPriority ${Group.Member[${g}].Pet.ID} 3
   						/varset Priorities[${Math.Calc[${g}+1]},3] ${Macro.Return}
   
   					} else {
   						/call AttemptAvoid ${Group.Member[${g}].Pet.ID} ${Spell[${SpellHoT}].Range}
   					}
   				}
   			}
   		}
   
   	/next g
   
   
   	/for g 1 to ${Math.Calc[${Group.Members}+1]}
   
   		/if (${Priorities[${g},1]} > ${toHeal[2]}) {
   			/varcalc toHeal[1] ${g}-1
   			/varset toHeal[2] ${Priorities[${g},1]}
   		}
   
   		/if (${Priorities[${g},2]} > ${toHeal[2]}) {
   			/varcalc toHeal[1] ${g}-1
   			/varset toHeal[2] ${Priorities[${g},2]}
   		}
   		
   		/if (${Priorities[${g},3]} > ${toHeal[2]}) {
   			/varcalc toHeal[1] ${g}-1
   			/varset toHeal[2] ${Priorities[${g},3]}
   		}
   	/next g



      	/if (${toHeal[2]}>0) {
      		/varset g ${toHeal[1]}
   
   		/if (${Priorities[${Math.Calc[${g}+1]},3]} >= ${toHeal[2]}) {
   
   			/call SpellInformation "${SpellHoT}"
   			
   
   			/varset GroupMemHoTTime${g} ${SpDuration}
   			
			/call FullStop
			

   			/squelch /target clear
   
   			/target id ${Group.Member[${g}].Pet.ID} 
   			/delay 1s ${Target.ID}==${Group.Member[${g}].Pet.ID} 
   			
   			/if (${Verbose}) /gsay ${SpellHoT} on < %T >
   
   			/varset Healing[1] ${Group.Member[${g}].Pet.ID}
   			/varset Healing[2] 3
   			/varset castTimer ${SpCastTime}
   			
   			/call cast "${SpellHoT}" gem${SpellHoTGem} ${SpCastTime} CheckHP 
   			/varset tookAction 1
   			/if (!${Macro.Return.Equal[CAST_SUCCESS]}) {
   				/varset GroupMemPetHoTTime${g} 50
				/varcalc GroupMemPetHoTTime${g} ${GroupMemPetHoTTime${g}}*((${SpellDurationBonus}/100)+1)
   			} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
   				/call AttemptAvoid ${Group.Member[${g}].Pet.ID} ${Spell[${SpellHoT}].Range}
   			}

			/if (${Priorities[${Math.Calc[${g}+1]},1]}) {

				/echo Before: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

				/varcalc ClassHeals${Spawn[${Healing[1]}].Class.ID}[4] ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]}+10

				/echo After: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

			}

   			/return
   		}
   
   		/if (${Priorities[${Math.Calc[${g}+1]},2]} >= ${toHeal[2]}) {
   
   			/call SpellInformation "${SpellHeal}"

   			
			/call FullStop
			

   			/squelch /target clear
   
   			/target id ${Group.Member[${g}].Pet.ID} 
   			/delay 1s ${Target.ID}==${Group.Member[${g}].Pet.ID} 
   			
   			/if (${Verbose}) /gsay ${SpellHeal} on < %T >
   
   			/varset Healing[1] ${Group.Member[${g}].Pet.ID}
   			/varset Healing[2] 2
   			/varset castTimer ${SpCastTime}
   			
   			/call cast "${SpellHeal}" gem${SpellHealGem} ${SpCastTime} CheckHP 
   			/varset tookAction 1 

			/if (${Priorities[${Math.Calc[${g}+1]},1]}) {

				/echo Before: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

				/varcalc ClassHeals${Spawn[${Healing[1]}].Class.ID}[4] ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]}+10

				/echo After: ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[4]} 

			}

   			/return
   
   		}
   
   		/if (${Priorities[${Math.Calc[${g}+1]},1]} >= ${toHeal[2]}) {
   
   			/call SpellInformation "${SpellCompleteHeal}"
   
   			
			/call FullStop
			

   			/squelch /target clear
   
   			/target id ${Group.Member[${g}].Pet.ID} 
   			/delay 1s ${Target.ID}==${Group.Member[${g}].Pet.ID} 
   			
   			/if (${Verbose}) /gsay ${SpellCompleteHeal} on < %T >
   
   			/varset Healing[1] ${Group.Member[${g}].Pet.ID}
   			/varset Healing[2] 1
   			/varset castTimer ${SpCastTime}
   			
   			/call cast "${SpellCompleteHeal}" gem${SpellCompleteHealGem} ${SpCastTime} CheckHP 
   			/varset tookAction 1 
   			
   			/return
   
   		}
      	}
      
   
/return 


| ################## Canni 5 

Sub Cannibalization 

   DEBUG_1 We shouldn't be here

   |/call CheckMyHPs 
   /if (${Me.CurrentHPs} > 3200) { 
      /if (${Verbose}) /gsay *** Doing Cannibalization ! 
      /aa act Cannibalization 
      /delay 3s 
   } 

/return 

| ################## This will NOT check self HPs, Only check HoT or recast HoT 

Sub CheckMyHPs 

   /if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) { 
      /echo *** Shit, I don't have mana to cast ${SpellHoT} 
   } else { 

			/if (!${GroupMemHoTTime0}) {

   				/call SpellInformation "${SpellHoT}"
    
				/target pc ${Group.Member[0]} 

               			/delay 1s ${Target.ID}==${Group.Member[0].ID} 

				/if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) { 
					/echo *** Shid ! I don't have mana to heal ${Group.Member[0]} 
				} else /if (${Target.ID}==${Group.Member[0].ID}) { 
					/varset GroupMemHoTTime0 ${SpDuration}

					/call FullStop

					/call cast "${SpellHoT}" gem${SpellHoTGem} 4s 
   					/varset tookAction 1
					/if (!${Macro.Return.Equal[CAST_SUCCESS]}) {
						/varset GroupMemHoTTime0 50
					}
				} 
			}
   } 

/return 

| ################## Buff pet with spells from SpellPetBuff array 

Sub BuffPet 

   /declare i int local 
   /for i 1 to ${SpellPetBuff.Size} 
      /if (!${Me.PetBuff[${SpellPetBuff[${i}]}]} && ${Spell[${SpellPetBuff[${i}]}].Mana} <= ${Me.CurrentMana}) { 

        /call checkCanCast "${SpellPetBuff[${i}]}" gem${SpellBuffsGem}
        /if (!${Macro.Return}) /return

         /pet target 
         /delay 1s ${Me.Pet.ID}==${Target.ID} 
         /call EquipItem ${BuffFocusItem} 
         /varset MainItem ${Macro.Return} 
	
	/call FullStop
	

         /call cast "${SpellPetBuff[${i}]}" gem${SpellBuffsGem} 9s CheckForHeal
   	 /varset tookAction 1
         /call EquipItem ${MainItem} 
      } 
   /next i 
/return 

Sub Cast_Avatar 

   /declare i int local 0 
   /for i 0 to ${Group.Members} 
   /if (${Group.Member[${i}].ID}) { 
      
	/if (${ATKBuffed${i}}==0) /if (${Me.PctMana}>40) /if (${Group.Member[${i}].Class.Name.Equal[Berserker]} || ${Group.Member[${i}].Class.Name.Equal[Beastlord]} || ${Group.Member[${i}].Class.Name.Equal[Shadow Knight]} || ${Group.Member[${i}].Class.Name.Equal[Bard]} || ${Group.Member[${i}].Class.Name.Equal[Ranger]} || ${Group.Member[${i}].Class.Name.Equal[Rogue]} || ${Group.Member[${i}].Class.Name.Equal[Paladin]} || ${Group.Member[${i}].Class.Name.Equal[Monk]} || ${Group.Member[${i}].Class.Name.Equal[Warrior]}) /if (${Group.Member[${i}].Distance}<=${Spell[${SpellATK}].Range}) { 
         
         /if (${Me.CurrentMana}>${Spell[${SpellATK}].Mana}) { 


            /call checkCanCast "${SpellATK}" gem${SpellATKGem}
            /if (!${Macro.Return}) /return


		/call FullStop


		/target pc ${Group.Member[${i}]} 
         	/delay 1s ${Group.Member[${i}].ID}==${Target.ID} 


            /call EquipItem ${BuffFocusItem} 
            /varset MainItem ${Macro.Return} 
	
            /call cast "${SpellATK}" gem${SpellATKGem} 4s CheckForHeal
            /varset tookAction 1
            /if (${Macro.Return.Equal["CAST_SUCCESS"]}) {
		/varset ATKBuffed${i} ${AvatarDelay}´ 
	    }  else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
		/varset ATKBuffed${i} 150
		/call AttemptAvoid ${Spawn[${sID}].ID} ${Spell[${SpellBuff[${i},1]}].Range}
	    }
            /call EquipItem ${MainItem} 
            /return 
         } 
      } 
   } 
   /next i 
/return 

| #################### The Single boofs stuff routine kinda 
| Im sure there is a better way to do this. 
| But this is what I could crackup at work. 

Sub SingleBuffs 

   /declare i int local 1 
   /declare g int local 0 
   /declare h int local 1 
   /declare Classes int local 0 
   /declare sID int local 0

   /if (!${SpellBuff.Size[1]}) /return

   /for i 1 to ${SpellBuff.Size[1]}

     /if (${Spell[${SpellBuff[${i},1]}].Mana} > ${Me.CurrentMana}) /return 

     /varset Classes ${String[${SpellBuff[${i},2]}].Count[,]} 

     /if (${Bool[${SpellBuff[${i},3]}]}) {

      /for g 0 to ${Math.Calc[${Group.Members}+${otherBuffees.Size}]}

	 /if (${g}<=${Group.Members}) {
	 	/varset sID ${Group.Member[${g}].ID}
	 } else {
	 	/varset sID ${Spawn[${otherBuffees[${Math.Calc[${g}-${Group.Members}]}]}].ID}
	 }


      	 /squelch /declare SpellBufftmr${i}${Spawn[${sID}].Name}   timer   global 0 


	 /if (${SpellBufftmr${i}${Spawn[${sID}].Name}}>0 && ${Spawn[${sID}].Type.Equal[Corpse]}) /resetbuffs corpse ${Spawn[${sID}].CleanName}


         /if (!${Spawn[${sID}].Type.Equal[Corpse]} && ${SpellBufftmr${i}${Spawn[${sID}].Name}}<=0) {


      	 /call SpellInformation "${SpellBuff[${i},1]}"

         /for h 1 to ${Classes} 

            /if (${Spawn[${sID}].Class.Name.Equal[${String[${SpellBuff[${i},2]}].Arg[${h},,]}]}) { 

               /target id ${sID}

               /delay 1s ${Target.ID}==${Spawn[${sID}].ID} 

		/if (${Target.Distance}<=${Spell[${SpellBuff[${i},1]}].Range}) { 

			/if (${Me.CurrentMana}<${Spell[${SpellBuff[${i},1]}].Mana}) { 
				/return
			}

                        /call checkCanCast "${SpellBuff[${i},1]}" gem${SpellBuffsGem}
                        /if (!${Macro.Return}) /return

               		/call EquipItem ${BuffFocusItem} 

               		/varset MainItem ${Macro.Return} 

			/call FullStop


               		/call cast "${SpellBuff[${i},1]}" gem${SpellBuffsGem} ${SpCastTime} CheckForHeal
   			/varset tookAction 1

			/if (${Macro.Return.Equal[CAST_SUCCESS]} || ${spellNotHold}) {
               			/varset SpellBufftmr${i}${Spawn[${sID}].Name} ${Math.Calc[${Math.Calc[${SpDuration}-${SpCastTime}]}-${Math.Calc[300-${Math.Calc[${Spell[${SpellBuff[${i},1]}].RecastTime}*10]}]}]} 
			} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]}) {
				/call AttemptAvoid ${sID} ${Spell[${SpellBuff[${i},1]}].Range}
	 		} else {
               			/varset SpellBufftmr${i}${Spawn[${sID}].Name} 10
               			/call EquipItem ${MainItem} 
				/next h
			}

               		/call EquipItem ${MainItem} 
               		/return 
		} else {
			/call AttemptAvoid ${Spawn[${sID}].ID} ${Spell[${SpellBuff[${i},1]}].Range}
               		/varset SpellBufftmr${i}${Spawn[${sID}].Name} 10
			/next h
		}
            } 
         /next h 
	}
      /next g 
     }
   /next i 




/return 

| ################### Get some information of the spell to be used. 

Sub SpellInformation(string SpellName) 

   /varset SpDurBonus ${Math.Calc[${SpellDurationBonus}/100+1]} 

   /varset SpDuration ${Math.Calc[${Spell[${SpellName}].Duration}*60*${SpDurBonus}]}

   |/varset SpDuration ${Math.Calc[${Spell[${SpellName}].Duration}/10*60*${SpDurBonus}]} 

   /varset SpCastTime ${Math.Calc[${Spell[${SpellName}].MyCastTime}*10].Int} 

/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 1
   /declare g int local 0 
   /declare sID int local 0

   /if (${Command.Equal[malo]} && ${DoMalo}==0) { 
      /varset DoMalo TRUE 
      /echo Do Malo:   ${DoMalo} 
   } else /if (${Command.Equal[malo]}) { 
      /varset DoMalo FALSE 
      /echo Do Malo:   ${DoMalo} 
   } 

   /if (${Command.Equal[slow]} && ${DoSlow}==0) { 
      /varset DoSlow TRUE 
      /echo Do Slow:   ${DoSlow} 
   } else /if (${Command.Equal[slow]}) { 
      /varset DoSlow FALSE 
      /echo Do Slow:   ${DoSlow} 
   } 
    
   /if (${Command.Equal[fastslow]} && ${FastSlow}==0) { 
      /varset FastSlow TRUE 
      /echo Do Fast Slow:   ${FastSlow} 
   } else /if (${Command.Equal[fastslow]}) { 
      /varset FastSlow FALSE 
      /echo Do Fast Slow:   ${FastSlow} 
   } 
    
   /if (${Command.Equal[root]} && ${DoRoot}==0) { 
      /varset DoRoot TRUE 
      /echo Do Root:   ${DoRoot} 
   } else /if (${Command.Equal[root]}) { 
      /varset DoRoot FALSE 
      /echo Do Root:   ${DoRoot} 
   }    
    
   /if (${Command.Equal[pet]} && ${SummonPet}==0) { 
      /varset SummonPet TRUE 
      /echo Summon Pet:   ${SummonPet} 
   } else /if (${Command.Equal[pet]}) { 
      /varset SummonPet FALSE 
      /echo Summon Pet:   ${SummonPet} 
   }    
    
   /if (${Command.Equal[dot]} && ${DoDoT}==0) { 
      /varset DoDoT TRUE 
      /echo Do DoT:   ${DoDoT} 
   } else /if (${Command.Equal[dot]}) { 
      /varset DoDoT FALSE 
      /echo Do DoT:   ${DoDoT} 
   } 
    
   /if (${Command.Equal[buffs]} && ${DoBuffs}==0) { 
      /varset DoBuffs TRUE 
      /echo Do Buffs:   ${DoBuffs} 
   } else /if (${Command.Equal[buffs]}) { 
      /varset DoBuffs FALSE 
      /echo Do Buffs:   ${DoBuffs} 
   } 
    
   /if (${Command.Equal[sow]} && ${DoSow}==0) { 
      /varset DoSow TRUE 
      /echo Do Sow:   ${DoSow} 
   } else /if (${Command.Equal[sow]}) { 
      /varset DoSow FALSE 
      /echo Do Sow:   ${DoSow} 
   } 
    
   /if (${Command.Equal[nuke]} && ${DoNuke}==0) { 
      /varset DoNuke TRUE 
      /echo Do Nuke:   ${DoNuke} 
   } else /if (${Command.Equal[nuke]}) { 
      /varset DoNuke FALSE 
      /echo Do Nuke:   ${DoNuke} 
   } 
    
   /if (${Command.Equal[heal]} && ${DoHeal}==0) { 
      /varset DoHeal TRUE 
      /echo Do Heal:   ${DoNuke} 
   } else /if (${Command.Equal[heal]}) { 
      /varset DoHeal FALSE 
      /echo Do Heal:   ${DoNuke} 
   } 

   /if (${Command.Equal[verbose]} && ${Verbose}==0) { 
      /varset Verbose TRUE 
      /echo Verbose:   ${Verbose} 
   } else /if (${Command.Equal[verbose]}) { 
      /varset Verbose FALSE 
      /echo Verbose:   ${Verbose} 
   } 

   /if (${Command.Equal[buffpet]} && ${ShouldBuffPet}==0) { 
      /varset ShouldBuffPet TRUE 
      /echo Buff Pet:   ${ShouldBuffPet} 
   } else /if (${Command.Equal[buffpet]}) { 
      /varset ShouldBuffPet FALSE 
      /echo Buff Pet:   ${ShouldBuffPet} 
   } 
    
   /if (${Command.Equal[assistat]}) { 
      /varset AssistAt ${Command2} 
      /echo Assisting at range:   ${AssistAt} _ (Longer range then 100 is futile) 
   } 
    
   /if (${Command.Equal[dotat]}) { 
      /varset CastDoTat ${Command2} 
      /echo Casting ${SpellDoT} at ${CastDoTat}% 
   } 
    
   /if (${Command.Equal[rootat]}) { 
      /varset Rootat ${Command2} 
      /echo Rooting Mobs at ${Rootat}% 
   } 
    
   /if (${Command.Equal[nukeat]}) { 
      /varset NukeAt ${Command2} 
      /echo Starting to Nuke Mobs at ${NukeAt}% 
   } 
    
   /if (${Command.Equal[combatat]}) { 
      /varset CombatAt ${Command2} 
      /echo Initiate Combat at ${CombatAt}% (Malo / Slow) 
   } 
    
   /if (${Command.Equal[healtankat]}) { 
      /varset TankHeal ${Command2} 
      /echo Healing ${M_Assist} at ${TankHeal}% 
   } 
    
   /if (${Command.Equal[healmeleeat]}) { 
      /varset MeleeHeals ${Command2} 
      /echo Healing all Melee classes at ${MeleeHeals}% 
   } 
    
   /if (${Command.Equal[healcastersat]}) { 
      /varset CasterHeals ${Command2} 
      /echo Healing all Caster classes at ${CasterHeals}% 
   } 
    
   /if (${Command.Equal[dohot]} && ${DoHoT}==0) { 
      /varset DoHoT TRUE 
      /echo Do HoT:   ${DoHoT} 
   } else /if (${Command.Equal[dohot]}) { 
      /varset DoHoT FALSE 
      /echo Do HoT:   ${DoHoT} 
   } 
    
   /if (${Command.Equal[DoHeal]} && ${DoHeal}==0) { 
      /varset DoHeal TRUE 
      /echo Do Heal:   ${DoHoT} 
   } else /if (${Command.Equal[DoHeal]}) { 
      /varset DoHeal FALSE 
      /echo Do Heal:   ${DoHeal} 
   } 

   /if (${Command.Equal[DoRootParking]} && ${DoRootParking}==0) { 
      /varset DoRootParking TRUE 
      /echo DoRootParking:   ${DoRootParking} 
   } else /if (${Command.Equal[DoRootParking]}) { 
      /varset DoRootParking FALSE 
      /echo DoRootParking:   ${DoRootParking} 
   } 


   /if (${Command.Equal[HealPets]} && ${HealPets}==0) { 
      /varset HealPets TRUE 
      /echo HealPets:   ${HealPets} 
   } else /if (${Command.Equal[HealPets]}) { 
      /varset HealPets FALSE 
      /echo HealPets:   ${HealPets} 
   } 

   /if (${Command.Equal[DoMelee]} && ${DoMelee}==0) { 
      /varset DoMelee TRUE 
      /echo DoMelee:   ${DoMelee} 
   } else /if (${Command.Equal[DoMelee]}) { 
      /varset DoMelee FALSE 
      /echo DoMelee:   ${DoMelee} 
   } 



    
   /if (${Command.Equal[clearpathing]}) { 

	/for i 1 to ${SafeLocs.Size[1]}
		/varset SafeLocs[${i},1] 0
		/varset SafeLocs[${i},2] 0
	/next i

   } 
    
   /if (${Command.Equal[assist]}) { 
      /varset M_Assist ${Command2} 

      /sq /target pc ${M_Assist} 
      /if (!${Target.ID}) { 
         /echo ${M_Assist} is not here dude ! 
         /return 
      } 
       
      /echo I will assist:   ${M_Assist} 
   } 
    

   /if (${Command.Equal[test]}) { 
	/call AttemptAvoid
        /return 
   } 



   /if (${Command.Equal[buff]} && ${Defined[Command2]}) { 

         /target ${Command2} 
         /if (${Target.ID}==${Spawn[${Command2}].ID}) {
		/declare tmpArray[${Math.Calc[${otherBuffees.Size}+1]}] string local

		/for i 1 to ${otherBuffees.Size}
			/if (${i}>${otherBuffees.Size}) /goto :followingBuffCommand
			/varset tmpArray[${i}] ${otherBuffees[${i}]}
			/if (${otherBuffees[${i}].Equal[${Command2}]}) /return

		/next i

:followingBuffCommand
		
		/varset tmpArray[${tmpArray.Size}] ${Command2}

		/deletevar otherBuffees

		/declare otherBuffees[${tmpArray.Size}] string global

		/for i 1 to ${tmpArray.Size}
			/if (${i}>${tmpArray.Size}) /goto :followingBuffCommand2
			/varset otherBuffees[${i}] ${tmpArray[${i}]}
		/next i
:followingBuffCommand2
	 }
      /return 

   }


   /if (${Command.Equal[resetbuffs]} && !${Defined[Command2]}) { 



    /if (!${SpellBuff.Size[1]}) /return

     /for i 1 to ${SpellBuff.Size[1]}

      /for g 0 to ${Math.Calc[${Group.Members}+${otherBuffees.Size}]}

	 /if (${g}<=${Group.Members}) {
	 	/varset sID ${Group.Member[${g}].ID}
	 } else {
	 	/varset sID ${Spawn[pc ${otherBuffees[${Math.Calc[${g}-${Group.Members}]}]}].ID}
	 }


      	 /squelch /varset SpellBufftmr${i}${Spawn[${sID}].Name}   0 
       /next g
     /next i

    }
      
   }
    


    
   /if (${Command.Equal[dofollow]}) { 

	 /if (!${AllowAutoFollow}) /return

		/call StickOff
	
         /target ${Command2} 
	
         /delay 1s ${Target.CleanName.Equal[${Command2}]}

         /echo Following ${Target.CleanName}

         /call FollowFunction "${Target.CleanName}"

         /varset following ${Command2}

         /return 

   } 
    
   /if (${Command.Equal[CastATK]} && ${CastATK}==0) { 
      /varset CastATK TRUE 
      /echo CastATK:   ${CastATK} 
   } else /if (${Command.Equal[CastATK]}) { 
      /varset CastATK FALSE 
      /echo CastATK:   ${CastATK} 
   } 

    
   /if (${Command.Equal[ClearBuffees]}) { 
	/deletevar otherBuffees
	/declare otherBuffees[0] string global
   }



   /if (${Command.Equal[resetbuffs]} && ${Defined[Command2]}) { 
     	/for i 1 to ${SpellBuff.Size[1]}
      		/squelch /varset SpellBufftmr${i}${Spawn[${Command2}].Name}   0 
     	/next i 
   }
    

   /if (${Command.Equal[healat]}) { 
      /varset HealGRPat ${Command2} 
      /echo Healing any group member below ${HealGRPat}% HPs 
   } 

   /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 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:................${SummonPet} 
      /echo Do Buffs:.............${DoBuffs} 
      /echo Do Root:..............${DoRoot} - Casting at: ${Rootat}% 
      /echo Do Sow:...............${DoSow} 
      /echo Do Heal:..............${DoHeal} 
      /echo Buff Pet:.............${BuffPet} 
      /echo --------------------------- 
      /echo Assist range: ${AssistAt} 
      /echo Assisting: ${M_Assist} 
      /echo Healing Casters: ${CasterHeals}% Melees: ${MeleeHeals}% 
      /echo ${M_Assist} get heals at ${TankHeal} 
      /echo Initiate Combat: ${CombatAt}% 
      /echo Verbose: ${Verbose} 
      /echo 
      /echo help - Will show help to set variables. 
       
   } 
    
   /if (${Command.Equal[help]}) { 
      /echo ___ Shaman Do Stuff Script ___ 
      /echo 
      /echo Commands that will turn ON or OFF 
      /echo /domalo, /doslow, /dofastslow, /doroot, /dopet, /dodot, /dobuffs, /dosow, /donuke, /doheal, /dobuffpet 
      /echo 
      /echo /dofastslow will NOT check if the slow is landed or not. Good to have on when you skip maloing. 
      /echo Commands to change values, ie: /assistat 50 (Will start the combat routine when mob is in range 50) 
      /echo /assisat <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 /doassist <PC Name> 
   } 
    
/return 
Last edited by guest_01 on Sun May 08, 2005 4:03 am, edited 4 times in total.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Mon May 02, 2005 2:32 pm

Code: Select all

| ###################################################################################################### 

Sub Event_OutDoor 
    
   /echo This is an indoor zone. Sorry. 
   /varset OutDoors FALSE 

/return 

| ###################################################################################################### 

Sub Event_NoMount 
    
   /echo No mount in this zone. Sorry. 
   /varset NoMount TRUE 

/return 

| ###################################################################################################### 

Sub Event_Invited 
   /invite 
/return 

| ################## 

Sub Event_ImDead 

	/declare i int local 1
   /declare g int local 0 
   /declare sID int local 0


   /echo Bummer ! 


	/delay 10s


	/if (${quitOnZone}) {
		/quit
		/end
	}



:Zone_Loop 
   /if ( ${Me.Bound.ID} != ${Zone.ID} ) /goto :Zone_Loop 

   /varset FollowFlag 0
   /varset underAttackBy 0

   /varset MobRooted FALSE 
   /varset MobMaloed FALSE 
   /varset MobSlowed FALSE 
   /varset PetOn FALSE 
   /varset MobDoTed FALSE 
   /varset CombatOn FALSE 
   /varset DotTime 0
    
   /varset TargetArray[1] NULL 
   /varset TargetArray[2] NULL 
   /varset TargetArray[3] NULL 
   /varset TargetArray[4] NULL 

   /delay 5s 
   /consent group 
   /consent raid
   /delay 5 
   |/gsay Im ready to get rez. 
   /call Wait4Rez 

   /delay 20 

   /call MemSpells 

    /if (!${SpellBuff.Size[1]}) /return

     /for i 1 to ${SpellBuff.Size[1]}

      /for g 0 to ${Math.Calc[${Group.Members}+${otherBuffees.Size}]}

	 /if (${g}<=${Group.Members}) {
	 	/varset sID ${Group.Member[${g}].ID}
	 } else {
	 	/varset sID ${Spawn[pc ${otherBuffees[${Math.Calc[${g}-${Group.Members}]}]}].ID}
	 }


      	 /squelch /varset SpellBufftmr${i}${Spawn[${sID}].Name}   0 
       /next g
     /next i

    }
      

/return 


| ################## This part is taken from wait4res. 

Sub Wait4Rez 

:waitforrez 
   /if (!${Window[ConfirmationDialogBox].Open}) { 
      /delay 5s ${Window[ConfirmationDialogBox].Open} 
      /goto :waitforrez 
   } 
   /if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup 
:zonein 
   /delay 5 
   /squelch /target mycorpse 
   /delay 5 
   /if (${Target.CleanName.NotEqual[${Me}'s corpse]}) /goto :zonein 
   /if (${Target.CleanName.Equal[${Me}'s corpse]}) { 
      /delay 3s 
      /call Loot_Corpse 
   } else /goto :zonein 

/return 

Sub Loot_Corpse 

  /declare LootTotal int local 0 
  /declare LootSlot int local 

  /squelch /target mycorpse 
  /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
    /echo ** Can't target my corpse. 
    /return 
  }    
  /corpse 
  /delay 1s 
  /loot 
  /delay 1s 
  /if (${Me.State.NotEqual[BIND]}) { 
    /echo ** Massive lag right now... Aborting looting. 
    /return 
  } 

  :LootLag 
  /if (${LootTotal}!=${Corpse.Items}) { 
    /varset LootTotal ${Corpse.Items} 
    /delay 5 
    /goto :LootLag 
  } 

  /for LootSlot 1 to ${LootTotal} 
    :LootItem 
    /itemnotify loot${LootSlot} rightmouseup 
    /delay 3 
    /if (${Corpse.Item[${LootSlot}].ID}) { 
      /delay 2 
      /goto :LootItem 
    } 
  /next LootSlot 
  /delay 5 
  /echo ** Done looting my corpse. 
  /notify LootWnd DoneButton leftmouseup 

/return 

| ################# Tells n Hells 

Sub Event_Chat(string ChatType,string ChatSender,string ChatText) 
      /if (!${ChatType.Equal[GROUP]} && !${ChatType.Equal[TELL]}) /return 

	/declare i int local
       
      /if (${ChatText.Equal[heal]}) { 
         /target pc ${ChatSender} 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) {
		
		/call FullStop
		

		/call cast "${SpellHeal}" gem${SpellHealGem}
   		/varset tookAction 1
	}
      /return 
      } 

      /if (${ChatText.Equal[hot]}) { 
         /target pc ${ChatSender} 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) {
		
		/call FullStop
		

		/call cast "${SpellHoT}" gem${SpellHoTGem}
   		/varset tookAction 1
	 }
      /return 
      } 
       
      /if (${ChatText.Equal[slow]}) { 
         /assist ${ChatSender} 
	 /delay 3
         /if (${Target.Type.Equal[NPC]} && ${Target.Distance}<=100) { 
		
		/call FullStop
		

            /call cast "${SpellMalo}" gem${SpellMaloGem} 6s
            /call cast "${SpellSlow}" gem${SpellSlowGem} 6s 
   	    /varset tookAction 1
            /tell ${ChatSender} %T is SLOWED 
         } 
      /return 
      } 

      /if (${ChatText.Equal[sow]}) { 
         /target pc ${ChatSender} 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) {
		/varset DoSow 1 
		/varset OutDoors 1
		/notify BuffWindow Buff${Math.Calc[${Me.Buff["Spirit of Bih`Li"].ID}-1].Int} leftmouseup
	 }
      /return 
      } 
       


      /if (${ChatText.Equal["buff me"]}) { 
         /target pc ${ChatSender} 
         /if (${Target.Type.Equal[PC]}) {
		/declare tmpArray[${Math.Calc[${otherBuffees.Size}+1]}] string local

		/for i 1 to ${otherBuffees.Size}
			/if (${i}>${otherBuffees.Size}) /goto :followingBuffMeCommand
			/varset tmpArray[${i}] ${otherBuffees[${i}]}
			/if (${otherBuffees[${i}].Equal[${ChatSender}]}) /return

		/next i

:followingBuffMeCommand
		
		/varset tmpArray[${tmpArray.Size}] "pc ${ChatSender}"

		/deletevar otherBuffees

		/declare otherBuffees[${tmpArray.Size}] string global

		/for i 1 to ${tmpArray.Size}
			/if (${i}>${tmpArray.Size}) /goto :followingBuffMeCommand2
			/varset otherBuffees[${i}] ${tmpArray[${i}]}
		/next i
:followingBuffMeCommand2
	 }
      /return 
      } 

       
      /if (${ChatText.Equal["follow me"]}) { 

	 /if (!${AllowAutoFollow}) /return

         /target pc ${ChatSender} 
	
         /delay 1s ${Target.CleanName.Equal[${ChatSender}]}

         /echo Following ${Target.CleanName}

         /call FollowFunction "${Target.CleanName}"

         /varset following ${ChatSender}

         /return 
      } 
       
      /if (${ChatText.Equal["wait here"]}) { 
         /varset FollowFlag 0
         /varset following FALSE
	 /keypress FORWARD

         /echo No longer following. Resuming program.
         /return 
      }

      /if (${ChatText.Equal[mana]}) { 

       		/gsay ${Me.PctMana}% Mana 
       		/varset CallManaTmr 300 

      /return
      }

/return 


| CheckIsLookingAt 
| Used for checking if an NPC is attacking.someone.  Default PC is master 
|Usage /call CheckIsLookingAt "id of mob to check" "id of PC to check" 
Sub CheckIsLookingAt(int MobID,int PCID) 
   /declare MobHeading int local 0 
   /declare HeadingToPC int local 
   /declare DeltaX local float 
   /declare DeltaY local float 
   /declare HeadingDelta local float 
   /if (!${Defined[PCID]} || !${PCID}) /return 0 
   /if (${Spawn[id ${MobID}].ID}) { 
      /varcalc DeltaX ${Spawn[id ${PCID}].X}-${Spawn[id ${MobID}].X} 
      /varcalc DeltaY ${Spawn[id ${PCID}].Y}-${Spawn[id ${MobID}].Y} 
      /varcalc MobHeading ${Spawn[id ${MobID}].Heading.Degrees} 
      /if (${DeltaX}>0) { 
         /varcalc HeadingToPC ${Math.Atan[${DeltaY}/${DeltaX}]}+270 
      } else /if (${DeltaX}<0) { 
         /varcalc HeadingToPC ${Math.Atan[${DeltaY}/${DeltaX}]}+90 
      } else { 
         /if (${DeltaY}>0) { 
            /varcalc HeadingToPC 90 
         } else { 
            /varcalc HeadingToPC 270 
         } 
      } 
      /varcalc HeadingDelta ${Math.Abs[${HeadingToPC}-${MobHeading}]} 
      |/echo DeltaY ${DeltaY} DeltaX ${DeltaX}  Atan ${Math.Atan[${DeltaY}/${DeltaX}]} 
      |/echo Mob ${Spawn[id ${MobID}].Name} MobHeading ${MobHeading} HeadingToPC ${HeadingToPC} 
      /if (${HeadingDelta}<4 || ${HeadingDelta}>356) { 
         /return 1 
      } 
   } 
/return 0


Sub CheckIsLookingAtGroup(int mob) 


	/call CheckIsLookingAt ${mob} ${Group.Member[0].ID} 
	/if (${Macro.Return}) /return 1

	/call CheckIsLookingAt ${mob} ${Group.Member[1].ID} 
	/if (${Macro.Return}) /return 1

	/call CheckIsLookingAt ${mob} ${Group.Member[2].ID} 
	/if (${Macro.Return}) /return 1

	/call CheckIsLookingAt ${mob} ${Group.Member[3].ID} 
	/if (${Macro.Return}) /return 1

	/call CheckIsLookingAt ${mob} ${Group.Member[4].ID} 
	/if (${Macro.Return}) /return 1

	/call CheckIsLookingAt ${mob} ${Group.Member[5].ID} 
	/if (${Macro.Return}) /return 1


/return 0



| #### Checks the animation value of a mob to see if it's attacking.
| # Returns 0 if not attacking, 1 if definitely attacking, and 2 if possibly attacking.


Sub CheckAttacking(int mob)

	/declare animation int local
	/declare sID int local

	/declare g int local

	/if (${LastHit[${mob}].Equal[NULL]}) {
		/return 0
	} else {

      /for g 0 to ${Math.Calc[${Group.Members}+${otherBuffees.Size}]}

	 /if (${g}<=${Group.Members}) {
	 	/varset sID ${Group.Member[${g}].ID}
	 } else {
	 	/varset sID ${Spawn[pc ${otherBuffees[${Math.Calc[${g}-${Group.Members}]}]}].ID}
	 }


      	 /if (${LastHit[${mob}].Equal[${Spawn[${sID}].Name}]}) /return 1
      	 /if (${Spawn[${sID}].Pet.ID}) /if (${LastHit[${mob}].Equal[${Spawn[${sID}].Pet.Name}]}) /return 1
       /next g

		
	}

	/return 0



	/varset animation ${Spawn[${mob}].Animation}


   	/if (${mob}==${TargetArray[4]}) {
		/if (${animation} == 5 ) /return 1
		/if (${animation} == 7 ) /return 1
		/if (${animation} == 8 ) /return 1
		/if (${animation} == 12 ) /return 1
		/if (${animation} == 13 ) /return 1
		/if (${animation} == 17 ) /return 1
		/if (${animation} == 18 ) /return 1
		/if (${animation} == 32 ) /return 1

		/if (${animation} == 43 ) /return 1
		/if (${animation} == 44 ) /return 1
		/echo Animation #${animation} detected while in combat mode.
	}




	/if (${animation} == 5 ) /return 1

	/if (${animation} == 7 ) /return 1

	/if (${animation} == 8 ) /return 1

	/if (${animation} == 12 ) /return 1

	/if (${animation} == 13 ) /return 1

	/if (${animation} == 16 ) /return 0

	|## 17: Walking
	/if (${animation} == 17 ) /return 0

	|## 18: Running
	/if (${animation} == 18 ) /return 0

	/if (${animation} == 26 ) /return 0

	/if (${animation} == 32 ) /return 0

	/if (${animation} == 33 ) /return 0

	/if (${animation} == 34 ) /return 0

	/if (${animation} == 37 ) /return 0

	/if (${animation} == 38 ) /return 0

	/if (${animation} == 43 ) /return 0
	/if (${animation} == 44 ) /return 0

	/if (${animation} == 71 ) /return 0

	/if (${animation} == 72 ) /return 0

	/if (${animation} == 73 ) /return 0

	/echo Unknown Animation #${animation}, by mob ID: ${mob} (${Spawn[${mob}].Name}).
/return 0




Sub AddSafeLoc

	/declare i int local 0	

	/declare tmp[2] float local

	/varset tmp[1] ${Me.X}
	/varset tmp[2] ${Me.Y}

	/for i 1 to ${SafeLocs.Size[1]}

		/if (${Math.Distance[${SafeLocs[${i},1]},${SafeLocs[${i},2]}:${tmp[1]},${tmp[2]}]} <= 25) /return

	/next i

	/varset LastSLAdded ${Math.Calc[${LastSLAdded}+1]}
	/if (${LastSLAdded}>${SafeLocs.Size[1]}) /varset LastSLAdded 1

	/varset SafeLocs[${LastSLAdded},1] ${tmp[1]}
	/varset SafeLocs[${LastSLAdded},2] ${tmp[2]}

	/echo Added SafeLoc: ${tmp[1]},${tmp[2]}

/return


Sub AttemptAvoid(int pcID, int distance)

	/declare i int local 1
	/declare j int local 1

	/declare final[4] float local
	/declare tmp[2] float local
	/declare tmp2[3] float local
	/declare tmp3[3] float local

	/if (!${Defined[distance]}) /declare distance int local 9999

	/if (!${AutoMove}) /return
	/if (${FollowFlag}) /return

	/if (${delayMoveTimer}) /return

	/varset tmp[1] ${Spawn[pc ${M_Assist}].X}
	/varset tmp[2] ${Spawn[pc ${M_Assist}].Y}

	/if (${Defined[pcID]} && ${pcID}) {

		/varset tmp[1] ${Spawn[${pcID}].X}
		/varset tmp[2] ${Spawn[${pcID}].Y}

	}

	/squelch /varset tmp2[1] ${Spawn[${underAttackBy}].X}
	/squelch /varset tmp2[2] ${Spawn[${underAttackBy}].Y}
	/squelch /varset tmp2[3] ${Spawn[${underAttackBy}].MaxRange}

	/varset final[3] 9999



	/for i 1 to ${SafeLocs.Size[1]}

		/if (${SafeLocs[${i},1]}!=0 && ${SafeLocs[${i},2]}!=0) {

			/varset final[4] ${Math.Distance[${SafeLocs[${i},1]},${SafeLocs[${i},2]}:${tmp[1]},${tmp[2]}]}


			/if (${final[4]} < ${final[3]}) {

				/if (${Math.Distance[${SafeLocs[${i},1]},${SafeLocs[${i},2]}:${tmp2[1]},${tmp2[2]}]} > ${tmp2[3]}) {
	
					/for j 1 to ${DebuffTimers.Size}
						/if (${DebuffTimers[${j}]}) {
						
							/squelch /varset tmp3[1] ${Spawn[${DebuffTimers[${j}]}].X}
							/squelch /varset tmp3[2] ${Spawn[${DebuffTimers[${j}]}].Y}
							/squelch /varset tmp3[3] ${Spawn[${DebuffTimers[${j}]}].MaxRange}


							/if (${Math.Distance[${SafeLocs[${i},1]},${SafeLocs[${i},2]}:${tmp3[1]},${tmp3[2]}]} <= ${Math.Calc[${tmp3[3]}+15]}) /next i
	
						}
					/next j

					/varset final[1] ${SafeLocs[${i},1]}
					/varset final[2] ${SafeLocs[${i},2]}
					/varset final[3] ${final[4]}
				}
			}
		}

	/next i


	/if (${Math.Distance[${final[1]},${final[2]}:${tmp[1]},${tmp[2]}]} > ${distance}) /return
	
	/if (${underAttackBy} && !(${Defined[DebuffTimer${underAttackBy}]} && ${DebuffTimer${underAttackBy}}>0)) {

		/echo Setting debuff timer....
		/call SetDebuffTimer ${underAttackBy} 50
	}

	/varset underAttackBy 0
   	/varset underAttack 50

	/if (${final[1]}!=0 && ${final[2]}!=0) /if (${Math.Distance[${final[2]},${final[1]}:${Me.Y},${Me.X}]} > 10) {

		/echo ${final[2]},${final[1]}:${Me.Y},${Me.X}
		/varset PauseFlag 0
		/varset PathingFlag 0
		/varset FollowFlag 0
		/varset RecordPathFlag 0

		|/call GotoFunction ${final[2]} ${final[1]}
		|/call MoveToLoc ${final[2]} ${final[1]}

		/sit off

		/delay 10

		/call StickOff

		/squelch /moveto loc ${final[2]} ${final[1]}
		/varset Sticking 1
		/varset MoveToTmr 50

		/varset DoingMove 1

		/varset delayMoveTimer 50


		/delay 10

		/return
	}

	/echo WARNING: No safe locs found to move to!

/return



Sub Event_Zoned(string Line) 

	/declare i int local

	/for i 1 to ${SafeLocs.Size[1]}
		/varset SafeLocs[${i},1] 0
		/varset SafeLocs[${i},2] 0
	/next i


	/if (${quitOnZone}) {
		/quit
		/end
	}


/return



Sub Event_UnderAttack(string Line) 

	/declare i int local

	/if (!${underAttack}) {
		/echo Under Attack! Not sitting for 5 seconds.

		/for i 1 to 10
			/varset underAttackBy ${Me.NearestSpawn[npc].ID}

			/if (${Line.Find[${Spawn[${underAttackBy}].CleanName}]}) {
				|/call cast "${SpellRoot}" gem${SpellRootGem}

				|/if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_CANNOTSEE]} || ${Macro.Return.Equal[CAST_IMMUNE]}) {
				|	/echo Rooted ${Target.CleanName}
				|	/call AttemptAvoid
				|}

				/call CheckIsLookingAt ${underAttackBy} ${Me.ID}
				/if (!${Macro.Return}) {
					/varset underAttackBy 0
					/next i
				}

				/varset underAttack 80
				/if (!${DoRootParking}) /if (!${DoMelee}) /call AttemptAvoid
				/stand
				/return
			}

			/varset underAttackBy 0
		
		/next i


	}
	/varset underAttack 80

/return



Sub Event_GMInZone
	/quit
	/end
/return



Sub BounceBuffs

	/declare i int local
	/declare tmpBuff string local
	
	/for i 1 to ${BounceBuff.Size}
	
		/varset tmpBuff ${BounceBuff[${i}]}
		/if (${Me.Buff[${tmpBuff}].ID}) /nomodkey /notify BuffWindow BW_Buff${Int[${Math.Calc[${Me.Buff[${tmpBuff}].ID}-1]}]}_Button leftmouseup 

	/next i
/return




Sub CheckHP 
	
	/if (${castTimer} > 10) /if (!${Spawn[${Healing[1]}].ID} || ${Spawn[${Healing[1]}].PctHPs}>90 || ${Spawn[${Healing[1]}].Type.Equal[CORPSE]}) {
		/echo ${Spawn[${Healing[1]}].Name} is at ${Spawn[${Healing[1]}].PctHPs} hp - interupting
		/stopcast
		/keypress duck
   		/if ( ${Me.Ducking} ) /keypress duck
		/call Interrupt 
	}
	/if (${Healing[2]}==1 && ${Spawn[${Healing[1]}].PctHPs} < ${Math.Calc[${ClassHeals${Spawn[${Healing[1]}].Class.ID}[2]}*0.66]} && ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[2]} < ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[1]} && ${castTimer} > 50) {
		
		/echo ${Spawn[${Healing[1]}].Name} is at ${Spawn[${Healing[1]}].PctHPs} hp - needs patch
		/stopcast
		/keypress duck
		/if ( ${Me.Ducking} ) /keypress duck
		/call Interrupt 
		/call Check_grpHPs
	}
	/if (${Healing[2]}==1 && ${Spawn[${Healing[1]}].PctHPs} < ${Math.Calc[${ClassHeals${Spawn[${Healing[1]}].Class.ID}[3]}*0.66]} && ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[3]} < ${ClassHeals${Spawn[${Healing[1]}].Class.ID}[1]} && ${castTimer} > 50) {
		
		/echo ${Spawn[${Healing[1]}].Name} is at ${Spawn[${Healing[1]}].PctHPs} hp - needs patch
		/stopcast
		/keypress duck
		/if ( ${Me.Ducking} ) /keypress duck
		/call Interrupt 
		/call Check_grpHPs
	}
/return 


Sub CheckForHeal
   /declare g int local 1 
   /declare gClass string local

   /for g 0 to ${Group.Members} 

	/if (${Group.Member[${g}].ID} && !${Group.Member[${g}].Type.Equal[CORPSE]}) {

		/varset gClass ${Group.Member[${g}].Class.ID}

		/if ((${DoHoT} || !${g}) && ${ClassHeals${gClass}[3]} && ${Group.Member[${g}].PctHPs}<=${ClassHeals${gClass}[3]}) { 


			/if (!${GroupMemHoTTime${g}}) {

   				/call SpellInformation "${SpellHoT}"

				/if (${Me.CurrentMana}<${Spell[${SpellHoT}].Mana}) { 
					|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
				} else /if (${Target.Distance}<=${Spell[${SpellHoT}].Range} && ${Target.ID}==${Group.Member[${g}].ID}) { 
					/stopcast
					/keypress duck
					/if ( ${Me.Ducking} ) /keypress duck
					/call Interrupt 
					/call Check_grpHPs
				}
			}
		}

		/if ((${DoHeal} || !${g}) && ${ClassHeals${gClass}[2]} && ${Group.Member[${g}].PctHPs}<=${ClassHeals${gClass}[2]}) { 

   			/call SpellInformation "${SpellHeal}"
   				
			/if (${Me.CurrentMana}<${Spell[${SpellHeal}].Mana}) { 
				|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
			} else /if (${Target.Distance}<=${Spell[${SpellHeal}].Range}) { 
				/stopcast
				/keypress duck
				/if ( ${Me.Ducking} ) /keypress duck
				/call Interrupt 
				/call Check_grpHPs
			}
			
		}

		/if ((${DoCompleteHeal} || !${g}) && ${ClassHeals${gClass}[1]} && ${Group.Member[${g}].PctHPs}<=${ClassHeals${gClass}[1]}) { 

			/call SpellInformation "${SpellCompleteHeal}"

			/if (${Me.CurrentMana}<${Spell[${SpellCompleteHeal}].Mana}) { 
				|/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]} 
			} else /if (${Target.Distance}<=${Spell[${SpellCompleteHeal}].Range}) {
				/stopcast
				/keypress duck
				/if ( ${Me.Ducking} ) /keypress duck
				/call Interrupt 
				/call Check_grpHPs
			}

		}
	}

   /next g
   
/return 



Sub TrickyDA 
   /declare intcount int local
   /for intcount 1 to 20 
      /if ((${Me.PctHPs}<40)&&(${Me.Buff[${trickybuff[${intcount}]}].ID})) /notify BuffWindow Buff${Math.Calc[${Me.Buff[${trickybuff[${intcount}]}].ID}-1].Int} leftmouseup 
   /next intcount 
   /if (${Me.Buff[${daspell}].ID}) { 
      :waitalittle 
      /delay 1s ${Me.Buff[${daspell}].Duration}<2 
      /if (${Me.Buff[${daspell}].Duration}>=2) /goto :waitalittle 
   } 
   /resetbuffs ${Me.Name}
/return 



Sub Event_Invite(string Line, string Name)

	/target pc ${Name}

	/delay 1s

	/invite

	/delay 1s

	/target clear

/return





|**
ClassHeals<class> array:
1: Complete heal - if HP drops below this, cast a cheal
2: Quick Heal - if HP drops below this, cast a quick heal
3: HOT - if HP drops below this, cast a HOT

Will always try to cast the one set to the LOWEST value first,
so if you have HOT set to 80, and CHeal set to 70, and tank01's
hp is at 60, it will cast CHeal, not HOT... 
Likewise, if HOT is 70, and CHEAL is 80, it would cast HOT first
and cheal after.

If it starts casting a CHEAL and has to interupt for a quick heal
(determined by f(HP < QHeal*0.66 && (TimeTilChealLands) > 5seconds))
then it will perform a temporary adjustment on cheal for that class,
making it cast cheal earlier next time... this is handy for greater
efficiency on named pulls and such, since it provides better efficiency
and will slowly scale cast time back to preset values over time without
user interaction.

4 & 5 are for internal program usage for dynamic heal adjustments


Adjust the values for 1, 2, and 3 in the function below...
Separated into functions so that you can easily add more functions for
different zones, and just comment out the function call to switch zones.
**|

Sub SetHealsPrimaryHealer

	|Bard
	/varset ClassHeals8[1] 0
	/varset ClassHeals8[2] 70
	/varset ClassHeals8[3] 0

	|Beastlord
	/varset ClassHeals15[1] 70
	/varset ClassHeals15[2] 50
	/varset ClassHeals15[3] 0

	|Berserker
	/varset ClassHeals16[1] 0
	/varset ClassHeals16[2] 70
	/varset ClassHeals16[3] 0

	|Cleric
	/varset ClassHeals2[1] 00
	/varset ClassHeals2[2] 60
	/varset ClassHeals2[3] 80

	|Druid
	/varset ClassHeals6[1] 0
	/varset ClassHeals6[2] 70
	/varset ClassHeals6[3] 0

	|Enchanter
	/varset ClassHeals14[1] 0
	/varset ClassHeals14[2] 80
	/varset ClassHeals14[3] 0

	|Magician
	/varset ClassHeals13[1] 0
	/varset ClassHeals13[2] 80
	/varset ClassHeals13[3] 0

	|Monk
	/varset ClassHeals7[1] 0
	/varset ClassHeals7[2] 70
	/varset ClassHeals7[3] 0

	|Necromancer
	/varset ClassHeals11[1] 0
	/varset ClassHeals11[2] 50
	/varset ClassHeals11[3] 60

	|Paladin
	/varset ClassHeals3[1] 70
	/varset ClassHeals3[2] 50
	/varset ClassHeals3[3] 0

	|Ranger
	/varset ClassHeals4[1] 0
	/varset ClassHeals4[2] 70
	/varset ClassHeals4[3] 0

	|Rogue
	/varset ClassHeals9[1] 0
	/varset ClassHeals9[2] 70
	/varset ClassHeals9[3] 0

	|Shadow Knight
	/varset ClassHeals5[1] 70
	/varset ClassHeals5[2] 50
	/varset ClassHeals5[3] 0

	|Shaman
	/varset ClassHeals10[1] 0
	/varset ClassHeals10[2] 50
	/varset ClassHeals10[3] 60

	|Warrior
	/varset ClassHeals1[1] 70
	/varset ClassHeals1[2] 50
	/varset ClassHeals1[3] 0

	|Wizard
	/varset ClassHeals12[1] 0
	/varset ClassHeals12[2] 80
	/varset ClassHeals12[3] 0

/return
Last edited by guest_01 on Sun May 08, 2005 3:57 am, edited 1 time in total.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Mon May 02, 2005 2:39 pm

Reserved.

Process
a lesser mummy
a lesser mummy
Posts: 73
Joined: Fri Jun 25, 2004 5:30 pm

Post by Process » Thu May 05, 2005 6:10 pm

I tried your macro out since my very favorite afcleric is non-functional for me.

It works pretty well except in zones where I can't summon a horse. In those zones, it just sits and stands repeatedly. It's very annoying. Is there some setting I can change to make it stop that?

Thanks,

Process

Pumba
orc pawn
orc pawn
Posts: 11
Joined: Mon Dec 13, 2004 3:24 pm

Post by Pumba » Thu May 05, 2005 7:18 pm

I'm having the same problem, I've been to cheap to buy my cleric a bridle so it just sits and stands repeatedly. Playing with it now to try fix it.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Fri May 06, 2005 7:47 pm

Hmm.... I think I know why it's doing that... tested in an outdoor zone mainly... been out of town for a week (still am - don't have the ability to test here), will take a look at it when I get home tomorrow and post an update. Originally this was accounted for, but I think I accidently removed it when I added in the dynamic horse/yaulp/melee support.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Sat May 07, 2005 5:53 pm

05/07/05: Fixed the sit/stand bug when not mounted - simple bug that I introduced shortly before release.
Config was not affected - can copy code below config settings.

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Sun May 08, 2005 3:59 am

05/08/05: Emergency patch fix - was not able to heal shadowknights (due to the way I was storing class heals - Shadow Knight has a space in it)
Change class heals to use class.ID instead of class.Name

Highly recommended update... (unless of course you have a vendetta against shadowknights)

MacNoob-2k5
decaying skeleton
decaying skeleton
Posts: 4
Joined: Mon May 09, 2005 5:06 am

Documentation?

Post by MacNoob-2k5 » Mon May 09, 2005 5:09 am

Hello,

First off Thanks for the macro, I like it so far... when I can get it to work right. I am still tweaking some things for my character.

Second, I was wondering if you could throw together a quick list of the commands that you can send the bot, I'm having trouble getting it to do what I want it to, like buff on command and such. I guess I just don't really know what I am doing. Any help or documentation would be awesome.

Thanks

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Mon May 09, 2005 10:39 pm

There aren't really a lot of commands that it responds to. About the only thing it responds to in terms of tell/group chat is "mana", "follow me" and "wait here".... most of it should be automated

There are a few artifacts from my shaman macro still in here, but I don't guarentee that they still work in this one.... such as /tell <bot> buff me

Basic set up - modify spells at the top... modify buffs at the top.... turn flags near the top to TRUE or FALSE (such as HealPets).... there is some rudimentary runtime changes available by using the alias' (also defined at the top - I think most of them are self explanitory)... change HEAL values at the BOTTOM (this one is probably the one most people would forget).

From there... target the main tank (who the cleric will be assisting for combat type things, and also gets a slight priority on heals) and do a /mac clericbot (or whatever you named it) and it should start automatically doing stuff.

Oh, if you manually move it around after turning the macro on, it will save locations and think that it's "Safe" to go to those locations (ie. if people are out of range for healing, it will go to whatever saved location is closest to them), so use /clearpathing to reset the locations, or you'll have it running half way back across the zone where you came from to heal the puller =P

That should be it. Anything specific you were having issues with?

MacNoob-2k5
decaying skeleton
decaying skeleton
Posts: 4
Joined: Mon May 09, 2005 5:06 am

Post by MacNoob-2k5 » Tue May 10, 2005 1:22 am

Thanks, that helps. I have to do some further testing with it to see if it is all working for me. But at one point it did summon food for me when I was hungry, but other times it didnt. Is there a set time that you have to remain hungry for it to summon the food or drink?

Thanks again

mrtyler
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue Apr 12, 2005 11:13 pm

Post by mrtyler » Tue May 10, 2005 2:24 pm

i added the macro but where do i put the last 2 sets of codes? do they go in the macro from the first code or just make them ini files?

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

hey

Post by Zazoot » Wed May 11, 2005 2:23 am

quick question :

does this macro melee and heal? or just one or other.