All pastes #979438 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-10 11:21 UTC
rendered paste body
objectdef oClass inherits oBase
{
	variable int RestHP = 75
	variable int RestMP = 0
	variable int StopCastingMP = 60
	variable int PotMP = 10
	variable int PotHP = 10
	variable int BandHP = 0
	variable int StandHP = 80
	variable int StandMP = 95
	variable bool RestHeal = TRUE

	;----------------------
	;--- Range Settings ---
	;----------------------
	variable int PullRange = 30
	variable int MaxRanged = 30
	variable int MinRanged = 15
	variable int MaxMelee = 8
	variable int MinMelee = 2

	;----------------------
	;--- Buff Variables ---
	;----------------------
	variable string WeaponProc = "Windfury Weapon"
	variable string WeaponBuffName = "Windfury"
	variable string ShieldBuff = "Water Shield"
	variable string PrimaryHealingSpell = "Lesser Healing Wave"
	
	; Heal / Mana stuff
	; Percentage of life before a heal is cast
	variable int CombatHealHP = 65
	
	;----------------------
	;--- Init and Shutdown ---
	;----------------------
	method Initialize()
	{
	}

	method Shutdown()
	{
	}	
	
	;------------------
	;--- Rest SetUp ---
	;------------------

	member NeedRest()
	{
		if ${Me.InCombat}
		{
			; dont rest in combat
			return FALSE
		}
		
		if ${Me.Buff[Resurrection Sickness](exists)}
		{
			; wait in rest if you have rez sickness
			return TRUE
		}	
		
		if ${Me.PctHPs} < ${RestHP}
		{
			; we are below our rest threshold for health
			return TRUE
		}	
		
		if ${Me.PctHPs} < ${StandHP} && ${Me.Sitting}
		{
			; stay stitting until full health 
			return TRUE
		}

		if ${Me.PctMana} < ${RestMP}
		{
			; we are below our rest threshold for Mana
			return TRUE
		}	
		
		if ${Me.PctMana} < ${StandMP} && ${Me.Sitting}
		{
			; stay stitting until full health 
			return TRUE
		}
		
		; otherwise FALSE when we dont need rest
		return FALSE
	}
	
	method RestPulse()
	{

		if ${Movement.Speed} || ${Movement.Forward} || ${Movement.Backward}
		{
			; ensure we arent moving
			move -stop
		}

		if ${Me.Buff[Resurrection Sickness](exists)}
		{
			; stupid rez sickness
			Toon:Sitdown
			return
		}
		
		; If I am full of mana and not eating and I am sitting stand up
		if ${Me.PctMana} >= ${StandMP} && !${Me.Buff[Food](exists)} && ${Me.Sitting}
		{
			Toon:Standup
		}
		
		if ${Me.PctMana} > ${RestMP} && ${Me.PctHPs} < ${RestHP} && ${RestHeal}
		{
			; rest heal
			Toon:CastSpell[Lesser Healing Wave]
			return
		}	
		elseif ${Consumable.HasFood} && ${Me.PctHPs} < ${RestHP} && !${Me.Buff[Food](exists)}
		{
			; eat
			Consumable:useFood
			return
		}
		elseif ${Me.PctHPs} < ${RestHP}
		{
			; sit down if we need HP
			Toon:Sitdown
			return				
		}

		if ${Consumable.HasDrink} && ${Me.PctMana} < ${RestMP} && !${Me.Buff[Drink](exists)}
		{
			; eat
			Consumable:useDrink
			return
		}
		elseif ${Me.PctMana} < ${RestMP}
		{
			; sit down if we need MANA
			Toon:Sitdown
			return				
		}
		
		; NOTE-- Casters will want to add this to the next line--  
			/* && ${Me.PctMana} >= ${Config:GetSlider[sldStandMana]} */
		if ${Me.PctHPs} >= ${StandHP} && ${Me.PctMana} >= ${StandMP} && ${Me.Sitting}
		{
			; stand up when we are done resting
			Toon:Standup
			return
		}		
	}
	
	;------------------
	;--- Buff SetUp ---
	;------------------

	member NeedBuff()
	{
		if (${Me.Equip[mainhand].PctDurability} > 1)
		{		
			if !${Me.Casting} && (${This.WeaponProc.NotEqual[NONE]} && (!${Me.Equip[mainhand].Enchantment[${This.WeaponBuffName}](exists)} || ((${Me.Equip[offhand].SubType.NotEqual[Shield]} && ${Me.Equip[offhand].SubType.NotEqual[Miscellaneous]}) && !${Me.Equip[offhand].Enchantment[${This.WeaponBuffName}](exists)}))
			{
				This:Output["Im missing my weapon buff, do I even own it yet? -- ${This.WeaponBuffName} -- ${This.WeaponProc}"]
				return TRUE
			}
			return FALSE
		}
		
		return FALSE
	}
	
	method BuffPulse()
	{
		Toon:Standup

		if ${Spell[${This.WeaponProc}](exists)}
		{
			if !${Me.Equip[mainhand].Enchantment[${This.WeaponBuffName}](exists)} || ((${Me.Equip[offhand].SubType.NotEqual[Shield]} && ${Me.Equip[offhand].SubType.NotEqual[Miscellaneous]}) && !${Me.Equip[offhand].Enchantment[${This.WeaponBuffName}](exists)})
			{
				Toon:CastSpell[${This.WeaponProc}]
				return
			}
		}
		return
	}
	
	;------------------
	;--- Pull SetUp ---
	;------------------
	
	member NeedPullBuff()
	{
		return FALSE
	}

	method PullBuffPulse()
	{
	}
	
	;------------------------
	;--- CombatBuff SetUp	---
	;------------------------

	member NeedCombatBuff()
	{
		return FALSE
	}

	method CombatBuffPulse()
	{
	}
	
	;------------------
	;--- Pull SetUp ---
	;------------------
		
	variable int PullTimeDelay = ${LavishScript.RunningTime}
	variable int RandomPull = 99
	
	method PullPulse()
	{
		
		if ${PullTimeDelay}>${LavishScript.RunningTime}
		{
			; We shouldnt do anything
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			return
		}

		if !${Toon.ValidTarget[${Target.GUID}]}
		{
			; ensure we target is valid
			This:Output["I need a target"]
			Toon:NeedTarget[1]			
			return
		}		

		if !${Toon.TargetIsBestTarget}
		{
			; ensure our target is the best target
			This:Output["Target is no longer best target, aquire new target."]
			Toon:BestTarget
			return
		}

		; If I am currently casting or have global cooldown return
		if ${Me.Casting} || ${Me.GlobalCooldown}
		{
			return
		}

		if !${Toon.withinRanged[TRUE]}
		{
			Toon:ToRanged
			return
		}

		if ${Movement.Speed}
		{
			move -stop
			return
		}

		; Bust Blood Fury if we got it and we can
		if ${Spell[Blood Fury](exists)} && !${Spell[Blood Fury].Cooldown}
		{
			Toon:CastSpell["Blood Fury"]
			return
		}		
		; Pull with Lightning Bolt		
		Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
		Toon:CastSpell["Lightning Bolt"]
		PullTimeDelay:Set[${Math.Calc[ ${LavishScript.RunningTime} + ${Spell[Lightning Bolt].CastTime} + 1000 ]}]

	}
	
	;--------------------
	;--- Combat SetUp ---
	;--------------------
	
	method AttackPulse()
	{
		if !${Toon.ValidTarget[${Target.GUID}]}
		{
			; ensure we target is valid
			This:Output["I need a target"]
			Toon:NeedTarget[1]
			if ${Movement.Speed}
			{
				This:Debug["Needed a target and was still moving?"]
				move -stop
			}
			return
		}			

		if ${PullTimeDelay}>${LavishScript.RunningTime}
		{
			; We shouldnt do anything
			return
		}

		if !${Me.Attacking}
		{
			WoWScript AttackTarget()
		}

		Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
		
		if ${Me.Casting} || ${Me.GlobalCooldown}
		{
			; Dont need to do anything we are casting
			return
		}
		
		; We need to get to melee the bastard
		Toon:ToMelee
		
		if ${Target.Distance}<=${MaxMelee} && ${Movement.Speed}
		{
			move -stop
		}
		
		; Do we have our shield buff on, if it's lightning shield, check mana level too
		if !${Me.Buff[${This.ShieldBuff}](exists)} && ${Spell[${This.ShieldBuff}](exists)} && ${This.ShieldBuff.Equal[Lightning Shield]} && ${Me.PctMana} > 50
		{
			This:Output["Attempting to cast ${This.ShieldBuff}"]
			Toon:CastSpell[${This.ShieldBuff}]
		}

		; If it's water shield, put it on always
		if !${Me.Buff[${This.ShieldBuff}](exists)} && ${Spell[${This.ShieldBuff}](exists)} && ${This.ShieldBuff.Equal[Water Shield]}
		{
			This:Output["Attempting to cast ${This.ShieldBuff}"]
			Toon:CastSpell[${This.ShieldBuff}]
		}
		
		; If we have stormstrike use it
		if ${Spell[Stormstrike](exists)} && !${Spell[Stormstrike].Cooldown}
    {
      Toon:CastSpell["Stormstrike"]
    }

		; If we have alot of mana Earth Shock him for shits and giggles
		if ${Me.PctMana} < ${StopCastingMP} && ${Spell[Earth Shock](exists)} && !${Spell[Earth Shock].Cooldown} && ${Me.Buff[Focused](exists)}
		{
			This:Output["Attempting to cast Earth Shock"]
			Toon:CastSpell["Earth Shock"]
		}
		
		; If target is casting on us and we can shock it then do that
		if ${Spell[Earth Shock](exists)} && !${Spell[Earth Shock].Cooldown} && ${Target.Casting(exists)} && !${Me.Buff[Grounding Totem Effect].exists} && !${Me.Casting}
		{
      Toon:CastSpell["Earth Shock"]
    }
    
    ; If target is casting and earth shock is on cooldown but grounding totem is not on cooldown then cast grounding totem
    if ${Spell[Grounding Totem](exists)} && !${Spell[Grounding Totem].Cooldown} && !${Me.Buff[Grounding Totem Effect].exists} && ${Target.Casting(exists)}
    {
      Toon:CastSpell[Grounding Totem]
    }
		
		; If we have less than the stop casting mana and the targets hp is greater than 80 percent cast shamanisitic rage
		if ${Me.PctMana} <= ${StopCastingMP} && ${Target.PctHPs} > 80 && !${Spell[Shamanistic Rage].Cooldown} && ${Spell[Shamanistic Rage](exists)}
    {
      Toon:CastSpell["Shamanistic Rage"]
    }
		
		; Check Earth Totem Buffs
		This:EarthCheck
		; Check Fire Totem Buffs
		; Check Water Totem Buffs
		; Check Air Totem Buffs
		
		if ${Me.PctHPs} < ${CombatHealHP} && ${Me.Action[Lesser Healing Wave].Usable}
		{
			This:Output["Attempting to cast Healing Wave"]
			Toon:CastSpell["Lesser Healing Wave"]
		}
		
	}

	method EarthCheck()
	{
		variable guidlist Aggros
		
		/* determine number of adds */
		Aggros:Clear
		Aggros:Search[-units, -nearest, -targetingme, -alive, -range 0-30]
		
		if ${Aggros.Count}>=2
		{
			if ${Spell[Stoneclaw Totem](exists)} && !${Unit[${Aggros.GUID[2]}].CreatureType.Equal[Totem]} && !${Spell[Stoneclaw Totem].Cooldown}
			{
				Toon:CastSpell[Stoneclaw Totem]
			}
			
      if ${Aggros.Count}>=3 && !${Spell[Gift of the Naaru].Cooldown}
      {
        Toon:CastSpell["Gift of the Naaru"]
      }			
			return
		}

		;If we have shamanistic rage off cooldown cast it now
		if ${Toon.CanCast[Shamanistic Rage]} &&	!${Spell[Shamanistic Rage].Cooldown} && ${Me.PctMana} <= ${StopCastingMP}
		{
			Toon:CastSpell[Shamanistic Rage]
		}	
		
		; If we have a cooldown on it.. That means it is out lets not overide that
		if ${Spell[Stoneclaw Totem](exists)} && ${Spell[Stoneclaw Totem].Cooldown}
		{
			return
		}
		;if !${Me.Buff[Strength of Earth](exists)} && ${Spell[Strength of Earth Totem](exists)} 
		;{
		;	Toon:CastSpell[Strength of Earth Totem]
		;}
	}
	
	;------------------
	;--- Assist Mode ---
	;------------------
	
	member IsAssistMode()
	{
		; returns a check that determines if the bot is in party mode
		if ${UIElement[chkAssistMode@Overview@Pages@openbot].Checked}
		{
			return TRUE
		}
		return FALSE
	}	
	
	;------------------
	;--- Flee SetUp ---
	;------------------
	
	variable bool HookFlee = FALSE
	method FleePulse()
	{
		; stuff to do while fleeing		
	}

	;------------------
	;--- Dead SetUp ---
	;------------------
	
	member NeedDead()
	{
		return FALSE
	}
	method DeadPulse()
	{
		; This is where you would do stuff while Dead before Release	
	}

	;------------------
	;--- Idle SetUp ---
	;------------------
	
	variable bool NeedCombatIdle = FALSE
	method CombatIdle()
	{
		; stuff to do while Idle in Combat		
	}
	
	;----------------------
	;--- Event Hooking ---
	;----------------------

	variable bool needUIHook = TRUE
	method UIErrorMessage(string Id, string Msg)
	{
		; check msg and perform action
	}	
	
	variable bool needCombatHook = TRUE
	method CombatEvent(string unitID, string unitAction, string isCrit, string amtDamage, string damageType)
	{
		; check args and perform action
	}
	
	;--------------------
	;--- GUI SetUp ---
	;--------------------
	
	method SetGUI()
	{
	   variable string uniqueToon = "${Me.Name}:${Me.Class}:${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}"
	   Config:SetSlider[${uniqueToon},"sldRestHP","sldRestHP@Main@Pages@ClassGUI",60]
	   Config:SetSlider[${uniqueToon},"sldStandHP","sldStandHP@Main@Pages@ClassGUI",100]
	   Config:SetSlider[${uniqueToon},"sldPullBailOutTimer","sldPullBailOutTimer@Main@Pages@ClassGUI",60]   
	}
	
	method SaveGUI()
	{
	   variable string uniqueToon = "${Me.Name}:${Me.Class}:${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}"
	   Config:SaveSlider[${uniqueToon},"sldRestHP"]
	   Config:SaveSlider[${uniqueToon},"sldStandHP"]
	   Config:SaveSlider[${uniqueToon},"sldPullBailOutTimer"]	   
	}	
}