Beastlord bot (Updated 05/07/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

Beastlord bot (Updated 05/07/05)

Post by guest_01 » Fri Apr 15, 2005 5:12 am

Been working on this for quite awhile.... loosely adapted from my shaman macro (which in turn was modded from Hubba's shammy mac), this tries to do it all. Loot code was adapted from Natural Beastlord Hunter (forget the author of that one, sorry).

MQ2MoveUtils plugin is required. As are a couple include files (spell_routines.inc and advpath.inc)

Read through the header source for an idea of what functionality is available.

Of note - in order for it to auto pull (ie. hunter mac) you NEED to record an AdvPath pathing file and list the name of the file in the PathFile Var, and then set the AutoPull var to TRUE. The path should START at your intended camp spot, and END at the furthest point away from your camp spot. When autopull is enabled, the mac will start by running to the start of the path, setting that as the home point, and will then traverse the path until it encounters a mob that is in line of sight and within range of your slow spell. It will then pull with slow and run the path in REVERSE back to the start of the path.

If you want it to slow all agroed mobs (ie. adds), you will need to compile the small plugin listed at the bottom, which provides some needed functionality.

This should be considered a living document, and may (or may not) be updated as I feel like it =P

Feel free to report any bugs you find, and if I get a chance, I'll see about fixing them... time is somewhat tight lately though.

UPDATE 05/02/05:
Many miscilanious updates, added Hobble of Spirits, look through the code if curious... some new switchs in config area.
Last edited by guest_01 on Sat May 07, 2005 6:47 pm, edited 5 times in total.

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

Post by guest_01 » Fri Apr 15, 2005 5:12 am

Code: Select all

#chat group 
#chat tell 

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

#Event   GroupLOM   "#*#tells the group#*# LOM #*#" 
#Event   GroupLOM   "#*#tells the group#*# OOM #*#" 
#Event   GroupLOM   "#*#tells the group#*#Low on mana#*#" 
#Event   GroupLOM   "#*#tells the group#*#Out of mana#*#" 

#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 


|-- The normal debug - for normal play. Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 "/echo"
|-- Deeper debugging - enable when trying to find bugs. Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_2 "/squelch /echo"
|-- The Deepest debugging - will spam a lot. Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_3 "/squelch /echo"


|-- Also loot items?
#define LOOT_ITEMS TRUE
|-- Loot all items?
#define LOOT_ALL_ITEMS FALSE
|-- Destroy the remaining items -not in use atm
|#define LOOT_DESTROY False
|-- What lvl should the mob be before we bother looting it
#define LOOT_ABOVE_LEVEL 1
|-- Keep loot record - Will display how much you have looted + items
#define LOOT_KEEP_RECORD TRUE

|-- No matter other settings. If the value of the item is above this, GET IT! (Value is in copper)
|-- Not nodrop
#define LOOT_NORMAL_ITEMS_IF_VALUE_IS_ABOVE 40000
|-- No matter other settings. If the value of the item is above this and stackable, GET IT! (Value is in copper)
|-- Not lore, not nodrop
#define LOOT_STACKABLE_ITEMS_IF_VALUE_IS_ABOVE 4000


Sub Main 

/call InitAPFVars 1 15 40 


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



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

   /declare SpellSlow          outer Sha's Revenge
   /declare SpellSlowGem          outer 3

   /declare SpellDoT         outer Scorpian Venom
   /declare SpellDoTGem         outer 8

   /declare SpellPet           outer Spirit of Sorsha
   /declare SpellPetGem           outer 7

   /declare SpellDeBuff        outer Incapacitate
   /declare SpellDeBuffGem        outer 5

   /declare SpellPetHeal           outer Healing of Sorsha
   /declare SpellPetHealGem           outer 1

   /declare SpellHeal          outer Chloroblast
   /declare SpellHealGem          outer 2

   /declare SpellNuke         outer Ice Shard
   /declare SpellNukeGem         outer 4

   /declare SpellOtherNuke         outer Frost Spear
   /declare SpellOtherNukeGem         outer 5

   /declare SpellATK          outer Ferocity
   /declare SpellATKGem          outer 6


   /declare SpellBuffsGem          outer 7




|   /declare SpellPetBuff[3] string outer 
   /declare SpellPetBuff[8] string outer 
   /varset SpellPetBuff[1] Arag`s Celerity
   /varset SpellPetBuff[2] Spirit of Rellic
   /varset SpellPetBuff[3] Spiritual Strength
   /varset SpellPetBuff[4] Infusion of Spirit
   /varset SpellPetBuff[5] Dexterity
   /varset SpellPetBuff[6] Furious Strength
   /varset SpellPetBuff[7] Talisman of Kragg
|   /varset SpellPetBuff[8] Spirit of Wolf


  /declare ItemPetBuff[0,2] string outer 
  
|  /varset  ItemPetBuff[1,1] Savage Lord's Totem 
|  /varset  ItemPetBuff[1,2] Savage Wildcaller's Blessing 
  
|  /varset  ItemPetBuff[2,1] Item 
|  /varset  ItemPetBuff[2,2] Buff Name 


  



| ############ 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[0,2] string outer 
   /declare SpellBuff[9,2] string outer 
|   /declare SpellBuff[5,2] string outer 
    
   /varset SpellBuff[1,1] Dexterity
   /varset SpellBuff[1,2] "Cleric,Bard,Beastlord,Berserker,Monk,Paladin,Ranger,Rogue,Shadowknight,Warrior," 

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

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

   /varset SpellBuff[4,1] Talisman of Kragg
   /varset SpellBuff[4,2] "Bard,Beastlord,Berserker,Druid,Enchanter,Magician,Monk,Necromancer,Paladin,Ranger,Rogue,Shadowknight,Warrior,Wizard," 

   /varset SpellBuff[5,1] Furious Strength
|   /varset SpellBuff[5,2] "Cleric,Bard,Beastlord,Berserker,Monk,Paladin,Ranger,Rogue,Shadowknight,Warrior," 

   /varset SpellBuff[6,1] Celerity
|   /varset SpellBuff[6,2] "Cleric,Bard,Beastlord,Berserker,Monk,Paladin,Ranger,Rogue,Shadowknight,Warrior," 

   /varset SpellBuff[7,1] Spirit of wolf
|   /varset SpellBuff[7,2] "Bard,Beastlord,Berserker,Cleric,Druid,Enchanter,Magician,Monk,Necromancer,Paladin,Ranger,Rogue,Shadowknight,Warrior,Wizard," 

   /varset SpellBuff[8,1] Regrowth
|   /varset SpellBuff[8,2] "Bard,Beastlord,Berserker,Monk,Paladin,Ranger,Rogue,Shadowknight,Warrior,Necromancer," 

   /varset SpellBuff[9,1] Frenzy
   /varset SpellBuff[9,2] "Beastlord," 

   


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

   /declare SpellGrpBuff[2] string outer 

   /varset SpellGrpBuff[1] Spiritual Dominion
   /varset SpellGrpBuff[2] Spiritual Vigor



   /declare DoSingleBuffs      outer TRUE
   /declare DoBuffs          outer TRUE 
    
   /declare AssistAt      int   outer 100 
   /declare CombatAt      int   outer 98 
   /declare CastDoTat      int   outer 98 
   /declare MinDoTat       int   outer 60
   /declare MinNukeat       int   outer 10
   /declare MinManaForNuke       int   outer 65
   /declare NukeAt         int   outer 95 
   /declare DelayBetweenNukes	int outer 0
   /declare HealPetAt		outer 50
   /declare HealGroupAt		outer 30
   /declare DowntimeHealGroupAt		outer 50

   /declare CastATK		outer FALSE
   /declare DoMelee		outer TRUE
   /declare DoMalo             outer FALSE  
   /declare DoSlow             outer TRUE 
   /declare FastSlow         outer FALSE 
   /declare SummonPet          outer TRUE 
   /declare BuffPet         outer TRUE 
   /declare HealPets         outer TRUE
   /declare DoDoT             outer FALSE
   /declare DoNuke            outer TRUE
   /declare DoHeal            outer TRUE 
   /declare Verbose         outer FALSE 
   
   /declare quitOnZone		outer TRUE

   /declare TetheredToHome		outer TRUE

   /declare PathFile		      outer "HS"
   /declare AutoPull		      outer FALSE
   /declare AutoPullDistance          outer 125
   /declare AutoPullEngageDistance    outer 20
   /declare AutoLoot                  outer LOOT_ITEMS 
   /declare AutoMove                  outer FALSE
   /declare AllowAutoFollow           outer TRUE



   | This is a delay for how long Avatar will hold. (6min) 
   /declare AvatarDelay       outer 4000 



    |Loot items we want to loot
    /declare LootList[6] string outer 
    /varset LootList[1] "silk" 
    /varset LootList[2] "Dust of Decay" 
    /varset LootList[3] "Emerald" 
    /varset LootList[4] "Opal" 
    /varset LootList[5] "Pearl" 
    /varset LootList[6] "Peridot" 
    
    
    
    
    
    



| ########### ! 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 /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 i int local 

   /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 
      
	/squelch /stick off

	/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[4] float outer

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

	/declare HomeX	int outer
	/declare HomeY	int outer


	/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 GotMob	int outer 0
	/declare GotMobID int outer 0

	/declare BuffsDone int outer 0


	/declare delayMoveTimer timer outer 0

	/declare doingPath int outer 0

	/declare WaitForMob timer outer 0


    	/declare lootcnt int outer 0       |Loot counter


	/declare stickID int outer 0
	/declare paragonNeeded int outer 0

	/declare paragonAnnounced int outer 0
	/declare attemptedLoot int outer 0
	
	/declare doorAttempt timer local 0
	/declare DelayPull timer outer 0
	/declare DidDelay int outer 0
	
	/declare singleBuffsDone int outer 0

    
   /call MemSpells 

   /call SilentFunction
    
| ############### Target a player as Main Assist 
    
    /if ((!${Target.ID} || (!${Target.Type.Equal[PC]} && !${Target.Type.Equal[Pet]})) && !${Defined[Param0]}) { 

	/varset M_Assist ${Me.Pet.CleanName}

    } else /if (${Defined[Param0]}) { 

	/varset M_Assist ${Param0}

    } else {

      	/varset M_Assist ${Target.CleanName} 
      	/assist off 
    } 

    /echo Assist set to ${M_Assist} 


/if (${AutoPull}) {

    	/call GoHome

:GoHomeLoop
	/call AdvPathPoll 
	/if (${PathingFlag}) /goto :GoHomeLoop
	
	/varset DelayPull 0
	/varset DidDelay 1
}

    /varset HomeX ${Me.X}
    /varset HomeY ${Me.Y}


:Main_Loop 

   /varset tookAction 0
   /varset WaitingOnSpell 0

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

   /if (!${CombatOn} && ${Me.Combat}) /attack off

   |/if (${Target.ID}==${Me.ID}) {

	/if (!${FollowFlag} && !${PathingFlag}) {
		/squelch /stick off
		/if (${CombatOn}) /target id ${TargetArray[4]}
		/if (${CombatOn} && ${DoMelee}) /if (${Target.ID} && ${Target.ID} == ${TargetArray[4]}) {
			/squelch /stick hold 40% moveback
		}
	}


	|/squelch /moveto off

   |}
   
   /if (${GotMobID} && ${WaitForMob}<=0 && !${GotMob}) {


	/varset GotMobID 0
	/varset WaitForMob 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 

      |/varset DelayPull 10


	/squelch /stick off

   }

   /if (${Me.Pet.Speed}>0) /if (${Math.Distance[${HomeY},${HomeX}:${Spawn[GotMobID].Y},${Spawn[GotMobID].X}]}>25) /if (${WaitForMob}>0 || ${GotMob}) {
	/pet back
      	/varset PetOn FALSE
   }
   
   /if (${CombatOn} && !${doorAttempt}) {

	/keypress use

   	/target id ${TargetArray[4]}
   	/varset doorAttempt 50
   }
   
| -------- You need to add this call to your loop section in Main. ------------------------------------------ 
/if (${FollowFlag} || ${PathingFlag}) /call AdvPathPoll 

/delay 1

   /if (${PrevLoc[1]}!=${Me.X} || ${PrevLoc[2]}!=${Me.Y}) {
   	/if (${Math.Distance[${PrevLoc[1]},${PrevLoc[2]}:${PrevLoc[3]},${PrevLoc[4]}]} >= 10) {
		/varset PrevLoc[3] ${PrevLoc[1]}
		/varset PrevLoc[4] ${PrevLoc[2]}
	}
	/varset PrevLoc[1] ${Me.X}
	/varset PrevLoc[2] ${Me.Y}
	/varset noMoveCount 0
   } else {
	/vardata noMoveCount Math.Calc[${noMoveCount}+1]
   }

   |- Check for new events in chat etc etc... 
   /doevents 

	/if (${PathingFlag}) {
	
		/keypress use
		
		/if (${underAttack} && !${GotMob}) {
				/varset GotMob 1
				/varset GotMobID ${underAttackBy}
				/call GoHome
		}

		/if (!${GotMob}) {
			/call PullNearestMob
			/if (${Macro.Return}) {
				/varset GotMob 1
				/call GoHome
			}
		}
		
		| -------- You need to add this call to your loop section in Main. ------------------------------------------ 
		/call AdvPathPoll 


		/goto :Main_Loop 
	} else {
		/if (${GotMob}) {
			/target id ${GotMobID}
			/face nolook loc ${PrevLoc[4]}, ${PrevLoc[3]}
			/varset WaitForMob 300
			/varset GotMob 0
		} else /if (!${CombatOn} && !${DidDelay}) {
		
			/face nolook loc ${PrevLoc[4]}, ${PrevLoc[3]}
			/varset DelayPull 300
			/varset DidDelay 1
		
		}
	}

/if (${noMoveCount} > 20 || ${CombatOn}) {


    /if (${Me.State.Equal[Stand]} && !${MoveToTmr} && !${FollowFlag} && !${Me.Moving} && !${PathingFlag}) {

	/if (!${underAttack} && (${Me.PctMana} < 30 || !${CombatOn} || !${DoMelee})) {
		/squelch /stick off
		/if (${Me.State.Equal[Stand]} && !${underAttack}) /sit 
		/varset DoingMove 0
	} else /if (${CombatOn}) {
		/sit off
		/attack on
		/if (${CombatOn} && ${DoMelee}) /if (${Target.ID} == ${TargetArray[4]}) {
			/squelch /stick hold 40% moveback
		}
		
	}
    }



    

   	/if (!${PathingFlag} && !${GotMob} && (!${GotMobID} || !${WaitForMob} || ${Math.Distance[${HomeY},${HomeX}:${Spawn[${GotMobID}].Y},${Spawn[${GotMobID}].X}]} < ${AutoPullEngageDistance})) /call GetTarget 

	|/call GetTarget

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

		/squelch /moveto off

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

	}


	/if (${FollowFlag}) {

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

		

	}	


   /if (!${GotMob} && !${CombatOn} && ${Me.Thirst} < 1000) {
	
	/call checkCanCast "Summon Drink" gem${SpellBuffsGem}
	/if (!${Macro.Return}) /goto :Hold_Main

	/squelch /moveto off
	/squelch /stick off

	/if (${Cursor.ID}) /autoinventory

	/call cast "Summon Drink" gem${SpellBuffsGem}
	
	/sit on
	
	/delay 2s ${Cursor.ID}
	/nomodkey /itemnotify pack8 leftmouseup
	/delay 5
	/nomodkey /itemnotify pack8 rightmouseup
	/delay 5
	/nomodkey /itemnotify pack8 leftmouseup
	/delay 5
	
	/if (${Cursor.ID}) /autoinventory

	/varset WaitingOnSpell 1
	
	/goto :Hold_Main

   }

   /if (!${GotMob} && !${CombatOn} && ${Me.Hunger} < 1000) {
	
        /call checkCanCast "Summon Food" gem${SpellBuffsGem}
        /if (!${Macro.Return}) /goto :Hold_Main
        

	/squelch /moveto off
	/squelch /stick off
	
	/if (${Cursor.ID}) /autoinventory

	/call cast "Summon Food" gem${SpellBuffsGem}
	
	/sit on
	
	/delay 2s ${Cursor.ID}
	/nomodkey /itemnotify pack8 leftmouseup
	/delay 5
	/nomodkey /itemnotify pack8 rightmouseup
	/delay 5
	/nomodkey /itemnotify pack8 leftmouseup
	/delay 5
	
	/if (${Cursor.ID}) /autoinventory

	/varset WaitingOnSpell 1
	
	/goto :Hold_Main

   }


DEBUG_2 Test 1

    |- Do we move? 
:Hold_Main 
   /varset BuffsDone 0
   /varset singleBuffsDone 0
    /if (!${FollowFlag} && ${Me.Moving}) /goto :Main_Loop 
    
    
    /if (!${MoveToTmr} && !${FollowFlag} && !${Me.Moving}) {

	/if (!${underAttack} && (${Me.PctMana} < 30 || !${CombatOn} || !${DoMelee})) {
		/squelch /stick off
		/if (${Me.State.Equal[Stand]} && !${underAttack}) /sit 
		/varset DoingMove 0
	} else /if (${CombatOn}) {
		/sit off
		/attack on
		/if (${Target.ID} == ${TargetArray[4]}) {
			/squelch /stick hold 40% moveback
		}
	}
    }

    |- Let the group know Im LOM 
    /if (${Me.PctMana} < 15 && !${CallManaTmr}) { 
       /if (${Verbose}) /gsay ${Me.PctMana}% Mana 
       /varset CallManaTmr 900 
    } 

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



DEBUG_2 Test 2

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

DEBUG_2 Test 3

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

DEBUG_2 Test 4

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

DEBUG_2 Test 5

   /if (${Math.Distance[${HomeY},${HomeX}:${Spawn[GotMobID].Y},${Spawn[GotMobID].X}]}>25) /if (${WaitForMob}>0 || ${GotMob}) /goto :Main_Loop 


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

DEBUG_2 Test 6


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

DEBUG_2 Test 7

   /if (${MeLoM} || (${Me.PctMana} < 50 && ${Me.PctHPs} < 50) || ${paragonNeeded}) {
	/if (${Me.AltAbilityReady[Paragon of Spirit]}) {
    		
		/squelch /moveto off
		/squelch /stick off

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

		/delay 3

		/target id ${Me.ID}
	
		/if (!${paragonAnnounced}) /g INC Paragon of Spirit - Group mana/health regen!
		/varset paragonAnnounced 1

		/call Cast "Paragon of Spirit" alt

		/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
			/varset paragonNeeded 0
			/varset paragonAnnounced 0
		}
		
		/delay 2
		
	}
   }

DEBUG_2 Test 8

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


   /if (${Me.PctMana} < 40 || ${CombatOn}) {
   	/goto :Main_Loop 
   }

DEBUG_2 Test 9

   /if (${WaitingOnSpell}) /goto :FollowingBuffs

DEBUG_2 Test 10

   |- Group Buffs 
   /if (${DoBuffs}) /if (!${grpBuffTimer}) /call GrpBuffs 
   /if (${WaitingOnSpell}) /goto :FollowingBuffs
   /if (${tookAction}) /goto :Main_Loop 

   /if (${Me.PctMana} > 40) /if (${CastATK}) /if (${Me.SpellReady[${SpellATK}]}) {
		/squelch /stick off
		/squelch /moveto off
	
	/call Cast_Avatar 
        /if (${tookAction}) /goto :Main_Loop 
   }

DEBUG_2 Test 11

    |- Single Buff ! 
    /if (${DoSingleBuffs}) /call SingleBuffs 
    /if (${WaitingOnSpell}) /goto :FollowingBuffs
    /if (${tookAction}) /goto :Main_Loop

DEBUG_2 Test 12


   |- Pet 
   /if (!${Me.Pet.ID} && ${SummonPet} && ${Spell[${SpellPet}].Mana} <= ${Me.CurrentMana}) {
        
        /call checkCanCast "${SpellPet}" gem${SpellPetGem}
        /if (!${Macro.Return}) /goto :FollowingBuffs

		/squelch /stick off
		/squelch /moveto off
	
	/call cast "${SpellPet}" gem${SpellPetGem} 25s 
   	/goto :Main_Loop 
   }

DEBUG_2 Test 13

   /if (${Me.Pet.ID} && ${BuffPet}) {
	/call BuffPet 
   	/if (${WaitingOnSpell}) /goto :FollowingBuffs
   	/if (${tookAction}) /goto :Main_Loop 
   }
   
   /call Check_grpHPsDowntime
   /if (${WaitingOnSpell}) /goto :FollowingBuffs
   /if (${tookAction}) /goto :Main_Loop 

   /varset BuffsDone 1

DEBUG_2 Buffs done

:FollowingBuffs

DEBUG_2 Waiting on spell...

}

   /goto :Main_Loop 
/return 






Sub MemSpells 
  /declare gemnum int local 
  /echo Memming spells. Hang on. 
  /if (${Me.Sitting}) /stand 
  /if (${HealPets}) /if (${Me.Gem[${SpellPetHeal}]} && ${Me.Gem[${SpellPetHeal}]}!=${SpellPetHealGem}) { 
    /varset gemnum ${Me.Gem[${SpellPetHeal}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellPetHealGem} ${SpellPetHeal} 
    /delay 5s 
  } 
  /if (${HealPets}) /if (!${Me.Gem[${SpellPetHeal}]}) { 
    /memspell ${SpellPetHealGem} ${SpellPetHeal} 
    /delay 5s 
  } 

  /if (${DoHeal}) /if (${Me.Gem[${SpellHeal}]} && ${Me.Gem[${SpellHeal}]}!=${SpellHealGem}) { 
    /varset gemnum ${Me.Gem[${SpellHeal}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellHealGem} ${SpellHeal} 
    /delay 5s 
  } 
  /if (${DoHeal}) /if (!${Me.Gem[${SpellHeal}]}) { 
    /memspell ${SpellHealGem} ${SpellHeal} 
    /delay 5s 
  } 

  /if (${DoSlow}) /if (${Me.Gem[${SpellSlow}]} && ${Me.Gem[${SpellSlow}]}!=${SpellSlowGem}) { 
    /varset gemnum ${Me.Gem[${SpellSlow}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellSlowGem} ${SpellSlow} 
    /delay 5s 
  } 
  /if (${DoSlow}) /if (!${Me.Gem[${SpellSlow}]}) { 
    /memspell ${SpellSlowGem} ${SpellSlow} 
    /delay 5s 
  } 
  
  /if (${DoMalo}) /if (${Me.Gem[${SpellDeBuff}]} && ${Me.Gem[${SpellDeBuff}]}!=${SpellDeBuffGem}) { 
    /varset gemnum ${Me.Gem[${SpellDeBuff}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellDeBuffGem} ${SpellDeBuff} 
    /delay 5s 
  } 
  /if (${DoMalo}) /if (!${Me.Gem[${SpellDeBuff}]}) { 
    /memspell ${SpellDeBuffGem} ${SpellDeBuff} 
    /delay 5s 
  } 
  
  /if (${DoNuke}) /if (${Me.Gem[${SpellFirstNuke}]} && ${Me.Gem[${SpellFirstNuke}]}!=${SpellFirstNukeGem}) { 
    /varset gemnum ${Me.Gem[${SpellFirstNuke}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellFirstNukeGem} ${SpellFirstNuke} 
    /delay 5s 
  } 
  /if (${DoNuke}) /if (!${Me.Gem[${SpellFirstNuke}]}) { 
    /memspell ${SpellFirstNukeGem} ${SpellFirstNuke} 
    /delay 5s 
  } 

  /if (${DoNuke}) /if (${Me.Gem[${SpellOtherNuke}]} && ${Me.Gem[${SpellOtherNuke}]}!=${SpellOtherNukeGem}) { 
    /varset gemnum ${Me.Gem[${SpellOtherNuke}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellOtherNukeGem} ${SpellOtherNuke} 
    /delay 5s 
  } 
  /if (${DoNuke}) /if (!${Me.Gem[${SpellOtherNuke}]}) { 
    /memspell ${SpellOtherNukeGem} ${SpellOtherNuke} 
    /delay 5s 
  } 

  /if (${DoDoT}) /if (${Me.Gem[${SpellDoT}]} && ${Me.Gem[${SpellDoT}]}!=${SpellDoTGem}) { 
    /varset gemnum ${Me.Gem[${SpellDoT}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellDoTGem} ${SpellDoT} 
    /delay 5s 
  } 
  /if (${DoDoT}) /if (!${Me.Gem[${SpellDoT}]}) { 
    /memspell ${SpellDoTGem} ${SpellDoT} 
    /delay 5s 
  } 

  /if (${CastATK}) /if (${Me.Gem[${SpellATK}]} && ${Me.Gem[${SpellATK}]}!=${SpellATKGem}) { 
    /varset gemnum ${Me.Gem[${SpellATK}]} 
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup 
    /memspell ${SpellATKGem} ${SpellATK} 
    /delay 5s 
  } 
  /if (${CastATK}) /if (!${Me.Gem[${SpellATK}]}) { 
    /memspell ${SpellATKGem} ${SpellATK} 
    /delay 5s 
  } 
/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}]} ) {
		/squelch /moveto off
		/squelch /stick off

		/delay 2

		/return 1
	}

	/if ( !${Me.Gem[${spellName}]} ) { 
		/squelch /moveto off
		/squelch /stick off
		
		/delay 2

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

/return 0





| ################# 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) {
			
        		/call checkCanCast "${SpellSlow}" gem${SpellSlowGem}
        		/if (!${Macro.Return}) /return

			/squelch /stick off
			/squelch /moveto off
			/if (${Me.Combat}) /attack off
	
			/target id ${DebuffTimers[${i}]}
			/call Slow

			/target id ${TargetArray[4]}
			/attack on

		}

	/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 ((${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[${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.Y},${Me.X},${Me.Z}:${Spawn[${s}].Y},${Spawn[${s}].X},${Spawn[${s}].Z}]}) {
					|	/if (${LineOfSight[${Spawn[${sID}].Y},${Spawn[${sID}].X},${Spawn[${sID}].Z}:${Spawn[${s}].Y},${Spawn[${s}].X},${Spawn[${s}].Z}]}) {

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


							/squelch /stick off
							/squelch /moveto off

							/if (${Me.Combat}) /attack off
	
							/target id ${s}

							/delay 5

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

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

								/call Slow

							}

							/target id ${TargetArray[4]}
							/attack on

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

/return





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

Sub GetTarget 

   /declare temp int inner 0
   /declare i int local 1


   /if (${GotMobID} && ${Spawn[${GotMobID}].Distance} < ${AutoPullEngageDistance}) {

	/target id ${GotMobID}

	/squelch /stick off
	/squelch /moveto off
	
	/target id ${GotMobID}
      	/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
  
   	/varset GotMobID 0
   	/varset WaitForMob 0
	/return  
   }

   /varset GotMobID 0
   /varset WaitForMob 0
    
   /if (${CombatOn} && !${Spawn[${TargetArray[4]}].Name.Equal[${TargetArray[3]}]} || ${Spawn[${TargetArray[4]}].Type.Equal[Corpse]}) { 
      /varset MobRooted FALSE 
      /varset MobMaloed FALSE 
      /varset MobSlowed FALSE 
      /varset PetOn FALSE 
      /varset MobDoTed FALSE 
      /varset CombatOn FALSE 
      /varset DotTime 0

      /if (${AutoLoot}) /call DoTheLooting ${TargetArray[4]}
      /call GoHome
    
      /varset TargetArray[1] NULL 
      /varset TargetArray[2] NULL 
      /varset TargetArray[3] NULL 
      /varset TargetArray[4] NULL 
      
      |/varset DelayPull 10

	
	/squelch /stick off

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

      }
    
   } 



   |/squelch /target clear

/if (!${AutoPull}) {

   /squelch /stick off

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

	| Try assisting MA and see if he has anything targeted...

   /if (${Target.Type.Equal[NPC]}) { 
      /varset TargetArray[1] ${Target.CleanName} 
      /varset TargetArray[2] ${Target.Level} 
      /varset TargetArray[3] ${Target.Name} 
      /varset TargetArray[4] ${Target.ID} 
      /if (${Target.Distance}<=${AssistAt} && ${Target.ID}==${TargetArray[4]} && ${Target.PctHPs}<=${CombatAt}) {
      		/varset CombatOn TRUE 
      }
      
      

   } 
   /return   
} else /if (${TargetArray[4]}) {

	/return

}

	/if (${Spawn[${TargetArray[4]}].ID} && !${Spawn[${TargetArray[4]}].Type.Equal[Corpse]} && ${Spawn[${TargetArray[4]}].Distance} > 50 && ${WaitForMob} <= 0) {
   		/varset GotMobID ${TargetArray[4]}
   		/varset WaitForMob 150
		/return
	}

   	/if (${Spawn[${TargetArray[4]}].ID} && !${Spawn[${TargetArray[4]}].Type.Equal[Corpse]}) /return


	| Nothing targeted on MA, do we have any other mobs slowed in the area? They need to die.

	/for i 1 to ${DebuffTimers.Size}

		/if (${DebuffTimers[${i}]}) /if (${Defined[DebuffTimer${DebuffTimers[${i}]}]}) {			

   			/if (${Spawn[${DebuffTimers[${i}]}].Type.Equal[NPC]}) { 

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

		/squelch /stick off
		/squelch /moveto off
	
				/target id ${DebuffTimers[${i}]}
      				/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    
			}
		}

	/next i

   | Clean up some corpses...

   /if (0 && ${AutoLoot} && !${attemptedLoot}) {
   
   	/target corpse
	/if (${Target.ID} && ${Target.Type.Equal[Corpse]} && (${Target.Distance} < 50 || ${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${Target.Z}]})) {

		/call DoTheLooting ${Target.ID}
		/varset attemptedLoot 1
		/call GoHome
	}
   }

   /varset attemptedLoot 0
   
   DEBUG_2 BuffsDone: ${BuffsDone}

   | No mobs on assist or slowed... lets pull another =P

   /if (${AutoPull} && ${BuffsDone} && !${paragonNeeded} && ${DelayPull} <= 0) {
	
	/call StopFunction

	/call PlayFunction "${PathFile} 1 cf pp noz"

	/varset doingPath 1
   }

/return 







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

Sub Combat 

   /target id ${TargetArray[4]}

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


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

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

   }




   /if (${CombatOn} && !${MobMaloed} && ${DoMalo} && ${Target.ID}==${TargetArray[4]}) {
	/call DeBuff
	/return
   }
 
   /if (${CombatOn} && !${PetOn} && ${Target.ID}==${TargetArray[4]}) { 
      	/pet attack 
      	/varset PetOn TRUE 
   } 

   /if (${Defined[DebuffTimer${Target.ID}]} && ${DebuffTimer${Target.ID}} > 0) /if (${DotTime}<=0) /if (${Me.PctMana} > 65) /if (${CombatOn} && ${DoDoT} && ${Target.PctHPs}<=${CastDoTat} && ${Target.PctHPs}>=${MinDoTat}) { 
      	
	
        /call checkCanCast "${SpellDoT}" gem${SpellDoTGem}
        /if (!${Macro.Return}) /return

		/squelch /stick off
		/squelch /moveto off
	
	/call cast "${SpellDoT}" gem${SpellDoTGem} 

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

   	/varset tookAction 1

	/return
   } 
    
   /if (${Me.Gem[${SpellNuke}]}) /if (${Me.PctMana} > ${MinManaForNuke}) /if (!${nukeTimer}) /if (${CombatOn} && ${DoNuke} && ${Target.PctHPs}<=${NukeAt} && ${Target.PctHPs}>=${MinNukeat}) { 
        /call checkCanCast "${SpellNuke}" gem${SpellNukeGem} 
        /if (!${Macro.Return}) /return

		/squelch /stick off
		/squelch /moveto off
	
      	/call cast "${SpellNuke}" gem${SpellNukeGem} 

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

   	/varset tookAction 1

	/return
   } 
    

   /if (${Me.Gem[${SpellNuke}]}) /if (${Me.PctMana} > ${MinManaForNuke}) /if (!${nukeTimer}) /if (${CombatOn} && ${DoNuke} && ${Target.PctHPs}<=${NukeAt} && ${Target.PctHPs}>=${MinNukeat}) { 
        /call checkCanCast "${SpellOtherNuke}" gem${SpellOtherNukeGem} 
        /if (!${Macro.Return}) /return

		/squelch /stick off
		/squelch /moveto off
	
      	/call cast "${SpellOtherNuke}" gem${SpellOtherNuke} 

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

   	/varset tookAction 1

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

	/if (${AutoLoot}) /call DoTheLooting ${TargetArray[4]}

	/call GoHome

	/varset TargetArray[1] NULL 
	/varset TargetArray[2] NULL 
	/varset TargetArray[3] NULL 
	/varset TargetArray[4] NULL 

	|/varset DelayPull 10

	/squelch /stick off

	/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

		/squelch /stick off
		/squelch /moveto off
	
         /call cast "${SpellDeBuff}" gem${SpellDeBuffGem} 6s 
         /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 (${Target.ID}==${TargetArray[4]} && ${Target.PctHPs}>${CombatAt}) /return

      /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

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


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


		/if (${Verbose}) /gsay < %T > RESISTED slow ! Trying again...

		/call SetDebuffTimer ${Target.ID} 60

                /return 
             } 
            /varset MobSlowed TRUE 
          } 
         /if (${Macro.Return.Equal["CAST_SUCCESS"]}) { 
            |/if (${Verbose}) 


		/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}
		/target id ${TargetArray[4]}

	 }
         /if (${Macro.Return.Equal["CAST_CANNOTSEE"]}) { 
	    /call SetDebuffTimer ${Target.ID} 150
		/echo Cannot See: ${Target.CleanName}
		/target id ${TargetArray[4]}

          } 

      } 
/return 
Last edited by guest_01 on Sat May 07, 2005 6:36 pm, edited 5 times in total.

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

Post by guest_01 » Fri Apr 15, 2005 5:12 am

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} ) { 

		/squelch /stick off
		/squelch /moveto off
	
         /target id ${Me.ID} 
         /delay 1s ${Target.ID} 

	/call AttemptAvoid

	/if (${grpBuffTimesAttempted}<3) {
      
		/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!
				
				/varset grpBuffTimer 150
				/varset grpBuffTimesAttempted ${Math.Calc[${grpBuffTimesAttempted}+1]}
				/call AttemptAvoid ${Spawn[pc ${M_Assist}].ID}
				/return
			}
		/next j
	}

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

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

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


Sub CheckHPs

	/if (${Target.PctHPs} >= 80) {
		/call Interrupt
	}

/return



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

Sub Check_grpHPsDowntime
   /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.Name}


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

		/squelch /stick off
		/squelch /moveto off
	
			/target pc ${Group.Member[${g}]} 
               		/delay 1s ${Target.ID}==${Group.Member[${g}].ID} 
			/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}) { 
				/if (${Verbose}) /gsay ${SpellHeal} on < %T >
		/squelch /stick off
		/squelch /moveto off
		
				/delay 5
	
				/call cast "${SpellHeal}" gem${SpellHealGem} 4s CheckHPs
  		 		/varset tookAction 1 
			} else {
				/call AttemptAvoid ${Group.Member[${g}].ID}
	 		}
			
		}
	}

   /next g
/return 


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

Sub Check_grpHPs 
   /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.Name}


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

		/squelch /stick off
		/squelch /moveto off
	
			/target pc ${Group.Member[${g}]} 
               		/delay 1s ${Target.ID}==${Group.Member[${g}].ID} 
			/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}) { 
				/if (${Verbose}) /gsay ${SpellHeal} on < %T >
		/squelch /stick off
		/squelch /moveto off
		
				/delay 5
	
				/call cast "${SpellHeal}" gem${SpellHealGem} 4s CheckHPs
  		 		/varset tookAction 1 
			} else {
				/call AttemptAvoid ${Group.Member[${g}].ID}
	 		}
			
		}
	}

   /next g
/return 


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

Sub Check_grpPetHPs 
   /declare g int local 0
   /declare gClass string local

	/if (${Group.Member[${g}].ID} && ${Group.Member[${g}].Pet.ID}) {

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

		/if ((${DoHeal}) && ${Group.Member[${g}].Pet.PctHPs}<=${HealPetAt}) { 

		/squelch /stick off
		/squelch /moveto off
	
			/target id ${Group.Member[${g}].Pet.ID} 
               		/delay 1s ${Target.ID}==${Group.Member[${g}].Pet.ID} 
			/if (${Me.CurrentMana}<${Spell[${SpellPetHeal}].Mana}) { 
				/echo *** Shid ! I don't have mana to heal ${Group.Member[${g}]}'s Pet
			} else /if (${Target.Distance}<=${Spell[${SpellPetHeal}].Range}) { 
				/if (${Verbose}) /gsay ${SpellPetHeal} on < %T >
		/squelch /stick off
		/squelch /moveto off
	
				/call cast "${SpellPetHeal}" gem${SpellPetHealGem} 4s CheckHPs
  		 		/varset tookAction 1 
			} else {
				/call AttemptAvoid ${Group.Member[${g}].Pet.ID}
	 		}
			
		}
	}

/return 


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

Sub BuffPet 



	/if (${Me.AltAbility[Hobble of Spirits]} && ${Me.AltAbilityReady[Hobble of Spirits]}) {
		/if (!${Me.PetBuff[Hobble of Spirits]}) {
		
			/squelch /stick off
			/squelch /moveto off

			/call Cast "Hobble of Spirits" alt
   	 		/varset tookAction 1
   	 		/return
		}
	}


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

		DEBUG_2 ${i}: ${SpellPetBuff[${i}]}
		/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} 
		/squelch /stick off
		/squelch /moveto off

		/call cast "${SpellPetBuff[${i}]}" gem${SpellBuffsGem} 9s 
		/varset tookAction 1
		/call EquipItem ${MainItem} 
	}
   /next i 
   
   /for i 1 to ${ItemPetBuff[1].Size} 
       /if (!${Me.PetBuff[${ItemPetBuff[${i},2]}]}) { 
		/pet target 
		/delay 1s ${Me.Pet.ID}==${Target.ID} 
		/call EquipItem ${ItemPetBuff[${i},1]} 
		/varset MainItem ${Macro.Return} 
		/squelch /stick off 
		/squelch /moveto off 
		/call cast "${ItemPetBuff[${i},1]}" item 
		/varset tookAction 1 
		/call EquipItem ${MainItem} 
       } 
  /next i
  
/return 

|################### Casting Avatar on all melee classes in group 

Sub Cast_Avatar 

   /declare i int local 0 
   /for i 0 to ${Group.Members} 
   /if (${Group.Member[${i}].ID}) { 
      /if (${ATKBuffed${i}}==0) /if (${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 (${Me.CurrentMana}>${Spell[${SpellATK}].Mana}) { 


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


		/squelch /stick off
		/squelch /moveto off

		/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 
            /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 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[,]} 

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

	/if (${g} != 0 && ${Group.Member[${g}].Class.Name.Equal[${Me.Class.Name}]}) /next g

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


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

         /for h 1 to ${Classes} 

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

		/if (${Spawn[${sID}].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

			/squelch /stick off
			/squelch /moveto off

			/target id ${sID}

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

               		/call EquipItem ${BuffFocusItem} 

               		/varset MainItem ${Macro.Return} 

		/squelch /stick off
		/squelch /moveto off
	
               		/call cast "${SpellBuff[${i},1]}" gem${SpellBuffsGem} ${SpCastTime} 
   			/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
	 		} else {
               			/varset SpellBufftmr${i}${Spawn[${sID}].Name} 10
               			/call EquipItem ${MainItem} 
				/next h
			}

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


   /varset singleBuffsDone 1

/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}].CastTime}*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[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[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]} && ${BuffPet}==0) { 
      /varset BuffPet TRUE 
      /echo Buff Pet:   ${BuffPet} 
   } else /if (${Command.Equal[buffpet]}) { 
      /varset BuffPet FALSE 
      /echo Buff Pet:   ${BuffPet} 
   } 
    
   /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[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[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[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[CastATK]} && ${CastATK}==0) { 
      /varset CastATK TRUE 
      /echo CastATK:   ${CastATK} 
   } else /if (${Command.Equal[CastATK]}) { 
      /varset CastATK FALSE 
      /echo CastATK:   ${CastATK} 
   } 


   /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[dofollow]}) { 

	 /if (!${AllowAutoFollow}) /return

		/squelch /stick off
		/squelch /moveto off
	
         /target ${Command2} 
	
         /delay 1s ${Target.CleanName.Equal[${Command2}]}

         /echo Following ${Target.CleanName}

         /call FollowFunction "${Target.CleanName}"

         /varset following ${Command2}

         /return 

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

		/squelch /stick off
		/squelch /moveto off
	
      /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]}) { 

		/squelch /stick off
		/squelch /moveto off
	
         /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[resetbuffs]} && ${Defined[Command2]}) { 
     	/for i 1 to ${SpellBuff.Size[1]}
      		/squelch /varset SpellBufftmr${i}${Spawn[${Command2}].Name}   0 
     	/next i 
   }
    

   /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 12:11 am, edited 5 times in total.

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

Post by guest_01 » Fri Apr 15, 2005 5:13 am

Code: Select all

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

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

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



	/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 

      |/varset DelayPull 10


	/squelch /stick off
	
   /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 
      /end
   } 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]}) { 
		/squelch /stick off
		/squelch /moveto off
	
         /target pc ${ChatSender} 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) {
		/squelch /stick off
		/squelch /moveto off
	
		/call cast "${SpellHeal}" gem${SpellHealGem}
   		/varset tookAction 1
	}
      /return 
      } 

      /if (${ChatText.Equal[slow]}) { 
         /assist ${ChatSender} 
	 /delay 3
         /if (${Target.Type.Equal[NPC]} && ${Target.Distance}<=100) { 
		/squelch /stick off
		/squelch /moveto off
	
            /call cast "${SpellMalo}" gem${SpellMaloGem} 6s 
            /call cast "${SpellSlow}" gem${SpellSlowGem} 6s 
   	    /varset tookAction 1
            /tell ${ChatSender} %T is SLOWED 
         } 
      /return 
      } 



      /if (${ChatText.Equal["buff me"]}) { 
		/squelch /stick off
		/squelch /moveto off
	
         /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.Find["LOM"]} || ${ChatText.Find["OOM"]}) /if (${ChatType.Equal[GROUP]} && ${Spawn[pc ${ChatSender}].Distance} < ${Spell[Paragon of Spirit].AERange}) /if (${Me.AltAbilityReady[Paragon of Spirit]}) {
    		
		/squelch /moveto off
		/squelch /stick off

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

		/delay 3

		/target id ${Me.ID}

	
		/if (!${paragonAnnounced}) /g INC Paragon of Spirit - Group mana/health regen!
		/varset paragonAnnounced 1

		/call Cast "Paragon of Spirit" alt

		/varset paragonNeeded 1

		/if (!${Macro.Return.Equal[CAST_SUCCESS]}) /varset paragonNeeded 1


		/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
			/varset paragonNeeded 0
			/varset paragonAnnounced 0
		}
	}

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

	 /if (!${AllowAutoFollow}) /return

		/squelch /stick off
		/squelch /moveto off
	
         /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)

	/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 (!${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 (${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 && !${DoMelee}) {


		/sit off

		/delay 1

		/squelch /stick off

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

		/varset DoingMove 1

		/varset delayMoveTimer 50


		/delay 10

		/return
	}

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

/return


Sub PullNearestMob

	
	/declare i int local 1
	/declare s int local 1
	/declare h int local 1


	/varset DidDelay 0

	/for i 1 to 10
	

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

	   /if (${Spawn[${s}].Speed}<100) /if (${Spawn[${s}].Distance}<=${Spell[${SpellSlow}].Range} && ${Spawn[${s}].Distance}<=${AutoPullDistance}) {

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


|${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${Target.Z}]}

		/squelch /target clear
		
		/target id ${s}
		/delay 2s ${s}==${Target.ID}
		
		/if (${Target.PctHPs}>=100) {

			/varset GotMobID ${s}
			
			
:WaitForStop
			/squelch /stick off
			/squelch /moveto off

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


			/delay 1

			/doevents
			/if (${underAttack}) {
				/varset GotMobID ${underAttackBy}
				/return 1
			}

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

			/delay 4

			/doevents
			/if (${underAttack}) {
				/varset GotMobID ${underAttackBy}
				/return 1
			}
			/face nolook loc ${PrevLoc[4]}, ${PrevLoc[3]}
			
			/call cast "${SpellSlow}" gem${SpellSlowGem} 6s 
			/varset tookAction 1

			/if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) {


				/doevents
				/if (${underAttack}) {
					/varset GotMobID ${underAttackBy}
					/return 1
				}

				/next i

			} else /if (${Macro.Return.Equal["CAST_IMMUNE"]}) { 
				|/if (${Verbose}) 


				/if (${Verbose}) /gsay < %T > is IMMUNE to slow ! 

				/call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*6000-100]}
				/varset MobSlowed TRUE 

				/return 1

			} else /if (${Macro.Return.Equal["CAST_RESISTED"]}) { 
				/if (!${FastSlow}) { 
					|/if (${Verbose}) 


					/if (${Verbose}) /gsay < %T > RESISTED slow ! Trying again...


					/call SetDebuffTimer ${Target.ID} 60
					/return 1
				} 

				/call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*60-100]}

				/varset MobSlowed TRUE 
				/return 1

			} else /if (${Macro.Return.Equal["CAST_SUCCESS"]}) { 
				|/if (${Verbose}) 


				/if (${Verbose}) /gsay < %T > is SLOWED 


				/varset MobSlowed TRUE 

				/call SetDebuffTimer ${Target.ID} ${Math.Calc[${Spell[${SpellSlow}].Duration}*60-100]}
				/return 1

			} else /if (${Macro.Return.Equal[CAST_OUTOFRANGE]} || ${Macro.Return.Equal[CAST_CANNOTSEE]}) {
				/next i
			} else /if (${Macro.Return.Equal["CAST_CANNOTSEE"]}) { 
				/next i
			} 
		}
		/squelch /target clear
	    }
	  }
	/next i


	/varset GotMobID 0

/return 0


Sub GoHome


	/if (${AutoPull}) {

		/call StopFunction

		/call PlayFunction "${PathFile} 1 cr nopp noz"

		/varset doingPath 2
		
	} else /if (${TetheredToHome} && ${following.Equal[FALSE]}) {
	
		  /if (${Me.Sitting}) /stand 
		  /squelch /stick off 
		  /squelch /moveto off
		  /call MoveAround 
		  /if (${Math.Distance[${HomeY},${HomeX}]}<15) { 
		    /squelch /stick off 
		    /keypress forward 
		    /keypress back 
		    /return 
		  } 
		  /face nolook loc ${HomeY},${HomeX} 
		  /delay 10
		  :MoveHome 
		  /delay 1 
		  /doevents 
		  /face nolook loc ${HomeY},${HomeX} 
		  /if (${Math.Distance[${HomeY},${HomeX}]}>10) /keypress forward hold 
		  /call AreWeStuck 
		  /if (${Math.Distance[${HomeY},${HomeX}]}<10) { 
		    /keypress forward 
		    /keypress back 
		    /return 
		  } 
		  /goto :MoveHome 
		
	
	}
/return



Sub AreWeStuck 
	/doevents 
	/declare counter int local 0 
	/declare StuckXLoc int local 0 
	/declare StuckYLoc int local 0 
	/declare i int local 0 
	/varset StuckXLoc ${Me.X} 
	/varset StuckYLoc ${Me.Y} 
	/delay 5 
	/if (${StuckXLoc}==${Me.X} && ${StuckYLoc}==${Me.Y}) /call MoveAround 
/return 

Sub MoveAround 
	/doevents 
	/keypress forward 
	/keypress back hold 
	/delay 3 
	/keypress back 
	/if (${Math.Rand[2]}) { 
	/keypress strafe_right hold 
	} else { 
	/keypress strafe_left hold 
	} 
	/delay 10 
	/keypress strafe_right 
	/keypress strafe_left 
/return



|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting(int targID)

    DEBUG_2 Going to loot
    DEBUG_2 DoTheLooting Target:  ${Spawn[${targID}].Level} ${Spawn[${targID}].CleanName}, ID:${targID}

    /declare tmptmr timer local 0

    /target id ${targID}

    /if (${Spawn[${targID}].Level}>LOOT_ABOVE_LEVEL) {

        /delay 3
        DEBUG_2 Running to the corpse
        
	/squelch /moveto loc ${Spawn[${targID}].Y} ${Spawn[${targID}].X}
	/varset tmptmr 50
:notThereLoop
	/if (${Spawn[${targID}].Distance}>10 && ${tmptmr} > 0) /goto :notThereLoop

	/squelch /moveto off

        
	DEBUG_2 Running done
        /if ( ${Spawn[${targID}].Type.Equal["Corpse"]} ) {
            /varcalc lootcnt ${lootcnt}+1
            DEBUG_2 Looting corpse #${lootcnt}
            /call LootMob

            /doevents
		
	    /autoinventory

        } else {
            DEBUG_1 Can't loot a non-corpse!
        }
    } else {
        DEBUG_1 This one is to low lvl. I wont loot it!
        /squelch /if ( ${Target.ID} ) /target clear
    }
    /call DisplayLootRecord
/return




|----------------------------------------------------------------------------
|SUB: Looting 
|----------------------------------------------------------------------------
Sub LootMob 

   /declare LootSlot    int local  0 
   /declare LootCheck   int local  0 
   /declare LootTotal   int local  0 
   /declare LootLoopCnt int local  0
    
   /declare LootItemName string local 

:LootLoop

   /if (!${Target.ID} || !${Target.Type.Equal[Corpse]}) /target corpse

   /fastdrop on 
   /loot never 
   /loot 
   /call Delay 10 
   /if (!${Corpse.Items}) { 
      /call Delay 30 
      /if (${Corpse.Items}) /goto :LootLoop
      /keypress ESC
      /call Delay 2
      /keypress ESC
      /call Delay 2
      /keypress ESC
      DEBUG_2 NO LOOT! Cheap Bastard! 
      /return
   } 

   /if (${Bool[LOOT_ITEMS]}) {
       /varset LootTotal ${Corpse.Items} 
       /for LootSlot 1 to ${Math.Calc[${LootTotal}+0]} 
   	  /call Delay 2 
          /itemnotify loot${LootSlot} leftmouseup 
          /delay 2s ${Cursor.ID}
          /if (${Bool[LOOT_ALL_ITEMS]}) {
             /call CopperToMoney ${Cursor.Value}
             DEBUG_1 Keeping a ${Cursor.Name} of value ${Macro.Return}... WOOT! 
			 /if (${Bool[LOOT_KEEP_RECORD]}) {
			    /call LootRecord "${Cursor.Name}"
			 }
             /autoinventory 
             /delay 2s !${Cursor.ID}
          } else { 
             /for LootCheck 1 to ${LootList.Size} 
                /if (${Cursor.Name.Find[${LootList[${LootCheck}]}]}) { 
                   /call CopperToMoney ${Cursor.Value}
                   DEBUG_1 Keeping a ${Cursor.Name} of value ${Macro.Return}... WOOT! 
                   |/varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1 
			       /if (${Bool[LOOT_KEEP_RECORD]}) {
					  /call LootRecord "${Cursor.Name}"
				   }
                   /autoinventory 
                   /delay 2s !${Cursor.ID}
                } 
             /next LootCheck 
             
             |If the item was not found in our list, Check if it should be looted anyway
             /if ( ${Cursor.ID} ) {
                /if ((!${Cursor.Lore}) && (!${Cursor.NoDrop}) && (${Cursor.Value} >= LOOT_STACKABLE_ITEMS_IF_VALUE_IS_ABOVE) && (${Cursor.Stackable})) {
                   /call CopperToMoney ${Cursor.Value}
                   DEBUG_1 This Stackable Item is of great Value. LOOT IT! (${Macro.Return}) ${Cursor.Value}
        		   /if (${Bool[LOOT_KEEP_RECORD]}) {
        			   /call LootRecord "${Cursor.Name}"
      		       }
                   /autoinventory 
                   /delay 2s !${Cursor.ID}
                } else /if ((${Cursor.Value} >= LOOT_NORMAL_ITEMS_IF_VALUE_IS_ABOVE)  && (!${Cursor.NoDrop})) {
                   /call CopperToMoney ${Cursor.Value}
                   DEBUG_1 This Item is of great Value. LOOT IT! (${Cursor.Value})
        		   /if (${Bool[LOOT_KEEP_RECORD]}) {
        			   /call LootRecord "${Cursor.Name}"
        		   }
                   /autoinventory 
                   /delay 2s !${Cursor.ID}
                }
             }
             
          } 
          
          |Drop if droppable, destroy if not
          |/if (${Bool[LOOT_DESTROY]}) {
            |
            /call CopperToMoney ${Cursor.Value}
            /if (${Cursor.ID} && (!${Cursor.NoDrop}) ) {
             	DEBUG_1 Dropping a ${Cursor.Name} of value ${Macro.Return}... 
                /drop            
            	/delay 2s !${Cursor.ID}
            }
            /if (${Cursor.ID}) {
             	DEBUG_1 Destroying a ${Cursor.Name} of value ${Macro.Return}... 
             	/destroy 
            	/delay 2s !${Cursor.ID}
          	} 
          |}
        /next LootSlot 

     /if (${Corpse.Items}) {
   	/keypress ESC
   	/call Delay 2
   	/keypress ESC
   	/call Delay 2
   	/keypress ESC
   	/call Delay 2
   	/keypress ESC

	/goto :LootLoop
     }

   }
   /keypress ESC
   /call Delay 2
   /keypress ESC
   /call Delay 2
   /keypress ESC

/return 


|----------------------------------------------------------------------------
|SUB: CopperToMoney - Returns pp,gp,sp,cp of pure cp values
|----------------------------------------------------------------------------
Sub CopperToMoney(int copper)
    /declare pp int local 0
    /declare gp int local 0
    /declare sp int local 0
:plat
    /if (${copper}>=1000) {
        /varcalc pp ${pp}+1
        /varcalc copper ${copper}-1000
        /goto :plat        
    }
:gold
    /if (${copper}>=100) {
        /varcalc gp ${gp}+1
        /varcalc copper ${copper}-100
        /goto :gold        
    }
:silver
    /if (${copper}>=10) {
        /varcalc sp ${sp}+1
        /varcalc copper ${copper}-10
        /goto :silver        
    }
    /declare ret string local
    /if (${pp}>0) /varset ret ${ret}, ${pp}pp
    /if (${gp}>0) /varset ret ${ret}, ${gp}gp
    /if (${sp}>0) /varset ret ${ret}, ${sp}sp
    /if (${copper}>0) /varset ret ${ret}, ${copper}cp
    /if ( ${ret.Length}>0 ) {
        /varset ret ${ret.Right[${Math.Calc[${ret.Length}-1]}]}
    } else {
        /varset ret Nothing!
    }
/return ${ret}


|----------------------------------------------------------------------------
|SUB: LootRecord - Keeps record of your looting 
|----------------------------------------------------------------------------
Sub LootRecord(string item)
    /declare tmp string local "${item}"
    |Removing variable letters that wont be accepted, add illegal variable letters here
    /call ReplaceString "${item}" " " "_" 
    /varset item ${Macro.Return}
    /call ReplaceString "${item}" "'" "_" 
    /varset item ${Macro.Return}
    /call ReplaceString "${item}" "-" "_" 
    /varset item ${Macro.Return}
    DEBUG_3 Variable name: ${item}
    /if ( !${Defined[Loot_Item_${item}]} ) {
        /declare Loot_Item_Name_${item} string outer ${tmp}
        /declare Loot_Item_${item} int outer 0
        /call AddToArray LootedList string ${item}
    }
    /varcalc Loot_Item_${item} ${Loot_Item_${item}} + 1
	
/return


Sub DisplayLootRecord
    |Display what we have so far:
    /declare i int local
    /declare output string local
    /for i 1 to ${LootedList.Size}
        /varset output ${output}, ${Loot_Item_${LootedList[${i}]}} ${Loot_Item_Name_${LootedList[${i}]}}
    /next i output ${output.Right[${Math.Calc[${output.Length}-1]}]}
    DEBUG_1 Items looted:  ${output}
/return


|----------------------------------------------------------------------------
|SUB: AddToArray - Dynamically adds elements to an array.
|----------------------------------------------------------------------------
Sub AddToArray(string varname, string vartype, targID)
	/declare i int local
	/declare copyofarr[0] ${vartype} local
    /if (${Defined[${varname}]}) { 
        /deletevar copyofarr

		/declare copyofarr[${${varname}.Size}] ${vartype} local

		/for i 1 to ${${varname}.Size}
			/varset copyofarr[${i}] ${${varname}[${i}]}
		/next i
		
        /deletevar ${varname}
	    /declare ${varname}[${Math.Calc[${copyofarr.Size}+1]}] ${vartype} outer
    	/for i 1 to ${Math.Calc[${copyofarr.Size}]}
			DEBUG_3 varset ${varname}[${i}] ${copyofarr[${i}]}
			/varset ${varname}[${i}] ${copyofarr[${i}]}
	    /next i
		/varset ${varname}[${${varname}.Size}] ${targID}
    } else {
    	/declare ${varname}[1]}] ${vartype} outer
		/varset ${varname}[1]}] ${targID}
    }

/return


|----------------------------------------------------------------------------
|SUB: ReplaceString - Replaces a string in a string with a string
|----------------------------------------------------------------------------
Sub ReplaceString(string str, string find, string replace)
    /declare stringcnt int local
    /declare i int local
    /declare ret string local 

    |/echo str: "${str}", find: "${find}", replace: "${replace}"
    
    /if ( ${str.Length}==0 ) /return ""
    /if ( ${find.Length}<=1 ) {
        /varcalc stringcnt ${str.Count["${find}"]} + 1
        /if ( ${stringcnt}==0 ) /return "${str}"
        /for i 1 to ${stringcnt}
            /varset ret ${ret}${replace}${str.Token[${i},"${find}"]}
        /next i
        /varset ret ${ret.Right[${Math.Calc[${ret.Length}-${replace.Length}]}]}
    } else {
        |The TOKEN method on string does not support splitters of length>1
        /varset ret ${str}
:GoAgain
        /if ( ${ret.Find["${find}"]} ) {
            /varset i ${ret.Find["${find}"]}
            /varset ret ${ret.Left[${Math.Calc[${i}-1]}]}${replace}${ret.Right[${Math.Calc[${ret.Length}-${i}-${find.Length}+1]}]}
            /if ( ${ret.Find["${find}"]} ) /goto :GoAgain
        }
    }
/return ${ret}




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} && !${PathingFlag}) /if (!${DoMelee}) /call AttemptAvoid
				/stand
				/return
			}

			/varset underAttackBy 0
		
		/next i


	}
	/varset underAttack 50

/return



Sub Event_GMInZone
	/quit
	/end
/return




Sub Event_Invite(string Line, string Name)

	/target pc ${Name}

	/delay 1s

	/invite

	/delay 1s

	/target clear

/return
Last edited by guest_01 on Sat May 07, 2005 6:43 pm, 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 » Fri Apr 15, 2005 5:13 am

Code: Select all

#pragma warning(disable: 4786) // disable "Truncating browse info" warning 

#include "../MQ2Plugin.h" 

PreSetup("MQ2Attacked"); 


VOID echo(char* output) 
{ 
   WriteChatColor(output,USERCOLOR_DEFAULT); 
} 


BOOL dataLastHit(PCHAR szID, MQ2TYPEVAR &Ret) 
{ 
   try { 

      PSPAWNINFO spawn; 
      SEARCHSPAWN ssSpawn; 

      ClearSearchSpawn(&ssSpawn); 
       
      ssSpawn.ZRadius=999999.0f; 
      ssSpawn.FRadius=999999.0f; 
      ssSpawn.SpawnID=atoi(szID); 

      spawn = NthNearestSpawn(&ssSpawn,1,(PSPAWNINFO)pCharSpawn,true); 

      if (spawn) 
      { 
         Ret.Ptr=spawn->pActorInfo->NameOfLastSuccessfulTargetHit; 
         Ret.Type=pStringType; 
         return true; 
      } 
   } 
   catch(...) 
   { 
      echo("[dataLastHit] Caught Terminal Error: attempting to continue as normal."); 
   } 
   return false; 
} 




// Called once, when the plugin is to initialize 
PLUGIN_API VOID InitializePlugin(VOID) 
{ 
   try 
   { 
      AddMQ2Data("LastHit",dataLastHit); 
   } 
   catch(...) 
   { 
      echo("[InitializePlugin] Caught Terminal Error: attempting to continue as normal."); 
   } 
    
} 






// Called once, when the plugin is to shutdown 
PLUGIN_API VOID ShutdownPlugin(VOID) 
{ 
   try 
   { 
         RemoveMQ2Data("LastHit"); 
   } 
   catch(...) 
   { 
      echo("[ShutdownPlugin] Caught Terminal Error: attempting to continue as normal."); 
   } 
}
Last edited by guest_01 on Sat May 07, 2005 6:41 pm, edited 1 time in total.

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Fri Apr 15, 2005 10:42 am

This looks awesome, I was thinking of using my BL to pull with in a 6box group.

I'm very interested in the slow code, I'd like to adapt it for my shaman macro so the shaman doesn't just keep spamming malo/slow when the MA switches targets back and forth.

Thanks for the macro guest_01

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

Post by guest_01 » Fri Apr 15, 2005 2:52 pm

it's mainly the CheckDebuffTimers, CheckSlowRadious, and SetDebuffTimers that's doing the slow maintanance. Keeps all mobs slowed, and will recast if slow is about to wear off on any of them.

I had originally done the slow code with my shaman, the slow code / buffing / healing code is basicly a direct copy of my shammies script... mainly added the pathing/pulling and tweaked it for melee use.

Of note though - it won't slow mobs that havn't hit a group member yet, since it checks who the mob hit last against group members and people in the OtherBuffees list (for PLing/buffing outside of group). So those proactive chanters who mezz before the mob comes in, and in rare cases - pallies who chain stun on pull and don't take a single hit until the mob is down to like 60 % hp won't have their mobs slowed.

Main reason for this is that I didn't want it slowing quest npcs and guards and what have you in the process of slowing the mobs. Before I added this, I had an unfortunate accident with Grimror Plaguebringer when my shammy was still a baby. =P

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:14 pm

Updated 05/02/05

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Wed May 04, 2005 10:40 pm

Guest:

I rewrote the memspells routine, first thing it does is makes sure you have the spell in the right gem, if you have it memmed, but in the wrong spot, it clears the correct gem and memorizes it there.

Code: Select all

Sub MemSpells
  /declare gemnum int local
  /echo Memming spells. Hang on. 
  /if (${Me.Sitting}) /stand 
  /if (${Me.Gem[${SpellPetHeal}]} && ${Me.Gem[${SpellPetHeal}]}!=${SpellPetHealGem}) {
    /varset gemnum ${Me.Gem[${SpellPetHeal}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellPetHealGem} ${SpellPetHeal}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellPetHeal}]}) {
    /memspell ${SpellPetHealGem} ${SpellPetHeal}
    /delay 5s
  }

  /if (${Me.Gem[${SpellHeal}]} && ${Me.Gem[${SpellHeal}]}!=${SpellHealGem}) {
    /varset gemnum ${Me.Gem[${SpellHeal}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellHealGem} ${SpellHeal}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellHeal}]}) {
    /memspell ${SpellHealGem} ${SpellHeal}
    /delay 5s
  }

  /if (${Me.Gem[${SpellSlow}]} && ${Me.Gem[${SpellSlow}]}!=${SpellSlowGem}) {
    /varset gemnum ${Me.Gem[${SpellSlow}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellSlowGem} ${SpellSlow}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellSlow}]}) {
    /memspell ${SpellSlowGem} ${SpellSlow}
    /delay 5s
  }
  
  /if (${Me.Gem[${SpellDeBuff}]} && ${Me.Gem[${SpellDeBuff}]}!=${SpellDeBuffGem}) {
    /varset gemnum ${Me.Gem[${SpellDeBuff}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellDeBuffGem} ${SpellDeBuff}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellDeBuff}]}) {
    /memspell ${SpellDeBuffGem} ${SpellDeBuff}
    /delay 5s
  }
  
  /if (${Me.Gem[${SpellFirstNuke}]} && ${Me.Gem[${SpellFirstNuke}]}!=${SpellFirstNukeGem}) {
    /varset gemnum ${Me.Gem[${SpellFirstNuke}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellFirstNukeGem} ${SpellFirstNuke}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellFirstNuke}]}) {
    /memspell ${SpellFirstNukeGem} ${SpellFirstNuke}
    /delay 5s
  }

  /if (${Me.Gem[${SpellOtherNuke}]} && ${Me.Gem[${SpellOtherNuke}]}!=${SpellOtherNukeGem}) {
    /varset gemnum ${Me.Gem[${SpellOtherNuke}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellOtherNukeGem} ${SpellOtherNuke}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellOtherNuke}]}) {
    /memspell ${SpellOtherNukeGem} ${SpellOtherNuke}
    /delay 5s
  }

  /if (${Me.Gem[${SpellDoT}]} && ${Me.Gem[${SpellDoT}]}!=${SpellDoTGem}) {
    /varset gemnum ${Me.Gem[${SpellDoT}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellDoTGem} ${SpellDoT}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellDoT}]}) {
    /memspell ${SpellDoTGem} ${SpellDoT}
    /delay 5s
  }

  /if (${Me.Gem[${SpellATK}]} && ${Me.Gem[${SpellATK}]}!=${SpellATKGem}) {
    /varset gemnum ${Me.Gem[${SpellATK}]}
    /notify SpellBookWnd SBW_Spell${gemnum} rightmouseup
    /memspell ${SpellATKGem} ${SpellATK}
    /delay 5s
  }
  /if (!${Me.Gem[${SpellATK}]}) {
    /memspell ${SpellATKGem} ${SpellATK}
    /delay 5s
  }
/return 

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Wed May 04, 2005 10:48 pm

Couple more things:

I added an item buff array as well, this needs to be placed in the declares:

Code: Select all

  /declare ItemPetBuff[1] string outer
  /varset  ItemPetBuff[1] Savage Lord's Totem
  
  /declare ItemPetBuffName[1] string outer
  /varset  ItemPetBuffName[1] "Savage Wildcaller's Blessing"
The item with the spell needs to match each other in the indexes.

here's the revamped Sub BuffPet:

Code: Select all

Sub BuffPet 
  /declare i int local 
  /declare j int local
  /if (${Me.AltAbility[Hobble of Spirits]} && ${Me.AltAbilityReady[Hobble of Spirits]}) { 
    /if (!${Me.PetBuff[Hobble of Spirits]}) { 
      /squelch /stick off 
      /squelch /moveto off 
      /call Cast "Hobble of Spirits" alt 
      /varset tookAction 1 
      /return 
    } 
  } 
  /for i 1 to ${SpellPetBuff.Size} 
    /if (!${SpellPetBuff[${i}].Equal[NULL]} && ${SpellPetBuff[${i}].Length} > 0) /if (!${Me.PetBuff[${SpellPetBuff[${i}]}]} && ${Spell[${SpellPetBuff[${i}]}].Mana} <= ${Me.CurrentMana}) { 
      DEBUG_2 ${i}: ${SpellPetBuff[${i}]} 
      /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} 
      /squelch /stick off 
      /squelch /moveto off 
      /call cast "${SpellPetBuff[${i}]}" gem${SpellBuffsGem} 9s 
      /varset tookAction 1 
      /call EquipItem ${MainItem} 
    } 
  /next i 
  /for j 1 to ${ItemPetBuff.Size}
    /if (!${Me.PetBuff[${ItemPetBuffName[${j}]}]}) {
      /if (!${Macro.Return}) /return 
      /pet target 
      /delay 1s ${Me.Pet.ID}==${Target.ID} 
      /varset MainItem ${Macro.Return} 
      /squelch /stick off 
      /squelch /moveto off 
      /call cast "${ItemPetBuff[${j}]}" item
      /varset tookAction 1
    }
  /next j     
/return 
There are a couple of other changes and updates I'm sure, just going through my hacked up version now and seeing what I changed.

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Wed May 04, 2005 11:08 pm

Last post, I promise...

I'm not familiar with advpath, so this may be a setting in the macro I just can't see, but is there a tether setting to get the beastlord to run back to homex/y when a mob dies?

I just put in an ugly little has with a mobdead event to run home if we're > 25 from the campspot we started the macro at (this is when the BL is not pulling, just assisting the MA, I have another toon that pulls)

The event:

Code: Select all

#Event MobDead     "#*#You have slain#*#"
#Event MobDead     "#*#has been slain by#*#"
The code added at the end of the macro: (I know this is a hack, I'm sure all this functionality is available in advpath, I just haven't taken time to dig into it, too many projects, not enough time)

Code: Select all

Sub Event_MobDead
  /keypress forward
  /keypress back
  /call MoveAround
  /if (!${Autopull} && !${Me.Combat}) {
    /call ReturnHome
  }
/return

Sub ReturnHome
  /if (${FollowingTank} || ${MovingCamp} || !${StaticCamp}) /return
  /if (${Me.Sitting}) /stand 
  /squelch /stick off
  /call MoveAround
  /if (${Math.Distance[${HomeY},${HomeX}]}<15) {
    /squelch /stick off
    /keypress forward
    /keypress back
    /return
  }
  :MoveHome
  /delay 1
  /doevents
  /face fast nolook loc ${HomeY},${HomeX}
  /if (${Math.Distance[${HomeY},${HomeX}]}>10) /keypress forward hold
  /call AreWeStuck
  /if (${Math.Distance[${HomeY},${HomeX}]}<10) {
    /keypress forward
    /keypress back
    /return
  }
  /goto :MoveHome
/return

Sub AreWeStuck
	/doevents
  /declare counter int local 0
  /declare StuckXLoc int local 0
  /declare StuckYLoc int local 0
  /declare i int local 0
  /varset StuckXLoc ${Me.X} 
  /varset StuckYLoc ${Me.Y}
  /delay 5
  /if (${StuckXLoc}==${Me.X} && ${StuckYLoc}==${Me.Y}) /call MoveAround
/return

Sub MoveAround
  /doevents
  /keypress forward 
  /keypress back hold 
  /delay 3 
  /keypress back 
  /if (${Math.Rand[2]}) { 
     /keypress strafe_right hold 
  } else { 
     /keypress strafe_left hold 
  } 
  /delay 10 
  /keypress strafe_right 
  /keypress strafe_left 
/return 

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Fri May 06, 2005 3:57 pm

One thing I've noticed, this version is never buffing the pet, I haven't looked at it in depth yet, but the petbuff routines haven't changed much other than the hobble add and my changes.

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:51 pm

Well, I guarentee that the version I posted buffs my pet, since I use it for that almost all the time, even in normal groups (have a hotkey to turn it on and another for /end... if a buff falls i just turn it on for a sec and it rebuffs for me)

I'll look into incorporating your changes... as for the return home code, that's an easy add.... all you need to do is add in a
/call GoHome
to everywhere that looting is done... again, I'll add this to my next release

DigitalMocking
a grimling bloodguard
a grimling bloodguard
Posts: 620
Joined: Mon Apr 04, 2005 5:53 pm

Post by DigitalMocking » Fri May 06, 2005 11:47 pm

guest_01 wrote:Well, I guarentee that the version I posted buffs my pet, since I use it for that almost all the time, even in normal groups (have a hotkey to turn it on and another for /end... if a buff falls i just turn it on for a sec and it rebuffs for me)

I'll look into incorporating your changes... as for the return home code, that's an easy add.... all you need to do is add in a
/call GoHome
to everywhere that looting is done... again, I'll add this to my next release
I'll try with just your code and see what's going on with pet buffing, but that function hasn't been changed. It never gets into the Sub BuffPet section best I can tell, I put a couple of /beep /echos in there, and nada.

The flags look right, no clue what's going on, just haven't had time to look into it.

Few other minor changes I've noted in this version:
There's a lot of stopping/starting attacking during the combat routine as well as random player /con selection messages.
Often combat won't initiate until much later in the fight, the previous version jumped in immidiately unless it was actually casting.

I still haven't had time to check it out, the /call GoHome would be nice, I really need to learn advpath.

These aren't criticisms at all, I love your bot, just trying to help if I can at all, its saved me a ton of coding.

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

Post by guest_01 » Sat May 07, 2005 1:15 pm

DigitalMocking wrote: I'll try with just your code and see what's going on with pet buffing, but that function hasn't been changed. It never gets into the Sub BuffPet section best I can tell, I put a couple of /beep /echos in there, and nada.

The flags look right, no clue what's going on, just haven't had time to look into it.
if you've changed anything in the main sub prior to where it reachs the buffing area, it could have an impact... also if you've changed the values of certain flags, that's another possibililty... could be many things, it's hard to say without seeing the changes you've made... enable the DEBUG_2 messages and look to see how far through the main sub it gets... that should tell you where it's dying.
DigitalMocking wrote: Few other minor changes I've noted in this version:
There's a lot of stopping/starting attacking during the combat routine as well as random player /con selection messages.
Often combat won't initiate until much later in the fight, the previous version jumped in immidiately unless it was actually casting.
Define the stopping/starting of attack? I turn attack off each time he casts a spell (slow most noticably) and also before assisting - just in case the main tank has switched targets temporarily... I found that he was breaking mezzes when a pally tank would switch to a mezzed mob and start stunning/taunting mid fight (they do that sometimes, strangely enough)... this was mainly a safety guard against mez breaks. I may put a timer on though so it only assists once every 5 or 10 seconds once combat is on though to limit that.

As for the con messages - this is again part of my door opening routine. I found that while fighting sometimes mobs would be pushed through doors, and the bot would get stuck on the other side of the door unable to reach the mob, so I put in a /keypress use that triggers once every 5 seconds to open any door that may be there.... if there's no door in front of you, /keypress use seems to con the mob instead.
DigitalMocking wrote: I still haven't had time to check it out, the /call GoHome would be nice, I really need to learn advpath.
I should mention that /call GoHome (this may not be the actual sub name, but will be something with Home in it... do a search in the source.... I don't have it with me at the moment since I'm at work - will update when I get home) will only work when you have a pathing file defined and your homepoint is at the start of the path (ie. autopull is on). I normally used the bot in roaming camps when not having him pull himself (ie. LDoNs or raids or DoNs), which is why he doesn't attempt to return to a homepoint after a kill.

I'll add another switch that specifies whether to return home after each kill when I get home from work tonight.
DigitalMocking wrote: These aren't criticisms at all, I love your bot, just trying to help if I can at all, its saved me a ton of coding.
No problem, I appreciate the feedback =P