Shaman macro

KingKiller

Lifetimer
Joined
May 1, 2008
Messages
38
Reaction score
0
Points
6
This is a shaman macro i wrote from scratch. Over the years i got some ideas from people and I am sorry to say I dont remember who it was. 98% of the code though in the main macro is stuff i came up with or something I reinvented the wheel with. Some of the includes arent my work but are well known like aapurchase.inc, spell_routines.inc, ninjadvloot.inc.

Features:
Debuff mobs in the radius set

Heals group like a bawse. Adding in healing people on ext target lists.

Buff from tells and everyone in BC

DoT

Nuke

Pet handling as well.

Cure from tells and everyone in BC. Will cast grp cure spells if people are in your grp and single target if they are out of grp.

Wild growth line on the MT.

Grp proc buff line on group.

Clicks 2.0 / 1.5 and spire if a named is in camp.

Plugins required:
Exchange
Netbots
EQBC
Cast
Stock plugins
I might be missing a couple. If I am forgetting any I will update this.

Code:
#include spell_routines.inc
#include wait4rez.inc
#include Events.inc
#include ninjadvloot.inc
#include AAPurchase.inc 
#include General2.inc
#include ItemBuff.inc
#include Cure.inc
 
#Event GainXP 		"You gain experience!!"
#Event GainXP 		"You gain raid experience!"
#Event ListMob 		"#*#[MQ2] list#*#"
#Event ImDead          	"You have been slain by#*#"
#Event ImDead          	"You died." 
#Event Summon		"#*#You have been summoned#*#"
#Event WornOff          "Your #1# spell has worn off of #2#."
#Event ImHit      	"#*#hits YOU for#*#"
#Event ImHit      	"#*#slashes YOU for#*#"
#Event ImHit      	"#*#crushes YOU for#*#"
#Event ImHit      	"#*#bashes YOU for#*#"
#Event ImHit      	"#*#kicks YOU for#*#"
#Event ImHit      	"#*#smashes YOU for#*#"
#event ImHit      	"#*#mauls YOU for#*#"
#Event ImHit      	"#*#gores YOU for#*#"
#Event ImHit      	"#*#pierces YOU for#*#"
#Event ImHit      	"#*#kicks YOU for#*#"
#Event ImHit      	"#*#bashes YOU for#*#"

#event AddFuck "[MQ2] Adding mob to dont fuck with list#*#"
 
#event Yak "#1# tells #2#, '#3#'"
#Event Talk "<#1#> #2#"
 
#turbo 40
 
