rendered paste bodyobjectdef oClass inherits oBase
{
; --- Misc Settings
variable int CommandTimer = ${LavishScript.RunningTime}
; --- Rest Settings
variable int RestMana = 80
variable int RestHPs = 80
variable int RestDrink = 70
variable int RestFood = 70
; --- Range Settings
variable int PullRange = 30
variable int MaxRanged = 30
variable int MinRanged = 15
variable int MaxMelee = 5
variable int MinMelee = 1
; --- Pet Settings
variable string PetFoodCustom = NULL
variable string PetFood = NULL
variable index:string PetFoodBad
variable bool PetFeed = FALSE
variable bool PetFed = FALSE
variable int PetFedCount = 0
variable bool CallPet = FALSE
method Initialize()
{
}
method RestPulse()
{
Move -stop
if ${Me.PctMana} > 95 && ${Me.PctHPs} > 95
{
Toon:Standup
}
if ${Me.Sitting}
{
return
}
if ${Spell[Aspect of the Hawk](exists)}
{
if ${This.EnsureBuffTMP[${Me.GUID},Aspect of the Hawk]}
{
return
}
}
elseif ${Spell[Aspect of the Monkey](exists)}
{
if ${This.EnsureBuffTMP[${Me.GUID},Aspect of the Monkey]}
{
return
}
}
if (${Me.PctMana} < ${RestMana} || ${Me.PctHPs} < ${RestHPs})
{
Toon:Sitdown
return
}
if ${This.PetDead} && !${CallPet}
{
if ${This.CastSpellGUIDTMP[${Me.GUID},Call Pet]}
{
return
}
CallPet:Set[TRUE]
return
}
if ${This.PetDead}
{
if ${This.CastSpellGUIDTMP[${Me.GUID},Revive Pet]}
{
return
}
return
}
CallPet:Set[FALSE]
if ${This.HasPet} && ${Me.Pet.PctHPs} < ${RestHPs}
{
if ${Me.Pet.PctHPs} < ${RestFood}
{
if ${This.EnsureBuffTMP[${Me.Pet.GUID},Mend Pet]}
{
return
}
}
return
}
if ${Consumable.HasDrink} && ${Me.PctMana} < ${RestDrink}
{
if !${Me.Buff[Drink](exists)}
{
Consumable:useDrink
}
return
}
if ${Consumable.HasFood}
{
if ${Me.PctHPs} < ${RestFood}
{
if !${Me.Buff[Food](exists)}
{
Consumable:useFood
}
return
}
if ${This.HasPet} && ${Me.Pet.PctHappiness} < 75 && ${This.NeedBuffTMP[${Me.Pet.GUID},Feed Pet Effect]} && ${PetFedCount} < 3
{
if ${This.CommandTimeout}
{
return
}
if ${PetFeed} && ${PetFood.NotEqual[NULL]}
{
Item[${PetFood}]:Use
PetFed:Set[TRUE]
PetFeed:Set[FALSE]
This:Timeout
return
}
if ${PetFed} && ${PetFood.NotEqual[NULL]}
{
if !${PetFoodBad.Get[${PetFood}](exists)}
{
PetFoodBad:Insert[${PetFood}]
}
PetFed:Set[FALSE]
PetFedCount:Set[${PetFedCount} + 1]
PetFood:Set[NULL]
return
}
if ${PetFood.Equal[NULL]}
{
This:GetPetFood
This:Timeout
}
else
{
if ${This.CastSpellGUIDTMP[${Me.Pet.GUID},Feed Pet]}
{
PetFeed:Set[TRUE]
}
}
return
}
}
PetFeed:Set[FALSE]
PetFed:Set[FALSE]
PetFood:Set[NULL]
if ${Target(exists)}
{
if ${This.CommandTimeout}
{
return
}
WoWScript ClearTarget()
This:Timeout
return
}
}
member NeedRest()
{
if (${Me.PctMana} < 90) || (${Me.PctHPs} < 90)
{
return TRUE
}
if ${This.PetDead}
{
return TRUE
}
if ${This.HasPet}
{
if ${Me.Pet.PctHPs} < 90
{
return TRUE
}
if ${Consumable.HasFood} && ${Me.Pet.PctHappiness} < 75 && ${PetFedCount} < 3
{
return TRUE
}
}
if ${Spell[Aspect of the Hawk](exists)}
{
if ${This.NeedBuffTMP[${Me.GUID},Aspect of the Hawk]}
{
return TRUE
}
}
elseif ${Spell[Aspect of the Monkey](exists)}
{
if ${This.NeedBuffTMP[${Me.GUID},Aspect of the Monkey]}
{
return TRUE
}
}
return FALSE
}
method PullPulse()
{
Move -stop
if ${This.EnsureTarget}
{
return
}
if ${Target(exists)} && ${Target.Level} > ${Me.Level}
{
if ${This.EnsureBuffTMP[${Target.GUID},"Hunter's Mark"]}
{
return
}
}
if ${Target(exists)} && ${This.HasPet} && !${Me.Pet.Target(exists)} && !${Me.Pet.Aggro}
{
if ${This.CommandTimeout}
{
return
}
WoWScript PetAttack()
This:Timeout
return
}
if ${This.InMelee}
{
Navigator:MoveTo[${Target.X},${Target.Y},${Target.Z}]
return
}
if ${This.InRanged}
{
if ${This.CastSpellGUIDTMP[${Target.GUID},Aimed Shot]}
{
return
}
}
}
method AttackPulse()
{
Move -stop
if ${This.EnsureTarget}
{
return
}
if ${Target(exists)}
{
if (${This.HasAction[Attack]} && !${Me.Attacking} && ${This.InMelee}) || (${This.HasAction[Auto Shot]} && !${Me.Action[Auto Shot].AutoRepeat} && ${This.InRanged})
{
WoWScript AttackTarget()
return
}
}
if ${Target(exists)} && !${This.IHasTarget} && !${This.InRanged}
{
Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
if ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} > ${MaxRanged}
{
Move Forward
}
else
{
Move Backward
}
return
}
if ${This.InMelee}
{
if ${Me.PctHPs} < 65 && ${Target.PctHPs} > 35
{
if ${This.EnsureBuffTMP[${Me.GUID},Aspect of the Monkey]}
{
return
}
}
if ${This.HasActionTMP[Mongoose Bite]}
{
if ${This.EnsureBuffTMP[${Target.GUID},Mongoose Bite]}
{
return
}
}
if ${This.CastSpellGUIDTMP[${Target.GUID},Raptor Strike]}
{
return
}
return
}
if ${This.InRanged}
{
if ${This.HasPet}
{
if ${This.IHasTarget}
{
if ${This.EnsureBuffTMP[${Target.GUID},Concussive Shot]}
{
return
}
}
}
if ${This.EnsureBuffTMP[${Target.GUID},Serpent Sting]}
{
return
}
if ${This.CastSpellGUIDTMP[${Target.GUID},Arcane Shot]}
{
return
}
return
}
if ${This.PetHasTarget}
{
if !${This.InRanged}
{
Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
if ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} > ${MaxRanged}
{
Move Forward
}
else
{
Move Backward
}
return
}
}
elseif ${This.IHasTarget}
{
if !${This.InMelee}
{
Navigator:MoveTo[${Target.X},${Target.Y},${Target.Z}]
return
}
}
else
{
if ${This.InRanged}
{
Move -stop
return
}
}
}
; --- Extra Functions That Will Help
member CommandTimeout(int ms = 2)
{
if (${Math.Calc[${LavishScript.RunningTime} - ${CommandTimer}]} < (1000 * ${ms}))
{
This:Output[Timeout ${Math.Calc[${LavishScript.RunningTime} - ${CommandTimer}]}]
return TRUE
}
return FALSE
}
method Timeout()
{
CommandTimer:Set[${LavishScript.RunningTime}]
}
member EnsureTarget()
{
if !${Target(exists)}
{
if ${This.HasPet}
{
if ${This.CommandTimeout}
{
return TRUE
}
if ${Me.Pet.Target(exists)} && !${Me.Pet.Target.Dead} && ${Me.Pet.Target.Attackable}
{
Target ${Me.Pet.Target.GUID}
This:Timeout
return TRUE
}
elseif ${Targeting.TargetCollection.Get[1](exists)} && !${Unit[${Targeting.TargetCollection.Get[1]}].Dead} && ${Unit[${Targeting.TargetCollection.Get[1]}].Attackable}
{
Target ${Targeting.TargetCollection.Get[1]}
This:Timeout
return TRUE
}
}
elseif ${Targeting.TargetCollection.Get[1](exists)} && !${Unit[${Targeting.TargetCollection.Get[1]}].Dead} && ${Unit[${Targeting.TargetCollection.Get[1]}].Attackable}
{
if ${This.CommandTimeout}
{
return TRUE
}
Target ${Targeting.TargetCollection.Get[1]}
This:Timeout
return TRUE
}
}
else
{
Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
if ${Target.Dead} && ${Me.InCombat}
{
if ${This.CommandTimeout}
{
return TRUE
}
WoWScript ClearTarget()
This:Timeout
return TRUE
}
}
return FALSE
}
member InMelee()
{
if ${Target(exists)} && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < ${MaxMelee} && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} > ${MinMelee}
{
return TRUE
}
return FALSE
}
member InRanged()
{
if ${Target(exists)} && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < ${MaxRanged} && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} > ${MinRanged}
{
return TRUE
}
return FALSE
}
member CastSpellGUIDTMP(string GUID, string spellname)
{
If ${Spell[${spellname}](exists)} && !${Spell[${spellname}].Cooldown} && ${GUID.NotEqual[NULL]} && ${This.EnsureManaTMP[${spellname}]}
{
/* Add here a test for instant Spell */
/* Test and check mate */
if !${Spell[${spellname}].Mana}
{
Move -stop
}
if (${Target(exists)} && ${Target.GUID.NotEqual[${GUID}]}) || !${Target(exists)}
{
Target ${GUID}
}
if ${GUID.NotEqual[${Me.GUID}]}
{
Navigator:FaceXYZ[${Object[${GUID}].X},${Object[${GUID}].Y},${Object[${GUID}].Z}]
}
Spell[${spellname}]:Cast
return TRUE
}
return FALSE
}
member NeedBuffTMP(string GUID, string spellname)
{
If !${Object[${GUID}].Buff[${spellname}](exists)}
{
return TRUE
}
return FALSE
}
member EnsureBuffTMP(string GUID, string spellname)
{
If ${This.NeedBuffTMP[${GUID},${spellname}]}
{
return ${This.CastSpellGUID[${GUID}, ${spellname}]}
}
return FALSE
}
member EnsureManaTMP(string spellname)
{
if ${Spell[${spellname}](exists)} && !${Spell[${spellname}].Mana}
{
return TRUE
}
if ${Me.Class.Equal[Rogue]}
{
if ${Spell[${spellname}](exists)} && ${Me.CurrentEnergy} >= ${Spell[${spellname}].Mana}
{
return TRUE
}
}
elseif ${Me.Class.Equal[Rogue]} || (${Me.Class.Equal[Druid]} && ${Me.Buff[Form](exists)})
{
if ${Spell[${spellname}](exists)} && ${Me.CurrentRage} >= ${Math.Calc[${Spell[${spellname}].Mana} / 1000]}
{
return TRUE
}
}
else
{
if ${Spell[${spellname}](exists)} && ${Me.CurrentMana} >= ${Spell[${spellname}].Mana}
{
return TRUE
}
}
return FALSE
}
member HasActionTMP(string spellname)
{
if ${Me.Action[${spellname}](exists)} && ${Me.Action[${spellname}].Usable}
{
return TRUE
}
return FALSE
}
member EnsureActionAutoRepeatTMP(string GUID, string spellname)
{
if ${This.HasActionTMP[${spellname}]} && !${Me.Action[${spellname}].AutoRepeat}
{
return ${This.CastSpellGUID[${GUID},${spellname}]}
}
return FALSE
}
member IHasTarget()
{
if ${Target(exists)} && ${Target.Target.GUID.Equal[${Me.GUID}]}
{
return TRUE
}
return FALSE
}
member HasPet()
{
if ${Me.Pet(exists)} && !${This.PetDead}
{
return TRUE
}
return FALSE
}
member PetDead()
{
if ${Spell[Call Pet](exists)}
{
if (${Me.Pet(exists)} && ${Me.Pet.Dead}) || !${Me.Pet(exists)}
{
return TRUE
}
}
return FALSE
}
member PetHasTarget()
{
if ${This.HasPet} && ${Me.Pet.Target(exists)} && ${Target(exists)} && ${Target.Target.GUID.Equal[${Me.Pet.GUID}]}
{
return TRUE
}
return FALSE
}
method GetPetFood()
{
declare Index int local 0
declare FoodList guidlist local
declare FoodIndex int local 0
if ${PetFoodCustom.NotEqual[NULL]}
{
if ${Item[${PetFoodCustom}](exists)}
{
PetFood:Set[${Object[${PetFoodCustom}].GUID}]
}
}
else
{
FoodList:Search[-items, -usable, -inventory, -food]
if ${FoodList.Count} > 0
{
while ${Index:Inc} <= ${FoodList.Count}
{
if !${PetFoodBad.Get[${FoodList.GUID[${Index}]}](exists)}
{
FoodIndex:Set[${Index}]
break
}
}
if ${FoodIndex} > 0
{
PetFood:Set[${FoodList.GUID[${FoodIndex}]}]
}
}
FoodList:Clear
}
}
}