private void Bandaging() { WoWItem bandage = HaveItemCheck(BandageIds); if (!Equals(null, bandage) && addsList.Count < 2) { slog("Bandaging."); Lua.DoString("UseItemByName(\"" + bandage.Entry + "\")"); StyxWoW.SleepForLagDuration(); Lua.DoString("TargetUnit(\"" + player + "\")"); uint a = 0; while (a < 81) { if (addsList[0].HasAura("Gouge") || addsList[0].HasAura("Blind")) { StyxWoW.SleepForLagDuration(); ++a; } else { addsList[0].Target(); WoWMovement.Face(); Lua.DoString("StartAttack()"); a = 81; } } } else { slog("No bandages in backpack."); } }
private static void CheckFace() { if (!WoWMovement.IsFacing) { WoWMovement.Face(Target.Guid); } }
// Combat for people in Subtlety spec. void FinishSub() { if (!Me.Combat) { return; } if (SSSettings.Instance.UseShadowDance) { if (SpellManager.CanCast("Shadowstep") && SpellManager.CanCast("Shadow Dance") && SpellManager.CanCast("Gouge")) { Gouge(); StyxWoW.SleepForLagDuration(); ShadowDance(); StyxWoW.SleepForLagDuration(); Shadowstep(); StyxWoW.SleepForLagDuration(); WoWMovement.Face(); StyxWoW.SleepForLagDuration(); Ambush(); } } if (StyxWoW.Me.ComboPoints > 1 && Me.CurrentTarget.HealthPercent < 20) { if (SpellManager.CanCast("Eviscerate") && Me.GotTarget && targetDistance <= 5) { Eviscerate(); } } if (StyxWoW.Me.ComboPoints > 3 && Me.CurrentTarget.HealthPercent < 40) { if (SpellManager.CanCast("Eviscerate") && Me.GotTarget && targetDistance <= 5) { Eviscerate(); } } if (StyxWoW.Me.ComboPoints > 4 && Me.CurrentTarget.HealthPercent < 100) { if (SpellManager.CanCast("Eviscerate") && Me.GotTarget && targetDistance <= 5) { Eviscerate(); } } if (StyxWoW.Me.ComboPoints < 5) { if (!SpellManager.HasSpell("Hemorrhage")) { SinisterStrike(); } if (SpellManager.CanCast("Hemorrhage") && Me.GotTarget && targetDistance <= 5) { Hemorrhage(); } else { return; } } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => Counter >= NumOfTimes, new Action(ret => _isBehaviorDone = true)), new PrioritySelector( new Decorator(ret => CurrentObject != null && CurrentObject.DistanceSqr > Range * Range, new Sequence( new Action(delegate { TreeRoot.StatusText = "Moving to use item on \"" + CurrentObject.Name + "\""; }), new Action(ret => Navigator.MoveTo(CurrentObject.Location)) ) ), new Decorator(ret => CurrentObject != null && CurrentObject.DistanceSqr <= Range * Range && Item != null && Item.Cooldown == 0, new Sequence( new DecoratorContinue(ret => StyxWoW.Me.IsMoving, new Action(ret => { WoWMovement.MoveStop(); StyxWoW.SleepForLagDuration(); })), new Action(ret => { bool targeted = false; TreeRoot.StatusText = "Using item on \"" + CurrentObject.Name + "\""; if (CurrentObject is WoWUnit && (StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget != CurrentObject)) { (CurrentObject as WoWUnit).Target(); targeted = true; StyxWoW.SleepForLagDuration(); } WoWMovement.Face(CurrentObject.Guid); Item.UseContainerItem(); _npcBlacklist.Add(CurrentObject.Guid); StyxWoW.SleepForLagDuration(); Counter++; Thread.Sleep(WaitTime); if (targeted) { StyxWoW.Me.ClearTarget(); } })) ), new Sequence( new Action(delegate { TreeRoot.StatusText = "Moving to location " + Location; }), new Action(ret => Navigator.MoveTo(Location)))) ))); }
private void ConeOfCold() { if (Me.CurrentTarget != null) { if (Me.GotTarget && SpellManager.CanCast("Cone of Cold")) { if (Me.CurrentTarget.Distance < 10) { WoWMovement.Face(); Log("Cone of Cold."); SpellManager.Cast("Cone of Cold"); } } } }
private bool Solo_Combat() { bool casted = false, thiscasted = false; //slog(Color.Black, "We are dpsissing"); if (unitcheck(Enemy) > 0) { if (Me.CurrentHolyPower == 3 && !GotBuff("Inquisition")) { thiscasted = Cast("Inquisition", "Buff", "Got plenty of holy power, time to pew pew"); if (thiscasted) { casted = true; } } else if (CanCast("Holy Shock", Enemy) && Enemy.Distance < 20) { if (Solo_wanna_face) { WoWMovement.Face(); } thiscasted = Cast("Holy Shock", Enemy, 20, "DPS", "Solo, we need to kill"); if (thiscasted) { casted = true; } } else { if (Solo_wanna_face) { WoWMovement.Face(); } thiscasted = Cast("Exorcism", Enemy, 30, "DPS", "Solo, we need to kill"); if (thiscasted) { casted = true; } } } return(casted); }
private bool ConsumeTime(bool CS) { /* * if (CanCast("Judgement", Enemy)) * { * Cast("Judgement", Enemy); * slog(Color.DarkMagenta, "Casting Judgment on {0} at {1}", Enemy.Name, Round(Enemy.Distance)); * return true; * } */ if (CS && Me.Combat && Enemy != null && Enemy.IsValid && !Enemy.Dead) { if (wanna_face) { WoWMovement.Face(); } //slog(Color.DarkMagenta, "Casting Crusader Strike on {0} at {1}", Enemy.Name, Round(Enemy.Distance)); return(Cast("Crusader Strike", Enemy, 5, "DPS", "Melee range, free HP")); } return(false); }
private void BlindAndGouge() { WoWUnit myAdd = addsList[1]; if (myAdd != oldAdd) { countBlind = 0; countGouge = 0; } if (countBlind < 3 && SpellManager.CanCast("Blind")) { addsList[1].Target(); WoWMovement.Face(); Thread.Sleep(750); SpellManager.Cast("Blind"); addsList[0].Target(); WoWMovement.Face(); Thread.Sleep(750); ++countBlind; Lua.DoString("StartAttack()"); oldAdd = myAdd; } else if (SpellManager.CanCast("Gouge") && 3 > countGouge) { addsList[1].Target(); WoWMovement.Face(); Thread.Sleep(750); SpellManager.Cast("Gouge"); addsList[0].Target(); Thread.Sleep(750); WoWMovement.Face(); Lua.DoString("StartAttack()"); ++countGouge; oldAdd = myAdd; } else { return; } }
private bool Dps(bool HoW, bool Denunce) { if (HoW && CanCast("Hammer of Wrath") && Me.Combat && Enemy != null && Enemy.IsValid && !Enemy.Dead) { if (wanna_face) { WoWMovement.Face(); } //slog(Color.DarkMagenta, "Casting Hammer of Wrath on {0} at {1}", Enemy.Name, Round(Enemy.Distance)); return(Cast("Hammer of Wrath", Enemy, 30, "DPS", "Enemy low on health")); } if (Denunce && GotBuff("Denounce") && Me.Combat && Enemy != null && Enemy.IsValid && !Enemy.Dead) { if (wanna_face) { WoWMovement.Face(); } //slog(Color.DarkMagenta, "Casting Exorcism on {0} at {1}", Enemy.Name, Round(Enemy.Distance)); return(Cast("Exorcism", Enemy, 30, "DPS", "Got Denunce buff")); } return(false); }
private void Strafe() { WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight); WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend); WoWMovement.Face(); ConeOfCold(); WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeRight); WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend); Log("Strife Jump"); if (Me.CurrentTarget != null) { if (Me.CurrentTarget.BoundingRadius < Me.CurrentTarget.Distance) { Log("Im still in hitting Range strife jumping again."); WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight); WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend); Thread.Sleep(50); WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeRight); WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend); } } WoWMovement.Face(); }
private Composite CreateCombat() { return(new PrioritySelector( //Retarget Polymorphed add if we dont have a current target. new Decorator(ret => !AmplifySettings.Instance.MoveDisable && !IsInPartyOrRaid() && GotSheep && (Me.CurrentTarget == null || Me.CurrentTarget.Dead), new Action(ctx => retargetSheep())), //Retarget Totem if no other unit is in play. new Decorator(ret => !AmplifySettings.Instance.MoveDisable && !IsInPartyOrRaid() && !GotSheep && (Me.CurrentTarget == null || Me.CurrentTarget.Dead), new Action(ctx => retargetTotem())), //Added to make sure we have a target when movement is disabled before spamming my pull sqeuence new Decorator(ret => AmplifySettings.Instance.MoveDisable && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new Action(ctx => RunStatus.Success)), //If we have an active pet, make it attack the same target we are. new Decorator(ret => Me.CurrentTarget != null && !Me.CurrentTarget.Dead && Me.GotTarget && Me.GotAlivePet && (!Me.Pet.GotTarget || Me.Pet.CurrentTarget != Me.CurrentTarget), new Action(ret => Lua.DoString("PetAttack()"))), // Face thehe tart if we aren't new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face())), new Decorator(ret => Me.IsCasting || Me.Silenced || Me.ActiveAuras.ContainsKey("Hypothermia"), new Action(ctx => RunStatus.Success)), new Decorator(ret => Me.ActiveAuras.ContainsKey("Ice Block"), new Action(ctx => RunStatus.Success)), // if Health Low, Use gift of the Narru new Decorator(ret => Me.HealthPercent <= 40 && SpellManager.CanCast("Gift of the Naaru"), new PrioritySelector(CreateSpellCheckAndCast("Gift of the Naaru"))), // Use Potions new Decorator(ret => Me.HealthPercent <= AmplifySettings.Instance.HealthPotPercent && HaveHealthPotion() && HealthPotionReady(), new Action(ret => UseHealthPotion())), new Decorator(ret => Me.ManaPercent <= AmplifySettings.Instance.ManaPotPercent && HaveManaPotion() && ManaPotionReady(), new Action(ret => UseManaPotion())), new Decorator(ret => Me.ManaPercent <= 20 && HaveManaGem(), new Action(ret => UseManaGem())), new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && Navigator.CanNavigateFully(Me.Location, Me.CurrentTarget.Location) && (!Me.CurrentTarget.InLineOfSight || !Me.InLineOfSpellSight), new Action(delegate { Log("Moving towards:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); return RunStatus.Success; })), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && Navigator.CanNavigateFully(Me.Location, Me.CurrentTarget.Location) && (Me.CurrentTarget.Distance > PullDistance + 3), new Action(delegate { Log("Moving towards:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); return RunStatus.Success; })), // At this point we shouldn't be moving. Atleast not with this 'simple' kind of logic new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), //new Decorator(ret => Me.GotAlivePet && Me.Pet.GotTarget && Me.Pet.CurrentTarget != Me.CurrentTarget, // new Action(ret => WoWMovement.MoveStop())), new Switch <MageTalentSpec>(r => _talentManager.Spec, new SwitchArgument <MageTalentSpec>(Low_ChecksAndRotation(), MageTalentSpec.Lowbie), new SwitchArgument <MageTalentSpec>(Frost_ChecksAndRotation(), MageTalentSpec.Frost), new SwitchArgument <MageTalentSpec>(Fire_ChecksAndRotation(), MageTalentSpec.Fire), new SwitchArgument <MageTalentSpec>(Arcane_ChecksAndRotation(), MageTalentSpec.Arcane)) )); }
public override void Combat() { isPulling = false; _combatLoop.Reset(); _combatLoop.Start(); if (_settings.showDebug) { slog("Starting Combat Loop!"); } try { if (Battlegrounds.IsInsideBattleground) { if (Me.GotTarget && Me.CurrentTarget.IsPet) { Blacklist.Add(Me.CurrentTarget, TimeSpan.FromDays(1)); Me.ClearTarget(); return; } } #region bugged mobs if (Me.GotTarget && (!fightTimer.IsRunning || Me.CurrentTarget.Guid != lastGuid)) { fightTimer.Reset(); fightTimer.Start(); lastGuid = Me.CurrentTarget.Guid; slog("Killing " + Me.CurrentTarget.Name + " at distance " + System.Math.Round(targetDistance).ToString() + "."); } if (Me.GotTarget && !Me.CurrentTarget.IsPlayer && fightTimer.ElapsedMilliseconds > 25 * 1000 && Me.CurrentTarget.HealthPercent > 95) { slog(" This " + Me.CurrentTarget.Name + " is a bugged mob. Blacklisting for 1 hour."); Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00)); Me.ClearTarget(); Styx.Helpers.KeyboardManager.PressKey('S'); Thread.Sleep(5 * 1000); Styx.Helpers.KeyboardManager.ReleaseKey('S'); Me.ClearTarget(); lastGuid = 0; return; } #endregion DotEmUp(); // Thanks to CodeNameG SmartTarget(); // TM :P if (Me.GotTarget) { if (isTotem) { slog("Killing totem {0}", Me.CurrentTarget.Name); KillTotem(); // Thread.Sleep(_settings.myLag); } } else { _combatLoop.Stop(); if (_settings.showDebug) { slog("Exiting Combat Loop (NoTarget)! Duration {0}ms", _combatLoop.ElapsedMilliseconds); } return; } //Thread.Sleep(_settings.myLag); if (Me.GotAlivePet) { if (Me.GotTarget && Me.CurrentTarget.CurrentTargetGuid == Me.Guid) { Lua.DoString("PetAttack()"); slog("Target is attacking me, calling {0} to get aggro", Me.Pet.Name); } Lua.DoString("PetAttack()"); } followTimer.Reset(); followTimer.Start(); while (targetDistance > shadowRange + 2) { slog("{0} yard from {1}.", System.Math.Round(targetDistance).ToString(), Me.CurrentTarget.Name); Navigator.MoveTo(attackPoint); //WoWMovement.ClickToMove(Me.CurrentTarget.Location, (float)shadowRange); Thread.Sleep(_settings.myLag); if (followTimer.ElapsedMilliseconds > 20000 && Me.CurrentTarget.IsPlayer) { followTimer.Stop(); slog("Followed for more than 20 secs!"); Me.ClearTarget(); Lua.DoString("PetFollow()"); return; } } followTimer.Stop(); CheckSummon(); while (Me.IsCasting) { Thread.Sleep(_settings.myLag); } if (Me.GotTarget) { CombatDecision(); } if (targetDistance <= 4 && !Me.IsCasting) { WoWMovement.Face(); Thread.Sleep(_settings.myLag); if (!Me.IsAutoAttacking) { Lua.DoString("StartAttack()"); } } } catch (Exception ex) { if (_settings.showDebug) { slog(ex.Source); slog(ex.Message); slog(ex.StackTrace); } } _combatLoop.Stop(); if (_settings.showDebug) { slog("Exiting Combat Loop! Duration {0}ms", _combatLoop.ElapsedMilliseconds); } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => Counter >= NumOfTimes, new Action(ret => _isBehaviorDone = true)), new PrioritySelector( new Decorator(ret => CurrentObject != null && CurrentObject.DistanceSqr > Range * Range, new Switch <NavigationType>(ret => NavigationState, new SwitchArgument <NavigationType>( NavigationType.CTM, new Sequence( new Action(ret => { TreeRoot.StatusText = "Moving to use item on - " + CurrentObject.Name; }), new Action(ret => WoWMovement.ClickToMove(CurrentObject.Location)) )), new SwitchArgument <NavigationType>( NavigationType.Mesh, new Sequence( new Action(delegate { TreeRoot.StatusText = "Moving to use item on \"" + CurrentObject.Name + "\""; }), new Action(ret => Navigator.MoveTo(CurrentObject.Location)) )), new SwitchArgument <NavigationType>( NavigationType.None, new Sequence( new Action(ret => { TreeRoot.StatusText = "Object is out of range, Skipping - " + CurrentObject.Name + " Distance: " + CurrentObject.Distance; }), new Action(ret => _isBehaviorDone = true) )))), new Decorator(ret => CurrentObject != null && CurrentObject.DistanceSqr <= Range * Range && Item != null && Item.Cooldown == 0, new Sequence( new DecoratorContinue(ret => StyxWoW.Me.IsMoving, new Action(ret => { WoWMovement.MoveStop(); StyxWoW.SleepForLagDuration(); })), new Action(ret => { bool targeted = false; TreeRoot.StatusText = "Using item on \"" + CurrentObject.Name + "\""; if (CurrentObject is WoWUnit && (StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget != CurrentObject)) { (CurrentObject as WoWUnit).Target(); targeted = true; StyxWoW.SleepForLagDuration(); } WoWMovement.Face(CurrentObject.Guid); Item.UseContainerItem(); _npcBlacklist.Add(CurrentObject.Guid); StyxWoW.SleepForLagDuration(); Counter++; if (WaitTime < 100) { WaitTime = 100; } if (WaitTime > 100) { if (targeted) { StyxWoW.Me.ClearTarget(); } } Thread.Sleep(WaitTime); })) ), new Decorator( ret => Location.DistanceSqr(Me.Location) > 2 * 2, new Sequence( new Action(delegate { TreeRoot.StatusText = "Moving to location " + Location; }), new Action(ret => Navigator.MoveTo(Location)))), new Decorator( ret => !WaitForNpcs && CurrentObject == null, new Action(ret => _isBehaviorDone = true)), new Action(ret => TreeRoot.StatusText = "Waiting for object to spawn") )))); }
private PrioritySelector CreatePullBehavior() { return(new PrioritySelector( new Decorator(ret => DunatanksSettings.Instance.DisableMovement && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new Action(ctx => RunStatus.Success)), // Use leaders target new Decorator( ret => !DunatanksSettings.Instance.DisableMovement && Me.IsInParty && RaFHelper.Leader != null && RaFHelper.Leader.GotTarget && Me.GotTarget && Me.CurrentTargetGuid != RaFHelper.Leader.CurrentTargetGuid, new Action(ret => RaFHelper.Leader.CurrentTarget.Target())), // Clear target and return failure if it's tagged by someone else new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && !Me.IsInParty && Me.GotTarget && Me.CurrentTarget.TaggedByOther, new Action(delegate { SpellManager.StopCasting(); Logging.Write(Color.Orange, "Someone else tagged your target! We are so not going to help him!"); Blacklist.Add(Me.CurrentTarget, TimeSpan.FromMinutes(30)); Me.ClearTarget(); return RunStatus.Failure; }) ), // If we are casting we assume we are already pulling so let it 'return' smoothly. // if we are in combat pull suceeded and the combat behavior should run new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && (Me.IsCasting || Me.Combat) && Me.CurrentTarget.Distance < PullDistance + 3, new Action(delegate { return RunStatus.Success; })), // Make sure we got a proper target new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && !Me.GotTarget && !Me.IsInParty, new Action(delegate { Targeting.Instance.TargetList[0].Target(); WoWMovement.Face(); Thread.Sleep(100); return RunStatus.Success; })), // Blacklist target's we can't move to new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Navigator.GeneratePath(Me.Location, Me.CurrentTarget.Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); Logging.Write(Color.Orange, "Can't move to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; }) ), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance || !Me.CurrentTarget.InLineOfSight), new Action(delegate { if (!DunatanksSettings.Instance.DisableMovement) { Logging.Write(Color.Orange, "Approaching:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); } })), // Stop moving if we are moving new Decorator(ret => DunatanksSettings.Instance.DisableMovement && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), // Face the target if we aren't new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face()) ), new PrioritySelector( new Sequence( //new Action(ret => Logging.Write(Color.Orange, "Engaging {0}", Me.CurrentTarget.Name)), new PrioritySelector( new PrioritySelector( CreateAutoAttack(), MoveToTargetProper(), WritePullDebug(), FaceTarget(ret => !DunatanksSettings.Instance.DisableMovement), ChargePull(), CreateSpellCheckAndCast("Heroic Throw", ret => Me.Level >= 20 && DunatanksSettings.Instance.PullHeroicThrow && !SpellManager.Spells["Heroic Throw"].Cooldown && Me.CurrentTarget.Distance <= 30), CreateSpellCheckAndCast("Intercept", ret => Me.Level >= 50 && DunatanksSettings.Instance.useInterceptApproachPvP && Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 25), CreateSpellCheckAndCast("Shoot", ret => Me.Inventory.Equipped.Ranged != null && SpellManager.CanCast("Shoot") && !Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 30 && Me.CurrentTarget.Distance > 15), CreateSpellCheckAndCast("Throw", ret => Me.Inventory.Equipped.Ranged != null && SpellManager.CanCast("Throw") && !Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 30 && Me.CurrentTarget.Distance > 15)), MoveToTargetProper(), //stopmoving(), CreateAutoAttack() ))))); }
/// <summary> /// Creates the behavior used for pulling mobs, (approach, attack) /// </summary> /// <returns></returns> private PrioritySelector CreatePullBehavior() { return(new PrioritySelector( new Decorator(ret => AmplifySettings.Instance.MoveDisable && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new ActionIdle()), // Use leaders target new Decorator( ret => !AmplifySettings.Instance.MoveDisable && Me.IsInParty && !Me.IsInInstance && RaFHelper.Leader != null && RaFHelper.Leader.GotTarget && Me.GotTarget && Me.CurrentTargetGuid != RaFHelper.Leader.CurrentTargetGuid, new Action(ret => RaFHelper.Leader.CurrentTarget.Target())), // Clear target and return failure if it's tagged by someone else new Decorator(ret => !Me.IsInParty && Me.GotTarget && Me.CurrentTarget.TaggedByOther, new Action(delegate { SpellManager.StopCasting(); Log("Current target is not tagged by me, Aborting pull!"); Blacklist.Add(Me.CurrentTarget, TimeSpan.FromMinutes(30)); Me.ClearTarget(); return RunStatus.Failure; }) ), // If we are casting we assume we are already pulling so let it 'return' smoothly. // if we are in combat pull suceeded and the combat behavior should run new Decorator(ret => (Me.IsCasting || Me.Combat) && Me.CurrentTarget.Distance < PullDistance + 3, new Action(delegate { return RunStatus.Success; })), /* * // Make sure we got a proper target * new Decorator(ret => !Me.GotTarget && !Me.IsInParty, * new Action(delegate * { * Targeting.Instance.TargetList[0].Target(); * WoWMovement.Face(); * Thread.Sleep(100); * return RunStatus.Success; * })), */ // Blacklist target's we can't move to new Decorator(ret => !IsBattleGround() && !Me.IsInInstance && Navigator.GeneratePath(Me.Location, Me.CurrentTarget.Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); Log("Failed to generate path to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; }) ), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance - 1 || !Me.CurrentTarget.InLineOfSight), new Action(delegate { Log("Moving towards:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); })), // Stop moving if we are moving new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), new Decorator(ret => !AmplifySettings.Instance.MoveDisable && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face()) ), new PrioritySelector( //Pull spells, Check Arcane Missles if Proc new Decorator(ret => SpellManager.CanCast("Arcane Missiles") && Me.Auras.ContainsKey("Arcane Missiles!") && AmplifySettings.Instance.Pull_ProcArcaneMissles, new PrioritySelector( CreateSpellCheckAndCast("Arcane Missiles") )), //Low Level Forced Fireball, should never be run after level 4 new Decorator(ret => !SpellManager.HasSpell("Frostbolt"), new PrioritySelector( CreateSpellCheckAndCast("Fireball") )), //Normal Pull Spells Toggled by Settings. new Decorator(ret => SpellManager.HasSpell(CurrentPullSpell), new PrioritySelector( CreateSpellCheckAndCast(CurrentPullSpell) )), //Step Through Pet Logic. new Decorator(ret => Me.GotAlivePet && AmplifySettings.Instance.Freeze && Me.CurrentTarget.Distance > 10 && !WillChain(0, Me.CurrentTarget.Location) && (!FreezeTimer.IsRunning || FreezeTimer.Elapsed.Seconds > 30), new Action(ctx => Freeze())) ) )); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector(ctx => Object, new Decorator(ctx => ctx != null && (((WoWObject)ctx).Distance > InteractRange || !((WoWObject)ctx).InLineOfSight), new Sequence( new Action(ctx => TreeRoot.StatusText = "Moving to use item on - " + ((WoWObject)ctx).Name), new Action(ctx => Navigator.MoveTo(((WoWObject)ctx).Location)))), new Decorator(ctx => ctx != null && ((WoWObject)ctx).Distance <= InteractRange, new Sequence( new DecoratorContinue(c => StopMovingOnUse && Me.IsMoving, new Sequence( new Action(ctx => WoWMovement.MoveStop()), new WaitContinue(5, ctx => !Me.IsMoving, new Action(ctx => StyxWoW.SleepForLagDuration())) )), new Sequence(ctx => StyxWoW.Me.CarriedItems.FirstOrDefault(ret => ret.Entry == ItemId), // Set the status text. new Action(ctx => TreeRoot.StatusText = "Using item on " + Object.Name), // If we don't have the item stop! new DecoratorContinue(ctx => ctx == null, new Action(ctx => LogMessage("fatal", "Could not find ItemId({0}) in inventory.", ItemId))), new DecoratorContinue(ctx => Object.Type == WoWObjectType.Unit, new Action(ctx => Object.ToUnit().Target())), // Face the object. new Action(ctx => WoWMovement.Face(Object.Guid)), // Use the item. new Action(ctx => ((WoWItem)ctx).UseContainerItem()), new DecoratorContinue(ctx => HasGroundTarget, new Action(ctx => LegacySpellManager.ClickRemoteLocation(Object.Location))), new WaitContinue(6, ctx => false, new Sequence( new Action(ctx => StyxWoW.SleepForLagDuration()), new Action(ctx => _npcBlacklist.Add(Object.Guid)), new Action(ctx => _waitTimer.Reset()), new DecoratorContinue(ctx => !_waitTimer.IsRunning, new Action(ctx => _waitTimer.Start())), new Action(ctx => Counter++) ) ) ) )), new Sequence( new Action(ctx => LogMessage("info", "Moving to {0}", Location)), new Action(ctx => Navigator.MoveTo(Location)) ) ))); }
//degrees = radians * 180 / Math.PI public override void Pull() { try { //if (initialized == false) //{ // Initialize(); //} bgTargetCheck(); getAdds(); slog("Starting Pull"); if (!Me.Combat && Me.GotTarget) { slog("Safe location is saved"); prevPrevSafePoint = prevSafePoint; prevSafePoint = safePoint; safePoint = Me.Location; } slog("PVP Checked"); if (Blacklist.Contains(Me.CurrentTarget.Guid)) { slog("Target is blacklisted"); Styx.Logic.Blacklist.Add(Me.CurrentTarget.Guid, System.TimeSpan.FromSeconds(30)); Me.ClearTarget(); //pullGuid = 0; } if (Me.CurrentTarget.Guid != lastGuid) { slog("Pull starting. Target is new"); pullTimer.Reset(); pullTimer.Start(); lastGuid = Me.CurrentTarget.Guid; if (Me.CurrentTarget.IsPlayer) { slog("Pull: Killing Player at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + ""); } slog("Pull: Killing " + Me.CurrentTarget.Name + " at distance " + Math.Round(Me.CurrentTarget.Distance).ToString() + ""); pullTimer.Reset(); pullTimer.Start(); } if (!Me.CurrentTarget.IsPlayer && Me.CurrentTarget.CurrentHealth > 95 && 30 * 1000 < pullTimer.ElapsedMilliseconds) { slog(" This " + Me.CurrentTarget.Name + " is a bugged mob. Blacklisting for 1 hour."); Blacklist.Add(Me.CurrentTarget.Guid, TimeSpan.FromHours(1.00)); Me.ClearTarget(); //pullGuid = 0; if (Me.Location.Distance(safePoint) >= 30) { slog("Try to move to safePoint"); SafeMoveToPoint(safePoint, 10000); } else if (Me.Location.Distance(prevSafePoint) >= 30) { slog("Try to move to prevSafePoint"); SafeMoveToPoint(prevSafePoint, 10000); } else if (Me.Location.Distance(prevPrevSafePoint) >= 30) { slog("Try to move to prevPrevSafePoint"); SafeMoveToPoint(prevPrevSafePoint, 10000); } else { slog("Can't move to locations"); } } if (SSSettings.Instance.UseDistract && SpellManager.CanCast("Distract")) { if (Me.IsAlive && Me.GotTarget && !Me.Combat) { if (Me.CurrentTarget.Distance > 4 && Me.CurrentTarget.Distance < 30) { Distract(); } } } if (!Me.Combat && targetDistance > 4 && targetDistance < Styx.Logic.Targeting.PullDistance + 10) { slog("Move to target"); int a = 0; float pullRange = 3.5f + StyxWoW.Me.CurrentTarget.BoundingRadius; while (a < 50 && ObjectManager.Me.IsAlive && ObjectManager.Me.GotTarget && ObjectManager.Me.CurrentTarget.Distance > pullRange) { if (ObjectManager.Me.Combat) { slog("Combat has started. Abandon pull."); break; } WoWMovement.Face(); Navigator.MoveTo(WoWMovement.CalculatePointFrom(ObjectManager.Me.CurrentTarget.Location, 3f /* + Me.CurrentTarget.BoundingRadius */)); StyxWoW.SleepForLagDuration(); ++a; } } else { WoWMovement.MoveStop(); WoWMovement.Face(); } if (Me.GotTarget && targetDistance <= 5 && !Me.IsAutoAttacking) { slog("Final state of pulling"); if (attackPoint != WoWPoint.Empty) { Navigator.MoveTo(attackPoint); } if (!PocketPicked) { if (SSSettings.Instance.UsePickPocket && SpellManager.CanCast("Pick Pocket") && Me.GotTarget && targetDistance <= 5 && !Me.CurrentTarget.IsPlayer) { if (Me.CurrentTarget.CreatureType == WoWCreatureType.Humanoid || Me.CurrentTarget.CreatureType == WoWCreatureType.Undead) { slog("Try to pickpocket"); PickPocket(); Thread.Sleep(1000); PocketPicked = true; } } } if (SSSettings.Instance.PullType.Equals(1)) { if (Me.GotTarget && targetDistance <= 5) { if (SpellManager.CanCast("Cheap Shot")) { CheapShot(); } else { Lua.DoString("StartAttack()"); } } } if (SSSettings.Instance.PullType.Equals(2)) { if (SpellManager.CanCast("Ambush") && Me.GotTarget && targetDistance <= 5) { Ambush(); } else if (SpellManager.CanCast("Backstab") && Me.GotTarget && targetDistance <= 5) { Backstab(); } else { Lua.DoString("StartAttack()"); } } if (SSSettings.Instance.PullType.Equals(3)) { if (Me.GotTarget && targetDistance <= 5) { if (SpellManager.CanCast("Garrote")) { Garrote(); } else { Lua.DoString("StartAttack()"); } } } if (SSSettings.Instance.PullType.Equals(4)) { Lua.DoString("StartAttack()"); } if (SSSettings.Instance.PullType.Equals(5)) { Throw(); Lua.DoString("StartAttack()"); } } } finally { slog("Pull done."); PocketPicked = false; fightTimer.Reset(); fightTimer.Start(); } }
private Composite CreateCombat() { return(new PrioritySelector( /* new Decorator(ret => RaFHelper.Leader != null, * // Use leaders target * new Decorator(ret => * * (RaFHelper.Leader.GotTarget && Me.GotTarget && * Me.CurrentTarget.Guid != RaFHelper.Leader.CurrentTargetGuid && * !RaFHelper.Leader.CurrentTarget.Dead && * RaFHelper.Leader.CurrentTarget.Attackable && * !RaFHelper.Leader.CurrentTarget.IsFriendly) || * * (!Me.GotTarget && * RaFHelper.Leader.GotTarget && * !RaFHelper.Leader.CurrentTarget.Dead && * RaFHelper.Leader.CurrentTarget.Attackable && * !RaFHelper.Leader.CurrentTarget.IsFriendly), * * new Sequence( * new Action(delegate * { * RaFHelper.Leader.CurrentTarget.Target(); * }), * * new Wait(3, ret => Me.GotTarget, * new ActionIdle()) * ))),*/ // Make sure we got a proper target new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && ((Me.GotTarget && Targeting.Instance.FirstUnit != null && Me.CurrentTarget != Targeting.Instance.FirstUnit) || !Me.GotTarget), new Sequence( // Set Target! new Action(ret => Targeting.Instance.FirstUnit.Target()), // Wait until we got a target new Wait(3, ret => Me.GotTarget, new ActionIdle())) ), //Added to make sure we have a target when movement is disabled before spamming my pull sqeuence new Decorator(ret => ZerfallSettings.Instance.MoveDisable && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new Action(ctx => RunStatus.Success)), //If we have an active pet, make it attack the same target we are. new Decorator(ret => (Me.CurrentTarget != null || !Me.CurrentTarget.Dead) && (Me.GotTarget && Me.GotAlivePet && (!Me.Pet.GotTarget || Me.Pet.CurrentTarget != Me.CurrentTarget)), new Action(ret => Lua.DoString("PetAttack()"))), // Face thege tart if we aren't new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face())), new Decorator(ret => Me.IsCasting || Me.Silenced, new Action(ctx => RunStatus.Success)), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance + 3 || !Me.CurrentTarget.InLineOfSight), new NavigationAction(ret => Me.CurrentTarget.Location)), // At this point we shouldn't be moving. Atleast not with this 'simple' kind of logic new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), new Decorator(ret => Me.HealthPercent <= ZerfallSettings.Instance.HealthStoneCombat && HaveHealthStone() && HealthStoneNotCooldown(), new Action(ret => UseHealthStone())), // Use Potions new Decorator(ret => Me.HealthPercent <= ZerfallSettings.Instance.HealthPotPercent && HaveHealthPotion() && HealthPotionReady(), new Action(ret => UseHealthPotion())), new Decorator(ret => Me.ManaPercent <= ZerfallSettings.Instance.ManaPotPercent && HaveManaPotion() && ManaPotionReady(), new Action(ret => UseManaPotion())), new Decorator(ret => ZerfallSettings.Instance.PS_Sacrifice && !Me.Auras.ContainsKey("Sacrifice") && Me.GotAlivePet && Me.HealthPercent <= 20 && Me.Pet.CreatedBySpellId == 697, new Action(ctx => PetSkill("Sacrifice")) ), //Old PetCast Logic. //new Decorator(ret => Me.GotAlivePet && Me.Pet.CreatedBySpellId == 30146 && getAdds2().Count >= ZerfallSettings.Instance.Adds, // new Action(ctx => PetSkill("Felstorm"))), //Using PetManager Logic PetSpellCheckAndCast("Felstorm", ret => Me.GotAlivePet && Me.Pet.CreatedBySpellId == SummonFelguard && getAdds2().Count >= ZerfallSettings.Instance.Adds), //Soul shard Re-coop needs to turn off during LazyRaider use, Dont think Legaston designed this to be on in his CC since i added it. new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.GotTarget && Me.CurrentSoulShards < 3 && Me.CurrentTarget.HealthPercent <= 10, new PrioritySelector( new Decorator(ret => Me.IsCasting, new Action(ctx => SpellManager.StopCasting())), CreateSpellCheckAndCast("Drain Soul") )), ///Same as Above Here. (!ISFTimer.IsRunning || PetTimerCombat.Elapsed.Seconds > 5) new Decorator(ret => ZerfallSettings.Instance.PetSpell != "No Pet" && !Me.Mounted && !Me.IsFlying && !Me.IsOnTransport && !Me.GotAlivePet && PetTimerCombat.Elapsed.Seconds >= 5, new PrioritySelector( CreateSpellCheckAndCast("Soulburn", ret => Me.Combat && Me.CurrentSoulShards > 0 && SpellManager.HasSpell("Soulburn")), SummonPet("Summon " + CurrentPetSpell + ""))), //PVP SpecSwitch new Decorator(ret => IsBattleGround(), new Switch <WarlockTalentSpec>(r => _talentManager.Spec, new SwitchArgument <WarlockTalentSpec>(Low_rotation(), WarlockTalentSpec.Lowbie), new SwitchArgument <WarlockTalentSpec>(Affliction_PVP(), WarlockTalentSpec.Affliction), new SwitchArgument <WarlockTalentSpec>(Demo_PVP(), WarlockTalentSpec.Demonology), new SwitchArgument <WarlockTalentSpec>(Destro_PVP(), WarlockTalentSpec.Destruction) )), //Instance SpecSwitch new Decorator(ret => Me.IsInInstance && Me.IsInParty, new Switch <WarlockTalentSpec>(r => _talentManager.Spec, new SwitchArgument <WarlockTalentSpec>(Low_rotation(), WarlockTalentSpec.Lowbie), new SwitchArgument <WarlockTalentSpec>(Affliction_Instance(), WarlockTalentSpec.Affliction), new SwitchArgument <WarlockTalentSpec>(Demo_Instance(), WarlockTalentSpec.Demonology), new SwitchArgument <WarlockTalentSpec>(Destro_Instance(), WarlockTalentSpec.Destruction) )), //PVE SpecSwitch if other two fail to be used. new Switch <WarlockTalentSpec>(r => _talentManager.Spec, new SwitchArgument <WarlockTalentSpec>(Low_rotation(), WarlockTalentSpec.Lowbie), new SwitchArgument <WarlockTalentSpec>(Affliction_PVE(), WarlockTalentSpec.Affliction), new SwitchArgument <WarlockTalentSpec>(Demo_PVE(), WarlockTalentSpec.Demonology), new SwitchArgument <WarlockTalentSpec>(Destro_PVE(), WarlockTalentSpec.Destruction) ) /*new Switch<WarlockTalentSpec>(r => _talentManager.Spec, * new SwitchArgument<WarlockTalentSpec>(Low_rotation(), WarlockTalentSpec.Lowbie), * new SwitchArgument<WarlockTalentSpec>(Affliction_rotation(), WarlockTalentSpec.Affliction), * new SwitchArgument<WarlockTalentSpec>(Demo_rotation(), WarlockTalentSpec.Demonology), * new SwitchArgument<WarlockTalentSpec>(Destro_rotation(), WarlockTalentSpec.Destruction) * )*/ )); }
private static Composite MovingFacingBehavior(CLU.UnitSelection onUnit) // TODO: Check if we have an obstacle in our way and clear it ALSO need a mounted CHECK!!. { var badStuff = ObjectManager.GetObjectsOfType <WoWUnit>(false, false).Where(q => q.CreatedByUnitGuid != Me.Guid && q.FactionId == 14 && !q.Attackable && q.Distance < 8).OrderBy(u => u.DistanceSqr).FirstOrDefault(); return(new Sequence( // No Target? // Targeting Enabled? // Aquire Target new DecoratorContinue(ret => (onUnit == null || onUnit(ret) == null || onUnit(ret).IsDead || onUnit(ret).IsFriendly) && CLUSettings.Instance.EnableTargeting, new PrioritySelector( ctx => { // Clear our current target if its Dead or is Friendly. if (ctx != null && (onUnit(ctx).IsDead || onUnit(ctx).IsFriendly)) { CLULogger.TroubleshootLog(" Target Appears to be dead or a Friendly. Clearing Current Target [" + CLULogger.SafeName((WoWUnit)ctx) + "]"); Me.ClearTarget(); } // Aquires a target. if (Unit.EnsureUnitTargeted != null) { // Clear our current target if its blacklisted. if (Blacklist.Contains(Unit.EnsureUnitTargeted.Guid) || Unit.EnsureUnitTargeted.IsDead) { CLULogger.TroubleshootLog(" EnsureUnitTargeted Appears to be dead or Blacklisted. Clearing Current Target [" + CLULogger.SafeName(Unit.EnsureUnitTargeted) + "]"); Me.ClearTarget(); } return Unit.EnsureUnitTargeted; } return null; }, new Decorator( ret => ret != null, //checks that the above ctx returned a valid target. new Sequence( //new Action(ret => SysLog.DiagnosticLog(" CLU targeting activated. Targeting " + SysLog.SafeName((WoWUnit)ret))), // pending spells like mage blizard cause targeting to fail. //new DecoratorContinue(ctx => StyxWoW.Me.CurrentPendingCursorSpell != null, // new Action(ctx => Lua.DoString("SpellStopTargeting()"))), new Action(ret => ((WoWUnit)ret).Target()), new WaitContinue(2, ret => onUnit(ret) != null && onUnit(ret) == (WoWUnit)ret, new ActionAlwaysSucceed()))))), // Are we Facing the target? // Is the Target in line of site? // Face Target new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsSafelyFacing(onUnit(ret), 45f) && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => WoWMovement.Face(onUnit(ret).Guid)))), // Target in Line of site? // We are not casting? // We are not channeling? // Move to Location new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).InLineOfSight&& !Me.IsCasting && !Spell.PlayerIsChanneling, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Target not in LoS. Moving closer.")), new Action(ret => Navigator.MoveTo(onUnit(ret).Location)))), // Blacklist targets TODO: check this. new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsInInstance && Navigator.GeneratePath(Me.Location, onUnit(ret).Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); CLULogger.MovementLog("[CLU] " + CLU.Version + ": Failed to generate path to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; })), // Move away from bad stuff new DecoratorContinue(ret => badStuff != null, new Sequence( new Action(ret => CLULogger.MovementLog("[CLU Movement] Movin out of bad Stuff.")), new Action(ret => { if (badStuff != null) { CLULogger.MovementLog("[CLU Movement] Movin out of {0}.", badStuff); Navigator.MoveTo(WoWMovement.CalculatePointFrom(badStuff.Location, 10)); } }))), // Move Behind Target enabled? // Target is Alive? // Target is not Moving? // Are we behind the target? // We are not casting? // We are not the tank? // We are not channeling? // Move Behind Target new DecoratorContinue(ret => CLUSettings.Instance.EnableMoveBehindTarget && onUnit(ret) != null && onUnit(ret) != Me && // && !onUnit(ret).IsMoving onUnit(ret).InLineOfSight&& onUnit(ret).IsAlive&& !onUnit(ret).MeIsBehind&& !Me.IsCasting && !Spell.PlayerIsChanneling && Unit.DistanceToTargetBoundingBox() >= 10, // && (Unit.Tanks != null && Unit.Tanks.Any(x => x.Guid != Me.Guid)) new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Not behind the target. Moving behind target.")), new Action(ret => Navigator.MoveTo(CalculatePointBehindTarget())))), // Target is greater than CombatMinDistance? // Target is Moving? // We are not moving Forward? // Move Forward to wards target new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMinDistance && onUnit(ret).IsMoving&& !Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight&& !IsFlyingUnit, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward)))), // Target is less than CombatMinDistance? // Target is Moving? // We are moving Forward // Stop Moving Forward new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMinDistance && onUnit(ret).IsMoving&& Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target (T[{0}] < P[{1}]). Movement Stopped.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)), new Action(ret => WoWMovement.MoveStop()))), // Target is not Moving? // Target is greater than CombatMaxDistance? // We are not Moving? // Move Forward new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).IsMoving&& Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMaxDistance && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from non moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)), new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward, new TimeSpan(99, 99, 99))))), // Target is less than CombatMaxDistance? // We are Moving? // We are moving Forward? // Stop Moving new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMaxDistance && Me.IsMoving && Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight, new Sequence( new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target (T[{0}] < P[{1}]). Movement Stopped", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)), new Action(ret => WoWMovement.MoveStop()))))); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( // done with QB? new Decorator(ret => IsQuestComplete(), new PrioritySelector( new Decorator(ret => Location.Distance(Me.Location) > 3, new Action(ret => Navigator.MoveTo(Location))), new Decorator(ret => !HasAura(Me, 82924) && 1000 < _bombWait.ElapsedMilliseconds && _bombWait.ElapsedMilliseconds > 12000, new Action(ret => _isBehaviorDone = true)), new Action(delegate { TreeRoot.StatusText = "Waiting for Living Bomb - " + Location; if (!_bombWait.IsRunning) { _bombWait.Start(); } }) ) ), // move to safe spot initially new Decorator(ret => !_moveToCoordYet, new PrioritySelector( new Decorator(ret => Location.Distance(Me.Location) < 3, new Action(ret => _moveToCoordYet = true)), new Sequence( new Action(delegate { TreeRoot.StatusText = "Move to start - " + Location; }), new Action(ret => Navigator.MoveTo(Location))) ) ), // have current mob new Decorator(ret => Mob != null, new PrioritySelector( // target quest mob new Decorator(ret => Mob != null && Mob != Me.CurrentTarget, new Action(ret => (Mob as WoWUnit).Target())), // need to move ( timer or aura ) new Decorator(ret => _castTime.ElapsedMilliseconds > 5000 || HasAura(Mob as WoWUnit, AuraId), new PrioritySelector( // if at safe spot then wait new Decorator(ret => Location.Distance(Me.Location) < 3, new Action(delegate { if (!HasAura(Mob as WoWUnit, AuraId)) { TreeRoot.StatusText = "Wait to see - " + Mob.Name; } else { TreeRoot.StatusText = "Wait till clear - " + Mob.Name; _castTime.Reset(); // clear timer now that we see aura } })), new Action(delegate { TreeRoot.StatusText = "Move away to - " + Location; Navigator.MoveTo(Location); })) ), // need to attack new PrioritySelector( new Decorator(ret => Mob.Distance > Range, new Action(delegate { TreeRoot.StatusText = "Moving in - " + Mob.Name; Navigator.MoveTo(WoWMovement.CalculatePointFrom(Mob.Location, (float)(Range - 1))); })), new Decorator(ret => Me.IsMoving, new Action(delegate { WoWMovement.MoveStop(); StyxWoW.SleepForLagDuration(); })), new Decorator(ret => _castTime.IsRunning, new Action(ret => 0)), new Action(delegate { TreeRoot.StatusText = "Using item on - " + Mob.Name; (Mob as WoWUnit).Target(); if (Item == null) { LogMessage("fatal", "Could not locate ItemId({0}) in inventory.", ItemId); return; } WoWMovement.Face(Mob.Guid); Item.UseContainerItem(); _castTime.Start(); StyxWoW.SleepForLagDuration(); }) ) ) ) ) )); }
/// <summary> /// Creates the behavior used for pulling mobs, (approach, attack) /// </summary> /// <returns></returns> private PrioritySelector CreatePullBehavior() { return(new PrioritySelector( //Added to make sure we have a target when movement is disabled before spamming my pull sqeuence new Decorator(ret => ZerfallSettings.Instance.MoveDisable && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new Action(ctx => RunStatus.Success)), // Use leaders target new Decorator( ret => !ZerfallSettings.Instance.MoveDisable && Me.IsInParty && RaFHelper.Leader != null && RaFHelper.Leader.GotTarget && Me.GotTarget && Me.CurrentTargetGuid != RaFHelper.Leader.CurrentTargetGuid, new Action(ret => RaFHelper.Leader.CurrentTarget.Target())), // Clear target and return failure if it's tagged by someone else new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && !Me.IsInParty && Me.GotTarget && Me.CurrentTarget.TaggedByOther, new Action(delegate { SpellManager.StopCasting(); Log("Current target is not tagged by me, Aborting pull!"); Blacklist.Add(Me.CurrentTarget, TimeSpan.FromMinutes(30)); Me.ClearTarget(); return RunStatus.Failure; }) ), // If we are casting we assume we are already pulling so let it 'return' smoothly. // if we are in combat pull suceeded and the combat behavior should run new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && (Me.IsCasting || Me.Combat) && Me.CurrentTarget.Distance < PullDistance + 3, new Action(delegate { return RunStatus.Success; })), // Make sure we got a proper target new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && !Me.GotTarget && !Me.IsInParty, new Action(delegate { Targeting.Instance.TargetList[0].Target(); WoWMovement.Face(); Thread.Sleep(100); return RunStatus.Success; })), // Blacklist target's we can't move to new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Navigator.GeneratePath(Me.Location, Me.CurrentTarget.Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); Log("Failed to generate path to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; }) ), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance || (!Me.CurrentTarget.InLineOfSight || !Me.InLineOfSpellSight)), new Action(delegate { if (!ZerfallSettings.Instance.MoveDisable) { Log("Moving towards:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); } })), // Stop moving if we are moving new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), // Face the target if we aren't new Decorator(ret => !ZerfallSettings.Instance.MoveDisable && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face()) ), new PrioritySelector( new Sequence( new Action(ret => Log("Pulling {0}", Me.CurrentTarget.Name)), new PrioritySelector( CreateSpellCheckAndCast(CurrentPullSpell), PetSpellCheckAndCast("Axe Toss", ret => Me.GotAlivePet && Me.Pet.CreatedBySpellId == SummonFelguard), //hopefully start running combat when the above ends. CreateCombatBehavior() ))))); }