Sub Main
 /call InitializeMac
 /call SetDebuffList
 /call SetDotList
 /call SetHealList
 /call SetBuffList
 /call SetPetList
 /call SetNuke
 /call InitCure
 /call GeneralDeclares2
 /call SetupAdvLootVars
 /call IntializeItemBuff

  /if (!${MaID}) {
    |/echo Need to set an MA in the INI or the MA isnt in zone!
  }

  /echo Shm mac started Version ${CurrentVersion}
  /echo There are ${BcClients2} toons in EQBC

  /if (${MA.NotEqual[Somebody]} && ${Spawn[pc ${MA}].ID}) {
    /varset MaID ${Spawn[pc ${MA}].ID}
    /echo MA is: ${MA}
  } else {
    /echo Need to set an MA in the INI or the MA isnt in zone!
    /echo Setting the MA makes the macro run better.  
    /echo Use /setma <name>
  }
  /echo Ignoring Mobs: ${ExcludeList}
  /echo Named Mobs: ${NameList}
 
 /doevents flush
 /call AAInit
 /varset QueueCount 0
 
 :Loop
    /if ( ${MacroState.NotEqual[MAINLOOP]} ) {
      /varset OldMacroState ${MacroState}
      /varset MacroState MAINLOOP
    }
    /doevents
    /if (${Me.Dead}) /call Wait4Rez
    |**/if (${Me.Invis}) /goto :Loop**|

    /call AssistMA
    /if (${DebuffList.Count[[]}) {
      /if (${DoDebuff}) /call Debuff
      /if (${Spawn[${MATarget}].PctHPs}<${WhenToBurn} && ${NameList.Find[${Spawn[${MATarget}].CleanName}]}) /call BurnName
      /if (${DoHeal}) /call CheckGrp
      /if (${DoCure}) /call CheckCureGrp
      /call Mana
    } else /if (${MobList.Count[[]} && !${DebuffList.Count[[]}) {
      |**|/echo MobList: ${MobList} |-| DebuffList: ${DebuffList} -- ${DebuffList.Count[[]}**|
      /if (${DoHeal}) /call CheckGrp
      /if (${Spawn[${MATarget}].PctHPs}<${WhenToBurn} && ${NameList.Find[${Spawn[${MATarget}].CleanName}]}) /call BurnName
      /if (${DoNuke}) /call Nuke
      /if (${DoDoT}) /call DoT
      /if (${DoPanther}) /call Panther
      /if (${DoHeal}) /call CheckGrp
      /if (${UsePet}) /call Pet
      /if (${DoCure}) /call CheckCureGrp
      /if (${DebuffedList.Count[[]}) /call CheckDebuffs
      /call Mana
    } else /if (!${MobList.Count[[]}) {
      /if (${DoHeal}) /call CheckGrp
      /if (${DoCure}) /call CheckCureGrp
      /call Mana
      /if (!${UnSlowedAdds} && !${Me.Casting.ID}) {
        /if ( ${UsePet} ) /call CheckPetBuff
        /if (${DoWild} && !${WildTimer}) /call CheckWild
        /call CheckSelfBuff
        /doevents
        /if (${QueueCount}) /call DoBuffEvents
      }
      /if (${Defined[MobList]} && ${MobList.Length}) /deletevar MobList
      /if (!${Defined[MobList]}) /declare MobList string outer
    }
    /if (${Cursor.ID}) /autoinventory
    /if (${DoLoot} && ${Me.CombatState.NotEqual[COMBAT]}) /call LootMobs
    /if (${Spawn[${MATarget}].Dead} || ${Spawn[${MATarget}].Type.Equal[NULL]}) /varset MATarget 0
    /if (${DoLeash} && !${DoLeashToon}) /call Leash
    /if (${DoLeashToon}) /call DoLeashPerson
    /if (!${CheckExpTimer}) /call AutoAdjustExp
    /call UpdateMobList
 /goto :Loop 
/return

Sub CheckTanks
  /varset OldGameState ${GameState}
  /varset GameState CHECKTANK
  /declare X int local
  
  /for X 1 to 10
    /if (${Spawn[${Me.XTarget[${X}].ID}].ID} && ${Spawn[${Me.XTarget[${X}].ID}].Type.Equal[PC]} && ${Spawn[${Me.XTarget[${X}].ID}].PctHPs}<=${${Spawn[id ${Me.XTarget[${X}].ID}].Class.ShortName}Point}) {
      /if (${Spawn[${Me.XTarget[${X}].ID}].PctHPs}<=${${Spawn[id ${Me.XTarget[${X}].ID}].Class.ShortName}Point} && ${Spawn[${Me.XTarget[${X}].ID}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Me.SpellReady[${HealSpell}]} && ${Spawn[${Me.XTarget[${X}].ID}].Type.Equal[PC]}) {
        /if (${Announce} || ${Debug}) /${ChatChannel} Healing XTarget ${Spawn[${Me.XTarget[${X}].ID}].CleanName}
        /call CastSpell "${HealSpell}" gem${HealGem} ${Spawn[${Me.XTarget[${X}].ID}].ID} CheckHP
      }
    }

  /next X

  /if (${Raid.Members} && !${AddTankTimer}) {
    /call AddTanks
    /call CreateTimer AddTankTimer
    /varset AddTankTimer 60s
  }

  /varset GameState ${OldGameState}  
  /varset OldGameState CHECKTANK
/return

Sub AddTanks
  /declare x int local
  /declare b int local 1
  /declare GroupList    string local
  /declare TempName    string local
  /declare Warriors    int local
  /declare SKS        int local
  /declare Paladins    int local
  /declare Rangers    int local
  /declare Zerkers    int local
  /declare Wizards    int local
  /declare Rogues        int local
  /declare Necros        int local
  /varset Warriors ${SpawnCount[pc warrior guild]}
  /varset SKS ${SpawnCount[pc shadowknight guild]}
  /varset Paladins ${SpawnCount[pc paladin guild]}
  /varset Rangers ${SpawnCount[pc Ranger guild]}
  /varset Zerkers ${SpawnCount[pc Berserker guild]}
  /varset Wizards ${SpawnCount[pc Wizard guild]}
  /varset Rogues ${SpawnCount[pc Rogue guild]}
  /varset Necros ${SpawnCount[pc Necromancer guild]}
  /for x 0 to ${Group}
    /varset TempName [${Group.Member[${x}].Name}]
    /varset GroupList ${GroupList}${TempName}
  /next x

  /if (${Rangers}) {
    /for x 1 to ${Rangers}
      /if (${b} >9) /return
      /if (${GroupList.Find[${NearestSpawn[${x}, pc Ranger guild].Name}]}) /goto :skip4
      /xtarget set ${b} ${NearestSpawn[${x}, pc Ranger guild]}
      /varcalc b ${b}+1
      :skip4
    /next x
  }
  /if (${Zerkers}) {
    /for x 1 to ${Zerkers}
      /if (${b} >9) /return
      /if (${GroupList.Find[${NearestSpawn[${x}, pc Berserker guild].Name}]}) /goto :skip5
      /xtarget set ${b} ${NearestSpawn[${x}, pc Berserker guild]}
      /varcalc b ${b}+1
      :skip5
    /next x
  }
  /if (${Wizards}) {
    /for x 1 to ${Wizards}
      /if (${b} >9) /return
      /if (${GroupList.Find[${NearestSpawn[${x}, pc Wizard guild].Name}]}) /goto :skip6
      /xtarget set ${b} ${NearestSpawn[${x}, pc Wizard guild]}
      /varcalc b ${b}+1
      :skip6
    /next x
  }
  /if (${Rogues}) {
    /for x 1 to ${Rogues}
      /if (${b} >9) /return
      /if (${GroupList.Find[${NearestSpawn[${x}, pc Rogue guild].Name}]}) /goto :skip7
      /xtarget set ${b} ${NearestSpawn[${x}, pc Rogue guild]}
      /varcalc b ${b}+1
      :skip7
    /next x
  }
  /if (${Necros}) {
    /for x 1 to ${Necros}
      /if (${b} >9) /return
      /if (${GroupList.Find[${NearestSpawn[${x}, pc Necromancer guild].Name}]}) /goto :skip8
      /xtarget set ${b} ${NearestSpawn[${x}, pc Necromancer guild]}
      /varcalc b ${b}+1
      :skip8
    /next x
  }
/return

Sub InitializeMac
  /declare CurrentVersion	string 	outer 4.0
  /declare Counter 		int 	local
  /declare MacroState		string	outer NULL
  /declare OldMacroState	string	outer NULL
  /declare iMobID 		int 	outer
  /declare iMobArray		int	outer 10
  /declare UnSlowedAdds		int	outer 0
  /declare DebuffList		string 	outer
  /declare MobList		string	outer
  /declare DebuffedList		string	outer
  /declare iNumOfDots		int	outer
  /declare Doting		int	outer
  /declare MaID			int	outer
  /declare MATarget		int	outer 0
  /declare MobAgro		int	outer
  /declare Interrupted		int	outer
  /declare AddOneID		int	outer 0
  /declare BcClients 		string 	outer
  /declare BcClients2 		int 	outer
  /declare X 			int 	local
  /declare BuffTimer 		timer 	outer 0s
  /declare INIFile 		string 	outer ${MacroQuest.Server}_Shm_${Me.Name}
  
  /varset BcClients ${NetBots.Client}
  /varset BcClients2 ${Math.Calc[${BcClients.Count[ ]}+1]}

  /call DeclareIniVar Version		string	SETTINGS 4.0
  /call DeclareIniVar RaidSet		int	SETTINGS 0 /raidset
  /call DeclareIniVar CanniSpell	string 	SETTINGS "NULL"
  /call DeclareIniVar CanniGem 		int 	SETTINGS 3

  /if (${RaidSet}) {
    /call IntializeRaidSettings
  } else {
    /call IntializeGrpSettings
  }
/return

Sub IntializeRaidSettings
  |/echo Intializing Raid Settings.
  /call DeclareIniVar MA 		string 	RAID Somebody
  /call DeclareIniVar DoDoT 		int 	RAID 0
  /call DeclareIniVar DoWild 		int 	RAID 1
  /call DeclareIniVar DoHeal 		int 	RAID 1
  /call DeclareIniVar DoDebuff 		int 	RAID 1
  /call DeclareIniVar DoNuke 		int 	RAID 1
  /call DeclareIniVar DoCure 		int 	RAID 0
  /call DeclareIniVar DoPanther 	int 	RAID 1
  /call DeclareIniVar MobRadius 	int 	RAID 150
  /call DeclareIniVar MasterList	string 	RAID NULL
  /call DeclareIniVar DoLoot 		int 	RAID 0
  /call DeclareIniVar WhenToBurn 	int 	RAID 99
/return

Sub IntializeGrpSettings
  |/echo Intializing Group Settings.
  /call DeclareIniVar MA 		string 	SETTINGS Somebody 	/setma
  /call DeclareIniVar DoDoT 		int 	SETTINGS 0 		/dodot
  /call DeclareIniVar DoWild 		int 	SETTINGS 1 		/dowild
  /call DeclareIniVar DoHeal 		int 	SETTINGS 1 		/doheal
  /call DeclareIniVar DoDebuff 		int 	SETTINGS 1 		/dodebuff
  /call DeclareIniVar DoNuke 		int 	SETTINGS 1 		/donuke
  /call DeclareIniVar DoCure 		int 	SETTINGS 0 		/docure
  /call DeclareIniVar DoPanther 	int 	SETTINGS 1		/dopanther
  /call DeclareIniVar MobRadius 	int 	SETTINGS 150		/mobrad
  /call DeclareIniVar MasterList	string 	SETTINGS NULL
  /call DeclareIniVar DoLoot 		int 	SETTINGS 0 		/doloot
  /call DeclareIniVar WhenToBurn 	int 	SETTINGS 99 		/burn
  /call DeclareIniVar DoShrink 		int 	SETTINGS 0 		/doshrink
/return

Sub CheckTanks
  /varset OldMacroState ${GameState}
  /varset MacroState CHECKTANK
  /declare X int local
  
  /for X 1 to 7
    /if (${Spawn[${Me.XTarget[${X}].ID}].ID} && ${Spawn[${Me.XTarget[${X}].ID}].Type.Equal[PC]}) {
      /if (${Spawn[${Me.XTarget[${X}].ID}].PctHPs}<=${${Target.Class.ShortName}Point} && ${Spawn[${Me.XTarget[${X}].ID}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Me.SpellReady[${HealSpell}]} && ${Spawn[${Me.XTarget[${X}].ID}].Type.Equal[PC]}) {
        /echo Healing XTarget ${Spawn[${Me.XTarget[${X}].ID}].CleanName}
        /call CastSpell "${HealSpell}" gem${HealGem} ${Spawn[${Me.XTarget[${X}].ID}].ID} CheckHP
      }
    }

  /next X
  /varset MacroState ${OldGameState}  
  /varset OldMacroState CHECKTANK
/return

Sub BurnName
  /echo Burnin NAMED!!
  /if (!${FindItem[Blessed spiritstaff of the heyokah].Timer}) {
    /echo Clicking 2.0!!
    /call CastItemClickyb "Blessed spiritstaff of the heyokah"
  }
  /if (${Me.AltAbilityReady[Fundament: Third Spire of Ancestors]}) {
    /echo Clicking Third Spire!!
    /call Cast "Fundament: Third Spire of Ancestors" alt 0
  }
  /if (${DoPanther}) /call Panther
/return

Sub MoveToTornado
  /moveto loc ${Spawn[Tempest of Vyskudra].Y} ${Spawn[Tempest of Vyskudra].X}
  /delay 2s ${Spawn[Tempest of Vyskudra].Distance}<30
/return

Sub AssistMA
  /varset OldMacroState ${MacroState}
  /varset MacroState ASSISTMA
  
  /if (${MaID}) {
    /if (${Spawn[${MA}].NearestSpawn[npc targetable radius ${MobRadius}].ID} && !${MATarget} && !${Me.Casting.ID} && ${Spawn[${MA}].LineOfSight} && ${Spawn[${MaID}].ID} && ${Spawn[${MaID}].Distance}<100 && ${Spawn[${MaID}].LineOfSight}) {
      /if (${NetBots[${MA}].ID}) {
        /if (${Spawn[${NetBots[${MA}].TargetID}].LineOfSight} && ${Spawn[${NetBots[${MA}].TargetID}].Type.Equal[NPC]} && !${ExcludeList.Find[${Spawn[id ${NetBots[${MA}].TargetID}].CleanName}]}) {
          /varset MATarget ${NetBots[${MA}].TargetID}
          /call AddToList MobList ${NetBots[${MA}].TargetID}
          /if (${Spawn[${MATarget}].PctHPs}<${WhenToBurn} && ${NameList.Find[${Spawn[${MATarget}].CleanName}]}) /call BurnName
          /if (${DoDebuff}) {
            /call AddToList DebuffList ${NetBots[${MA}].TargetID}
            /if (${DoDebuff}) /call Debuff
          }
        }
      } else {
        /assist ${Spawn[${MaID}].CleanName}
        /delay 7
        /if (${Target.LineOfSight} && ${Target.ID} && ${Target.Type.Equal[NPC]} && !${ExcludeList.Find[${Spawn[id ${Target.ID}].CleanName}]}) {
          /call AddToList MobList ${Target.ID} 
          /if (${Spawn[${MATarget}].PctHPs}<${WhenToBurn} && ${NameList.Find[${Spawn[${MATarget}].CleanName}]}) /call BurnName
          /if (${DoDebuff}) {
            /call AddToList DebuffList ${Target.ID}
            /if (${DoDebuff}) /call Debuff
          }
        }
      }
    }
  }
  /if (${DoDebuff}) /call GetMobs
  /varset MacroState ${OldMacroState}
  /varset OldMacroState ASSISTMA
/return

Sub GetMobs
  /varset OldMacroState ${MacroState}
  /varset MacroState GETMOBS
  /declare lMobID 	string 	local 
  /declare Mobs   	int   	local 1
  /declare Temp		int	local

  :ParseNextMob
   /if (${NearestSpawn[${Mobs},pet targetable range 45 110 radius ${MobRadius} zradius 50].Master.Type.Equal[NPC]}) {
     /varset lMobID ${NearestSpawn[${Mobs}, targetable pet range 45 110 radius ${MobRadius} zradius 50].ID}
     /if (!${MobList.Find[${lMobID}]} && ${Spawn[id ${lMobID}].Distance}<=${MobRadius} && ${Spawn[id ${lMobID}].LineOfSight} && !${ExcludeList.Find[${Spawn[id ${lMobID}].CleanName}]} && ${Spawn[${lMobID}].CleanName.Length}>1 && ${Spawn[${lMobID}].Type.NotEqual[Untargetable]}) {
       |/echo ADDIN PET TO LIST!
       /call AddToList MobList ${lMobID}
       /if (!${DebuffList.Find[${lMobID}]} && ${DoDebuff}) {
         /call AddToList DebuffList ${lMobID}
       }
     }
     /varcalc Mobs ${Mobs}+1
   }
   /if (${NearestSpawn[${Mobs},npc targetable range 45 110 radius ${MobRadius} zradius 50].ID}) { 
     /varset lMobID ${NearestSpawn[${Mobs},npc targetable range 45 110 radius ${MobRadius} zradius 50].ID}
     /if (!${MobList.Find[${lMobID}]} && ${Spawn[id ${lMobID}].Distance}<=${MobRadius} && ${Spawn[id ${lMobID}].LineOfSight} && !${ExcludeList.Find[${Spawn[id ${lMobID}].CleanName}]} && ${Spawn[${lMobID}].CleanName.Length}>1 && ${Spawn[${lMobID}].Type.NotEqual[Untargetable]} && ${Spawn[${lMobID}].State.NotEqual[FEIGN]}) {
       /call AddToList MobList ${lMobID}
       /if (${Spawn[${MATarget}].PctHPs}<${WhenToBurn} && ${NameList.Find[${Spawn[${MATarget}].CleanName}]}) /call BurnName
       /if (!${DebuffList.Find[${lMobID}]} && ${DoDebuff}) {
         /call AddToList DebuffList ${lMobID}
       }
     }
     /varcalc Mobs ${Mobs}+1
   }
   
  /if (${NearestSpawn[${Mobs},npc targetable range 45 110 radius ${MobRadius} zradius 50].ID} || ${NearestSpawn[${Mobs},pet range 45 110 radius ${MobRadius} zradius 50].Master.Type.Equal[NPC]}) /goto :ParseNextMob
  
  /varset MacroState ${OldMacroState}
  /varset OldMacroState GETMOBS
/return

Sub AddToList(string listName,string tempID)
  /if (!${${listName}.Find[${tempID}]}) {
    /varset ${listName} ${${listName}}[${tempID}]
    /if (${listName.Equal[DebuffList]}) {
      /if (!${Defined[SlowTimer${tempID}]} && ${DoDebuff}) /declare SlowTimer${tempID} timer outer 0
      /if (!${Defined[MaloTimer${tempID}]} && ${DoDebuff}) /declare MaloTimer${tempID} timer outer 0
      /if (!${AddOneID}) /varset AddOneID ${Int[${tempID}]}
    }
    /return 1
  }
/return 0

Sub DeleteFromList(string listName,string tempID)
  /declare TempID string local [${tempID}]
  /declare a int local
  /declare b int local
  /declare strLeft string local
  /declare strRight string local
  /varcalc a ${${listName}.Find[${TempID}]}-1
  /varcalc b ${${listName}.Length}-${TempID.Length}-${a}
  /if (${a}>0) /varset strLeft ${${listName}.Left[${a}]}
  /if (${b}>0) /varset strRight ${${listName}.Right[${b}]}
  /varset ${listName} ${strLeft}${strRight}
/return

Sub UpdateMobList
  /declare a int local
  /declare i int local
  /declare MobListID string local

  /if (${MobList.Find[[]}) {
    /if (${MobList.Find[[]}>1) /varset MobList ${MobList.Right[-${Math.Calc[${MobList.Find[[]}-1]}]}
    /for i ${MobList.Count[[]} downto 1
      /varset MobListID ${MobList.Arg[${i},[].Left[-1]}
      /if (${Spawn[${MobListID}].Dead} || !${Spawn[${MobListID}].LineOfSight} || ${Spawn[${MobListID}].Distance}>${MobRadius} || !${Spawn[${MobListID}].ID}) {
        /if (${Defined[SlowTimer${MobListID}]}) /deletevar SlowTimer${MobListID}
        /if (${Defined[MaloTimer${MobListID}]}) /deletevar MaloTimer${MobListID}
        /if (${Int[${MobListID}]}==${MATarget}) {
          /varset MATarget 0
          /for a 1 to ${NumOfDots}
            /varset DotTimer${a} 0
          /next a
        }
        /if (${MobList.Find[${MobListID}]}) /call DeleteFromList MobList ${MobListID}
        /if (${DebuffList.Find[${MobListID}]}) /call DeleteFromList DebuffList ${mobListID}
        /if (${DebuffedList.Find[${MobListID}]}) /call DeleteFromList DebuffedList ${mobListID}
      }
    /next i
  }
/return

Sub CheckWild
  /if ((!${NetBots[${MA}].Buff.Find[${Spell[${WildSpell}].ID}]} || ${NetBots[${MA}].Duration[${Math.Calc[${Select[${Spell[${WildSpell}].ID},${NetBots[${MA}].Buff}]}-1]}]}<26) && ${Me.SpellReady[${WildSpell}]} && ${Spawn[${MA}].ID} && ${Spawn[${MA}].Distance}<=${Spell[${WildSpell}].MyRange}) {
    /target pc ${MA}
    /delay 5s ${Target.ID}==${Spawn[$MA].ID}
    /if (${Target.ID}!=${Spawn[${MA}].ID}) /return
    /call cast "${WildSpell}" gem4 10s
    /if (${castReturn.Equal[CAST_SUCCESS]}) /varset WildTimer 120s
  } else /if (!${Me.Gem[${WildSpell}]} && ${Spawn[${MA}].ID}) {
    /memspell 4 ${WildSpell}
    /delay 10s ${Me.Gem[${WildSpell}]}
  }
/return

Sub AddToQueue(int Buffee,int BuffNumber)
/declare a           int local
/declare Compare     int local
/if (${QueueCount}<25 && !${Spawn[${Buffee}].Dead} && ${Spawn[${Buffee}].ID}) {
   /varset Compare 0
   /for a 1 to 25
      /if ((${Buffee}==${DoBuffQueue[${a},1]} || (${Select[${Spell[${DoBuffID[${DoBuffQueue[${a},2]}]}].TargetType},"Group v2","AE PC v2","Group v1","AE PC v1"]} && (${Group.Member[${Spawn[${Buffee}].CleanName}]} || ${Group.Member[${Spawn[${Buffee}].Master.CleanName}]}) && ${Group.Member[${Spawn[${DoBuffQueue[${a},1]}].CleanName}]})) && ${BuffNumber}==${DoBuffQueue[${a},2]}) /varset Compare 1
   /next a

   /if (!${Compare}) {
      /for a 1 to 25
         /if (!${DoBuffQueue[${a},1]}) {
            /varset DoBuffQueue[${a},1] ${Buffee}
            /varset DoBuffQueue[${a},2] ${BuffNumber}
            /varcalc QueueCount ${QueueCount}+1
            /return
         }
      /next a
   }
}
/return

Sub RemoveFromQueue(int Buffee,int BuffNumber)
/doevents IRC
/doevents Chat
/declare a int local
/for a 1 to 25
   /if (((${Spawn[${DoBuffQueue[${a},1]}].State.Equal["DEAD"]} || !${Spawn[${DoBuffQueue[${a},1]}].ID}) || ((${DoBuffQueue[${a},1]}==${Buffee} || (!${Buffee} && (${Group.Member[${Spawn[${DoBuffQueue[${a},1]}].CleanName}]} || ${Group.Member[${Spawn[${DoBuffQueue[${a},1]}].Master.CleanName}]}))) && (${DoBuffID[${DoBuffQueue[${a},2]}]}==${BuffNumber} || ${DoBuffQueue[${a},2]}==${BuffNumber}))) && ${DoBuffQueue[${a},1]}) {
      /varset DoBuffQueue[${a},1] 0
      /varset DoBuffQueue[${a},2] 0
      /varcalc QueueCount ${QueueCount}-1
   }
/next a
/return

Sub CheckDoBuffs(Sender,ChatText)
/declare a        int local
/declare i        int local

/for i 1 to ${DoBuffTotal}
   /for a 1 to ${DoBuffAliases${i}.Count[|]}
      /if (${ChatText.Find["${DoBuffAliases${i}.Arg[${a},|]}"]}) {
         /if (${ChatText.Find["pet"]} || ${ChatText.Find[${Spawn[pc ${Sender}].Pet.CleanName}]} || ${Spawn[pet ${Sender}].ID}) {
           /echo Pet ${ChatText} -- ${DoBuffAliases${i}.Arg[${a},|]} - ${ChatText.Find["${DoBuffAliases${i}.Arg[${a},|]}"]}
           /call AddToQueue ${Spawn[pc ${Sender}].Pet.ID} ${i}
         } else {
           /echo Person ${ChatText} -- ${DoBuffAliases${i}.Arg[${a},|]} - ${ChatText.Find["${DoBuffAliases${i}.Arg[${a},|]}"]}
           /call AddToQueue ${Spawn[pc ${Sender}].ID} ${i}
         }
      }
   /next a
/next i

/return

Sub DoBuffEvents
  /declare a       int local
  /declare TempVar int local ${Math.Calc[${DoBuffTotal}+1]}
  /declare TempGuy int local 0

  /varset OldMacroState ${MacroState}
  /varset MacroState DoBuffEvents
  
  /for a 1 to 25
    /if (${DoBuffQueue[${a},2]}<${TempVar} && ${Spawn[${DoBuffQueue[${a},1]}].ID} && !${Spawn[${DoBuffQueue[${a},1]}].Dead} && (${Spawn[${DoBuffQueue[${a},1]}].Distance}<${Spell[${DoBuffID[${DoBuffQueue[${a},2]}]}].MyRange} || ${Spawn[${DoBuffQueue[${a},1]}].Distance}<${Spell[${DoBuffID[${DoBuffQueue[${a},2]}]}].AERange})) {
      /varset TempGuy ${DoBuffQueue[${a},1]}
      /varset TempVar ${DoBuffQueue[${a},2]}
    }
  /next a
  /if (${TempGuy}) /if (((${Me.SpellReady[${DoBuffCast${TempVar}}]} || !${Me.Gem[${DoBuffCast${TempVar}}]} || ${Spell[${DoBuffID[${TempVar}]}].RecastTime}<30) && ${Me.CurrentMana}>${Spell[${DoBuffID[${TempVar}]}].Mana} && ${Me.PctMana}>=${DoBuffMana${TempVar}}) || (${DoBuffGem${TempVar}.Equal[item]} && ${FindItem[${DoBuff${TempVar}}].TimerReady}<30) || (${DoBuffGem${TempVar}.Equal[alt]} && ${Me.AltAbilityReady[${DoBuff${TempVar}}]}<30)) {
    /call CastSpell "${DoBuffCast${TempVar}}" gem${DoBuffGem${TempVar}} ${TempGuy}
    /if (${castReturn.Equal[CAST_SUCCESS]} || ${spellNotHold}) /call RemoveFromQueue ${TempGuy} ${TempVar}
    /doevents flush
  }

  /varset MacroState ${OldMacroState}
  /varset OldMacroState DoBuffEvents
/return

Sub Mana
  /if (${Me.PctMana}<=95 && ${Me.PctHPs}>=60 && ${Me.SpellReady["${CanniSpell}"]}) /call CastSpell "${CanniSpell}" ${CanniGem} 0 CheckALL
  /if (${Me.PctMana}<=80 && ${Me.PctHPs}>=85 && ${Me.AltAbilityReady[Cannibalization]}) {
    /delay 1s
    /alt activate 47
    /delay 3s
  }
  /if (!${FindItem[rod of prime transvergence].Timer} && ${Me.PctMana}<=80 && ${Me.PctHPs}>=54 ) /call cast "rod of prime transvergence" Item 0s
  /if (${Me.PctHPs}<85 && !${Me.Song[${HotSpell}].ID} && ${Me.SpellReady[${HotSpell}]}) {
    /call CastSpell "${HotSpell}" gem${HoTGem} ${Me.ID} CheckALL
  }
  /if (!${Me.Mount.ID}) /call CheckSit
/return

Sub CheckDTGargoyle 
  /declare GargRace string local Gargoyle
  /declare WolfRace string local Werewolf
  /declare b int local
  
  /for b 0 to ${Group.Members}
   :CureZiDT
    /if (${Group.Member[${b}].Race.Name.Equal[${GargRace}]}) {
      /target id ${Group.Member[${b}].ID}
      /delay 2s ${Target.ID}==${Group.Member[${b}].ID}
      /bc INC RGC on ==[ ${Target.CleanName} ]==
      /call Cast "Remove Greater Curse" gem6 5s CheckCured
      /if (${Macro.Return.NotEqual[CAST_SUCCESS]}) /goto :CureZiDT
    }
    |**/if (${Group.Member[${b}].Race.Name.Equal[${WolfRace}]}) {
      /target id ${Group.Member[${b}].ID}
      /delay 2s ${Target.ID}==${Group.Member[${b}].ID}
      /bc INC Cure Corruption Rk. III on ==[ ${Target.CleanName} ]==
      /call Cast "Cure Corruption Rk. III" gem8 5s
      /if (${Macro.Return.NotEqual[CAST_SUCCESS]}) /goto :CureZiDT
    }**|
  /next b
  |** 
  :Startagain 
  /if (${SpawnCount[pc race ${GargRace}]} && ${NearestSpawn[pc race ${GargRace}].Distance}<${Spell[Remove Greater Curse].MyCastRange}) { 
    /target id ${Spawn[pc race ${GargRace}].ID} 
    /delay 1s ${Target.Race.Name.Equal[${GargRace}]} 
    /if (${Target.Race.Name.Equal[${GargRace}]}) {
      /bc INC RGC on ==[ ${Target.CleanName} ]==
      /call Cast "Remove Greater Curse" gem6 5s CheckCured
    }
  }
  /if (${SpawnCount[pc race ${WolfRace}]} && ${NearestSpawn[pc race ${WolfRace}].Distance}<${Spell[Cure Corruption Rk. III].MyCastRange}) { 
    /target id ${Spawn[pc race ${WolfRace}].ID} 
    /delay 1s ${Target.Race.Name.Equal[${WolfRace}]} 
    /if (${Target.Race.Name.Equal[${GargRace}]}) {
      /bc INC Cure Corruption Rk. III on ==[ ${Target.CleanName} ]==
      /call Cast "Cure Corruption Rk. III" gem8 5s
    }
    /goto :Startagain 
  }**|
  /doevents 
/return 

Sub CheckCured 
  /declare GargRace string local Gargoyle 
  /if (${Target.Race.Name.NotEqual[${GargRace}]}) /call Interrupt 
/return 

Sub Panther
  /if (!${Me.Buff[${PantherSpell}].ID}) {
    /call CastSpell "${PantherSpell}" gem${PantherSpellGem} ${Me.ID}
    /return
  }
/return

Sub CheckSit
  /varset OldMacroState ${MacroState}
  /varset MacroState CHECKSIT

  /doevents Summon
  /doevents ImHit
  /if (${Me.CombatState.NotEqual[COMBAT]} && ${Me.CombatState.Equal[ACTIVE]} && ${Me.Standing} && ${Me.PctMana}<98 && !${Me.Casting.ID}) {
    /if (${MobAgro}) /varset MobAgro 0
    /sit
  } else /if (!${MobAgro} && !${Me.Sitting} && !${Me.Mount.ID} && ${Me.PctMana}<=85 && !${Me.Sitting} && !${Me.Casting.ID} ) {
    /sit
  } else /if (${MobAgro} && ${Me.Sitting} && !${Me.Mount.ID}) {
    /stand
  }
  
  /varset MacroState ${OldMacroState}  
  /varset OldMacroState CHECKSIT
/return

Sub CheckList
  /return
  /declare a int local
  /declare b int local

 /for a 1 to ${iMobArray}
   /if (${iDebuffList[${a}}) {
     |/echo --------------------------
     |/echo Mob${a} - ${Spawn[id ${iDebuffList[${a}]}].CleanName}
     |/echo --------------------------
   }
 /next a
/return

Sub SetDebuffList
   /call DeclareIniVar MaloSpell string DEBUFFS "Malis Rk. II"
   /call DeclareIniVar MaloType string DEBUFFS "gem8"
   /call DeclareIniVar MaloList string DEBUFFS "NULL"
   /call DeclareIniVar SlowSpell1 string DEBUFFS "Turgur's Swarm"
   /call DeclareIniVar SlowType1 string DEBUFFS "alt"
   /call DeclareIniVar SlowSpell2 string DEBUFFS "Time's Antithesis"
   /call DeclareIniVar SlowType2 string DEBUFFS "item"
   /call DeclareIniVar AESlowSpell string DEBUFFS "Tortugone's Drowse"
   /call DeclareIniVar AESlowType string DEBUFFS "gem4"
   /call DeclareIniVar SlowList string DEBUFFS "NULL"
/return

Sub Debuff
  /varset OldMacroState ${MacroState}
  /varset MacroState DEBUFF

  /if (!${DoDebuff}) /goto :EndDebuffMob
  /declare a		int	local 1
  /declare i		int	local
  /declare Counter	int	local ${DebuffList.Count[[]}
  /declare IsSlow	int	local
  /declare IsMalo	int	local
  /declare tempID 	string 	local

  :DebuffNextMob
   /if (${DebuffList.Left[1].NotEqual[[]}) {
     /varset DebuffList [2${DebuffList}
     /call DeleteFromList DebuffList ${DebuffList.Arg[1,[].Left[-1]}
   }

   /if ((${Me.SpellReady[${AESlowSpell}]} || ${AESlowType.Equal[alt]} && ${Me.AltAbilityReady[${AESlowSpell}]}) && ${DebuffList.Count[[]}>=3) {
     /call CastSpell "${AESlowSpell}" ${AESlowType} ${DebuffList.Arg[1,[].Left[-1]} CheckALL
   }
    /varset tempID ${DebuffList.Arg[1,[].Left[-1]}
    /if (${Spawn[${tempID}].ID} && ${tempID} && !${Spawn[${tempID}].Dead}) {
      /varset IsMalo 0
      /varset IsSlow 0
      :RecastDebuff
       /if (${Spawn[id ${tempID}].LineOfSight} && ${Spawn[${tempID}].Distance}<=${MobRadius} && !${Spawn[${tempID}].Dead} && (!${MaloTimer${tempID}} || !${SlowTimer${tempID}})) {
         /target id ${tempID}
         /delay 2s ${Target.ID}==${tempID}
         /if (${Me.LAInspectBuffs} || ${Group.GroupSize}>=3) {
           /delay 5 ${Target.BuffCount}
           /if (!${Target.BuffCount}) {
             /if (!${MaloTimer${tempID}}) /call Malo ${tempID}
             /if (!${SlowTimer${tempID}}) /call Slow ${tempID}
             /goto :EndDebuffMob
           }
           /for i 1 to ${Target.BuffCount}
              /if (${MaloList.Find[${Target.Buff[${i}]}]} && !${MaloTimer${tempID}}) {
                /varcalc MaloTimer${tempID} ${Target.BuffDuration[${i}]}*6-15
               /varset IsMalo 1
               /if (${IsSlow}) /goto :EndDebuffMob
             } else /if (${SlowList.Find[${Target.Buff[${i}]}]} && !${SlowTimer${tempID}}) {
               /varcalc SlowTimer${tempID} ${Target.BuffDuration[${i}]}*6-15
               /if (${UnSlowedAdds}) /varcalc UnSlowedAdds ${UnSlowedAdds}-1
               /varset IsSlow 1
               /if (${IsMalo}) /goto :EndDebuffMob
             }
           /next i
           /if (!${MaloTimer${tempID}}) /call Malo ${tempID}
           /if (!${SlowTimer${tempID}}) /call Slow ${tempID}
         } else /if (${Target.ID}!=${tempID} || ${Target.Type.Equal[PC]}) {
           /goto :RecastDebuff
         } else {
           /if (!${MaloTimer${tempID}}) /call Malo ${tempID}
           /if (!${SlowTimer${tempID}}) /call Slow ${tempID}
         }
       } else /if (${Spawn[id ${tempID}].Dead}) {
         /call UpdateMobList
       }
    } else {
      /call DeleteFromList DebuffList ${tempID}
    }
   :EndDebuffMob

   /if (${Spawn[${tempID}].ID}) {
     /if (${MaloTimer${tempID}} && ${SlowTimer${tempID}}) {
       /call DeleteFromList DebuffList ${tempID}
       /call AddToList DebuffedList ${tempID}
     } else /if (${Spawn[${tempID}].ID} && ${tempID}) {
       /goto :DebuffNextMob
     }
   }

  /varset AddOneID 0
  /varset UnSlowedAdds 0
  /varset MacroState ${OldMacroState}
  /varset OldMacroState DEBUFF
/return

Sub CheckDebuffs
  /declare a 		int local
  /declare tempID 	int local

  /for a 1 to ${DebuffedList.Count[[]}
    /varset tempID ${DebuffedList.Arg[${a},[].Left[-1]}
    :CheckDebuffs
     /if (!${MaloTimer${tempID}} && !${Spawn[${tempID}].Dead} && ${Spawn[${tempID}].ID} && ${tempID} && ${DoDebuff}) /call Malo ${tempID}
     /if (!${SlowTimer${tempID}} && !${Spawn[${tempID}].Dead} && ${Spawn[${tempID}].ID} && ${tempID} && ${DoDebuff}) /call Slow ${tempID}
     /if ((!${MaloTimer${tempID}} || !${SlowTimer${tempID}}) && !${Spawn[${tempID}].Dead} && ${Spawn[${tempID}].ID} && ${tempID}) /goto :CheckDebuffs
  /next a
/return

Sub Malo(int MaloID)
  /declare tempID int local ${MaloID}
  /declare MaloResistCounter int local 0

  :RecastMalo
  /if (${Spawn[${tempID}].Type.NotEqual[PC]} && ${Spawn[${tempID}].Distance}<=${Spell[${MaloSpell}].MyRange} && ${Spawn[${tempID}].LineOfSight}) {
    |/echo Casting Malo on ${Spawn[${tempID}].CleanName}
    /call CastSpell "${MaloSpell}" ${MaloType} ${tempID} CheckALL
    /if (${castReturn.Equal[CAST_SUCCESS]}) {
      /if (${Defined[MaloTimer${tempID}]}) {
        /varcalc MaloTimer${tempID} ${Spell[${MaloSpell}].Duration.TotalSeconds}*.975*10
      } else {
        /declare MaloTimer${tempID} timer outer ${Math.Calc[${Spell[${MaloSpell}].Duration.TotalSeconds}*.975*10]}
      }
    } else /if (${castReturn.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
      /if (${Defined[MaloTimer${tempID}]}) {
        /varset MaloTimer${tempID} 1000s
      } else {
        /declare MaloTimer${tempID} timer outer 1000s
      }
    } else /if (${castReturn.Equal[CAST_RESISTED]}) {
      /varcalc MaloResistCounter ${MaloResistCounter}+1
      /if (${MaloResistCounter}>=2) {
        /if (${Defined[MaloTimer${tempID}]}) {
	  /varset MaloTimer${tempID} 1000s
	} else {
	  /declare MaloTimer${tempID} timer outer 1000s
        }
        /return
      } else {
        /goto :RecastMalo
      }
    } else /if (${Interrupted} || ${castReturn.Equal[CAST_INTERRUPTED]}) {
      /varset Interrupted 0
      /varcalc MaloResistCounter ${MaloResistCounter}-1
      /goto :RecastMalo
    }
  } else {
    /if (${Defined[MaloTimer${tempID}]}) {
      /varset MaloTimer${tempID} 1000s
    } else {
      /declare MaloTimer${tempID} timer outer 1000s
    }
  }
/return

Sub Slow(int SlowID)
  /declare tempID int local ${SlowID}
  /declare SlowResistCounter int local 0
  :RecastSlow
  /if (${Spawn[${tempID}].Type.NotEqual[PC]} && ${Spawn[${tempID}].Distance}<=${Spell[${SlowSpell1}].MyRange} || (${Select[${SlowType1},item,alt]} && ${Spawn[${tempID}].Distance}<=200)) {
    /if ((${SlowType1.Equal[alt]} && ${Me.AltAbilityReady[${SlowSpell1}]}) || (${SlowType1.Find[gem]} && ${Me.SpellReady[${SlowSpell1}]})) {
      |/echo Casing Slow1 on ${Spawn[${tempID}].CleanName}
      /call CastSpell "${SlowSpell1}" ${SlowType1} ${tempID} CheckALL
    } else {
      /goto :RecastSlow
    }
    /if (${castReturn.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
      /varset SlowTimer${tempID} 1000s
    } else /if (${castReturn.Equal[CAST_SUCCESS]}) {
      /if (${Defined[SlowTimer${tempID}]}) {
        /varcalc SlowTimer${tempID} ${Spell[${SlowSpell1}].Duration.TotalSeconds}*.975*10
      } else {
        /declare SlowTimer${tempID} timer outer ${Math.Calc[${Spell[${SlowSpell1}].Duration.TotalSeconds}*.975*10]}
      }
      /if (${UnSlowedAdds}) /varcalc UnSlowedAdds ${UnSlowedAdds}-1
      ||/echo ${Spawn[${tempID}].CleanName} has been slowed.
    } else /if (${castReturn.Equal[CAST_RESISTED]}) {
      /if (${SlowResistCounter}<5 && ${Target.LineOfSight}) {
        ||/echo Casing Slow2 on ${Spawn[${tempID}].CleanName}
        /call Cast "${SlowSpell2}" ${SlowType2} ${tempID} CheckALL
        /if (${castReturn.Equal[CAST_SUCCESS]}) {
          /if (${Defined[SlowTimer${tempID}]}) {
           /varcalc SlowTimer${tempID} ${Spell[${SlowSpell1}].Duration.TotalSeconds}*.975*10
          } else {
            /declare SlowTimer${tempID} timer outer ${Math.Calc[${Spell[${SlowSpell1}].Duration.TotalSeconds}*.975*10]}
          }
          /if (${UnSlowedAdds}) /varcalc UnSlowedAdds ${UnSlowedAdds}-1
          /return
        }
      }
      /varcalc SlowResistCounter ${SlowResistCounter}+1
      /if (${SlowResistCounter}>=4) {
        /if (${Defined[SlowTimer${tempID}]}) {
          /varset SlowTimer${tempID} 10000s
        } else {
          /declare SlowTimer${tempID} timer outer 1000s
        }
        /return
      } else {
        /goto :RecastSlow
      }
    } else /if (${Select[${castReturn},CAST_OUTOFMANA,CAST_OUTOFRANGE,CAST_CANNOTSEE]}) {
      /varset SlowTimer${tempID} 50
    } else /if (${Interrupted} || ${castReturn.Equal[CAST_INTERRUPTED]}) {
      /varset Interrupted 0
      /varcalc MaloResistCounter ${MaloResistCounter}-1
      /goto :RecastSlow
    }
  } else {
    /if (${Defined[SlowTimer${tempID}]}) {
      /varset SlowTimer${tempID} 10000s
    } else {
      /declare SlowTimer${tempID} timer outer 1000s
    }
  }
/return

Sub SetDotList
  /declare a int local
  /declare i int local
  
  /call DeclareIniVar NumOfDots int DOTS 4 /numofdots DOTS
  /call DeclareIniVar DotMinManaPct int DOTS 35
  
  /for i 1 to ${NumOfDots}
    /call DeclareIniVar Dot${i} string DOTS "DotName"
    /call DeclareIniVar DotType${i} string DOTS  "Type"
    /declare DotTimer${Spell[${Dot${i}}].ID} timer outer 0
  /next i

  /for a 1 to ${NumOfDots}
    /declare DotTimer${a} timer outer 0
  /next a
/return

Sub DoT
  /varset OldMacroState ${MacroState}
  /varset MacroState DOT
  /declare TimesCast	int	local 0
  /declare a		int	local

  /if (!${MATarget} || ${Spawn[${MATarget}].Dead}) /call GetMaTarget
  /if (${Spawn[${MATarget}].Type.NotEqual[NPC]} || ${Spawn[${MATarget}].Dead} || !${MATarget}) {
    /varset MATarget 0
    /if (${DoDebuff}) /call GetMobs
    /goto :GetOutSubDot
  }
  /if (!${MobList.Find[${MATarget}]} || !${DebuffList.Find[${MATarget}]}) /call GetMobs
  /if (!${MaloTimer${MATarget}} && ${DoDebuff}) /call Malo ${MATarget}
  /if (!${SlowTimer${MATarget}} && ${DoDebuff}) /call Slow ${MATarget}
  /varset Doting 1
  /for a 1 to ${NumOfDots}
    /varset TimesCast 0
    :RecastDot
     /if (!${Me.SpellReady[${Me.Gem[1]}]} && !${Me.SpellReady[${Me.Gem[2]}]} && !${Me.SpellReady[${Me.Gem[3]}]} && !${Me.SpellReady[${Me.Gem[4]}]}) {
       /call CheckGrp
       /delay 3s ${Me.SpellReady[${Dot${a}}]}
     }
     /if (!${DotTimer${a}} && ${Spawn[id ${MATarget}].LineOfSight} && ${Spawn[${MATarget}].Distance}<${MobRadius} && !${Spawn[${MATarget}].Dead} && ${Spawn[${MATarget}].Type.Equal[NPC]}) {
       /if (${DotType${a}.Find[gem]} && ${Spawn[id ${MATarget}].PctHPs}>30 && ${Me.PctMana}>${DotMinManaPct} && ${Me.SpellReady[${Dot${a}}]}) {
         |/echo Dotting ${Spawn[id ${MATarget}].CleanName} with ${Dot${a}}
         /call CastSpell "${Dot${a}}" "${DotType${a}}" ${MATarget} CheckALL
         /varcalc TimesCast ${TimesCast}+1
       } else /if (${DotType${a}.Equal[item]}) {
         /echo Dotting ${Spawn[id ${MATarget}].CleanName} with ${Dot${a}}
         /call CastSpell "${Dot${a}}" "${DotType${a}}" ${MATarget} CheckALL
         /varcalc TimesCast ${TimesCast}+1
       } else {
         /goto :BreakOutDot
       }
       
       /if (${castReturn.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
         /varset DotTimer${a} 10000s
       } else /if (${Macro.Return.Equal[DEAD]}) {
         /goto :GetOutSubDot
       } else /if (${castReturn.Equal[CAST_SUCCESS]} && !${Interrupted}) {
         /if ( ${DotType${a}.Equal[item]} ) {
           /varset DotTimer${a} ${Math.Calc[${FindItem[${Dot${a}}].Spell.Duration.TotalSeconds}-6]}s
           /varset DotTimer${FindItem[${Dot${a}}].Spell.ID} ${Math.Calc[${FindItem[${Dot${a}}].Spell.Duration.TotalSeconds}-6]}s
         } else /if ( ${TimesCast}>1 ) {
           /varset DotTimer${a} 10000s
           /goto :BreakOutDot
         } else {
           /varset DotTimer${a} ${Math.Calc[${Spell[${Dot${a}}].Duration.TotalSeconds}-6]}s
           /varset DotTimer${Spell[${Dot${a}}].ID} ${Math.Calc[${Spell[${Dot${a}}].Duration.TotalSeconds}-6]}s
         }
       } else /if (${Interrupted} || ${castReturn.Equal[CAST_INTERRUPTED]}) {
         /varset Interrupted 0
         /varcalc TimesCast ${TimesCast}-1
         /goto :RecastDot
       } else {
         /goto :RecastDot
       }
    }
   :BreakOutDot
  /next a
   
  :GetOutSubDot
   /varset Doting 0
   /varset MacroState ${OldMacroState}
   /varset OldMacroState DOT
/return

Sub SetNuke
  /call DeclareIniVar NumOfNuke int NUKES 2
  /call DeclareIniVar NukeMinManaPct int NUKES 35
  /call DeclareIniVar Nuke1 string NUKES "Sting of the Queen Rk.II"
  /call DeclareIniVar NukeType1 string NUKES  gem9
  /call DeclareIniVar NukeAt1 int NUKES 80
  /call DeclareIniVar NukeStop1 int NUKES 0
  /call DeclareIniVar Nuke2 string NUKES "Ahnkaul's Spear of Venom"
  /call DeclareIniVar NukeType2 string NUKES  gem4
  /call DeclareIniVar NukeAt2 int NUKES 80
  /call DeclareIniVar NukeStop2 int NUKES 0
/return

Sub Nuke
  /varset OldMacroState ${MacroState}
  /varset MacroState NUKE
  
  /declare a int local

  /if (!${MATarget} || ${Spawn[${MATarget}].Dead}) /call GetMaTarget
  /if ( ${Spawn[${MATarget}].Type.NotEqual[NPC]} || ${Spawn[${MATarget}].Dead} ) {
    /varset MATarget 0
    /if (${DoDebuff}) /call GetMobs
    /goto :BreakOutNuke
  }

  :TopOfNuke
    /for a 1 to ${NumOfNuke}
      /doevents
      /if (${Me.Book["${Nuke${a}}"]}) {
        /if ( ${Spawn[${MATarget}].ID} && ${Spawn[${MATarget}].Type.Equal[NPC]} && ${Spawn[${MATarget}].PctHPs}<=${NukeAt${a}} && ${Spawn[${MATarget}].PctHPs}>=${NukeStop${a}} && ${Me.PctMana}>${NukeMinManaPct} ) {
          /if (${Me.SpellReady["${Nuke${a}}"]}) {
            /if ( ${Target.ID}!=${MATarget} ) {
              /target id ${MATarget}
              /delay 1s ${Target.ID}==${MATarget}
            }
            /call CastSpell "${Nuke${a}}" "${NukeType${a}}" ${MATarget} CheckALL
          } else /if ( !${Me.Gem["${Nuke${a}}"]} ) {
            /memspell ${NukeType${a}.Right[1]} "${Nuke${a}}"
            /delay 10s ${Me.Gem[${NukeType${a}.Right[1]}].Name.Equal[${Nuke${a}}]}
          }
        }
      }
    /next a
  
  /if ( ${Me.PctMana}<=95 && ${Me.PctHPs}>=85 && ${Me.SpellReady["${CanniSpell}"]} ) /call CastSpell "${CanniSpell}" ${CanniGem} 0 CheckALL

  :BreakOutNuke
  /varset MacroState ${OldMacroState}
  /varset OldMacroState NUKE    
/return

Sub CastSpell(string sSpell,string sType,int iTarget,string sCheckUp)
  /if (${sSpell.Equal[NULL]} || ${sType.Equal[NULL]}) {
    /return
  }
  :ReTarget
    /if ( ${iTarget} && ${Target.ID}!=${iTarget} && ${Spawn[id ${iTarget}].ID} && !${Spawn[id ${iTarget}].Dead}) {
      /squelch /target id ${iTarget}
      /delay 2s ${Target.ID}==${iTarget}
      /if ( ${Target.ID}!=${iTarget} ) {
        /if (${Me.Dead}) /call Wait4Rez
        /goto :ReTarget
      }
    } else /if (${Spawn[id ${iTarget}].Type.Equal[PC]} && ${Spawn[${Spawn[id ${iTarget}].Name}].ID}!=${iTarget}) {
      /target id ${Spawn[${Spawn[id ${iTarget}].Name}].ID}
      /delay 2s ${Target.ID}==${Spawn[${Spawn[id ${iTarget}].Name}].ID}
    } else /if (!${Spawn[id ${iTarget}].ID} && ${iTarget} && !${Spawn[${Spawn[id ${iTarget}].Name}].ID} && ${Spawn[id ${iTarget}].Dead}) {
      /if (${DoDebuff}) {
        /call UpdateMobList
        /call GetMobs
      }
      /return DEAD
    }
    /if (${Target.Dead} || ${Spawn[id ${iTarget}].Dead}) {
      /if (${DoDebuff}) /call GetMobs
      /return DEAD
    }
  /if (!${Me.Gem[${sSpell}]} && ${sType.Find[gem]} && ${Me.Book[${sSpell}]}) {
    /if (${sType.Length}==4) /memspell ${sType.Right[1]} "${sSpell}"
    /if (${sType.Length}==5) /memspell ${sType.Right[2]} "${sSpell}"
    /delay 10s ${Me.Gem[${sType.Right[1]}].Name.Equal[${sSpell}]}
  } else /if (!${Me.Book[${sSpell}]} && ${sType.Find[gem]}) {
    /return
  }
  :WaitToCast
   /doevents
    /if (!${Me.SpellReady["${sSpell}"]} && ${sType.Find[gem]}) {
      /if (!${Me.Gem[${sSpell}]} && ${Me.Book[${sSpell}]}) /goto :ReTarget
      /if (${Me.Dead}) /call Wait4Rez
      /call CheckALL
      /if (!${Spawn[${iTarget}].ID}) /return DEAD
      /goto :WaitToCast
    }

  /if (${sType.Equal[item]}) {
    /echo Its an ITEM!!
    /if (${FindItem[${sSpell].InvSlot}) /call CastItemClickyb ${sSpell}
  } else /if ( ${sCheckUp.NotEqual[NULL]} ) {
    /call Cast "${sSpell}" ${sType} 0 ${sCheckUp}
  } else {
    /call Cast "${sSpell}" ${sType} 0
  }
/return ${Macro.Return}

Sub SetHealList
  /declare WorstHurt	int	outer 0
  /declare WorstHp 	int    	outer 100
  /declare WorstClass	string	outer NULL
  /declare MinorHurt	int    	outer 0 
  /declare MajorHurt	int    	outer 0
  /declare HoTTimer	timer	outer 0
  /declare DaTimer 	timer 	outer 0
  
  /call DeclareIniVar HealSpell 	string 	HEAL "Ancient: Wilslik's Mending"
  /call DeclareIniVar HealGem 		int 	HEAL 1
  /call DeclareIniVar HotSpell 		string 	HEAL "Halcyon Breeze Rk. II"
  /call DeclareIniVar HoTGem 		int 	HEAL 2
  /call DeclareIniVar GroupHoT 		string 	HEAL "Ghost of Renewal"
  /call DeclareIniVar GroupGem 		int 	HEAL 4
  /call DeclareIniVar InterventionSpell string 	HEAL "Ancestral Intervention RK. II"
  /call DeclareIniVar HealRange 	int 	HEAL 150
  /call DeclareIniVar GroupRange 	int 	HEAL 100
  /call DeclareIniVar EmgHealMod 	int 	HEAL 60
  /call DeclareIniVar HealPriority 	int 	HEAL 0 /healp
  /call DeclareIniVar CLRPoint 		int 	HEAL 80 
  /call DeclareIniVar DRUPoint 		int 	HEAL 70
  /call DeclareIniVar SHMPoint 		int 	HEAL 60
  /call DeclareIniVar WIZPoint 		int 	HEAL 75
  /call DeclareIniVar MAGPoint 		int 	HEAL 75
  /call DeclareIniVar ENCPoint 		int 	HEAL 80
  /call DeclareIniVar NECPoint 		int 	HEAL 75
  /call DeclareIniVar WARPoint 		int 	HEAL 45
  /call DeclareIniVar MNKPoint 		int 	HEAL 60
  /call DeclareIniVar ROGPoint 		int 	HEAL 60
  /call DeclareIniVar RNGPoint 		int 	HEAL 60
  /call DeclareIniVar BSTPoint 		int 	HEAL 60
  /call DeclareIniVar SHDPoint 		int 	HEAL 50
  /call DeclareIniVar BRDPoint 		int 	HEAL 65
  /call DeclareIniVar BERPoint 		int 	HEAL 60
  /call DeclareIniVar PALPoint 		int 	HEAL 50

/return

Sub CheckGrp
  /varset OldMacroState ${MacroState}
  /varset MacroState CHECKGRP

  /declare b	int	local

  :HealTop
   /varset WorstHurt 0
   /varset WorstHp 100
   /varset WorstClass NULL
   /varset MinorHurt 0
   /varset MajorHurt 0
   
   /for b 0 to ${Group.Members}
     /if ((${Spawn[pc id ${Group.Member[${b}].ID}].ID} || ${Spawn[mercenary id ${Group.Member[${b}].ID}].ID}) && ${Group.Member[${b}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Group.Member[${b}].PctHPs}<=${WorstHp} && !${Group.Member[${b}].Dead}) {
       /varset WorstHurt ${Group.Member[${b}].ID}
       /varset WorstHp ${Group.Member[${b}].PctHPs}
       /varset WorstClass ${Group.Member[${b}].Class.ShortName}
     }
    /if (${Group.Member[${b}].PctHPs}<85 && ${Group.Member[${b}].PctHPs}>${${Group.Member[${b}].Class.ShortName}Point}*.7 && ${Group.Member[${b}].Distance}<=${Spell[${GroupHoT}].AERange}) {
      /varcalc MinorHurt ${MinorHurt}+1
    } else /if (${Group.Member[${b}].PctHPs}<${${Group.Member[${b}].Class.ShortName}Point}*.7 && ${Group.Member[${b}].Type.NotEqual[Corpse]} && ${Group.Member[${b}].Distance}<=${Spell[${GroupHoT}].AERange}) {
      /varcalc MajorHurt ${MajorHurt}+1
    }
   /next b
   
   /if (!${MajorHurt} && !${MinorHurt} || ${Spawn[${WorstHurt}].CleanName.Equal[NULL]} || ${Spawn[${WorstHurt}].PctHPs}>${${WorstClass}Point} || ${Me.Buff["Bestow Divine Aura"].ID}) /goto :GetOutChkGrp

   /if (${Spawn[${WorstHurt}].PctHPs}<=${${WorstClass}Point}*.5 && ${Spawn[${WorstHurt}].Distance}<=${Spell[${InterventionSpell}].MyRange} && ${Me.SpellReady[${InterventionSpell}]}) {
     /if (${Me.Casting.ID}) /call Interrupt
     /echo Interrupting a spell.  CheckGrp DivARB
     /call Cast "${InterventionSpell}" gem10 1s
   }
   /if (${Math.Calc[${MajorHurt}+${MinorHurt}]}>3 && ${Me.SpellReady[${GroupHoT}]} && ${Spell[${GroupHoT}].Stacks[0]} && ${Me.CurrentMana}>${Spell[${GroupHoT}].Mana} && !${Me.Buff[${GroupHoT}].ID}) {
     /call CastSpell "${GroupHoT}" gem${GroupGem} ${Me.ID} CheckALL 50
     /if ( !${castReturn.Equal[CAST_SUCCESS]} ) /goto :HealTop
     /goto :GetOutChkGrp
   }
   /if ( ${Spawn[${WorstHurt}].PctHPs}<=${${WorstClass}Point} && ${Spawn[${WorstHurt}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Me.CurrentMana}>${Spell[${HealSpell}].Mana} ) {
      |/echo Healing ${Spawn[${WorstHurt}].CleanName}
      /call CastSpell "${HealSpell}" gem${HealGem} ${WorstHurt} CheckALL 50
      /if ( !${castReturn.Equal[CAST_SUCCESS]} ) /goto :HealTop
   }
   :GetOutChkGrp
    /if ( ${Me.PctHPs}<85 && !${Me.Song[${HotSpell}].ID} && ${Me.SpellReady[${HotSpell}]} ) {
      /call CastSpell "${HotSpell}" gem${HoTGem} ${Me.ID} CheckALL 50
    }
    /if (${Spawn[id ${MaID}].PctHPs}<=85 && !${HoTTimer} ) {
      /call CastSpell "${HotSpell}" gem${HoTGem} ${MaID} CheckALL 50
      /if (${Macro.Return.Equal[CAST_SUCCESS]} ) /varset HoTTimer 65s      
    }    
    /varset MacroState ${OldMacroState}
    /varset OldMacroState CHECKGRP
/return


Sub CheckHP(int HealModPct)
  /varset OldMacroState ${MacroState}
  /varset MacroState CHECKHP

  /declare TempHealModPct int local 10

  /if (${HealModPct}) {
    /varset TempHealModPct ${EmgHealMod}
  } else {
    /varset TempHealModPct ${HealModPct}
  }
  /declare lWorstHurt 	int 	local
  /declare lWorstHp	int	local
  /declare lWorstClass	string	local
  /declare lMajorHurt	int	local
  /declare a int local
  
  :HealTopB
   /if (!${Me.Casting.ID}) /goto :EndCHKHP

   /varset lWorstHurt 0
   /varset lWorstHp 100
   /varset lWorstClass NULL
   /varset lMajorHurt 0

   /for a 0 to ${Group.Members}
     /if (${Group.Member[${a}].ID} && ${Group.Member[${a}].Distance}<=${HealRange} && ${Group.Member[${a}].PctHPs}<=${lWorstHp}) {
       /varset lWorstHurt ${Group.Member[${a}].ID} 
       /varset lWorstHp ${Group.Member[${a}].PctHPs} 
       /varset lWorstClass ${Group.Member[${a}].Class.ShortName} 
     }
     /if (${Group.Member[${a}].ID} && ${Group.Member[${a}].PctHPs}<${${Group.Member[${a}].Class.ShortName}Point}*${EmgHealMod} && ${Group.Member[${a}].Distance}<${HealRange}) /varcalc lMajorHurt ${lMajorHurt}+1         
   /next a

   /if (${Spawn[${lWorstHurt}].PctHPs}<=${${lWorstClass}Point}*.5 && ${Spawn[${lWorstHurt}].Distance}<=${Spell[${InterventionSpell}].MyRange} && ${Me.SpellReady[${InterventionSpell}]} && ${Me.CurrentMana}>${Spell[${InterventionSpell}].Mana}) {
     /if (${Me.Casting.ID}) /call Interrupt
     /varset Interrupted 1
     /echo Interrupted to divarb!
     /call Cast "${InterventionSpell}" gem10 1s
     /varset MacroState ${OldMacroState}
     /varset OldMacroState CHECKHP
     /return CAST_INTERRUPTED
   }
   /if (${Spawn[${lWorstHurt}].PctHPs}<${Math.Calc[${${lWorstClass}Point}*${TempHealModPct}/100]} && ${Me.CurrentMana}>${Spell[${HealSpell}].Mana} && ${Spawn[${lWorstHurt}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Target.ID}!=${lWorstHurt} && ${Target.PctHPs}>${Math.Calc[${${Target.Class.ShortName}Point}*${TempHealModPct}/120]} || ${Spawn[${lWorstHurt}].ID}==${Me.ID} && ${Target.ID}!=${Me.ID} && ${Me.CurrentMana}>${Spell[${HealSpell}].Mana} && ${Me.PctHPs}<${Math.Calc[${${Me.Class.ShortName}Point}*${TempHealModPct}/120]}) {
     /if (${Me.Casting.ID}) /call Interrupt
     /echo INTERRUPT!!!! ${Spawn[${Target.ID}].CleanName} != ${Spawn[${lWorstHurt}].CleanName}
     /echo ${${lWorstClass}Point} -- ${Math.Calc[${${lWorstClass}Point}*${TempHealModPct}/100]} -- ${Math.Calc[${${lWorstClass}Point}*${TempHealModPct}]}
     /varset Interrupted 1
     /call CastSpell "${HealSpell}" gem${HealGem} ${lWorstHurt} CheckALL
     /if ( !${Macro.Return.Equal[CAST_SUCCESS]} ) /goto :HealTopB
     /varset MacroState ${OldMacroState}
     /varset OldMacroState CHECKHP
     /return CAST_INTERRUPTED
   }

  :EndCHKHP
   /varset MacroState ${OldMacroState}
   /varset OldMacroState CHECKHP
/return

Sub CheckAll
  /if (${Me.Casting.SpellType.Equal[Detrimental]} && ${Target.Type.Equal[PC]}) {
    /echo WHY AM I CASTING A BAD SPELL ON TEH GOOD GUY! -- ${Me.Casting.Name} -- ${Me.Casting.SpellType}
    /call Interrupt
  }
  /if (${Me.Dead}) /call Wait4Rez
  /if (${DoCure}) /call CheckCureGrp
  /if (${Me.Casting.ID} && ${DoHeal}) /call CheckHP ${EmgHealMod}
  /if (${Me.Casting.ID} && ${Target.Dead}) /call Interrupt
  /if (${NetBots[${Target.CleanName}].Buff.Find[${Spell[${Me.Casting}].ID}]}) {
    /echo Bish already has the buff!
    /call Interrupt
  }
  /doevents
  /delay 1
  /if (${DoDebuff}) {
    /call UpdateMobList
    /call GetMobs
  }
  /if (${DebuffList.Count[[]} && ${Me.Casting.SpellType.NotEqual[Detrimental]} && ${Me.Casting.Name.NotEqual[${HealSpell}]} && ${Me.Casting.Name.NotEqual[${InterventionSpell}]} && !${HealPriority} && !${Curing} && ${DoDebuff}) {
    /call Interrupt
    /echo There is an add in camp!!! ${Me.Casting.Name}
    /if (${DoDebuff}) /call Debuff
  }
/return


Sub SetBuffList
  /call DeclareIniVar NumSelfBuff 	int 	BUFF 0
  /call DeclareIniVar SelfBuff1 	string 	BUFF NULL
  /call DeclareIniVar SelfType1 	string 	BUFF NULL
  /call DeclareIniVar BuffNoStack1 	string 	BUFF NULL
  /call DeclareIniVar SelfBuff2 	string 	BUFF NULL
  /call DeclareIniVar SelfType2 	string 	BUFF NULL 
  /call DeclareIniVar BuffNoStack2 	string 	BUFF NULL
  /call DeclareIniVar SelfBuff3 	string 	BUFF NULL
  /call DeclareIniVar SelfType3 	string 	BUFF NULL
  /call DeclareIniVar BuffNoStack3 	string 	BUFF NULL
  /call DeclareIniVar SelfBuff4 	string 	BUFF NULL
  /call DeclareIniVar SelfType4 	string 	BUFF NULL
  /call DeclareIniVar BuffNoStack4 	string 	BUFF NULL
  /call DeclareIniVar SelfBuff5 	string 	BUFF NULL
  /call DeclareIniVar SelfType5 	string 	BUFF NULL
  /call DeclareIniVar BuffNoStack5 	string 	BUFF NULL
  /call DeclareIniVar SelfBuff6 	string 	BUFF NULL
  /call DeclareIniVar SelfType6 	string 	BUFF NULL
  /call DeclareIniVar BuffNoStack6 	string 	BUFF NULL
  /call DeclareIniVar NumGrpBuff 	int 	BUFF 0
  /call DeclareIniVar GrpBuff1 		string 	BUFF NULL
  /call DeclareIniVar GrpGem1 		int 	BUFF 0
  /call DeclareIniVar GrpBuff2 		string 	BUFF NULL
  /call DeclareIniVar GrpGem2 		int 	BUFF 0
  /call DeclareIniVar GrpBuff3 		string 	BUFF NULL
  /call DeclareIniVar GrpGem3 		int 	BUFF 0
  /call DeclareIniVar GrpBuff4 		string 	BUFF NULL
  /call DeclareIniVar GrpGem4 		int 	BUFF 0
  /call DeclareIniVar PantherSpell 	string 	BUFF NULL
  /call DeclareIniVar PantherSpellGem 	int 	BUFF 0  
  /call DeclareIniVar BuffGem 		string 	Buff gem9
  /call DeclareIniVar DoBuffTotal 	int 	BUFF 0
  /call DeclareIniVar WildSpell 	string 	BUFF "Rampant Growth"

  /declare i int local
  /declare WildTimer	timer	outer 0
  
  /if (${DoBuffTotal}) {
   /if (!${Defined[DoBuffID]})       /declare DoBuffID[${DoBuffTotal}] int   outer
   /if (!${Defined[DoBuffQueue]})    /declare DoBuffQueue[25,2]        int   outer
   /if (!${Defined[QueueCount]})     /declare QueueCount               int   outer 0
   /if (!${Defined[DoBuffLowest]})   /declare DoBuffLowest             int   outer 100
   /if (!${Defined[DoBuffTimer]})    /declare DoBuffTimer              timer outer
   /for i 1 to ${DoBuffTotal}
      /call DeclareIniVar DoBuff${i} string Buff NULL
      /call DeclareIniVar DoBuffCast${i} string Buff NULL
      /call DeclareIniVar DoBuffGem${i} string Buff null
      /call DeclareIniVar DoBuffAliases${i} string Buff NULL
      /call DeclareIniVar DoBuffMana${i} int Buff NULL
      /call DeclareIniVar DoBuffIgnoreClass${i} string Buff "Use the Class's full Name and seperate with commas"
      /if (${Me.AltAbility[${DoBuff${i}}]}) /varset DoBuffID[${i}] ${Me.AltAbility[${DoBuff${i}}].Spell.ID}
      /if (${FindItem[${DoBuff${i}}].ID}) /varset DoBuffID[${i}] ${FindItem[${DoBuff${i}}].Spell.ID}
      /if (${Me.Book[${DoBuffCast${i}}]}) /varset DoBuffID[${i}] ${Me.Book[${Me.Book[${DoBuffCast${i}}]}].ID}
      /if (${Ini[${MacroQuest.Server}_Shm_${Me.CleanName}.ini,Buff,DoBuffIcon${i},NOTFOUND].NotEqual[NOTFOUND]}) /varset DoBuffID[${i}] ${Spell[${Ini[${MacroQuest.Server}_Shm_${Me.CleanName}.ini,Buff,DoBuffIcon${i},NOTFOUND]}].ID}
      /if (${DoBuffLowest}>${DoBuffMana${i}}) /varset DoBuffLowest ${DoBuffMana${i}}
   /next i
  }  
/return

Sub CheckSelfBuff
  /varset OldMacroState ${MacroState}
  /varset MacroState CHECKSELFBUFF
  
  /declare X int local
  /declare a int local
  /declare b int local 1
  /declare c int local
  /declare BuffName string local
  /declare ItemSlot string local
  /declare OldItem string local
  /declare ignorelist string local
      
  /if (${Me.AltAbility[Group Pact of the Wolf]} && !${Me.State.Equal[MOUNT]} && !${Me.Buff[Group Pact of the Wolf].ID}) /call Cast "Group Pact of the Wolf" alt
  /if (${Me.Height}>2.5 && ${Me.AltAbility[Group Shrink]} && ${Me.AltAbilityReady[Group Shrink]} && ${DoShrink}) /call CastSpell "Group Shrink" "alt" ${Me.ID} CheckAll

  /call CheckItems
  
  /if (!${NumSelfBuff}) /goto :CheckBcBuffs
  /for a 1 to ${NumSelfBuff}
    /if ( ${SelfBuff${a}.NotEqual[NULL]} && ${SelfType${a}.Equal[item]} && ${FindItem[=${SelfBuff${a}}].ID} && ${Me.Buff[${FindItem[=${SelfBuff${a}}].Spell.Name}].Duration}<4 ) {
      :CheckNoStack
       /if (!${Spell[${FindItem[=${SelfBuff${a}}].Spell.Name}].Stacks[2]}) /goto :SkipBuff
       /varset BuffName ${BuffNoStack${i}.Arg[${b},,]}
       /if (${FindItem[=${SelfBuff${a}}].InvSlot}>21) {
         /varset ItemSlot ${FindItem["${SelfBuff${a}}"].WornSlot[1].Name}
       } else {
         /varset ItemSlot ${FindItem[=${SelfBuff${a}}].InvSlot.Name}
       }
       /if ( ${Bool[${BuffName}]} ) {
         /if ( ${Me.Buff[${BuffName}].ID} ) /goto :SkipBuff
         /varcalc b ${b}+1
         /goto :CheckNoStack
       }
      /if (${Me.Inventory[${ItemSlot}].Name.NotEqual["${SelfBuff${a}}"]}) {
        /varset OldItem ${Me.Inventory[${ItemSlot}].Name}
        /exchange "${SelfBuff${a}}" ${ItemSlot}
        /call Cast "${Me.Inventory[${ItemSlot}].Name}" item
        /exchange "${OldItem}" ${ItemSlot}
      } else {
        /call Cast "${Me.Inventory[${ItemSlot}].Name}" item
      }
    } else /if ( ${Me.Book[${SelfBuff${a}}]} && ${SelfType${a}.Find[gem]} && ${SelfBuff${a}.NotEqual[NULL]} && ${Spell[${SelfBuff${a}}].Mana} < ${Me.CurrentMana} ) {
      /if ( !${Me.Buff[${SelfBuff${a}}].ID} || ${Me.Buff[${SelfBuff${a}}].Duration} < 4 ) {
        :CheckNoStack2
         /if (!${Spell[${SelfBuff${a}}].Stacks[2]}) /goto :SkipBuff
         /varset BuffName ${BuffNoStack${i}.Arg[${b},,]}
         /if ( ${Bool[${BuffName}]} ) {
           /if ( ${Me.Buff[${BuffName}].ID} ) /goto :SkipBuff
           /varcalc b ${b}+1
           /goto :CheckNoStack2
         }
        /call Cast "${SelfBuff${a}}" "${SelfType${a}}"
      }
    }
   :SkipBuff
  /next a
  
  :CheckBcBuffs
   /varset BcClients ${NetBots.Client}
   /varset BcClients2 ${Math.Calc[${BcClients.Count[ ]}+1]}
   |**Start Of the BC buffing Routine**|
   /for X 1 to ${BcClients2}
     /for b 1 to ${DoBuffTotal}
       /varset ignorelist ${Ini[${INIFile}.ini,BUFF,DoBuffIgnoreClass${b},NOTFOUND]}
       /if (${NetBots[${BcClients.Arg[${X}]}].Stacks[${Spell[${DoBuff${b}}].ID}]} && ${NetBots[${BcClients.Arg[${X}]}].InZone} && ${Spawn[${BcClients.Arg[${X}]}].ID} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=100 && ${Me.PctMana}> ${DoBuffMana${b}} && !${SpawnCount[npc targetable radius ${DoBuffMobRange${b}} range 40 130]} && !${ignorelist.Find[${NetBots[${BcClients.Arg[${X}]}].Class}]} && ${Me.CurrentMana}>${Spell[${DoBuff${b}}].Mana} && ${NetBots[${BcClients.Arg[${X}]}.Stacks[${Spell[${DoBuff${b}}].ID}]} && ${NetBots[${BcClients.Arg[${X}]}.Stacks[${Spell[${DoBuffCast${b}}].ID}]}) {
         |/echo buffing ${NetBots[${BcClients.Arg[${X}]}].Name} the ${NetBots[${BcClients.Arg[${X}]}].Class.ShortName} with ${DoBuff${b}} by Casting ${DoBuffCast${b}}
         /call CastSpell "${DoBuffCast${b}}" ${BuffGem} ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
       }
     /next b
   /next X
  |**end bc buffing**|
  :EndCheckBuffs
  /varset BuffTimer 25s
  /varset MacroState ${OldMacroState}
  /varset OldMacroState CHECKSELFBUFF
/return

Sub SetPetList
  /call DeclareIniVar UsePet int PET 0 /usepet
  /call DeclareIniVar PetSpell string PET NULL
  /call DeclareIniVar NumPetBuff int PET 0
  /call DeclareIniVar PetBuff1 string PET NULL
  /call DeclareIniVar PetBuff2 string PET NULL
  /call DeclareIniVar PetBuff3 string PET NULL
  /call DeclareIniVar PetBuff4 string PET NULL
/return

Sub CheckPetBuff
  /varset OldMacroState ${MacroState}
  /varset MacroState CHECKPETBUFF

  /declare a	int	local
  /if ( !${Me.Pet.ID} ) {
    /call CastSpell "${PetSpell}" gem9 ${Me.ID} CheckALL
  }
  /if ( ${Me.Pet.ID} && ${NumPetBuff} ) {
    /for a 1 to ${NumPetBuff}
      /if ( !${Me.PetBuff[${PetBuff${a}}]} ) {
        /call CastSpell "${PetBuff${a}}" gem9 ${Me.Pet.ID} CheckALL
      }
    /next a
  }
  
  /varset MacroState ${OldMacroState}  
  /varset OldMacroState CHECKPETBUFF
/return

Sub Pet
  /varset OldMacroState ${MacroState}
  /varset MacroState PET

  /declare PetTarget int local 0
  
  /if (!${MATarget} || ${Spawn[${MATarget}].Dead}) /call GetMaTarget
  /if (${Spawn[${MATarget}].ID} && ${Spawn[${MATarget}].Type.Equal[NPC]} && ${Spawn[${MaID}].ID} && ${Me.Pet.ID} && !${Me.Pet.Following.ID} || ${Me.Pet.Following.ID}!=${MATarget} && ${Spawn[${MATarget}].ID}) {
    /squelch /target id ${MaID}
    /delay 1s ${Target.ID}==${MaID}
    /assist ${Spawn[${MaID}].CleanName}
    /delay 1s ${Target.ID}==${MATarget}
    
    /if ( ${Target.ID} && ${Target.Type.Equal[NPC]} ) /pet attack
  } else {
    /call CheckPetBuff
  }

  /varset MacroState ${OldMacroState}  
  /varset OldMacroState PET
/return

Sub GetMaTarget
  /varset OldMacroState ${MacroState}
  /varset MacroState GETMATARGET

  /if (${NetBots[${MA}].ID}) {
    /varset MATarget ${NetBots[${MA}].TargetID}
  } else {
    /if (${Spawn[${MaID}].Type.Equal[PC]} && ${Spawn[${MaID}].ID} && ${Spawn[${MaID}].Distance}<150) {
      /squelch /target id ${MaID}
      /delay 1s ${Target.ID}==${MaID}
      /assist ${Spawn[${MaID}].CleanName}
      /delay 7
      /if ( ${Target.ID} && ${Target.Type.Equal[NPC]} && !${ExcludeList.Find[${Spawn[id ${Target.ID}].CleanName}]}) {
        /varset MATarget ${Target.ID}
      }   
    }
  }
  /varset MacroState ${OldMacroState}
  /varset OldMacroState GETMATARGET
/return

Sub Event_ImDead 
   :Zone_Loop 
    |/if ( ${Me.Bound.ID} !=${Zone.ID} ) /goto :Zone_Loop 
   /delay 5s 
   /delay 5 
   /call Wait4Rez 
   /delay 20   
   /if (${Me.State.Equal[Stand]}) /sit
   :Meditate
      /delay 1s 
      /if (${Me.CurrentMana} < 300) /goto :Meditate 
/return

sub Event_GainXP
  /call UpdateMobList
/return

sub Event_ListMob
   /declare lCounter int local
   
   /varset lCounter 1
   |/echo displayin mobs on list
   :DisplayLoop
   
   /if (${lCounter}<11) {
      |/echo Mob ${lCounter}: ${Spawn[id ${iDebuffList[${lCounter}]}].Name} -- ${iDebuffList[${lCounter}]}
      /varcalc lCounter ${lCounter}+1
      /goto :DisplayLoop
   }
/return

Sub Event_Summon
  /varset MobAgro ${NearestSpawn[npc targetable radius 20].ID}
/return

Sub CastBuff(string Buff, string Person)
   /if ( ${Spawn[PC ${Person}].Distance}<=100 ) {     
      /target pc ${Person}
      /tell ${Person} ${Buff} is incomming!!!
      /call cast "${Buff}" gem7
   }
/return

Sub Event_ImHit(string Line)
   /if (${Me.PctHPs}<60) {
      /if (${Me.Casting.ID}) /call Interrupt
      /echo I AM HIT....HARD!!
      /target myself
      /delay 2s ${Target.ID}==${Me.ID}
      /call Cast "${HealSpell}" gem${HealGem}
   }
   /varset MobAgro ${NearestSpawn[1,npc targetable radius 20].ID}
   /doevents flush
/return

Sub Event_AddFuck
  /declare CurrFuckList string local
  /bc Adding ${Target.DisplayName} to ExcludeList
  /varset CurrFuckList ${Ini[${INIFile}.ini,${Zone},ExcludeList,NULL]}
  /if ( ${CurrFuckList.Find[NULL]} ) {
    /ini "${INIFile}.ini" "${Zone.ShortName}" "ExcludeList" "${Target.CleanName}"
    /varset CurrFuckList ${Target.CleanName}
  } else {
    /varset CurrFuckList ${Target.CleanName}|${CurrFuckList}
    /ini "${INIFile}.ini" "${Zone.ShortName}" "ExcludeList" "${CurrFuckList}"
  }
  /varset ExcludeList ${CurrFuckList}
/return

Sub DeclareIniVar(string name,string varType,string section,string value,string alias)
  /if ( !${Defined[${name}]} ) /declare ${name} ${varType} outer
  /varset ${name} ${Ini[${INIFile}.ini,"${section}",${name.Left[1].Upper}${name.Right[-1]},"${value}"]}
  /ini "${INIFile}.ini" "${section}" "${name.Left[1].Upper}${name.Right[-1]}" "${${name}}"
  /if (${Defined[alias]} && ${Version.NotEqual[${CurrentVersion}]}) {
    /echo /alias ${alias} /echo set: ${name} ${section}
    /docommand /alias ${alias} /echo set: ${name} ${section}
  }
  /if (${Me.Book[${Me.Book[${${name}} Rk. III]}].ID}) /varset ${name} ${Me.Book[${Me.Book[${${name}} Rk. III]}].Name} 
  /if (${Me.Book[${Me.Book[${${name}} Rk. II]}].ID}) /varset ${name} ${Me.Book[${Me.Book[${${name}} Rk. II]}].Name}
  /if (${Me.CombatAbility[${${name}} Rk III]}) /varset ${name} ${${name}} Rk. III
  /if (${Me.CombatAbility[${${name}} Rk. II]}) /varset ${name} ${${name}} Rk. III
/return

|**Sub Event_SetVar(sting line,string varName,string section,string value)
  /if (${value.Equal[on]}) /varset value 1
  /if (${value.Equal[off]}) /varset value 0
  /echo ${varName} -- ${${varName}}
  /if (${Defined[${varName}]} && ${${varName}}!=${Int[${value}]}) {
    /doevents flush
    /if (${varName.Equal[RaidSet]}) {
      /if (${value.Equal[1]}) {
        /call IntializeRaidSettings
      } else {
        /call IntializeGrpSettings
      }
    }
    /ini "${INIFile}.ini" ${section} "${varName.Left[1].Upper}${varName.Right[-1]}" "${value}"
    /varset ${varName} ${value}
    /popup ${varName} is set to ${${varName}} now.
  }
/return**|

Sub Event_WornOff(string sLine, string sSpell, string sTarget)
  /if (${Defined[DotTimer${Spell[${sSpell}].ID}]} && ${Me.SpellReady[${sSpell}]}) {
    /echo calling DOT OMG!!!
    /echo DotTimer${Spell[${sSpell}].ID} is at ${DotTimer${Spell[${sSpell}].ID}}
    /echo ${DotTimer1} ${DotTimer2} ${DotTimer3} ${DotTimer4} ${DotTimer5}
    /call DoT
  }
/return

Sub Event_Yak(string Line, string Person, string Channel, string Message)   
   |**/if ( !${MasterList.Find[${Person}]} ) /return**|
   /varset Person ${Person.Right[-2].Left[-1]}

   /if (!${Spawn[pc ${Person}].ID} && ${Spawn[pc ${Person}].CleanName.NotEqual[${Person}]} || ${Channel.NotEqual[you]}) /return
   /if (${DoBuffTotal} && ${Spawn[pc ${Person}].ID} && ${Person.NotEqual[${Me.CleanName}]}) {
     |/echo Checking Buffs1 <<${Person}>> >>${Message}<< == ${Spawn[pc ${Person}].CleanName} == ${Spawn[pc ${Person}].CleanName.NotEqual[${Person}]} ==
     /call CheckDoBuffs "${Person}" "${Message}"
     /doevents flush
   }
   /if (${QueueCount}) /call DoBuffEvents
/return

Sub Event_Talk(String Line, String Sender, String ChatText)
  /varset Sender ${Sender.Right[-2].Left[-1]}
  /if (!${Spawn[pc ${Sender}].ID} || ${Spawn[pc ${Sender}].CleanName.NotEqual[${Sender}]}) /return
  /if (${ChatText.Equal[follow]}) {
   :TargetSender
    /if (${Spawn[pc ${Sender}].ID}) {
      /target id ${Spawn[pc ${Sender}].ID}
      /delay 5 ${Target.ID}==${Spawn[pc ${Sender}].ID}
      /if (${Target.ID}!=${Spawn[pc ${Sender}].ID}) /goto :TargetSender
      /afollow on
    }
    /return
  }
  /if (${ChatText.Equal[stop]}) {
    /afollow off
    /return
  }
  /if (${DoBuffTotal} && ${Sender.NotEqual[${Me.CleanName}]} && ${Spawn[pc ${Sender}].ID}) {
    |/echo Checking Buffs2 <<${Sender}>> >>${ChatText}<< ==${Spawn[pc ${Sender}].CleanName}== ${Spawn[pc ${Sender}].CleanName.NotEqual[${Sender}]} ==
    /call CheckDoBuffs "${Sender}" "${ChatText}"
  }
  /if (${QueueCount}) /call DoBuffEvents
/return
 
Here are the include files. Not posting up the common includes, but if you need the ones not posted here just tell me and I will post them up. General2.inc is kind of a combined work of myself and Nytemyst. There is a lot of different things this include does. Later on I will come back and try to explain everything it does, but if you see something and need help with it or want me to explain how it works just ask.

Cure.inc

Code:
Sub InitCure
  /call DeclareIniVar STCurseSpell string CURING "Remove Greater Curse"
  /call DeclareIniVar GrpCurseSpell string CURING "Remove Greater Curse"
  /call DeclareIniVar STCorruptSpell string CURING "Cure Corruption Rk. III"
  /call DeclareIniVar CurseGem string CURING "gem9"
  /call DeclareIniVar STPoisonSpell string CURING "Disinfecting Aura"
  /call DeclareIniVar GrpPoisonSpell string CURING "Blood of Avoling Rk. III"
  /call DeclareIniVar PoisonGem string CURING "gem6"
  /call DeclareIniVar STDiseaseSpell string CURING "Disinfecting Aura"
  /call DeclareIniVar GrpDiseaseSpell string CURING "Blood of Avoling Rk. III"
  /call DeclareIniVar DiseaseGem string CURING "gem6"
  /call DeclareIniVar STCorruptSpell string CURING "Cure Corruption Rk. III"
  /call DeclareIniVar GrpCorruptSpell string CURING "Chant of the Burynai Rk. III"
  /call DeclareIniVar CorruptGem string CURING "gem7"
  /declare Curing int outer 0
  /declare GrpMemberList string outer |${Me.CleanName}
/return

Sub CheckCureGrp
  /varset BcClients ${NetBots.Client}
  /varset BcClients2 ${Math.Calc[${BcClients.Count[ ]}+1]}
  
  /declare X int local

  /for X 1 to ${Group.Members}
    /if (${Group.Member[${X}].ID} && !${GrpMemberList.Find[${Group.Member[${X}].CleanName}]}) /varset GrpMemberList ${GrpMemberList}|${Group.Member[${X}].CleanName}|
  /next X

  /varset Curing 1
  
  /for X 1 to ${BcClients2}
    /if (${Debuff[${NetBots[${NetBots[${BcClients.Arg[${X}]}].Name}].Buff}].Counters}<=0) /next X
     /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Cursed} && ${Spawn[${BcClients.Arg[${X}]}].ID} && !${Spawn[${BcClients.Arg[${X}]}].Dead} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${CurseSpell}].MyRange}) {
       :CureCurse
        /bc Curing Curse on ${BcClients.Arg[${X}]}
        /if (${GrpMemberList.Find[${BcClients.Arg[${X}]}]}) {
          /call CastSpell "${GrpCurseSpell}" "${CurseGem}" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        } else {
          /call CastSpell "${STCurseSpell}" "${CurseGem}" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        }
       /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Cursed} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${CurseSpell}].MyRange}) /goto :CureCurse
     } else /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Corrupted} && ${Spawn[${BcClients.Arg[${X}]}].ID} && !${Spawn[${BcClients.Arg[${X}]}].Dead}) {
       :CureCorrupt
        /bc Curing Corruption on ${BcClients.Arg[${X}]}
        /if (${GrpMemberList.Find[${BcClients.Arg[${X}]}]}) {
          |/echo casting Grp Spell
          /call CastSpell "${GrpCorruptSpell}" "CorruptGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        } else {
          |/echo Casting Single Spell
          /call CastSpell "${STCorruptSpell}" "CorruptGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        }
       /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Corrupted} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${CorruptSpell}].MyRange}) /goto :CureCorrupt
     } else /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Poisoned} && ${Spawn[${BcClients.Arg[${X}]}].ID} && !${Spawn[${BcClients.Arg[${X}]}].Dead} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${PoisonSpell}].MyRange}) {
       :CurePoison
        /bc Curing Poison on ${BcClients.Arg[${X}]}
        /if (${GrpMemberList.Find[${BcClients.Arg[${X}]}]}) {
          /call CastSpell "${GrpPoisonSpell}" "PoisonGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        } else {
          /call CastSpell "${STPoisonSpell}" "PoisonGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        }
       /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Poisoned} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${PoisonSpell}].MyRange}) /goto :CurePoison
     } else /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Diseased} && ${Spawn[${BcClients.Arg[${X}]}].ID} && !${Spawn[${BcClients.Arg[${X}]}].Dead} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${DiseaseSpell}].MyRange}) {
       :CureDisease
        /bc Curing Disease on ${BcClients.Arg[${X}]}
        /if (${GrpMemberList.Find[${BcClients.Arg[${X}]}]}) {
          /call CastSpell "${GrpDiseaseSpell}" "DiseaseGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        } else {
          /call CastSpell "${STDiseaseSpell}" "DiseaseGem" ${NetBots[${BcClients.Arg[${X}]}].ID} CheckAll
        }
       /if (${Debuff[${NetBots[${BcClients.Arg[${X}]}].Buff}].Diseased} && ${Spawn[${BcClients.Arg[${X}]}].Distance}<=${Spell[${DiseaseSpell}].MyRange}) /goto :CureDisease
     }
  /next X
  
  /varset Curing 0

/return

Sub CheckCure
  /if (${Me.Casting.Name.Equal[${STCurseSpell}]} && !${Debuff[${NetBots[${Target.Name}].Buff}].Cursed}) /call Interrupt
  /if (${Me.Casting.Name.Equal[${STCorruptSpell}]} && !${Debuff[${NetBots[${Target.Name}].Buff}].Corrupted}) /call Interrupt
  /if (${Me.Casting.Name.Equal[${STPoisonSpell}]} && !${Debuff[${NetBots[${Target.Name}].Buff}].Poisoned}) /call Interrupt
  /if (${Me.Casting.Name.Equal[${STDiseaseSpell}]} && !${Debuff[${NetBots[${Target.Name}].Buff}].Diseased}) /call Interrupt
/return

Events.inc

Code:
|
#event hatchet1 "#*#Hatchet hefts a weighted throwing axe in his offhand#*#
#event hatchet2 "#*#Hatchet lifts his axe high#*#
#event hatchet3 "#*#Hatchet levels his axe at your upper body#*#
#event hatchet3 "#*#Breakneck hoists an arm back#*#
#event hatchet4 "#*#Hatchet locks eyes with you#*#
#event hatchet4 "#*#Breakneck locks eyes with you and snorts#*#
#event hatchet5 "#*#Hatchet the torturer levels#*#
#event hatchet6 "#*#You outdistance the reach#*#
#event hatchet6 "#*#Breakneck's mallet passes harmlessly overhead.#*#
#event hatchet6 "#*#Breakneck, Master at Arms pauses to catch his breath#*#
#event hatchet6 "#*#By darting between#*#
#event hatchet6 "#*#You outdistance the reach#*#
#event hatchet6 "#*#Hatchet's axe passes#*#
#event MMMUnit  "#*#Support Unit turns to face you#*#"
#Event doom "#*#you sense your doom#*#"
#Event doom "#*#Marked for death#*#"
#event doom "#*#A dire disease creeps through your veins.#*#"
#event doom "#*#Your movements become stiff.#*#"
#event doom "#*#fire courses through your veins#*#"
#Event GazeYou         "#*#gaze of deadly power focusing on you#*#"
#event smotherdecay "#*#You lose your will to fight#*#"
#event curseofthefirstborn "#*#A festering darkness saps your strength#*#"
#event presentofthefirstborn "#*#dumbstruck by the presence#*#"
#event plagueofmana "#*#Your blood is tainted with magical essence#*#"
#event queenlocation "#*#Sendaii begins to look in your direction#*#"
#event queenae 		"#*#Sendaii glances to her #1# as she adjusts her footing.#*#"
#event Adds 		"#*#You hear a strange buzzing around your head, and feel as though something is creeping toward you.#*#
#event UquaKey 		"The #1# Key must unlock the door to the next room."
#Event Silence    	"#*#The air stops moving around you#*#"
#event Start            "The Performer says 'Wonderful!  Pay attention to the cues#*#"
#event Randal1          "Ol' Nilipus hailed from Misty Thicket#*#"
#event Randal2          "Where'er he smelled Jumjum he'd pick it#*#"
#event Randal3          "The halflings grew cross#*#"
#event Randal4          "When their profits were lost,#*#"
#event Seth1            "Another night, in eternal darkness.#*#"
#event Seth2            "Time bleeds like a wound that's lost all meaning.#*#"
#event Seth3            "It's a long winter in the swirling chaotic void.#*#"
#event Seth4            "This is my torture,#*#"
#event Seth5            "my pain and suffering!#*#"
#event Aelfric1         "Touched tenderly.#*#"
#event Aelfric2         "Where will you be?#*#"
#event Aelfric3         "Dreaming with me.#*#"
#event Aelfric4         "Please,#*#"
#event Britton1         "When she and I split ways,#*#"
#event Britton2         "it felt like the end of my days.#*#"
#event Britton3         "Until I suddenly,#*#"
#event Britton4         "suddenly realized#*#"
#event Britton5         "this life was better off alone.#*#"
#event fero             "You have succumbed to the ferocity of sullon#*#"
#event wrath            "Your knees tremble from the wrath of sullon#*#"
#event Exile 		"#*#being exiled#*#"
#event Corrupt 		"#*#hatch on your skin#*#"
#event king             "#*#you notice a glint#*#"
#event deepscar         "#*#boulders begin to unlodge above #1#!"
#event irissa           "#*#your view of the world changes#*#"
#event QueenAdd		"#*#You see the queen glare at you#*#"
#Event QueenAE		"#*#Queen Malarian anchors her feet to the ground and prepares to unleash a wave of burning acid#*#"
|**#Event Protype	"#*#A bolt of energy surges through you#*#"**|
#Event MMMPriest	"#*#And as for you #1#, you're the worst of the bunch. Suffer priest!"
#Event MMMBomb		"Tick, tick, tick. Target acquired! Physical translation to location of target #1# in progress. Termination of explosive duties eminent."
#Event Sleeper		"#*#You can't concentrate!#*#"
#Event UnstableCharge	"#*#An unstable charge courses through you.#*#"
#event Front            "#*#The mighty prismatic dragon prepares a terrible tail strike!#*#"
#event Back             "#*#Kerafyrm tenses for a charge that will overwhelm his foes!#*#"
#event Back             "#*#Kerafyrm exhales a blast of magical prismatic energy!#*#"
#event mindshear        "#*#You get the feeling that someone is watching you#*#"
#Event TZBOOM		"#*#Tallon Zek appears to be taking aim at this area#*#"
#Event Mindblight 	"#*#The maw in the #1# gurgles and coughs up a drop of ooze.#*#"
#Event BrektRock	"#*#A shadow passes over you#*#"
#Event BrektFeet	"#*#Lord Brekt prepares to unleash his fury on the mortals at his feet#*#"
#Event BrektDT		"#*#You are corrupted by discordant energy#*#"
#Event BeastOne		"#*#Grunkuck looks at #1# with glee!#*#"
#Event BeastTwo		"#*#Grunkuck looks at #1# with strange intent#*#"
#Event HiveGuard	"#*#The ceiling begins to crumble#*#"
#Event LCWhip		"#*#A whip wraps around your limbs!#*#"
#Event BTLight		"#*#Refracted golem light lacerates you#*#"

#Event CV2Corrupt	"#*#Seething Corruption BURNS within you, #1#!#*#"

#Event SpineFreeze	"#*#Spinerfreezer's eye all focus upon you#*#"
#Event RunAway		"#*#The Tentacle of Terror Mentor points at you#*#"
#Event CVSisterRun	"#*##1# lashes out with debilitating energy#*#"
#Event GolemAEArg	"#*#prepares for a massive strike at anyone not hidden from sight#*#"
#Event GolemSteelAdd	"#*#drops a piece of steel from its body#*#"
#Event AaryonarGaze	"Aaryonar turns a dreadful gaze upon YOU!"
#Event AaryonarGazeOff	"Aaryonar turns his gaze away from you."
#Event RTCure		"Seek out the purity stone to remove the filth that surrounds you."
#Event RTCureDone	"You have been cleansed."
#Event RTJump		"Jump from this tower as the ultimate sacrifice to Sholoth!"
#Event RTJumpDone	"You have made the proper sacrifice."
#Event RTSludge		"Your feet are stuck in a pool of sludge.#*#"

#Event ZlaAE		"Zlexak has spotted you!#*#"

Sub Event_ZlaAE
  /bc I NEED TO RUN AWAY!!!
/return

Sub Event_RTSludge
  /bc MOVE ME MAFUKKA in SLUDGE!!!
/return

Sub Event_RTCure
  /bc I NEED TO BE CURED!
  /mqp
/return

Sub Event_RTCureDone
  /bc CURED
/return

Sub Event_RTJump
  /bc I NEED TO JUMP!
/return

Sub Event_RTJumpDone
  /bc I JUMPED
/return

Sub Event_AaryonarGaze
  /declare CasterClasses string local "|DRU|CLR|SHM|ENC|NEC|MAG|WIZ|"
  
  /bc OH SHIT HE BE LOOKIN AT ME
  /if (${Target.CleanName.Equal[Aaryonar]}) {
    /melee off
    /stick off
    /face away fast
  } else /if (${CasterClasses.Find[${Me.Class.ShortName}]} && ${Target.CleanName.NotEqual[Aaryonar]}) {
    /target Aaryonar
    /delay 1s ${Target.CleanName.Equal[Aaryonar]}
    /melee off
    /stick off
    /face away fast
  }
  
  :AaryonarGaze
   /if (${Target.CleanName.Equal[Aaryonar]} && !${CasterClasses.Find[${Me.Class.ShortName}]}) {
     /doevents
     /delay 1s ${Target.ID}
     /goto :AaryonarGaze
   }
   /melee on
   /bc Gaze is off me!
/return

Sub Event_AaryonarGazeOff
  /bc He cant handle looking at my junk!
  /if (${Target.CleanName.Equal[Aaryonar]}) /target clear
/return

Sub Event_GolemSteelAdd
  |**
  /return
  /if (!${Spawn[a steel pattern].ID}) /return
  /bc Killing this mofo steel pattern!!
  /target id ${Spawn[a steel pattern].ID}
  /play SteelAdd smart reverse
  /delay 1s ${Me.Moving}
  :RunGolemAddSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :RunGolemAddSpot
  **|
/return

Sub Event_GolemAEArg
  /if (!${Spawn[Avatar of Steel].LineOfSight}) /return
  /bc I NEED to RUN AWAY!
  /target clear
  /play RunFromGolem smart
  /delay 1s ${Me.Moving}
  :RunGolemSafeSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :RunGolemSafeSpot
/return

Sub Event_CVSisterRun(string Line, string Name)
  /bc I NEED TO RUN AWAY FROM ${Name}!!
/return

Sub Event_Runaway
  /bc I NEED TO RUN AWAY!!
/return

Sub Event_Spinefreeze
  /bc I NEED TO RUN AWAY!!
/return

Sub Event_CV2Corrupt(string Line, string Name)
  /if (!${Name.Find[${Me.Name}]}) /return
  /bc I NEED to RUN AWAY!
  /target clear
  /play SeethCorrupt smart
  /delay 1s ${Me.Moving}
  :MoveCorruptSafeSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :MoveCorruptSafeSpot
  :CheckCorruptAE
   /delay 1s ${Me.Song[Seething Corruption].ID}
  /if (!${Me.Song[Seething Corruption].ID}) /goto :CheckCorruptAE
  :WaitCorruptAE
   /delay 1s !${Me.Song[Seething Corruption].ID}
  /if (${Me.Song[Seething Corruption].ID}) /goto :WaitCorruptAE
  /play RunToCorruptCamp
  /delay 1s ${Me.Moving}
  :BackToCorruptCamp
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :BackToCorruptCamp
/return

Sub Event_QueenAE
  /bc Getting away from Queen
  /if (${Spawn[Queen Malarian].Distance}>30) /return
  /return
  /target clear
  /play QueenAE smart
  /delay 2s ${Me.Moving}
  :MovingFromQueen
   /delay 2s !${AdvPath.Playing}
  /if (${AdvPath.Playing}) /goto :MovingFromQueen
/return

Sub Event_HiveGuard
  /bc I GOT CEILING EMOTE!!!
/return

Sub Event_BeastOne(line,person)
  /if (${person.Equal[${Me}]}) {
    /bc say I got beast ONE!!
    /target clear
    /play path1 smart
    /delay 1s ${Me.Moving}
    /delay 15s
    /play path1 reverse smart
    /delay 1s ${Me.Moving}
    :BackToCamp
      /delay 1s !${Me.Moving}
    /if (${Me.Moving}) /goto :BackToCamp
  }
/return

Sub Event_BeastTwo(line,person)
  /if (${person.Equal[${Me}]}) {
    /bc say I got beast TWO!!
    /target clear
    /play path1 smart
    /delay 1s ${Me.Moving}
    /delay 15s
    /play path1 reverse smart
    /delay 1s ${Me.Moving}
    :BackToCamp
     /delay 1s !${Me.Moving}
    /if (${Me.Moving}) /goto :BackToCamp
  }
/return

Sub_Event_BrekDT
  /bc Possible got the DT
  /delay 1s ${Me.Buff[Discordant Doom].ID}
  /if (${Me.Buff[Discordant Doom].ID}) /bc I NEED A CURE!!!
/return

Sub_Event_BrektFeet
  /bc GET AWAY FROM BREKT'S FEET
/return

Sub Event_BrektRock
  /bc GET AWAY FROM THE RAID NOW!!
/return

Sub Event_Mindblight(Line,Direction)
  /if (${Direction.Equal[southwest]}) {
    /if (${Spawn[npc =The Mindblight].ID}) /return
    /bc Moving NE
    /moveto loc 201 -79
    /delay 2s ${MoveTo.Moving}
    /delay 20s !${MoveTo.Moving}
    /return
  }
  /if (${Direction.Equal[northwest]}) {
    /if (${Spawn[npc =The Mindblight].ID}) /return
    /bc Moving SE
    /moveto loc 94 -86
    /delay 2s ${MoveTo.Moving}
    /delay 20s !${MoveTo.Moving}
    /return
  }
  /if (${Direction.Equal[southeast]}) {
    /if (${Spawn[npc =The Mindblight].ID}) /return
    /bc Moving NW
    /moveto loc 215 71
    /delay 2s ${MoveTo.Moving}
    /delay 20s !${MoveTo.Moving}
    /return
  }
  /if (${Direction.Equal[northeast]}) {
    /if (${Spawn[npc =The Mindblight].ID}) /return
    /bc Moving SW
    /moveto loc 92 82
    /delay 2s ${MoveTo.Moving}
    /delay 20s !${MoveTo.Moving}
    /return
  }
/return

Sub Event_TZBOOM
  /bc TZ ABOUT TO DROP THE BOMB HERE!
  /if (${Math.Distance[1166,-1148]}<${Math.Distance[1242,-1297]}) {
    /play TZW smart
    /delay 1s ${Me.Moving}
    :MoveToWestSpot
     /delay 1s !${Me.Moving}
    /if (${Me.Moving}) /goto :MoveToWestSpot
  } else {
    /play TZE smart
    /delay 1s ${Me.Moving}
    :MoveToEastSpot
     /delay 1s !${Me.Moving}
    /if (${Me.Moving}) /goto :MoveToEastSpot
  }
  /doevents flush
/return

Sub Event_Back
|   /declare MeleeList string local Bard|Ranger|Berserker|Rogue|Warrior|Paladin|ShadowKnight|Beastlord|Monk
   /if (${MeleeList.Find[${Me.Class}]}) /squelch /stick ${StickSetting} behind
   /return

Sub Event_Front
|   /declare MeleeList string local Bard|Ranger|Berserker|Rogue|Warrior|Paladin|ShadowKnight|Beastlord|Monk
   /if (${MeleeList.Find[${Me.Class}]}) /squelch /stick ${StickSetting} front
   /return
Sub Event_mindshear
  /bc i need to move away from the raid
/return

Sub Event_UnstableCharge
  /bc CHARGE ON ME...CURE!!!
/return

Sub Event_MMMUnit
  /bc SUPPORT UNIT ON ME!!
/return

Sub Event_king
/bc say I'm getting the archer emote
/return

Sub event_deepscar(line,person)
/if (${person.Equal[${Me}]}) /bc I'm getting the boulders emote!
/return

Sub Event_irissa
/bc I GOT IRISSA's DEBUFF!
/return

Sub SpeakLine
 /if (${Spawn[${Param0}].Distance}>50) /bc I need to Move Closer To ${Param0}
:speakloop
 /if (${Me.Combat}) /attack off
 /if (${Stick.Status.Equal[ON]}) /stick off
 /if (${Spawn[${Param0}].Distance}>50) {
   /delay 1s ${Spawn[${Param0}].Distance}>50
   /goto :speakloop
 } else {
   /target ${Param0}
   /delay 1s ${Target.CleanName.Equal[${Param0}]}
   /say ${Param1}
 }
/return

Sub event_Exile
  /bc I am going to get exiled!!
  /if (${Me.Buff[Dooming Exile].ID} && ${Me.AltAbilityReady[radiant cure]}) /call cast "radiant cure" alt 3s
  /if (${Me.Buff[Dooming Exile].ID}) {
    /target npc an infused crystal
    /stick 5
    /attack on
    /delay 6s !${Me.Buff[Dooming Exile].ID}
  }   
/return

Sub event_Corrupt
  /bc I am Corrupted!!
  /if (${Me.Buff[Breed of Corruption].ID} && ${Me.AltAbilityReady[radiant cure]}) /call cast "radiant cure" alt 3s
  /if (${Me.Buff[Breed of Corruption].ID}) {
    /target npc an infused crystal
    /stick 5
    /attack on
    /delay 6s !${Me.Buff[Breed of Corruption].ID}
  } 
/return

Sub event_hatchet1
  /bc I NEED TO RUN AWAY
  /declare running 		int 	local
  /declare distanceNow 		float 	local
  /declare distanceBefore 	float 	local
  /declare distanceModifier 	int 	local
  /declare MoveToID		int	local ${Spawn[Hatchet].ID}
  /declare StopDistance		int	local 200
  /declare distanceTimer 	timer 15
  /varset distanceBefore ${Spawn[${MoveToID}].Distance}
  /varset distanceModifier 1
  /varset running 0
  /stick off
  :moveAway
   /squelch /face fast away id ${MoveToID}

   /if (${Spawn[${MoveToID}].Distance}>=${StopDistance}) {
     /keypress forward
     /bc I am far from Hatchet!!!
     /return
   }   
   /if (${distanceTimer}==0) {
     /if (${Me.Sneaking         }) {
       /varset distanceModifier 2
     } else {
       /varset distanceModifier 1
     }
     /varset distanceNow ${Spawn[${MoveToID}].Distance}
     /if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
       /keypress forward
       /if (${Math.Rand[99]}>50) {
         /keypress strafe_right hold
       } else {
         /keypress strafe_left hold
       }
       /delay 1s
       /keypress strafe_right
       /keypress strafe_left
       /keypress forward hold
     }
     /varset distanceBefore ${Spawn[${MoveToID}].Distance}
     /varset distanceTimer 15
     }
      /if (${running}==0) {
        /keypress forward
        /if (${Spawn[${MoveToID}].Distance}<=${StopDistance}) {
          /varset running 1
          /keypress forward hold
        }
      } else {
        /if (${Spawn[${MoveToID}].Distance}>=${StopDistance}) {
          /varset running 0
          /keypress forward
        }
     /goto :moveAway
   }
/return

Sub event_hatchet2
  /bc I NEED TO RUN BETWEEN HIS LEGS
  /declare running 		int 	local
  /declare distanceNow 		float 	local
  /declare distanceBefore 	float 	local
  /declare distanceModifier 	int 	local
  /declare MoveToID		int	local ${Spawn[Hatchet].ID}
  /declare StopDistance		int	local 6
  /declare distanceTimer 	timer 15
  /varset distanceBefore ${Spawn[${MoveToID}].Distance}
  /varset distanceModifier 1
  /varset running 0

  :moveToSpawn
   /squelch /face fast nolook id ${MoveToID}

   /if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
     /keypress forward
     /bc I am at Hatchet!!!
     /return
   }
   /if (${distanceTimer}==0) {
     /if (${Me.Sneaking}) {
       /varset distanceModifier 2
     } else {
       /varset distanceModifier 1
     }
     /varset distanceNow ${Spawn[${MoveToID}].Distance}
     /if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
       /keypress forward
       /if (${Math.Rand[99]}>50) {
         /keypress strafe_right hold
       } else {
         /keypress strafe_left hold
       }
       /delay 1s
       /keypress strafe_right
       /keypress strafe_left
       /keypress forward hold
     }
     /varset distanceBefore ${Spawn[${MoveToID}].Distance}
     /varset distanceTimer 15
     }
      /if (${running}==0) {
        /keypress forward
        /if (${Spawn[${MoveToID}].Distance}>=${StopDistance}) {
          /varset running 1
          /keypress forward hold
        }
      } else {
        /if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
          /varset running 0
          /keypress forward
        }
   }
  /goto :moveToSpawn
/return

Sub event_hatchet3
  /bc I NEED TO DUCK
  /if (${Me.Class.Name.Equal[BARD]}) /twist off
 :TopDuck
  /if (${Me.State.NotEqual[DUCK]}) /keypress DUCK
  /doevents
  /delay 5
  /if (${Me.State.Equal[DUCK]}) /goto :TopDuck
  /if (${Me.Class.Name.Equal[BARD]}) /twist
/return

Sub event_hatchet4
  /bc RUN AWAY FROM THE NAMED!!!
  /if (${Stick.Status[ON]}) /stick off
  /mqp
/return

Sub event_hatchet5
  /bc HE IS CHARGING SOMEONE
/return

Sub event_hatchet6
  /bc DANGER IS GONE!
  /if (${Me.State.Equal[DUCK]}) /keypress DUCK
/return

sub Event_doom
  /bc I got DT!
  /if (${Spawn[Vishimtar].ID}) {
   :TargetMournful
    /target clear
    /delay 1s
    /target "mournful spirit"
    /delay 1s ${Target.Name.Find[mournful]}
    /face fast
    :WaitForCure
     /delay 5
     /if (!${Target.Name.Find[mournful]}) /goto :TargetMournful
     /if (${Target.Distance}>10) /goto :WaitForCure
    /docommand /say Shoulder my burden
  }
/return

Sub Event_GazeYou
/if (!${Spawn[npc "overlord mata muram"].ID}) /return
  /declare OldItem string local
 
  /popup CLICK ON THE MASK!
  /bc I GOT MASK EMOTE!
 
  /if ( ${Me.Casting.ID} ) /stopcast
  /if (${Me.Inventory[face].Name.NotEqual[Mirrored Mask]}) {
    /varset OldItem ${Me.Inventory[face].Name}
    /exchange "Mirrored Mask" face
    /delay 1
    /call Cast "mirrored mask" item 3s
    /exchange "${OldItem}" face
  } else {
    /call Cast "${Me.Inventory[face].Name}" item 3s
  }
/return

Sub Event_smotherdecay
  /bc I'm snared/slow i need to click on the blue crystal
/return

Sub Event_curseofthefirstborn
  /bc My stats are deduced. i need to click on the yellow crystal.
/return

Sub Event_presentofthefirstborn
  /bc I'm silenced. I need to click on the red crystal
/return

Sub Event_plagueofmana
  /bc I have the 3k dot on me. I need to click on the green crystal.
/return

Sub Event_Silence
  /bc i'm silenced!
/return

Sub Event_Adds
  /bc The adds are going to spawn right on top of me!
/return

Sub Event_UquaKey(string line,string key)
  /bc ${key}
/return

Sub Event_queenlocation
  /bc Queen is heading right for me
/return

Sub Event_queenae(string line, string Direction)
  /bc Sendaii is going to AE ${Direction}
/return

Sub Event_Randal1
  /call SpeakLine "Randal Reedsea" "Where'er he smelled Jumjum he'd pick it."
/return

Sub Event_Randal2
  /call SpeakLine "Randal Reedsea" "The halflings grew cross"
/return

Sub Event_Randal3
  /call SpeakLine "Randal Reedsea" "When their profits were lost,"
/return

Sub Event_Randal4
  /call SpeakLine "Randal Reedsea" "screamin', 'Where is that brownie? I'll kick it!'"
/return

Sub Event_Seth1
  /call SpeakLine "Seth Kimble" "Time bleeds like a wound that's lost all meaning."
/return

Sub Event_Seth2
  /call SpeakLine "Seth Kimble" "It's a long winter in the swirling chaotic void."
/return

Sub Event_Seth3
  /call SpeakLine "Seth Kimble" "This is my torture,"
/return

Sub Event_Seth4
  /call SpeakLine "Seth Kimble" "my pain and suffering!"
/return

Sub Event_Seth5
  /call SpeakLine "Seth Kimble" "Pinch me, O'Death. . ."
/return

Sub Event_Aelfric1
  /call SpeakLine "Aelfric the Flautist" "Where will you be?"
/return

Sub Event_Aelfric2
  /call SpeakLine "Aelfric the Flautist" "Dreaming with me."
/return

Sub Event_Aelfric3
  /call SpeakLine "Aelfric the Flautist" "Please,"
/return

Sub Event_Aelfric4
  /call SpeakLine "Aelfric the Flautist" "everybody, hear the music."
/return

Sub Event_Britton1
  /call SpeakLine "Britton Harmony" "it felt like the end of my days."
/return

Sub Event_Britton2
  /call SpeakLine "Britton Harmony" "Until I suddenly,"
/return

Sub Event_Britton3
  /call SpeakLine "Britton Harmony" "Suddenly realized"
/return

Sub Event_Britton4
  /call SpeakLine "Britton Harmony" "this life was better off alone."
/return

Sub Event_Britton5
  /call SpeakLine "Britton Harmony" "Solitude was the best gift you ever gave me."
/return

sub Event_Start
  /echo  The Performer Event Started
  /bc The Performer Event Started
/return

Sub Event_fero
/bc i have fero i need to get away from the raid!
/return

Sub Event_wrath
/bc i have wrath. i need to get away from the raid!
/return

Sub Event_QueenAdd
  /bc I NEED to RUN AWAY!
  /target clear
  /play QueenAdd smart
  /delay 1s ${Me.Moving}
  :MoveToQueenSafeSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :MoveToQueenSafeSpot
  :CheckQueenAE
   /delay 1s ${Me.Buff[Wave of Infestation].ID}
  /if (!${Me.Buff[Wave of Infestation].ID}) /goto :CheckQueenAE
  :CureQueenAE
   /delay 1s !${Me.Buff[Wave of Infestation].ID}
  /if (${Me.Buff[Wave of Infestation].ID}) /goto :CureQueenAE
  /play RunToQueenCamp
  /delay 1s ${Me.Moving}
  :BackToQueenCamp
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :BackToQueenCamp
/return

Sub Event_QueenAE
  /bc Getting away from Queen
  /if (${Spawn[Queen Malarian].Distance}>30) /return
  /return
  /target clear
  /play QueenAE smart
  /delay 2s ${Me.Moving}
  :MovingFromQueen
   /delay 2s !${AdvPath.Playing}
  /if (${AdvPath.Playing}) /goto :MovingFromQueen
/return

Sub Event_Protype
  /bc I NEED to RUN AWAY!
  /target clear
  /play ProtypeAE smart
  /delay 1s ${Me.Moving}
  :MoveToProtypeSafeSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :MoveToProtypeSafeSpot
  :CureProtypeAE
   /delay 1s !${Me.Buff[Zot].ID}
  /if (${Me.Buff[Zot].ID}) /goto :CureProtypeAE
  /play RunToProtypeCamp
  /delay 1s ${Me.Moving}
  :BackToProtypeCamp
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :BackToProtypeCamp
/return

Sub Event_MMMPriest(string Line, string Name)
  /if (${Name.Equal[${Me.Name}]}) /bc I have to CURE MYSELF!!!
/return

Sub Event_MMMBomb(string Line, string Name)
  /bc BOMB!!! ${Name}
  /if (${Name.Equal[${Me.Name}]}) /bc I have the BOMB!!!
/return

Sub Event_Sleeper
  /echo I got STUNNED!!!!!!
  /if (!${Defined[SleeperCastTimer]}) {
    /declare SleeperCastTimer int outer ${Macro.RunTime}
    /echo Declaring SleeperCastTimer at 10s
  } else {
    /varset SleeperCastTimer ${Math.Calc[${Macro.RunTime}+10]}
    /echo Reseting SleeperCastTimer at 10s
  }
/return

Sub Event_LCWhip
  /bc I NEED to RUN AWAY!
  /target clear
  /play LCWhip smart
  /delay 1s ${Me.Moving}
  :MoveToLCSafeSpot
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :MoveToLCSafeSpot
  :CheckLCAE
   /delay 1s ${Me.Buff[Bullwhip Grab].ID}
  /if (!${Me.Buff[Bullwhip Grab].ID}) /goto :CheckLCAE
  :CureLCAE
   /delay 1s !${Me.Buff[Bullwhip Grab].ID}
  /if (${Me.Buff[Bullwhip Grab].ID}) /goto :CureLCAE
  /play LCWhip reverse smart
  /delay 1s ${Me.Moving}
  :BackToLCCamp
   /delay 1s !${Me.Moving}
  /if (${Me.Moving}) /goto :BackToLCCamp
/return

Sub Event_BTLight
  /bc I HAVE THE LIGHT ON ME!!! OMG MOVE!!!
/return

General2.inc

Code:
#event IRC             	"<#1#> #2#"
#event IRC             	"[#1#(msg)] #2#"
#Event IRC		"#1# tells you, '#2#'"
#event ExcludeMob      	"[MQ2] exclude: #1#"
#event NamedMob        	"[MQ2] named: #1#"
#event SetVar 		"[MQ2] set: #1# #2# #3#"
#event MezzImmuneMob   	"[MQ2] MezzImmune: #1#"
#event RangeMob   	"[MQ2] RangeMob: #1#"
#event Zone            	"You have entered #1#."
#event Zone            	"LOADING, PLEASE WAIT..."
#event SetVar "[MQ2] set: #1# #2# #3#"

Sub GeneralDeclares2
   /declare BalanceHPCheck int    outer 6
   /call DeclareVar MacroState     	string 	outer MULL
   /call DeclareVar ExcludeList    	string 	outer NULL
   /call DeclareVar MezzImmuneList 	string 	outer NULL
   /call DeclareVar NameList       	string 	outer NULL
   /call DeclareVar LeashTag       	int    	outer NULL
   /call DeclareVar stakeX         	int    	outer ${Me.X}
   /call DeclareVar stakeY         	int    	outer ${Me.Y}
   /call DeclareVar following		int    	outer 0
   /call DeclareVar MaID           	int    	outer NULL
   /call DeclareVar MATarget       	int    	outer 0
   /call DeclareVar currentY       	float  	outer NULL
   /call DeclareVar currentX       	float  	outer NULL
   /call DeclareVar ExcludeIni     	string 	outer Gen_ignore.ini
   /call DeclareVar MezzImmuneIni  	string 	outer Gen_MezzImmune.ini
   /call DeclareVar NameIni        	string 	outer Gen_Names.ini
   /call DeclareVar RangeMobsIni   	string 	outer Gen_Rangemobs.ini
   /call DeclareVar RangeMobList   	string 	outer
   /call DeclareVar currentZone    	int    	outer ${Zone.ID}
   /call DeclareVar BuffList       	string 	outer Enchanter|Shaman|Cleric|Druid|Magician
   /call DeclareVar CureList       	string 	outer Shaman|Cleric|Druid
   /call DeclareVar MeleeList      	string 	outer Warrior|Rogue|Beastlord|Monk|Shadowknight|Paladin|Berserker|Bard|Ranger
   /call DeclareVar CanCast		string 	outer Bard|Beastlord|Shadowknight|Paladin|Ranger|Cleric|Druid|Shaman|Enchanter|Wizard|Necromancer|Magician
   /call DeclareVar CheckExpTimer  	timer  	outer 0
   /call DeclareVar GiftOfMana     	string 	outer "Gift of Amazing Exquisite Radiant Mana"
   /call DeclareVar UseAdvPath		int 	outer 1

   /call DeclareIniVar BalanceHP     	int    	Settings 0 	/balance Settings
   /call DeclareIniVar DoLeash       	int 	Settings 1 	/leash Settings
   /call DeclareIniVar DoLeashToon     	int 	Settings 0 	/ltoon Settings
   /call DeclareIniVar DoLeashToonName 	string 	Settings [NULL]	/lperson Settings
   /call DeclareIniVar leashlength   	int 	Settings 50 	/leashlength Settings
   /call DeclareIniVar AutoExpAdjust 	int 	Settings 0 	/autoadjustexp Settings
   /call DeclareIniVar MaintExpLvl   	int 	Settings 20 	/maintexplvl Settings
   /call DeclareIniVar MaxLevel      	int 	Settings 100 	/MaxLevel Settings
   /call DeclareIniVar MasterList    	string 	Settings ""
   /call DeclareIniVar autosit       	int    	Settings 1 	/autosit Settings

   /declare RaidBuffList   string outer |Beastlord|Paladin|Ranger|Cleric|Druid|Shaman|Enchanter|Wizard|
   
   /squelch /alias /exclude 	/echo exclude:
   /squelch /alias /named 	/echo named:
   /squelch /alias /MezzImmune 	/echo MezzImmune:
   /squelch /alias /rmob 	/echo RangeMob:
   
   /varset ExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
   /varset MezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
   /varset NameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
   /varset RangeMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
  /echo $${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
  /echo ${RangeMobList}
/return

Sub DeclareVar(string sName, string sType, string sScope, string sSetting)
  /if (!${Defined[${sName}]}) {
    /declare ${sName} ${sType} ${sScope}
    /if (${sSetting.NotEqual[NULL]}) /varset ${sName} ${sSetting}
  }
/return

Sub DoLeashPerson
  /declare lsLeashToon string local
  /declare a int local

  /if (${DoLeashToonName.Find[[]}>1) /varset DoLeashToonName ${DoLeashToonName.Right[-${Math.Calc[${DoLeashToonName.Find[[]}-1]}]}

  /for a 1 to ${DoLeashToonName.Count[[]}
    /varset lsLeashToon ${DoLeashToonName.Arg[${a},[].Left[-1]}
    /if (${Spawn[${lsLeashToon}].ID} && ${Spawn[${lsLeashToon}].LineOfSight}) {
      /goto :FollowToon
    }
  /next a

  :FollowToon
   /if (${Me.Dead}) /return
   /if (${lsLeashToon.NotEqual[NULL]} && ${Spawn[pc ${lsLeashToon}].ID} && ${Spawn[pc ${lsLeashToon}].Distance}>25 && !${Spawn[pc ${lsLeashToon}].Dead}) {
     /target id ${Spawn[pc ${lsLeashToon}].ID}
     /delay 1s ${Target.CleanName.Equal[${lsLeashToon}]}
     /face fast
     /squelch /stick 8
     /delay 2s ${Spawn[pc ${lsLeashToon}].Distance}<10
     /squelch /stick off
     /if (${Spawn[pc ${lsLeashToon}].Distance}<25) /target clear
   } else /if (!${Spawn[pc ${lsLeashToon}].ID} || ${Spawn[pc ${lsLeashToon}].Dead}) {
     |BLANK
   }
/return

Sub CastDebuff(MySpell,MySpellType,Int MyTarget,MyTimer,MyTimerLength)
  /call CastSpell "${MySpell}" ${MySpellType} ${MyTarget}
  /if (${castReturn.Equal[CAST_SUCCESS]} || ${castReturn.Equal[CAST_NOHOLD]}) {
    /call CreateTimer ${MyTimer}
    /varset ${MyTimer} ${MyTimerLength}
  }
/return

Sub AutoBalance
/varset MacroState Autobalance
/if (!${Defined[Balanced]}) /declare Balanced bool outer TRUE
/if (!${Defined[IniLoaded]}) /declare IniLoaded bool outer FALSE
/if (!${Defined[NameCount]}) /declare NameCount int outer ${Ini[af_balance.ini,Mobs,NameCount]}
/declare Mobs[${NameCount}] string local
/declare x int local
/declare b int local 0
/declare lowesthp int local 100
/declare lowestmob int local
/declare MyTarget  int local
|Load the entire ini into Memory
/if (!${IniLoaded}) {
	/for x 1 to ${NameCount}
		/varset Mobs[${x}] ${Ini[af_balance.ini,Mobs,Name${x}]}
		/varset IniLoaded TRUE
/next x
}
|Find how many are in the zone to balance and set them to a variable.
/for x 1 to ${NameCount}
	/if (${Spawn[npc =${Mobs[${x}]}].ID} && !${Defined[BalanceMob${Math.Calc[${b}+1].Int}]}) { 
			/declare BalanceMob${Math.Calc[${b}+1].Int} int outer ${Spawn[npc =${Mobs[${x}]}].ID}
			/varcalc b ${b}+1
			} else /if (${Defined[BalanceMob${Math.Calc[${b}+1].Int}]}) {
				/varcalc b ${b}+1
			}
/next x
/if (${b} <= 1) /return
|Let's Find the NPC that has the lowest Health and which mob we're currently on.
/for x 1 to ${b}
/if (${Spawn[npc id ${BalanceMob${x}}].PctHPs} < ${lowesthp}) /varset lowestmob ${BalanceMob${x}} 
/if (${Target.ID} == ${BalanceMob${x}}) /varset MyTarget ${BalanceMob${x}}
/next x
|If we're on the lowest mob then let's make sure the others are caught up if not stop. 
|If we're not on the lowest mob then let's continue until we're the lowest mob and it's unbalanced.
/if (${MyTarget} == ${lowestmob}) {
	/for x 1 to ${b}
	/if (${BalanceMob${x}} == ${MyTarget}) /next x
	/if (${Math.Abs[${Math.Calc[${Spawn[npc id ${BalanceMob${x}}].PctHPs} - ${Spawn[npc id ${MyTarget}].PctHPs}]} >= ${AutoBalanceHPCheck}]}) {
		/varset Balanced FALSE
		/return
		}
/next x
} 
|If we got here then all mobs are balanced or you need to catch up with the rest.
/varset Balanced TRUE
/return

Sub AutoAdjustExp
  /varset CheckExpTimer 60s
  /if (${Me.Level}<${MaxLevel} || (${Me.Level}==${MaxLevel} && ${Me.PctExp}<=${MaintExpLvl})) {
    /alt off
  } else /if (${Me.Level}==${MaxLevel} && ${Me.PctExp}>=${MaintExpLvl}) {
    /alt on 100
  }
/return

Sub RaidBuff
  /varset MacroState RaidBuff
  /declare i int local
  /declare x int local

  /if (${Raid.Members} && ${Me.PctMana} > 10) {
    /for i 1 to ${Raid.Members}
      /if (${Spawn[${Raid.Member[${i}].Name}].ID}) {
        /for x 1 to ${RaidBuffTotal}
          /if (!${RaidBuff${x}${Spawn[${Raid.Member[${i}].Name}].ID}} && ${RaidBuffClass${x}.Find[${Spawn[${Raid.Member[${i}].Name}].Class.Name}]} && ${Spawn[${Raid.Member[${i}].Name}].Type.Equal[pc]} && ${Spawn[${Raid.Member[${i}].Name}].Distance} < 200 && ${Me.PctMana}>=10) {
            /if (!${Me.Gem[${RaidBuffCast${x}}]}) /call MemSpell "${RaidBuffCast${x}}" ${BuffGem}
            /if (!${Me.SpellReady[${RaidBuffCast${x}}]}) /return
            /if (${Stick.Active}) /squelch /stick pause
            /target ID ${Spawn[${Raid.Member[${i}].Name}].ID}
            /delay 3 ${Target.CleanName.Equal[${Raid.Member[${i}].Name}]}
            /delay 3s ${Target.BuffCount}
            /if (${Target.Buff[${RaidBuff${x}}].ID} || ${Target.Buff[${RaidBuff${x}} rk. ii].ID} || ${Target.Buff[${RaidBuff${x}} rk. iii].ID}) {
              /call CreateTimer RaidBuff${x}${Spawn[${Raid.Member[${i}].Name}].ID} ${Spell[${RaidBuff${x}}].Duration.TotalSeconds}s
              /next x
            } else {
              /call CastSpell "${RaidBuffCast${x}}" ${BuffGem} ${Spawn[${Raid.Member[${i}].Name}].ID}
              /if (${castReturn.Equal[CAST_SUCCESS]} || ${castReturn.Equal[CAST_NOHOLD]}) /call CreateTimer RaidBuff${x}${Spawn[${Raid.Member[${i}].Name}].ID} ${Spell[${RaidBuff${x}}].Duration.TotalSeconds}s
              /return
            }
            :skip
          }
        /next x
      }
    /next i
  }

  /call CreateTimer RaidBuffTimer 45s
/return

Sub Rod
  /declare x int local
  /declare AmountOfRods int local ${RodList.Count[|]}
  /for x 1 to ${AmountOfRods}
    /If (!${FindItem[${RodList.Arg[${x},|]}].Timer} && ${Me.PctMana}<=80 && ${Me.PctHPs}>=54 && ${FindItem[${RodList.Arg[${x},|]}].ID}) {
      /call CastItemClicky "${FindItem[${RodList.Arg[${x},|]}].Name}"
      /return
    }
  /next x
/return

Sub CheckBuffies(string MySub)
  /declare a int local
  /for a 1 to ${NumSelfBuff}
    /if ( ${selfBuff${a}.NotEqual[NULL]} && ${SelfType${a}.Equal[item]} && ${FindItem[=${selfBuff${a}}].ID} && ${Me.Buff[${FindItem[=${selfBuff${a}}].Spell.Name}].Duration}<4 && !${FindItem[=${selfBuff${a}}].Timer}) {
      /if (!${Spell[${FindItem[=${selfBuff${a}}].Spell.Name}].Stacks[2]}) /goto :SkipBuff
      /call CastItemClicky "${selfBuff${a}}"
    } else /if ( ${Me.Book[${selfBuff${a}}]} && ${SelfType${a}.Find[gem]} && ${selfBuff${a}.NotEqual[NULL]} && ${Spell[${selfBuff${a}}].Mana} < ${Me.CurrentMana} && !${Me.Class.Name.Equal[bard]} ) {
      /if ( !${Me.Buff[${selfBuffToCheck${a}}].ID} || ${Me.Buff[${selfBuffToCheck${a}}].Duration} < 4 ) {
        /if (!${Spell[${selfBuff${a}}].Stacks[2]}) /goto :SkipBuff
        /if (!${Me.Gem[${selfBuff${a}}]})  /call MemSpell "${selfBuff${a}}" ${SelfType${a}}
        /if (${Me.SpellReady[${selfBuff${a}}]}) {
          /if (${Spell[${selfBuff${a}}].TargetType.Find[Single]}) /target myself
          /if (${Bool[${MySub}]}) /call Cast "${selfBuff${a}}" "${SelfType${a}}" 0 ${MySub}
          /if (!${Bool[${MySub}]}) /call Cast "${selfBuff${a}}" "${SelfType${a}}" 0
          /return
        }
      }
    }
    :SkipBuff
  /next a
  /if (${Cursor.ID}) /autoinventory
  /if (${Window[Itemdisplaywindow].Open}) /squelch /windowstate itemdisplaywindow close
  /call CheckItems
/return

Sub Leash
  /if (${DoLeashToon} || ${Me.Dead}) /return
  /varset MacroState Leash
  /doevents
  /if (${Stick.Status.Equal[ON]}) /squelch stick off
  /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${leashlength} && ${currentZone} == ${Zone.ID}) {
   :FollowingLoop1
    /doevents
    /delay 1
    /if (${Me.Dead}) /return
    /varset currentX ${Me.X}
    /varset currentY ${Me.Y}
    /squelch /face fast nolook loc ${stakeY},${stakeX}
    /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>10) {
      /keypress forward hold
      /delay 2
      /if ((${Me.X}==${currentX}) && (${Me.Y}==${currentY})) /call Obstacle
    }
    /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<=10) /keypress back
    /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>10) {
      /goto :FollowingLoop1
    } else {
      /keypress forward
      /keypress back
      /squelch /face fast nolook loc ${stakeY},${stakeX}
      }
    }
  }
/return

Sub Obstacle
   /varset MacroState Obstacle
   /doevents
   /keypress forward
   /keypress back hold
   /delay 3
   /keypress back
   /if (${Math.Rand[100]}+1>50) {
      /keypress strafe_right hold
   } else {
      /keypress strafe_left hold
   }
   /delay 5
   /keypress strafe_right
   /keypress strafe_left
   /keypress forward hold
   /keypress jump
   /return

Sub MoveToTornado
/varset MacroState MoveToTornado
   /moveto loc ${Spawn[Tempest of Vyskudra].Y} ${Spawn[Tempest of Vyskudra].X}
   /if (${DoLeash}) {
      /varset stakeX ${Me.X}
      /varset stakeY ${Me.Y}
      }   
   /return

Sub SetLeash
   /varset MacroState SetLeash
   /varset DoLeash 1
   /varset stakeX ${Me.X}
   /varset stakeY ${Me.Y}
   /varset currentZone ${Zone.ID}
/return

Sub StopLeash
  /varset MacroState StopLeash
  /varset DoLeash 0
/return

Sub Event_Zone
   /if ( ${MA.NotEqual[Somebody]} && ${Spawn[pc ${MA}].ID} ) {
      /varset MaID ${Spawn[pc ${MA}].ID}
   } else {
      /varset MaID ${Target.ID}
   }
   /if (${Defined[mobList]}) /call ClearMobList
   /if (${Defined[addList]}) /varset addList
   /if (${Defined[buffQueue]}) /varset buffQueue
   /if (${Defined[mobID]}) /varset mobID 0
   /if (${Defined[petID]}) /varset petID 0
   /if (${Defined[petID2]}) /varset petID2 0
   /varset currentZone ${Zone.ID} 
   /varset DoLeash 0
   /varset LeashTag 0
   /varset stakeX ${Me.X}
   /varset stakeY ${Me.Y}
   /varset ExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
   /if (${ExcludeList.Equal[NULL]}) {
      /ini "${ExcludeIni}" "${Zone.ShortName}" "Exclude" "|"
      /varset ExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
      /echo ExcludeList: ${ExcludeList}
   } else {
      /varset ExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
      /echo ExcludeList: ${ExcludeList}
   }
   /varset MezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
   /if (${MezzImmuneList.Equal[NULL]}) {
      /ini "${MezzImmuneIni}" "${Zone.ShortName}" "MezzImmune" "|"
      /varset MezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
      /echo MezzImmuneList: ${MezzImmuneList}
   } else {
      /varset MezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
      /echo MezzImmuneList: ${MezzImmuneList}
   }
   /varset NameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
   /if (${NameList.Equal[NULL]}) {
      /ini "${NameIni}" "${Zone.ShortName}" "Name" "|"
      /varset NameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
      /echo NameList: ${NameList}
   } else {
      /varset NameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
      /echo NameList: ${NameList}
   }
   /varset RangeMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
    /if (${RangeMobList.Equal[NULL]}) {
      /ini "${RangeMobsIni}" "${Zone.ShortName}" "Name" "|"
      /varset RangeMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
      /echo RangeMobList: ${RangeMobList}
   } else {
      /varset RangeMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
      /echo RangeMobList: ${RangeMobList}
   }
/return

Sub Follow(string line,string sender,string name)
  /varset MacroState Follow
  /if (${sender.Equal[${Me.Name}]} ) /return
  /if (!${Spawn[${sender}].ID}) {
     /e ${Sender} is not in zone for me to follow!
     /return
  }
  /if (${Me.Class.ShortName.Equal[BRD]}) {
    /twist 12 once
  }
  /if (${DoLeash}) {
    /varset DoLeash 0
    /varset LeashTag 1 |** this lets us know leash was active prior to a follow command **|
  }
  /varset following 1
  /if (${AdvPath.Active} && ${UseAdvPath}) /goto :advpath
  :targetfoll
   /if (${Me.Dead}) /return
   /target pc ${sender}
   /delay 1s ${Target.Name.Equal[${sender}]}
   /if (!${Me.Standing}) {
     /stand
   }
   /if (${Target.Name.Equal[${sender}]}) {
     /goto :Loop
    } else {
     /goto :targetfoll
     :Loop
      /if (${Me.Dead}) /return
      /varset currentX ${Me.X}
      /varset currentY ${Me.Y}
       /face fast
      /if (${Target.Distance}>10) /keypress forward hold
      /if (${Target.Distance}<9) /keypress back
      /if (!${Target.ID}) /varset following 0
      /doevents
      /delay 2
      /if (${Target.Distance}>25) {
        /keypress forward hold
        /delay 2
        /if ((${Me.X}==${currentX}) && (${Me.Y}==${currentY})) /call Obstacle
      } 
      /if ((${Target.Name.Equal[${sender}]})&&(${following}>0)) {
         /goto :Loop
      } else {
        /keypress forward
        /keypress back
        /return
      }
   }

  :advpath
   /target pc ${sender}
   /delay 1s ${Target.Name.Equal[${sender}]}
   :loop2
    /if (${Me.Dead}) /return
    /if (!${AdvPath.Following}) /squelch /afollow
    /doevents
    /if (!${Target.ID}) /varset following 0
    /if (${Target.Name.Equal[${sender}]} && ${following}>0) /goto :loop2
/return

Sub Stop
   /varset following 0
   /if (${AdvPath.Following}) {
      /squelch /afollow off
      /keypress forward
      /keypress back
   }
   /target clear
    /varset stakeX ${Me.X}
    /varset stakeY ${Me.Y}
 |  /if (${LeashTag}) /varset DoLeash 1 
/return

Sub CreateTimer(string asMyTimer, string asTime)
  |/echo Trying to do something with a Timer
  /if (!${Defined[${asMyTimer}]}) {
    |/echo Declaring timer ${asMyTimer} with ${asTime}
    /declare ${asMyTimer} timer outer ${asTime}
  } else {
    |/echo Updating ${asMyTimer} to ${asTime}
    /varset ${asMyTimer} ${asTime}
  }
/return

Sub Event_IRC(string ChatType,string Sender,string ChatText,string Extra)
   /if (${MasterList.Find[${Sender}]} && ${ChatText.Left[1].Equal[/]}) /docommand ${ChatText} 
   /if (${ChatText.Equal[follow]}) /call Follow  "tell" "${Sender}" "${ChatText}"
   /if (${ChatText.Equal[stop]}) {
   	/call Stop "tell" "${Sender}" "{$ChatText}"
   	/return
  }
  /if (${ChatText.Equal[capture]} && !${FindItem[epositrig].Timer}) /call cast "Epositrig" Item 0
   /if (${ChatText.Equal[leash]}) /call SetLeash
   /if (${ChatText.Equal[stopleash]}) /call StopLeash
   /if (${ChatText.Equal[come]} && ${MeleeList.Find[${Me.Class.Name}]}) /call Follow "tell" "${Sender}" "${ChatText}"
   /if (${ChatText.Equal[clear]} && ${MasterList.Find[${Sender}]} && ${MeleeList.Find[${Me.Class.Name}]}) /multiline ; /target clear; /varset dispelled 0; /varset Snared 0; /varset CurrentTarget 0
   /if (${ChatText.Equal[clear]} && ${Me.Class.Name.Equal[Necromancer]} || ${ChatText.Equal[clear]} && ${Me.Class.Name.Equal[Wizard]}) /target clear
   /if (${ChatText.Equal[blunt]} && ${MeleeList.Find[${Me.Class.Name}]}) /bandolier activate blunt
   /if (${ChatText.Equal[dps]} && ${MeleeList.Find[${Me.Class.Name}]}) /bandolier activate dps
   /if (${ChatText.Equal[Invis]} && ${Me.AltAbilityReady[Group Perfect Invisibility]}) {
   	/alt activate 1210
   	/delay 1s
  }
   /if (${ChatText.Equal[charm]} && ${Me.Class.Name.Equal[Enchanter]}) {
      /squelch /assist ${chatSender}
      /delay 5s ${Target.ID}
      /if (${Target.ID}) {
         /call cast  "${charmSpell}" gem10 3s
         /return
      }
   }
   /if (${ChatText.Find[pick up]} && ${MasterList.Find[${Sender}]}) {
     /if (!${FindItem[${ChatText.Right[-8]}].ID}) {
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /declare PickUpTimer timer local 31s
       /declare lookangle int local
       :GetGroundItem
        /itemtarget
        /delay 1s ${Ground.ID}

        /if (${Ground.Distance}>40) {
          /bc Item is to far away.
          /return
        } else /if (${Ground.Distance}<40) {
          :KeepMovingToGround
           /face loc ${Ground.Y}, ${Ground.X} 
           /delay 1 
           /keypress forward hold 
           /if (${Ground.Distance}>10) /goto :KeepMovingToGround
           :StopMovingToGround
            /keypress forward 
        }

        /face item nolook
        /delay 5
        /look -128
        /click left center
        /if (!${Cursor.ID}) {
         :GroundClickLoop
          /click left center
          /if (${Target.ID}) /target clear
          /if (!${Cursor.ID} && ${Me.Look}<0) {
            /varcalc lookangle ${Me.Look}+2
            /look ${lookangle}
            /goto :GroundClickLoop
          }
        }
        /if (!${PickUpTimer}) {
          /bc ran out of time tell me to pick up the item again!
          /return
        }
       /if (!${Cursor.Name.Equal[${ChatText.Right[-8]}]}) /goto :GetGroundItem
       /autoinventory
       /delay 1s !${Cursor.ID}
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress esc
       /keypress back hold
       /delay 2
       /keypress back
     } else {
       /if ( ${Ground.Distance} < 8 ) {
         /keypress back hold
         /delay 2
         /keypress back
       }
     }
   }
   /if (${ChatText.Arg[1, ].Equal[ma]} && ${MeleeList.Find[${Me.Class.Name}]}) {
      /echo Changing MA to ${ChatText.Arg[2, ]}
      /varset MainAssist ${ChatText.Arg[2, ]}
   }
   /if (${ChatText.Equal[attack]} && ${MeleeList.Find[${Me.Class.Name}]}) {
      /multiline ; /killthis; /varset validTarget 1; /varset CurrentTarget ${Target.ID}
      /call KillTarget
      /return
   }
   /if (${ChatText.Find[Buff]} && ${BuffList.Find[${Me.Class.Name}]}) {
      /if (${ChatText.Arg[5, ].NotEqual[NULL]}) {
         /call CheckDoBuffs "${ChatText.Arg[2, ]}" "${ChatText.Arg[3, ]} ${ChatText.Arg[4, ]} ${ChatText.Arg[5, ]}"
         /return
      }
      /if (${ChatText.Arg[4, ].NotEqual[NULL]}) {
         /call CheckDoBuffs "${ChatText.Arg[2, ]}" "${ChatText.Arg[3, ]} ${ChatText.Arg[4, ]}"
         /return
      }
      /call CheckDoBuffs "${ChatText.Arg[2, ]}" "${ChatText.Arg[3, ]}"   
      /return
    }
   /if (${DoBuffTotal} && ${Sender.NotEqual[${Me.CleanName}]} && ${Spawn[pc ${Sender}].ID} && ${BuffList.Find[${Me.Class.Name}]}) {
     /call CheckDoBuffs "${Sender}" "${ChatText}"
   }
   /if (${ChatText.Find[cure curse]} && ${CureList.Find[${Me.Class.Name}]}) {
      /target ${ChatText.Arg[3, ]}
      /call cast "${CurseSpell}" gem10 0s CheckHP2
      /return
   }
   /if (${ChatText.Find[cure poison]} && ${CureList.Find[${Me.Class.Name}]}) {
      /target ${ChatText.Arg[3, ]}
      /call cast "${{PoisonSpell}" gem10 0s CheckHP2
      /return
   }
   /if (${ChatText.Find[cure disease]} && ${CureList.Find[${Me.Class.Name}]}) {
      /target ${ChatText.Arg[3, ]}
      /call cast "${DiseaseSpell}" gem10 0s CheckHP2
      /return
   }
   /if (${ChatText.Find[cure cor]} && ${CureList.Find[${Me.Class.Name}]}) {
      /target ${ChatText.Arg[3, ]}
      /call cast "${CorruptSpell}" gem10 0s CheckHP2
      /return
   }
   /if (${ChatText.Equal[rezzme]} && ${Me.Class.Name.Equal[cleric]}) {
      /keypress back
      /target ${Sender}'s Corpse
      /delay 3
      /if (${Target.Type.Equal[corpse]}) {
         /corpse
         /delay 3         
         /call Cast "blessing of resurrection" alt 3s CheckHP2
      }
   }
   /if (${Sender.Equal[${Me}]}) /return
   /if (${ChatText.Equal[patch me]} && ${Me.Class.Name.Equal[cleric]}) {
      /call FindExactPC ${Sender}
      /if (${Macro.Return.NotEqual[TARGET_SUCCESS]}) /return
      /if (${Target.Distance}<=${patchhealrange}) {
         /if (${announce}==1) /g Casting ${patchheal} on %T
         /call Cast "${patchheal}" gem10  2s
         /delay 15 ${Me.SpellReady[${patchheal}]}
      } else /tell ${Sender} you're OOR
   }
 
   /if (${ChatText.Equal[rc]} && ${CureList.Find[${Me.Class.Name}]}) {
      /if (${Me.AltAbilityReady[radiant cure]}) /call Cast "radiant cure" alt
   }
   /if (${ChatText.Equal[port]} && ${FindItem[fellowship registration insignia].ID}) /call cast "fellowship registration insignia" item 1s
   /if (${ChatText.Arg[1, ].Equal[tank]} && ${Me.Class.Name.Equal[cleric]}) {
      /echo Changing Tank to ${ChatText.Arg[2, ]}
      /varset tankname ${ChatText.Arg[2, ]}
      /target ${ChatText.Arg[2, ]}
      /varset tanknameid ${Target.ID}
      /varset tankclass ${Target.Class.Name}
   }
   /if (${ChatText.Arg[1, ].Equal[ma]}) {
      /echo Changing MA to ${ChatText.Arg[2, ]}
      /if (${Defined[MainAssist]}) /varset MainAssist ${ChatText.Arg[2, ]}
   }
   /if (${ChatText.Equal[mgb dmf]} && ${Me.AltAbilityReady[Mass Group Buff]} && ${Me.Class.Name.Equal[Necromancer]}) {
     /call cast "Mass group Buff" alt
     /call cast "Dead Men Floating" gem10 3s
   }
   /if (${ChatText.Equal[take rez]}) {
     /if (${Me.Dead}) {
       /call wait4rez
     } else /if (${Zone.ShortName.Equal[GuildLobby]}) {
       /if (${Window[LargeDialogWindow].Open}) /notify LargeDialogWindow LDW_YesButton leftmouseup
       /if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup 
     }
   }
   /return

Sub Event_ExcludeMob(string line,string MobName)
   /declare CurrentExcludeList string local
   /varset CurrentExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
   /if (${CurrentExcludeList.Find[NULL]}) {
      /ini "${ExcludeIni}" "${Zone.ShortName}" "Exclude" "${MobName}"
      /varset CurrentExcludeList ${MobName}
   } else /if (!${CurrentExcludeList.Find[${MobName}]}) {
      /ini "${ExcludeIni}" "${Zone.ShortName}" "Exclude" "${ExcludeList}${MobName}|"
      /varset CurrentExcludeList ${Ini[${ExcludeIni},"${Zone.ShortName}","Exclude"]}
   }
   /varset ExcludeList ${CurrentExcludeList}
   /echo ExcludeList: ${ExcludeList}
   /return

Sub Event_NamedMob(string line,string MobName)
   /declare CurrentNameList string local
   /varset CurrentNameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
   /if (${CurrentNameList.Find[NULL]}) {
      /ini "${NameIni}" "${Zone.ShortName}" "Name" "${MobName}"
      /varset CurrentNameList ${MobName}
   } else /if (!${CurrentNameList.Find[${MobName}]}) {
      /ini "${NameIni}" "${Zone.ShortName}" "Name" "${NameList}${MobName}|"
      /varset CurrentNameList ${Ini[${NameIni},"${Zone.ShortName}","Name"]}
   }
   /varset NameList ${CurrentNameList}
   /echo NameList: ${NameList}
   /return

Sub Event_MezzImmuneMob(string line,string MobName)
   /declare CurrentMezzImmuneList string local
   /varset CurrentMezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
   /if (${CurrentMezzImmuneList.Find[NULL]}) {
      /ini "${MezzImmuneIni}" "${Zone.ShortName}" "MezzImmune" "${MobName}"
      /varset CurrentMezzImmuneList ${MobName}
   } else /if (!${CurrentMezzImmuneList.Find[${MobName}]}) {
      /ini "${MezzImmuneIni}" "${Zone.ShortName}" "MezzImmune" "${MezzImmuneList}${MobName}|"
      /varset CurrentMezzImmuneList ${Ini[${MezzImmuneIni},"${Zone.ShortName}","MezzImmune"]}
   }
   /varset MezzImmuneList ${CurrentMezzImmuneList}
   /echo MezzImmuneList: ${MezzImmuneList}
   /return

  |**************************************************|
  |                       SETVAR                     |
  |**************************************************|
  
Sub Event_SetVar(string line,string varName,string section,string value)
  /if ( ${value.Equal[on]} ) /varset value 1
  /if ( ${value.Equal[off]} ) /varset value 0
  /if ( ${value.Equal[TRUE]} ) /varset value TRUE
  /if ( ${value.Equal[FALSE]} ) /varset value FALSE

  /if ( ${Defined[${varName}]} ) {
    /varset ${varName} ${value}
    /popup ${varName} in ${INIFile} section ${section} is set to ${value} now.
    /echo "${INIFile}.ini" ${section} ${varName.Left[1].Upper}${varName.Right[-1]} ${value}
    /ini "${INIFile}.ini" ${section} ${varName.Left[1].Upper}${varName.Right[-1]} ${value}
  }
  /doevents flush
/return

Sub Event_RangeMob(string line,string MobName)
   /declare CurrentRangeMobList string local
   /varset CurrentRangeMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
   /if (${RangeMobList.Find[NULL]}) {
      /ini "${RangeMobsIni}" "${Zone.ShortName}" "Name" "${MobName}"
      /varset RangeMobList ${MobName}
   } else /if (!${RangeMobList.Find[${MobName}]}) {
      /ini "${RangeMobsIni}" "${Zone.ShortName}" "Name" "${RangeMobList}${MobName}|"
      /varset RangedMobList ${Ini[${RangeMobsIni},"${Zone.ShortName}","Name"]}
   }
   /varset RangeMobList ${RangedMobList}
   /echo RangeMobList: ${RangeMobList}
/return

Sub MemSpell(SpellName,SpellGem)
  /varset MacroState "MemSpell ${SpellName}"
  /if (${SpellGem.Length}==1)	/memspell ${SpellGem.Right[1]} "${SpellName}"
  /if (${SpellGem.Length}==2)	/memspell ${SpellGem.Right[2]} "${SpellName}"
  /if (${SpellGem.Length}==4)	/memspell ${SpellGem.Right[1]} "${SpellName}"
  /if (${SpellGem.Length}==5)	/memspell ${SpellGem.Right[2]} "${SpellName}"
  /delay 5s ${Me.Gem[${SpellName}]}
/return

Sub MedTime
   /if (${autosit} && !${Bool[${Me.Sitting}]} && (!${Me.Casting.ID} || ${Me.Class.ShortName.Equal[BRD]}) && !${Me.Moving} && !${Me.CombatState.Equal[combat]}) {
      /delay 10
      /if (${MeleeList.Find[${Me.Class.Name}]} && ${CanCast.Find[${Me.Class.Name}]} && (${Me.PctEndurance}<90 || ${Me.PctMana}<90) && ${Me.CombatState.Equal[Active]}) {
        /sit
      } else /if (${MeleeList.Find[${Me.Class.Name}]} && (!${Me.Casting.ID} || ${Me.Class.ShortName.Equal[BRD]}) && ${Me.PctEndurance}<90 && ${Me.CombatState.Equal[Active]}) {
        /sit
      } else /if (${CanCast.Find[${Me.Class.Name}]} && (!${Me.Casting.ID} || ${Me.Class.ShortName.Equal[BRD]}) && ${Me.PctMana}<90 && ${Me.CombatState.Equal[Active]}) {
        /sit
      }
   }
   /if (${MeleeList.Find[${Me.Class.Name}]} && ${CanCast.Find[${Me.Class.Name}]} && ${Me.PctEndurance}>99 && ${Me.PctMana}>99 && ${Bool[${Me.Sitting}]}) {
      /stand
   } else /if (${MeleeList.Find[${Me.Class.Name}]} && !${CanCast.Find[${Me.Class.Name}]} && ${Me.PctEndurance}>99 && ${Bool[${Me.Sitting}]}) {
     /stand
   } else /if (!${MeleeList.Find[${Me.Class.Name}]} && ${CanCast.Find[${Me.Class.Name}]} && ${Me.PctMana}>99 && ${Bool[${Me.Sitting}]}) {
     /stand
   }
/return

ItemBuff.inc

Code:
Sub IntializeItemBuff
   |------------------------------------------------------------
   | Auto Item Inventory for Spells
   |------------------------------------------------------------

   /declare AAAA                  int      outer 1
   /declare BBBB                  int      outer 0
   /declare CCCC                  int      outer 0
   /declare DDDD                  int      outer 0
   /declare EEEE                  int      outer 0

   /declare UseItem[20]                  outer
   /declare DoExchange[${UseItem.Size}]      outer
   /declare SelfItem[${UseItem.Size}]   string   outer
   /declare SpellItem[${UseItem.Size}]   string   outer
   /declare Exchange[${UseItem.Size}]   string   outer
   /declare Return[${UseItem.Size}]   string   outer

   /for EEEE 1 to ${UseItem.Size}
      /varset UseItem[${EEEE}] FALSE
      /varset DoExchange[${EEEE}] FALSE
   /next EEEE

   /declare ItemSpellSet            string   outer
   /declare ItemSpellFound            string   outer
   /echo ${INIFile}

   /for BBBB 1 to 32
      /if (${InvSlot[${BBBB}].Item.Container}>0) {
         /for CCCC 1 to ${InvSlot[${BBBB}].Item.Container}
            /if (${Me.Inventory[${BBBB}].Item[${CCCC}].ID} && ${Me.Inventory[${BBBB}].Item[${CCCC}].Spell.ID} && (${Me.Inventory[${BBBB}].Item[${CCCC}].CastTime} || ${Me.Inventory[${BBBB}].Item[${CCCC}].EffectType.Equal[Click Worn]} || ${Me.Inventory[${BBBB}].Item[${CCCC}].EffectType.Equal[Click Inventory]}) && ${Me.Inventory[${BBBB}].Item[${CCCC}].WornSlots} && ${Me.Level}>=${Me.Inventory[${BBBB}].Item[${CCCC}].RequiredLevel} && ${Spell[${Me.Inventory[${BBBB}].Item[${CCCC}].Spell}].Duration}>50) {
               /varset ItemSpellFound Hold
               /varset ItemSpellSet ${Ini[${INIFile}.ini,${Me.Name},${Me.Inventory[${BBBB}].Item[${CCCC}].Spell},${ItemSpellFound}]}
               /if (${ItemSpellSet.Equal[Hold]}) {
                  /ini "${INIFile}.ini" "${Me.Name}" "${Me.Inventory[${BBBB}].Item[${CCCC}].Spell}" "0"
                  /echo Adding ${Me.Inventory[${BBBB}].Item[${CCCC}].Name} ${Me.Inventory[${BBBB}].Item[${CCCC}].Spell} to INI
               } else /if (${ItemSpellSet.Equal[1]}) {
                  /varset UseItem[${AAAA}] TRUE
                  /varset DoExchange[${AAAA}] TRUE
                  /varset SelfItem[${AAAA}] "${Me.Inventory[${BBBB}].Item[${CCCC}].Name}"
                  /varset SpellItem[${AAAA}] "${Me.Inventory[${BBBB}].Item[${CCCC}].Spell}"
                  /varset Exchange[${AAAA}] "${Me.Inventory[${BBBB}].Item[${CCCC}].WornSlot[1].Name}"
                  /varset Return[${AAAA}] "${Me.Inventory[${Exchange[${AAAA}]}].Name}"
                  /varcalc AAAA ${AAAA}+1
               }
            }
         /next CCCC
      } else /if (${InvSlot[${BBBB}].Item.Container}==0 && ${InvSlot[${BBBB}].Item.ID} && ${InvSlot[${BBBB}].Item.Spell.ID} && (${InvSlot[${BBBB}].Item.CastTime} || ${InvSlot[${BBBB}].Item.EffectType.Equal[Click Worn]} || ${InvSlot[${BBBB}].Item.EffectType.Equal[Click Inventory]}) && ${InvSlot[${BBBB}].Item.WornSlots} && ${Me.Level}>=${InvSlot[${BBBB}].Item.RequiredLevel} && ${Spell[${InvSlot[${BBBB}].Item.Spell}].Duration}>50) {
         /varset ItemSpellFound Hold
         /varset ItemSpellSet ${Ini[${INIFile}.ini,${Me.Name},${InvSlot[${BBBB}].Item.Spell},${ItemSpellFound}]}
         /if (${ItemSpellSet.Equal[Hold]}) {
            /ini "${INIFile}.ini" "${Me.Name}" "${InvSlot[${BBBB}].Item.Spell}" "0"
            /echo Adding ${InvSlot[${BBBB}].Item.Name} ${InvSlot[${BBBB}].Item.Spell} to INI
         } else /if (${ItemSpellSet.Equal[1]}) {
            /varset UseItem[${AAAA}] TRUE
            /varset DoExchange[${AAAA}] TRUE
            /varset SelfItem[${AAAA}] "${InvSlot[${BBBB}].Item}"
            /varset SpellItem[${AAAA}] "${InvSlot[${BBBB}].Item.Spell}"
            /varset Exchange[${AAAA}] "${InvSlot[${BBBB}].Item.WornSlot[1].Name}"
            /varset Return[${AAAA}]  "${InvSlot[${Exchange[${AAAA}]}].Item}"
            /varcalc AAAA ${AAAA}+1
         }
      }
   /next BBBB
/return TRUE

Sub CheckItems
   |- Item Buffs
   /if (${Me.State.NotEqual[Bind]} && ${Me.FreeBuffSlots}>3 && (${UseItem[1]} && ${FindItem[${SelfItem[1]}].ID} && ${Cast.Ready[${SelfItem[1]}]} && !${Me.Buff[${SpellItem[1]}].ID} || ${UseItem[2]} && ${FindItem[${SelfItem[2]}].ID} && ${Cast.Ready[${SelfItem[2]}]} && !${Me.Buff[${SpellItem[2]}].ID} || ${UseItem[3]} && ${FindItem[${SelfItem[3]}].ID} && ${Cast.Ready[${SelfItem[3]}]} && !${Me.Buff[${SpellItem[3]}].ID} || ${UseItem[4]} && ${FindItem[${SelfItem[4]}].ID} && ${Cast.Ready[${SelfItem[4]}]} && !${Me.Buff[${SpellItem[4]}].ID} || ${UseItem[5]} && ${FindItem[${SelfItem[5]}].ID} && ${Cast.Ready[${SelfItem[5]}]} && !${Me.Buff[${SpellItem[5]}].ID})) /call ItemBuffs
   /if (${Me.State.NotEqual[Bind]} && ${Me.FreeBuffSlots}>3 && (${UseItem[6]} && ${FindItem[${SelfItem[6]}].ID} && ${Cast.Ready[${SelfItem[6]}]} && !${Me.Buff[${SpellItem[6]}].ID} || ${UseItem[7]} && ${FindItem[${SelfItem[7]}].ID} && ${Cast.Ready[${SelfItem[7]}]} && !${Me.Buff[${SpellItem[7]}].ID} || ${UseItem[8]} && ${FindItem[${SelfItem[8]}].ID} && ${Cast.Ready[${SelfItem[8]}]} && !${Me.Buff[${SpellItem[8]}].ID} || ${UseItem[9]} && ${FindItem[${SelfItem[9]}].ID} && ${Cast.Ready[${SelfItem[9]}]} && !${Me.Buff[${SpellItem[9]}].ID} || ${UseItem[10]} && ${FindItem[${SelfItem[10]}].ID} && ${Cast.Ready[${SelfItem[10]}]} && !${Me.Buff[${SpellItem[10]}].ID})) /call ItemBuffs
/return TRUE

   |------------------------------------------------------------
   |  ITEM BUFFS
   |------------------------------------------------------------
i
Sub ItemBuffs
  /declare TT int local
  /for TT 1 to ${UseItem.Size}
    |/if (${Group.Member[1].Moving} && (${Group.Member[1].Distance}>50 || !${Group.Member[1].LineOfSight}) && ${Group.Member[1].Distance}<125 || ${Group.Member[2].Moving} && (${Group.Member[2].Distance}>50 || !${Group.Member[2].LineOfSight}) && ${Group.Member[2].Distance}<125 || ${Group.Member[3].Moving} && (${Group.Member[3].Distance}>50 || !${Group.Member[3].LineOfSight}) && ${Group.Member[3].Distance}<125 || ${Group.Member[4].Moving} && (${Group.Member[4].Distance}>50 || !${Group.Member[4].LineOfSight}) && ${Group.Member[4].Distance}<125 || ${Group.Member[5].Moving} && (${Group.Member[5].Distance}>50 || !${Group.Member[5].LineOfSight}) && ${Group.Member[5].Distance}<125) /return
    /if (${FindItem[${SelfItem[${TT}]}].ID} && ${Cast.Ready[${SelfItem[${TT}]}]} && ${UseItem[${TT}]} && ${Me.FreeBuffSlots}>3 && !${Me.Buff[${SpellItem[${TT}]}].ID} && ${Spell[${SpellItem[${TT}]}].Stacks}) {
      /echo Buffing ${SpellItem[${TT}]} with ${SelfItem[${TT}]}
      /call CastItemClickyB ${SelfItem[${TT}]}
    }
  /next TT
/return TRUE

Sub CastItemClickyB(string sItemClicky)
  /declare OldItem string local
  /echo Need to cast ${sItemClicky} and its Worn ${FindItem[${sItemClicky}].EffectType.Equal[Click Worn]}
  /if (${FindItem[${sItemClicky}].EffectType.Equal[Click Worn]} && ${FindItem[${sItemClicky}].InvSlot}) {
    /varset OldItem ${Me.Inventory[${FindItem[${sItemClicky}].WornSlot[1].ID}].Name}
    /exchange "${sItemClicky}" ${FindItem[${sItemClicky}].WornSlot[1].ID}
    /nomodkey /itemnotify ${FindItem["${sItemClicky}"].InvSlot} rightmouseup
    /delay 2s ${Me.Casting.ID}
    /delay ${FindItem[${sItemClicky}].CastTime}s
    /exchange "${OldItem}" ${FindItem[${OldItem}].WornSlot[1].ID}
    /delay 1s ${Me.Inventory[${FindItem[${OldItem}].WornSlot[1].ID}].Name.Equal[${OldItem}]}
  } else {
    /nomodkey /itemnotify ${FindItem[${sItemClicky}].InvSlot} rightmouseup
    /delay 2s ${Me.Casting.ID}
    /delay ${FindItem[${sItemClicky}].CastTime}s
  }
/return TRUE

AApurchase.inc
I modded this so it wont buy the glyphs first. Also if you want to take the time to set the order of AA bought take the file this inc creates and set the order you want. After that make the file read only. I plan to make it a bit easier in the future but for now that is the way it needs to be done.

Code:
| AAPurchase.inc Revamped
| Rewritten by 3PO with ideas and code snippets from smattowers
| Date 11/11/2008
|
| KingKiller / Fury
| Revamp on the order of AA purchased.
| 3/21/12
|
| This is a complete revamp of the AAPicker routine.
| It now parses text from the AA Window to determine the Level required to purchase an
| AA as well as the current level and max level of the AA.
| If your level is below the level required to purchae the AA it will skip it.
| It will detect and skip an AA that you do not have the expansion for.
|    This is performed by first making sure you are the right level to purchase it and
|    then if your banked AA is equal to or higher than that needed it will skip it.
| It will also detect if your class is not able to purchase a skill defined if you
| accidentally add a wrong ability and skip it.
| It will tell you when all your abilities are maxed, will warn you if your banked AAs
| are over 27, and if you reach 30 banked it will switch you to full Level XP.
| Can choose to restrict how many levels of an ability to purchase by putting |# where
| where # would equal the max skill you want to purchase. M would be used to purchase
| the to the max possible level of the ability.
| You can also have multiple setcions in the ini file now. AAtoBuy is the default but
| you can now call the init routine like this "/call AAInit inisection" and setup a special
| section to purchase skills for a shroud without having to lose your section for your
| characters Alt Ability skills.
|
| Todo:
|   Add ability to purchase skills evenly.
|     For instance Combat Agility and Stability you might want to purchase them evenly through all levels.
|
| Usage:
| Setup your ini file.
| For example:
|
|   Your file is AA_Frank.INI
|   [AAtoBuy]
|   AACount=2
|   AA1=Combat Agility|2
|   AA2=Combat Stability|M
|
| Put "/call AAInit" or "/call AAInit inisection" into the initialization section of your macro.
| Put "/call AAPicker" into your main loop.
|
| If you want to use a special purchase section other than AAtoBuy in your ini. For instance to define AA
| you want to purchase when in a shroud change "/call AAInit" to "/call AAInit yoursectionnamehere"

#event AAEarned "#*#You have gained an ability point!#*#"
|#event AAEarned "#*#You have reached the AA point cap#*#"
| Change this to change which channel you send your notifications to.
| Ex: /bc , /echo , /mqlog
#define def_channel_ /echo

Sub AAInit(IniSection)
  |**Declare local variables**|
  /if (!${Defined[ListNum]}) /declare ListNum string outer
  /declare AAIniFile string local AA_${Me.Name}.ini
  /declare a int local
  /if (!${Defined[IniSection]}) /declare IniSection string local AAtoBuy
  /if (${IniSection.Equal[NULL]}) /varset IniSection AAtoBuy
  |**Determine the max AACount.**|
  /call LoadINIVar ${IniSection} AACount 1 AACount ${AAIniFile} int
  |**If AACount is not 0**|
  /if (${AACount}) {
    |**Create the AA array**|
    /declare AA[${AACount}] string outer
  
    |**Load the AAs into the array.**|
    /for a 1 to ${AACount}
      /call LoadINIVar ${IniSection} AA${a} " " AA[${a}] ${AAIniFile}
    /next a
  }
  |/call AADump
/return

Sub AAPicker
  |**Declare local variables**|
  /declare x int local
  /declare Cost int local
  /declare AALevelStr string local
  /declare curAALevel int local
  /declare maxAALevel int local
  /declare maxPurchaseLevel int local
  /declare nameAA string local
  /declare requiredLevel int local
  /declare requiredExpansion string local
  /declare maxCounter int local 0
  |**Declare and set lvlDigits to 2**|
  /echo PICKING AN AA!
  /declare lvlDigits int local 2
  |**|Change lvlDigits to 1 if your level is less than 10 (usefull for using this with a shroud)**|
  /if (${Me.Level}<10) /varset lvlDigits 1

  /for x 1 to ${AACount}
    |**Sel ListNum to the page the AA is on.**|
    /varset nameAA ${AA[${x}].Arg[1,"|"]}
    /varset ListNum List${AltAbility[${nameAA}].Type}
    |**Bookmark**|
    :BuyAdditional
     |**If Can Purchase is selected unselect it.**|
     /if (${Window[AAWindow].Child[CanPurchaseFilter].Checked}) /nomodkey /notify AAWindow CanPurchaseFilter leftmouseup
     |**Check if the skill is available to your class.**|
     /echo ${nameAA}
    
    /if (!${AltAbility[${nameAA}].ID}==NULL) {
       |**Grab the level information from the AAWindow so that**|
       /varset AALevelStr ${Window[AAWindow].Child[${ListNum}].List[${Window[AAWindow].Child[${ListNum}].List[=${nameAA}]}, 2]}
       |**we can determine the current AA level**|
       /varset curAALevel ${AALevelStr.Arg[1,"/"]}
       |**and the max AA level of the AA.**|
       /varset maxAALevel ${AALevelStr.Arg[2,"/"]}
       
       |**check if we are leveling to max skill**|
       /if (${AA[${x}].Arg[2,"|"].Equal[M]}) {
         /varset maxPurchaseLevel ${maxAALevel}
         |**or if we want to level evenly**|
       } else /if (${AA[${x}].Arg[2,"|"].Equal[E]}) {
         def_channel_ Error. ${nameAA} is set to equal but this feature is not active yet.
         /return
         |**or set to the max skill we want to train to**|
       } else {
         /varset maxPurchaseLevel ${AA[${x}].Arg[2,"|"]}
         |**and if the max skill we want to train is valid.**|
         /if (${maxPurchaseLevel}<=0) {
           def_channel_ Error. ${nameAA} is set to an invalid level to train to. Skipping.
           /next x
         }
       }
      |**Select the AA so that we can**|
      /call AASelect "${nameAA}"
      |**parse the level information from the text window.**|
      /varset requiredLevel ${Window[AAWindow].FirstChild.Next.Text.Mid[${Math.Calc[${Window[AAWindow].FirstChild.Next.Text.Find[Level:]} + 7]},${lvlDigits}]}
      |**Set requiredExpansion to the expansion listed in the AAWindow.**|
      /varset requiredExpansion ${Window[AAWindow].Child[${ListNum}].List[${Window[AAWindow].Child[${ListNum}].List[=${nameAA}]}, 4]}
      |**If AA required level is less than or equal to your level.**|
      /if (${requiredLevel}<=${Me.Level}) {
        |**If the AA Cost is not equal to zero length.**|
        /if (${curAALevel}<${maxPurchaseLevel}) {
          |**Define Cost be the cost listed in the AAWindow.**|
          /varset Cost ${Window[AAWindow].Child[${ListNum}].List[${Window[AAWindow].Child[${ListNum}].List[=${nameAA}]}, 3]}
          |**Click the can purchase button.**|
          /nomodkey /notify AAWindow CanPurchaseFilter leftmouseup
          |**If the Cost of the ability is less than or equal to your banked AA and if the AA still shows in the list.**|
          /if (${Cost}<=${Me.AAPoints} && !${Window[AAWindow].Child[${ListNum}].List[=${nameAA}]}==NULL) {
            |**Select and purcahse the AA.**|
            /call AASelect "${nameAA}"
            /call AAPurchase
            /varcalc curAALevel ${curAALevel}+1
            def_channel_ ${Time} Purchased level ${curAALevel}/${maxAALevel} of ${nameAA} for ${Cost} points.
            /delay 2s
            |**If I still have points after purchasing try to purchase again.**|
            /if (${Me.AAPoints}>0) /goto :BuyAdditional
            /return
          } else /if (${Cost}>${Me.AAPoints}) {
            |**Else, if Cost is greater than banked AA.**|
            def_channel_ Unable to purchase ${nameAA} at this time. You have ${Me.AAPoints} AA and need ${Cost} AA.  Damn I have to return!
            /return
            |**Else, you dont have the expansion.**|
          } else {
            def_channel_ You have ${Me.AAPoints} AA and ${nameAA} costs ${Cost} AA. You must not have ${requiredExpansion} or you have not met the prerequisites. Skipping.
            /varcalc maxCounter ${maxCounter}+1
          }
          |**Else, the skill is maxed.**|
        } else {
          /if (${curAALevel}==${maxAALevel} && ${maxPurchaseLevel}==${maxAALevel}) def_channel_ ${nameAA} is Maxed
          /varcalc maxCounter ${maxCounter}+1
        }
        |**Else, you are not the right level.**|
     } else {
      def_channel_ You are ${Me.Level} and ${nameAA} requires ${requiredLevel}. Skipping.
     }
     |**Else, that skill is not available to your class.**|
    } else /if (${AltAbility[${nameAA}].ID}==NULL) {
      def_channel_ ${nameAA} is not a ${Me.Class} Ability.
      /varcalc maxCounter ${maxCounter}+1
    }
  /next x
  |**If all skills are maxed or you do not have the right expansions.**|
   /if (${maxCounter}==${AACount}) {
      def_channel_ All defined skills maxed or unable to be purchased due to expansion/prerequisite issues. You should define new ones.
  | Else, if not, wait for next round.
   } else {
      def_channel_ Cycled through all AA and nothing to purchase this round.
   }
  | If banked AA is greater than or equal to 27 and less than 30, issue a warning.
   /if (${Me.AAPoints}>=69 && ${Me.AAPoints}<70) def_channel_ WARNING!!! You are at ${Me.AAPoints} banked AA.
  | If banked AA equals 30, turn off alt exp.
   /if (${Me.AAPoints}>=70) {
      def_channel_ You have maxed your AAs and are unable to purchase any of your defined AAs.
      def_channel_ Changing you to full level XP. Hopefully you are not max level yet.
      /alt off
   }
/return

Sub AASelect(string AAName)
| Code to select the AA passed into it by AAName.
   /nomodkey /notify AAWindow AAW_Subwindows tabselect ${AltAbility[${AAName}].Type}
   /nomodkey /notify AAWindow ${ListNum} listselect ${Window[AAWindow].Child[${ListNum}].List[=${AAName}]}
   /nomodkey /notify AAWindow ${ListNum} leftmouse ${Window[AAWindow].Child[${ListNum}].List[=${AAName}]}
/return

Sub AAPurchase
| The actual purchase code.
   /nomodkey /notify AAWindow TrainButton leftmouseup
   /delay 2s
| If fast AA purchase is not on, accept the purchase.
   /if (!${Window[OptionsWindow].Child[OptionsGeneralPage].Child[OGP_AANoConfirmCheckbox].Checked}) {
      
      :ConfirmWait
      /delay 10s ${Window[ConfirmationDialogBox].Open}
      /if (!${Window[ConfirmationDialogBox].Open}) /goto :ConfirmWait
      /delay 2s
      /nomodkey /notify ConfirmationDialogBox Yes_Button leftmouseup
      /delay 2s
   }
/return

Sub Event_AAEarned
| Triggered  From event statement at the top
   /call AADump
   /call AAPicker
   /echo Returning to orig mac motherfucka!!
/return

Sub LoadINIVar(IniSection,IniVar,IniValue,MacroVar,MyIni,VarType)
| INI loading code from ModBot, used with permission.
   /if (!${Defined[${MacroVar}]} && ${Defined[VarType]}) /declare ${MacroVar} ${VarType} outer
   /declare IniString string local ${Ini[${MyIni},${IniSection},${IniVar},NOTFOUND]}
   /varset ${MacroVar} ${IniString}
   /if (${IniString.Equal["NOTFOUND"]}) {
      /varset ${MacroVar} ${IniValue}
      /ini ${MyIni} "${IniSection}" "${IniVar}" "${${MacroVar}}"
   }
/return

Sub AADump()
  /declare a int local 1
  /declare b int local 3
  /declare AAcnt int local 1
  /declare AAIniFile string local AA_${Me.Name}.ini

  /ini ${AAIniFile} AAtoBuy AACount 0
  /declare AALevelStr string local

  /if (${Window[AAWindow].Child[CanPurchaseFilter].Checked}) /nomodkey /notify AAWindow CanPurchaseFilter leftmouseup
  /delay 10
  
  :Loop
   /if (${Window[AAWindow].Child[List${b}].List[${a}].Length}) {
     /varset AALevelStr ${Window[AAWindow].Child[List${b}].List[${a}, 2]}
     /if (${AALevelStr.Arg[1,"/"]}<${AALevelStr.Arg[2,"/"]}) {
       /ini ${AAIniFile} AAtoBuy AA${AAcnt} "${Window[AAWindow].Child[List${b}].List[${a}]}|M"
       /varcalc AAcnt ${AAcnt}+1
     }
     /varcalc a ${a}+1
     /goto :Loop
   }
   /if (${b}>1) {
     /varcalc b ${b}-1
     /varset a 1
     /goto :Loop
   }

   /varset a 1

  :SpecialLoop
   /if (${Window[AAWindow].Child[List4].List[${a}].Length}) {
     /varset AALevelStr ${Window[AAWindow].Child[List4].List[${a}, 2]}
     /if (${AALevelStr.Arg[1,"/"]}<${AALevelStr.Arg[2,"/"]}) {
       /ini ${AAIniFile} AAtoBuy AA${AAcnt} "${Window[AAWindow].Child[List4].List[${a}]}|M"
       /varcalc AAcnt ${AAcnt}+1
     }
     /varcalc a ${a}+1
     /goto :SpecialLoop
   }

  /ini ${AAIniFile} AAtoBuy AACount ${Int[${Math.Calc[${AAcnt} -1]}]}
  /echo Finished dump to file:${AAIniFile}

/return
 
Last edited:
Typical level 100 INI file. Notice on the bottom is a list names of clicky buffs. It will scan all the items you have on you including the ones in the bags for clickies and put them on that list. Then you just set them to 1 or 0 if you want that clicky on. I plan to make it so it will only list the highest version of the clicky you have and not list everyone you have. Most of what that does wasnt my code and right now the person that did it escapes me. Soon as I find the person i will give the credit to them.

If you want it to function different in raids than it does in groups you can set raidset to 1 and it will use the settings under the raid tag instead.

If you need to update the alias change the version number at the top and after it updates change it back to what it was.

Any questions please just ask.

Code:
[SETTINGS]
Version=4.0
DoDoT=0
DoHeal=1
DoDebuff=0
DoNuke=0
DoPanther=1
DoWild=1
DoCure=0
MobRadius=50
MasterList=YourToon
MA=YourToon
CanniSpell=Ancestral Pact
CanniGem=3
HealRange=150
GroupRange=100
DoLeash=1
Leashlength=25
AutoExpAdjust=1
MaintExpLvl=98
MaxLevel=100
Autosit=1
DoLoot=0
BalanceHP=0
WhenToBurn=99
RaidSet=0
DoQuest=1
RelayTells=0
AutoBalance=0
AutoBalanceHPCheck=5
DoFood=0
DoLeashToon=0
DoLeashToonName=[Toon1][Toon2][Toon....]
DoShrink=1

[RAID]
MA=YourToon
DoDoT=0
DoWild=1
DoHeal=1
DoDebuff=0
DoNuke=1
DoCure=1
DoPanther=0
MobRadius=150
MasterList=YourToon
DoLoot=0
WhenToBurn=95

[DEBUFFS]
MaloSpell=Malis Rk. II
MaloType=gem8
MaloList=NULL
SlowSpell1=Turgur's Swarm
SlowType1=alt
SlowSpell2=Time's Antithesis
SlowType2=item
AESlowSpell=Tigir's Insect Swarm
AESlowType=alt
SlowList=NULL
NumOfDebuffs=2
Debuff1=Malis
DebuffType1=gem8
Debuff2=Time's Antithesis
DebuffType2=item

[DOTS]
NumOfDots=3
DotMinManaPct=35
Dot1=Banescale's Venom
DotType1=gem6
Dot2=Falhotep's Malady
DotType2=gem7
Dot3=Nectar of Anguish
DotType3=gem12
Dot4=Naganaga
DotType4=gem9
Dot5=Naeya Blood
DotType5=gem5
Dot6=Spinechiller Blood
DotType6=gem5

[NUKES]
NumOfNuke=2
Nuke1=Seedspitter's Bite
NukeType1=gem9
NukeAt1=98
NukeStop1=0
Nuke2=Slaunk's Spear of Venom
NukeType2=gem4
NukeAt2=95
NukeStop2=0
NukeMinManaPct=35
DotMinManaPct=35

[HEAL]
HealSpell=Blezon's Mending
HealGem=1
HotSpell=Halcyon Shear
HoTGem=2
GroupHoT=Wisp of Renewal
GroupGem=4
HealRange=150
GroupRange=100
EmgHealMod=50
HealPriority=0
CLRPoint=80
DRUPoint=70
SHMPoint=60
WIZPoint=75
MAGPoint=75
ENCPoint=80
NECPoint=75
WARPoint=75
MNKPoint=60
ROGPoint=60
RNGPoint=60
BSTPoint=60
SHDPoint=95
BRDPoint=65
BERPoint=60
PALPoint=85
InterventionSpell=Progenitor's Intervention

[CURING]
STCurseSpell=Remove Greater Curse
GrpCurseSpell=Blood of Sanera
CurseGem=gem12
STPoisonSpell=Disinfecting Aura
GrpPoisonSpell=Blood of Sanera
PoisonGem=gem12
STDiseaseSpell=Disinfecting Aura
GrpDiseaseSpell=Blood of Sanera
DiseaseGem=gem12
;Chant of the Burynai Rk. III
STCorruptSpell=Cure Corruption Rk. III
GrpCorruptSpell=Chant of the Izon
CorruptGem=gem12
DoCure=1

[BUFF]
NumSelfBuff=0
SelfBuff1=NULL
SelfType1=NULL
SelfBuff2=NULL
SelfType2=NULL
SelfBuff3=NULL
SelfType3=NULL
SelfBuff4=NULL
SelfType4=NULL
SelfBuff5=NULL
SelfType5=NULL
SelfBuff6=NULL
SelfType6=NULL
BuffNoStack1=NULL
BuffNoStack2=NULL
BuffNoStack3=NULL
BuffNoStack4=NULL
BuffNoStack5=NULL
BuffNoStack6=NULL
PantherSpell=Talisman of the Snow Leopard
PantherSpellGem=10
DoBuffTotal=3
DoBuff1=Preeminent Foresight
DoBuffCast1=Unity of the Courageous
DoBuffGem1=9
DoBuffAliases1=|sense
DoBuffMana1=50
DoBuffIgnoreClass1=Use the Class's full Name and seperate with commas
DoBuff2=Spirit of Dauntlessness
DoBuffCast2=Unity of the Courageous
DoBuffGem2=9
DoBuffAliases2=|sta
DoBuffMana2=50
DoBuffIgnoreClass2=Use the Class's full Name and seperate with commas
DoBuff3=Insistent Focusing
DoBuffCast3=Unity of the Courageous
DoBuffGem3=9
DoBuffAliases3=|focus|unity
DoBuffMana3=50
DoBuffIgnoreClass3=Use the Class's full Name and seperate with commas
DoBuff4=Champion
DoBuffCast4=Champion
DoBuffGem4=9
DoBuffAliases4=|chm|
DoBuffMana4=50
DoBuffIgnoreClass4=Use the Class's full Name and seperate with commas
BuffGem=gem9
NumGrpBuff=0
GrpBuff1=NULL
GrpGem1=0
GrpBuff2=NULL
GrpGem2=0
GrpBuff3=NULL
GrpGem3=0
GrpBuff4=NULL
GrpGem4=0
WildSpell=Rampant Growth

[PET]
UsePet=0
PetSpell=NULL
NumPetBuff=0
PetBuff1=NULL
PetBuff2=NULL
PetBuff3=NULL
PetBuff4=NULL

[ThisToon]
Form of Endurance VIII=0
Soothing Breath III=0
Illusionary Spikes III=0
Prismatic Ward IV=0
Form of Defense VIII=0
Myrmidon's Skill IV=0
Summon Drogmor=0
Illusion: Frost Goblin=0
Pestilence Shock=0
Eternal Ward=1
Turgur's Insects=0
Knowledge of the Past V=0
Illusion: Fier`dal=0
Levitation=0
Illusion: Skeleton=0
Bramblecoat=0
Reyfin's Racing Thoughts=1
Knowledge of the Past IV=0
Knowledge of the Past VI=1
Soothing Breath II=0
Form of Defense VII=0
Prismatic Ward VI=0
Knowledge of the Past VIII=0
Expanding Mind IV=0
Illusion: Satyr=0
Form of Endurance X=1
Myrmidon's Skill VIII=0
Form of Defense X=0
Expanding Mind V=0
Myrmidon's Skill VII=0
Prismatic Ward VIII=1
Illusionary Spikes VII=0
Illusion: Feir'Dal=0
Expanding Mind VI=0
Illusionary Spikes VI=0
Expanding Mind VII=1
Geomantra X=0
Geomantra IX=0
Form of Endurance XI=0
Form of Defense XI=0
 
Have you had any issue with NetBots causing random crashes? I used to, but haven't tried it in a while. Would overload EQBC and messages would quit flowing.
 
A while back I did ya. Keeping up the timers on the buffs and having them all being sent thru bc was causing the buffer overflow errors. These days BC seems to be running great other than the once in a while hiccup. I would look into using BC for buffing again if you arent currently. We have had up to 27 toons on a bc server and it was running ok.
 
Updated and added some include files requested. If anyone needs anything just ask. :cool:
 
Have you had any issue with NetBots causing random crashes? I used to, but haven't tried it in a while. Would overload EQBC and messages would quit flowing.

this made me stop using netbots yrs ago (still have no good way to get toons w a macro besides requesting it by each toon

so that would be checking the toon that needs a cure sending a bc to curer
 
I want to give this a shot but I'm just wondering the easiest way to go about getting this into my macro folder.. do I need to make my own .ini for it i.e copy paste etc.. Generally I've just downloaded the files that were attached to the post but I'm not seeing htem for this particular mac.

Thanks in advance for any advice.
 
Yep, just create the file with editor, copy/paste, save. Make sure whatever editor you are using doesn't change (or add to) the extension.

htw
 
Wanted to try this out but I can't seem to get it to run, it keeps saying a bunch of sub routines are missing. If I comment one out, another sub is missing.

Subroutine SetupAdvLootVars wasn't found (comment sub call out and;)

Subroutine IntializeItemBuff wasn't found (comment sub call out and;)

Subroutine CheckItems wasn't found (ect, ect, ect...)

I'd created all of the .ini's and customized the settings ini but just get error after error.

I must be doing something major wrong, any ideas?
 
I don't really know much about this Mac but have you tried setting up Pete's Mac? I've set it up on my shammy and he plays phenomenally if you want I can hook you up with my ini but you'll have to tune it to your character a bit(not much). Let me know
 
I don't really know much about this Mac but have you tried setting up Pete's Mac? I've set it up on my shammy and he plays phenomenally if you want I can hook you up with my ini but you'll have to tune it to your character a bit(not much). Let me know

Sure, I'd give it a try for sure, please post your ini.