All pastes #389674 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-10 21:53 UTC
rendered paste body
/*
 * Priest routine for ByteBot by Coconut
 * Version 1.5 (comments & bug reports - coconut@vanaguide.com)
 *
 */

#define FORM_CASTER 0
#define FORM_SHADOW 1
#define SHOW_DEBUG TRUE

objectdef oToon inherits oToonBase
{
	variable string oldMessage
	variable bool useBlessingOfWisdom = TRUE
	variable bool useDevotionAura = TRUE
	variable bool useRighteousFury = TRUE
	variable bool exhaustedRegen = FALSE
	variable int currentForm = 0
	variable int minimumHP = 50
	variable int minimumMP = 30
	variable int criticalHP = 30
	variable int criticalMP = 10
	variable int WandAtMobHP = 40
	variable int WandAtMP = 30
	variable string myDrink = Morning Glory Dew
	
	method InitToon()
	{
		if ${Me.Level} < 1
		{
			This.useDevotionAura:Set[FALSE]
		}
		if ${Me.Buff["Devotion Aura"](exists)}
		{
			This.currentForm:Set[FORM_SHADOW]
		}
		elseif !${Me.Buff["Devotion Aura"](exists)}
		{
			This.currentForm:Set[FORM_CASTER]
		}
	}

	;Simple Debugging echo
	member Debug(string debugMessage)
	{
		if SHOW_DEBUG == TRUE
		{
			This:Echo[${debugMessage}]
		}
	}

	;Check to see if you have the Buff on you.
	member GotBuff(string thisBuff)
	{
		if ${Me.Buff[${thisBuff}](exists)}
		{
			return TRUE
		}
		else 
		{
			return FALSE
		}
		
	}
	
	;Check to see if we need a buff casting.
	member NeedBuff()
	{
		if !${This.GotBuff[Seal of the Crusader]} && ${Spell[Seal of the Crusader](exists)}
		{
			return TRUE
		}
		elseif ${This.useBlessingOfWisdom} && !${This.GotBuff["Blessing of Wisdom]} && ${Spell["Blessing of Wisdom](exists)}
		{
			return TRUE
		}
		elseif ${This.useRighteousFury} && !${This.GotBuff["Righteous Fury"]} && ${Spell["Righteous Fury"](exists)}
		{
			return TRUE
		}		
		elseif ${This.useDevotionAura} &&  !${This.GotBuff["Devotion Aura"]} && ${Spell["Devotion Aura"](exists)}
		{
			return TRUE
		}
			
		return FALSE
			
	}
	
	;Give us the buffs require.
	method BuffPulse()
	{
		if ${Me.Casting} || ${Me.GlobalCooldown}
		{
			return
		}
		elseif !${This.GotBuff[Seal of the Crusader]} && ${This.CanCast[Seal of the Crusader]}
		{
			This:Debug[Buff Pulse - Casting Seal of the Crusader]
			This:CastInstantSpell[Seal of the Crusader]
		}
		elseif ${This.useBlessingOfWisdom} && !${This.GotBuff["Blessing of Wisdom]} && ${This.CanCast["Blessing of Wisdom]}
		{
			This:Debug[Buff Pulse - Casting "Blessing of Wisdom]
			This:CastInstantSpell["Blessing of Wisdom]
		}
		elseif ${This.useRighteousFury} && !${This.GotBuff["Righteous Fury"]} && ${This.CanCast["Righteous Fury"]}
		{
			This:Debug[Buff Pulse - Casting "Righteous Fury"]
			This:CastInstantSpell["Righteous Fury"]
		}
		elseif ${This.useDevotionAura} && !${This.GotBuff["Devotion Aura"]} && ${This.CanCast["Devotion Aura"]}
		{
			This:Debug[Buff Pulse - Casting "Devotion Aura"]
			Me.Action["Devotion Aura"]:Use
		}
	}
	member NeedRest()
	{
		if ${Me.InCombat}
		{
			This.exhaustedRegen:Set[FALSE]
			FALSE
		}
		if ${Me.PctHPs} < ${This.minimumHP} || ${Me.PctMana} < ${This.minimumMP}
		{
			return TRUE

		}
		if ${Me.PctMana} < 100 && ${Me.Buff[Drink](exists)}
		{
			return TRUE
		}
		This.exhaustedRegen:Set[FALSE]
		return FALSE
	}
	method RestPulse()
	{
		if ${Me.Casting} || ${Me.GlobalCooldown}
		{
			return
		}
		elseif !${Me.Buff[Renew](exists)} && ${Me.PctHPs} < ${This.minimumHP}
		{
			if ${Me.Buff["Devotion Aura"](exists)}
			{
				Me.Action["Devotion Aura"]:Use
				This:Wait[100]
			}
			elseif ${This.CanCast[Renew]} && !${This.GotBuff[Renew]} &&  ${Me.CurrentMana} > ${Spell[Renew].Mana}
			{
				This:CastInstantSpell[Renew]
			}
		}
		elseif ${Me.PctMana} < ${This.minimumMP}
		{
			if !${Me.Sitting}
			{
				This:Sit	
			}
			elseif !${Me.Buff[Drink](exists)} && !${Me.Action[${This.myDrink}].Cooldown}
			{
				Consumable:Drink
				This:Wait[500]
			}		
		}
	}
	method Routine()
	{
		if ${Me.Casting} || ${Me.GlobalCooldown} || !${Me.Target(exists)} && ${Target.Distance} > ${This.MaxCombatDistance} || !${Target(exists)}
		{
			return
		}
		if !${Me.Attacking} && !${Me.Action[Shoot].AutoRepeat} && ${Target.Distance} < 3 && !${Me.Equip[ranged](exists)}
		{
			Me:ToggleAttack
		}
		; Let's check to see if we're in a Critical Situation here.
		elseif ${Me.PctHPs} < ${This.criticalHP}
		{
			if ${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Stopping Wand - Entered Critical Routine]
				Me.Action[Shoot]:Use
				This:Wait[100]
			}
			if ${Me.Buff["Devotion Aura"](exists)}
			{
				This:Debug[Critical: Removing "Devotion Aura"]
				Me.Action["Devotion Aura"]:Use
				This:Wait[300]
			}
			elseif (${Me.CurrentMana} < ${Spell[Power Word: Shield].Mana} || ${Me.CurrentMana} < ${Spell[Renew].Mana} || ${Me.CurrentMana} < ${Spell[Flash Heal].Mana}) && ${This.CanCast[Consume Magic]} && !${Spell[Consume Magic].Cooldown} && ${Spell[Consume Magic](exists)}
			{
				This:Debug[Critical: Consume Magic]
				This:CastInstantSpell[Consume Magic]
			}			
			elseif !${Me.Buff[Power Word: Shield](exists)} && ${Me.CurrentMana} > ${Spell[Powrd Word: Shield].Mana} && ${This.CanCast[Power Word: Shield]} && !${Me.Buff[Weakened Soul](exists)} && ${Spell[Power Word: Shield](exists)}
			{
				This:Debug[Critical: Casting Power Word: Shield]
				This:CastInstantSpell[Power Word: Shield]
			}
			elseif !${Me.Buff[Power Word: Shield](exists)} && ${This.CanCast[Psychic Scream]} && ${Me.CurrentMana} > ${Spell[Psychic Scream].Mana} && ${Spell[Psychic Scream](exists)}
			{
				This:Debug[Critical: Psychic Scream]
				This:CastInstantSpell[Psychic Scream]
			}
			elseif ${Me.CurrentMana} > ${Spell[Renew].Mana} && ${This.CanCast[Renew]} && !${Me.Buff[Renew](exists)} && ${Spell[Renew](exists)}
			{
				This:Debug[Critical: Casting Renew]
				This:CastInstantSpell[Renew]
			}
			elseif ${Me.CurrentMana} > ${Spell[Flash Heal].Mana} && ${This.CanCast[Flash Heal]} && ${Me.Buff[Renew](exists)} && ${Spell[Flash Heal](exists)}
			{
				This:Debug[Critical: Casting Flash Heal]
				This:CastSpell[Flash Heal]
				This:Wait[100]
			}
			elseif ${Me.CurrentMana} > ${Spell[Lesser Heal].Mana} && ${This.CanCast[Lesser Heal]}
			{
				This:Debug[Critical: Casting Lesser Heal]
				This:CastSpell[Lesser Heal]
				This:Wait[100]
			}
		}
		elseif !${Me.Buff[Power Word: Shield](exists)} && ${This.CanCast[Power Word: Shield]} && !${Me.Buff[Weakened Soul](exists)} && ${Me.CurrentMana} > ${Spell[Power Word: Shield].Mana} && ${Spell[Power Word: Shield](exists)}
		{
			if ${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Stopping Wanding while I cast Power Word: Shield]
				Me.Action[Shoot]:Use
				This:Wait[100]
			}
			elseif !${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Casting Power Word: Shield]
				This:CastInstantSpell[Power Word: Shield]
			}
		}
		
		elseif ${Me.Buff["Devotion Aura"](exists)} && ${Me.PctHPs} < 80 && ${This.CanCast[Vampiric Embrace]} && !${Target.Buff[Vampiric Embrace](exists)}
		{
			if ${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Stopping Wanding while I cast Vampiric Embrace]
				Me.Action[Shoot]:Use
				This:Wait[100]
			}
			elseif !${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Casting Vampiric Embrace]
				This:CastInstantSpell[Vampiric Embrace]
			}
		}
		elseif ${Me.Buff["Devotion Aura"](exists)} && ${Target.PctHPs} < 50 && ${This.CanCast[Vampiric Touch]} && !${Target.Buff[Vampiric Touch](exists)}
		{
			This:Debug[Casting Vampiric Touch]
			This:CastInstantSpell[Vampiric Touch]
		}
		elseif !${Target.Buff[Shadow Word: Pain](exists)} && ${Me.CurrentMana} > ${Spell[Shadow Word: Shield].Mana} && ${This.CanCast[Shadow Word: Pain]} && ${Spell[Shadow Word: Pain](exists)}
		{
			if ${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Stopping Wanding while I cast Shadow Word: Pain]
				Me.Action[Shoot]:Use
				This:Wait[100]
			}
			elseif !${Me.Action[Shoot].AutoRepeat}
			{
				This:Debug[Casting Shadow Word: Pain]
				This:CastInstantSpell[Shadow Word: Pain]

			}
		}
		elseif ${Me.PctMana} < ${This.WandAtMP} && !${Me.Action[Shoot].AutoRepeat} && ${Me.Equip[ranged](exists)}
		{
			This:Debug[Beginning to Wand. Low Mana]
			Me.Action[Shoot]:Use
			This:Wait[100]
		}
		elseif ${Target.PctHPs} < ${This.WandAtMobHP} && !${Me.Action[Shoot].AutoRepeat} && ${Me.Equip[ranged](exists)}
		{
			This:Debug[Beginning to Wand. Mob Low HP]
			Me.Action[Shoot]:Use
			This:Wait[100]
		}


		elseif ${Me.PctMana} > ${This.WandAtMP}
		{
			if ${Target.Distance} > 5 && ${This.CanCast[Mind Flay]} && ${Me.CurrentMana} > ${Spell[Mind Flay].Mana} && ${Spell[Mind Flay](exists)}
			{
				This:Debug[Casting Mind Flay - Mob is running away]
				This:CastSpell[Mind Flay]
			}
			elseif ${This.CanCast[Mind Flay]} && !${This.CanCast[Mind Blast]} && ${Me.CurrentMana} > ${Spell[Mind Flay].Mana} && ${Me.Buff[Power Word: Shield](exists)} && ${Target.PctHPs} > 10 && ${Spell[Mind Flay](exists)}
			{
				This:Debug[Casting Mind Flay]
				This:CastSpell[Mind Flay]
			}
			elseif ${This.CanCast[Mind Blast]} && ${Me.CurrentMana} > ${Spell[Mind Blast].Mana} && ${Target.PctHPs} > 10  && ${Spell[Mind Blast](exists)}
			{
				This:Debug[Casting Mind Blast]
				This:CastSpell[Mind Blast]
			}
			elseif !${Spell[Mind Blast](exists)} && ${Me.CurrentMana} > ${Spell[Smite].Mana} && ${This.CanCast[Smite]}
			{
				This:Debug[Casting Smite]
				This:CastSpell[Smite]
			}
		}		
	}	
	method LoadConfig()
	{
		This.WandAtMobHP:Set[${This.ToonConfig.FindSetting["WandAtMobHP",30}]
		This.WandAtMP:Set[${This.ToonConfig.FindSetting["WandAtMP",30}]
		This.useBlessingOfWisdom:Set[${This.ToonConfig.FindSetting["useBlessingOfWisdom",FALSE}]
		This.criticalHP:Set[${This.ToonConfig.FindSetting["criticalHP",30}]
		This.useDevotionAura:Set[${This.ToonConfig.FindSetting["useDevotionAura",TRUE}]
		This.useRighteousFury:Set[${This.ToonConfig.FindSetting["useRighteousFury",TRUE}]
		This.MinCombatRange:Set[${This.ToonConfig.FindSetting["MinCombatRange",0]}]
		This.MaxCombatRange:Set[${This.ToonConfig.FindSetting["MaxCombatRange",30]}]
		This.RepairPct:Set[${This.ToonConfig.FindSetting["RepairPct",20]}]
		This.KeepFreeSlots:Set[${This.ToonConfig.FindSetting["KeepFreeSlots",3]}]
		This.MountDistance:Set[${This.ToonConfig.FindSetting["MountDistance",400]}]
		This.Loot:Set[${This.ToonConfig.FindSetting["Loot",TRUE]}]
		This.CorpseCampLimit:Set[${This.ToonConfig.FindSetting["CorpseCampLimit",2]}]
		This.ExitOnStuck:Set[${This.ToonConfig.FindSetting["ExitOnStuck",0]}]
		This.PrimaryStat:Set[${This.ToonConfig.FindSetting["PrimaryStat",STAT_SPI]}]
		This.SecondaryStat:Set[${This.ToonConfig.FindSetting["SecondaryStat",STAT_INT]}]
		This.AutoEquip:Set[${This.ToonConfig.FindSetting["AutoEquip",FALSE]}]
	}
}