All pastes #473091 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-06 01:14 UTC
rendered paste body
; Immolator's OpenBot Frost Mage Routine
; 5/5/07 10:20 PM
; 
; History:
; 	Legend: E = Enhancement, F = Fix, C 
; 	v0.1.0
; 		E: First version, put up a skeleton for all the necessary functions
;		E: Faces mob while casting
;		E: Eats, drinks and buffs
;		E: Combat added, pulls and fights
;		E: Uses Ice Barrier
; 		E: Uses Evocation
;		E: Uses Water Elemental
;	v0.1.1
;		F: Stopped routine trying to cast while drinking
;		E: Rewrote rest routine (faster and smarter)
;		E: Tidied combat routine
;		E: Added CheckSpell function to help with routine intelligence
;
; Todo:
; 	Better combat sequence
;	Bandages
;	Potions
;	Scrolls
;	Polymorph
;	Better Water Elemental
;	Better Evocation

objectdef oClass inherits oBase
{
	; Customize these variables to suit your needs:
	; The distance at which the PullSpell is used
	variable int PullRange = 34
	; The spell used to pull mobs
	variable string PullSpell = "Frostbolt"
	; The armour spell used (Ice Armour, Frost Armour, Mage Armour)
	variable string ArmourBuff = "Ice Armor"
	; Whether to use Dampen Magic or not
	variable bool UseDampen = TRUE
	; Whether to use Polymorph or not
	variable bool UsePoly = TRUE
	; Stop resting when above this amount of mana
	variable int FullMana = 95
	; Stop resting when above this amount of health
	variable int FullHealth = 95
	
	method Initialize()
	{
	}
	
	method CastingPulse()
	{
		if ${Target.GUID.NotEqual[${Me.GUID}]} && ${Target(exists)}
		{
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
		}
	}
	
	method RestPulse()
	{
		Move -stop
		if (${Me.PctMana} > ${This.FullMana}) && (${Me.PctHPs} > ${This.FullHealth})
		{
			Toon:Standup
		}
		if ${Me.Buff[Drink](exists)} || ${Me.Buff[Eat](exists)}
		{
			return
		}
		if (!${Consumable.HasDrink} && ${Inventory.GetBagsInfo[RETRIEVE_FREESLOTS,"normal"]} > 0) || (!${Consumable.HasFood} && ${Inventory.GetBagsInfo[RETRIEVE_FREESLOTS,"normal"]} > 0)
		{
			if (!${Consumable.HasDrink} && ${Inventory.GetBagsInfo[RETRIEVE_FREESLOTS,"normal"]} > 0) && ${CheckSpell(Conjure Water)}
			{
				Toon.CastSpellGUID[${Me.GUID},Conjure Water]
			}
			if (!${Consumable.HasFood} && ${Inventory.GetBagsInfo[RETRIEVE_FREESLOTS,"normal"]} > 0) && ${CheckSpell(Conjure Food)}
			{
				Toon.CastSpellGUID[${Me.GUID},Conjure Food]
			}
			return
		}
		if ${Toon.NeedBuff[${Me.GUID},${This.ArmourBuff}]} || ${Toon.NeedBuff[${Me.GUID},Arcane Intellect]} || (${This.UseDampen} && ${Toon.NeedBuff[${Me.GUID},Dampen Magic]} && ${This.CheckSpell(Dampen Magic})
			if ${Toon.NeedBuff[${Me.GUID},${This.ArmourBuff}]} && ${This.CheckSpell(${This.ArmourBuff})}
			{
				${Toon.EnsureBuff[${Me.GUID},${This.ArmourBuff}]}
			}
			if ${Toon.NeedBUff[${Me.GUID},Arcane Intellect]} && ${This.CheckSpell(Arcane Intellect)}
			{
				Toon.EnsureBuff[${Me.GUID},Arcane Intellect]
			}
			if ${This.UseDampen} && ${Toon.NeedBuff[${Me.GUID},Dampen Magic]} && ${This.CheckSpell(Dampen Magic)}
			{
				Toon.EnsureBuff[${Me.GUID},Dampen Magic]
			}
			return
		if ${Consumable.HasDrink} && !${Me.Buff[Drink](exists)} && (${Me.PctMana} < ${This.FullMana})
		{
			Consumable:useDrink
			return
		}
		if ${Consumable.HasFood} && !${Me.Buff[Food](exists)} && (${Me.PctHPs} < ${This.FullHealth})
		{
			Consumable:useFood
			return
		}

	}
	
	member NeedRest()
	{
		if (${Me.PctMana} < ${This.FullMana}) || (${Me.PctHPs} < ${This.FullHealth})
		{
			return TRUE
		}
		if ${Toon.NeedBuff[${Me.GUID},${This.ArmourBuff}]}
		{
			return TRUE
		}
		if ${Toon.NeedBuff[${Me.GUID},Arcane Intellect]}
		{
			return TRUE
		}
		if ${This.UseDampen} && ${Toon.NeedBuff[${Me.GUID},Dampen Magic]}
		{
			return TRUE
		}
		return FALSE
	}
	
	method PullPulse()
	{
		Move -stop
		if ${This.CheckSpell(Ice Barrier)}
		{
			Toon.CastSpellGUID[${Target.GUID},Ice Barrier]
		}
		if ${This.CheckSpell(Water Elemental)}
		{
			Toon.CastSpellGUID[${Target.GUID},Summon Water Elemental]}
		}
		if ${Toon.CastSpellGUID[${Targeting.TargetCollection.Get[1]},${PullSpell}]}
		{
			return
		}
	}	
	
	method AttackPulse()
	{
		if !${Target(exists)} || ${Target.GUID.Equal[${Me.GUID}]} || ${Target.Dead}
		{
			Toon:NeedTarget[1]
		}
		if (${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < 10) &&  (${Me.PctMana} < 5) && ${This.CheckSpell(Frost Nova)} && ${This.CheckSpell(Evocation)}
		{
			if ${Toon.CastSpellGUID[${Target.GUID},"Frost Nova"]}
			{
				Move Backward
				if ${Toon.CastSpellGUID[${Target.GUID},Evocation]}
				{
					return
				}
			}
		}
		if (${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < 10) && ${Toon.CastSpellGUID[${Target.GUID},"Frost Nova"]} 
		{
			return
		}
		if (${Target.Distance} > 34)
		{
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			Move Forward
			return
		}
		if (${Target.Buff[Frost Nova](exists)} || ${Target.Buff[Frostbite](exists)}) && (${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < 10)
		{
			Move Backward
			return
		}

		if !${Me.Buff[Ice Barrier](exists)} && ${Toon.CastSpellGUID[${Target.GUID},Ice Barrier]}
		{
			return
		}
		if ((${Me.PctMana }< 5) || (${Target.PctHPs} < 10)) && ${Toon.CastSpellGUID[${Target.GUID},Shoot]}
		{
			return
		}
		if (${Target.Distance} < 8) && ${Toon.CastSpellGUID[${Target.GUID},Cone of Cold]}
		{
			return
		}
		if (${Target.Distance} < 20) && ${Toon.CastSpellGUID[${Target.GUID},Fire Blast]}
		{
			return
		}
		if ${Toon.CastSpellGUID[${Target.GUID},Frostbolt]}
		{
			return
		}
	}
	
	member CheckSpell(string spellname)
	{
		if ${Spell[${spellname}](exists)} && !${Spell[${spellname}].Cooldown} &&  (${Me.CurrentMana} >= ${Spell[${SpellName}].Mana})
		{
			return TRUE
		}
		return FALSE
	}
	
}