Its a work in progress, I use it to bot my wifes necro while shes away messing with the kids. Its not exceedingly efficient or smart, but its a start.
Code: Select all
| necrobot.mac
#chat tell
#event PetBuffDown "Your pet's Intensify Death spell has worn off."
#event Fizzle "Your spell fizzles!"
#event Interrupt "Your spell is interrupted."
#define constLifetapSpell "Spirit Tap"
#define constNukeSpell "Shock of Poison"
#define constPetSpell "Summon Dead"
#define constPetHealSpell "Renew Bones"
#define constPetBuffSpell "Intensify Death"
#define constConvertSpell "Allure of Death"
#define constSelfShieldSpell "Major Shielding"
#define constDOT1Spell "Boil Blood"
Sub Main
/zapvars
/keepkeys
/press esc
/declare aMasters array
/declare g_EndMacro global
/declare g_PetBuffStatus global
/declare g_FizzleFlag global
/varset g_PetBuffStatus 0
| define the masters for this bot
/varset aMasters(1) "WhateverTheNameOfYourMainIs"
:MainLoop
/doevents
/call DoBot
/if n @g_EndMacro==0 /goto :MainLoop
/return
||| FUNCTIONS
Sub DoBot
| check to see if we have a target, if so, then we are in combat mode
/if "$target()"=="TRUE" {
| if I am below 75% hp, cast lifetap spell
/if n $char(hp,pct)<75 /call CastWithoutFizzle "constLifetapSpell"
| if I have enough mana, and the mob is in the right hp range, cast nuke
/if n $char(mana,pct)>80 /if n $target(hp,pct)<81 /if n $target(hp,pct)>29 /call CastWithoutFizzle "constNukeSpell"
} else {
| if I have no pet, then cast one
/if n $char(pet)==0 /call CastWithoutFizzle "constPetSpell"
/if n $char(buff,"constSelfShieldSpell")==0 {
/call CastWithoutFizzle "constSelfShieldSpell"
}
/if "$char(state)"=="STAND" /sit
}
| buff our pet
/if n @g_PetBuffStatus==0 {
/call CastWithoutFizzle "constPetBuffSpell"
/varset g_PetBuffStatus 1
}
| convert hp to mana
/if n $char(hp,pct)>75 /if $char(buff,"constConvertSpell")==0 {
/call CastWithoutFizzle "constConvertSpell"
}
| if my pet gets hurt enough, and I have mana, heal him
/if n $char(mana,pct)>60 /if n $spawn($chat(pet),hp,pct)<80 /call DoHealPet
:DoneDoBot
/return
||| SUBS
Sub DoHealPet
/declare vPreviousTarget local
/varset vPreviousTarget 0
/if n $target(id)!=0 /varset vPreviousTarget $target(id)
/target id $char(pet)
/call CastWithoutFizzle "constPetHealSpell"
/if n @vPreviousTarget!=0 /target id @vPreviousTarget
/return
Sub CastWithoutFizzle
/if $char(state)!="STAND" /stand
/echo "Casting @Param0"
| make sure we dont get passed a null spell name
/if "@Param0"!="" {
:NoFizzleCastStart
/varset g_FizzleFlag 0
| check to make sure we have mana to cast this spell
/if n $char(mana,cur)<$spell("@Param0",mana) /goto :NoFizzleCastEnd
/cast "@Param0"
/doevents Fizzle
| if we fizzled, try to cast again
/if n @g_FizzleFlag==1 /goto :NoFizzleCastStart
}
:NoFizzleCastEnd
/delay $int($calc($spell("@Param0",casttime)*10+5))
/return
||| EVENTS
Sub Event_Chat
/if "@Param1"=="@aMasters(1)" {
/if "@Param2"~~"sit" {
/sit
/goto :DoneEventChat
}
/if "@Param2"~~"assist" {
/stand
/target "@Param1"
/assist
/delay 1s
/face
/if n $char(pet)!=0 /pet attack
/if n $char(mana,pct)>20 /call CastWithoutFizzle "constDOT1Spell"
/goto :DoneEventChat
}
/if "@Param2"~~"end" /varset g_EndMacro 1
} else {
/tell @aMasters(1) "@Param1 told me @Param2"
}
:DoneEventChat
/return
Sub Event_PetBuffDown
/varset g_PetBuffStatus 0
/return
Sub Event_Fizzle
/varset g_FizzleFlag 1
/return
Sub Event_Interrupt
/varset g_FizzleFlag 1
/return
