Пример #1
0
 internal static Composite CreateKitingBehavior()
 {
     return
         (new Decorator(
              ctx => BelphegorSettings.Instance.Kiting.IsKitingActive,
              new Sequence(
                  new Action(ctx => RegenerateCache(MinimumDistance, (CombatContext)ctx)),
                  new PrioritySelector(
                      new Decorator(
                          ctx => CheckTimer.IsFinished && _currentTargetPoint == Vector3.Zero && NeedsToGetGround,
                          new Action(
                              ctx =>
     {
         Log.Info("Kiting behavior started.");
         _currentTargetPoint =
             ((CombatContext)ctx).PlayerPosition.
             GeneratePossibleTargetPointsInHalfCircleFacingAwayFromTarget(
                 (CombatContext)ctx,
                 ((CombatContext)ctx).TargetPosition,
                 MaximumDistance - MinimumDistance).
             FirstOrDefault(
                 p =>
                 ((CombatContext)ctx).UnitPositions.CachedPositions.Any(
                     cp =>
                     cp.Position.DistanceSqr(p) <
                     BelphegorSettings.Instance.Kiting.AggroRange *
                     BelphegorSettings.Instance.Kiting.AggroRange));
         if (_currentTargetPoint == Vector3.Zero)
         {
             Log.Info("Kiting failed to find target spot.");
             CheckTimer.Reset();
             return RunStatus.Success;
         }
         Log.Info("Kiting target position found.");
         return RunStatus.Failure;
     }
                              )
                          ),
                      new Decorator(
                          ctx =>
                          (_currentTargetPoint != Vector3.Zero &&
                           (_currentTargetPoint.DistanceSqr(((CombatContext)ctx).PlayerPosition) < 4f * 4f ||
                            _currentTargetPoint.DistanceSqr(((CombatContext)ctx).PlayerPosition) >
                            (MaximumDistance - MinimumDistance) * (MaximumDistance - MinimumDistance))) ||
                          ZetaDia.Me.Movement.StuckFlags.HasFlag(StuckFlags.WasStuck),
                          new Action(ret =>
     {
         _currentTargetPoint = Vector3.Zero;
         CheckTimer.Reset();
         Log.Info("Kiting behavior finished.");
     })
                          ),
                      new Decorator(
                          ctx => _currentTargetPoint != Vector3.Zero,
                          CommonBehaviors.MoveAndStop(ret => _currentTargetPoint, 4f, true, "Kiting Position")
                          )
                      )
                  )
              ));
 }
Пример #2
0
 public static Composite CreateUsePoolOfReflection()
 {
     return
         (new Decorator(
              ret =>
              BelphegorSettings.Instance.UsePoolOfReflection,
              new PrioritySelector(ctx => PoolOfReflection,
                                   new Decorator(ctx => ctx != null,
                                                 new PrioritySelector(
                                                     new Decorator(ctx => ((DiaObject)ctx).Distance > 14f,
                                                                   CommonBehaviors.MoveAndStop(ctx => ((DiaObject)ctx).Position, 14f)),
                                                     new Decorator(ctx => ((DiaObject)ctx).Distance <= 14f,
                                                                   new Action(ctx =>
     {
         Log.InfoFormat("Using {0}", ((DiaObject)ctx).Name);
         ((DiaObject)ctx).Interact();
         Blacklist.Add(((DiaObject)ctx).ACDGuid, BlacklistFlags.All,
                       TimeSpan.FromMinutes(10));
     }
                                                                              )
                                                                   )
                                                     )
                                                 )
                                   )
              ));
 }
Пример #3
0
 public static Composite MoveToLineOfSight(ValueRetriever <DiaUnit> unit)
 {
     return
         (new Decorator(ret => unit != null && !unit(ret).InLineOfSight,
                        CommonBehaviors.MoveToLos(unit, true)
                        ));
 }
Пример #4
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       new Decorator(ret => Talk.DialogOpen, new Action(ret => Talk.Next())),
                       new Decorator(ret => SelectYesno.IsOpen, new Action(ret => SelectYesno.ClickYes())),
                       CommonBehaviors.HandleLoading,
                       new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()),
                       new Decorator(ret => DutyManager.InInstance && Core.Player.IsVisible,
                                     new PrioritySelector(
                                         //r=> GuardianNPC,
                                         //new Decorator(ret => !initialized,new Action(ret => init())),
                                         //
                                         //new Decorator(r => NeedToMove && ((r as BattleCharacter) == null || !(r as BattleCharacter).IsValid || (r as BattleCharacter).Location.Distance2D(Core.Player.Location) <= 5), new Action(r => NeedToMove = false)),
                                         //new Decorator(r => NeedToMove, CommonBehaviors.MoveAndStop(r => (r as BattleCharacter).Location, 5f, true, "Moving back into guardian npc range")),
                                         //new Decorator(r => (r as BattleCharacter) != null && ((r as BattleCharacter).Location.DistanceSqr(Core.Player.Location) > LeashSquared), new ActionAlwaysFail()),

                                         new ActionRunCoroutine(r => DoControlLogic()),
                                         new Decorator(r => CombatTargeting.Instance.FirstUnit == null, new HookExecutor("HotspotPoi")),
                                         new HookExecutor("SetCombatPoi"),
                                         new ActionAlwaysSucceed()
                                         )
                                     ),
                       new Decorator(r => Chocobo.Summoned, new ActionRunCoroutine(r => Chocobo.DismissChocobo())),
                       CommonBehaviors.MoveAndStop(r => XYZ, InteractDistance, true),
                       CreateUseObject(),
                       new ActionAlwaysSucceed()
                       ));
        }
Пример #5
0
        /// <summary>
        /// Tries to navigate to a given GameObject with the selected navigation mode.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        private async Task <bool> PerformNavigation(GameObject obj)
        {
            if (!BotBase.Instance.UseNavGraph)
            {
                Navigator.PlayerMover.MoveTowards(obj.Location);
                return(await Task.FromResult(true));
            }

            if (BotBase.Instance.UseNavGraph)
            {
                if (!MovementManager.IsFlying && !MovementManager.IsDiving)
                {
                    await CommonBehaviors.MoveAndStop(
                        r => obj.Location, r => BotBase.Instance.FollowDistance, true,
                        "Following selected target")
                    .ExecuteCoroutine();
                }
                else
                {
                    if (WaitHelper.Instance.IsDoneWaiting("FlightorWaitingTimer", TimeSpan.FromMilliseconds(500), true))
                    {
                        Flightor.MoveTo(obj.Location);
                    }
                }
                return(await Task.FromResult(true));
            }

            return(await Task.FromResult(false));
        }
Пример #6
0
 public static Composite CreateUseHealthWell()
 {
     return
         (new Decorator(
              ret =>
              BelphegorSettings.Instance.UseHealthWell &&
              ZetaDia.Me.HitpointsCurrentPct <= BelphegorSettings.Instance.HealthWellHP,
              new PrioritySelector(ctx => HealthWell,
                                   new Decorator(ctx => ctx != null,
                                                 new PrioritySelector(
                                                     new Decorator(ctx => ((DiaObject)ctx).Distance > 14f,
                                                                   CommonBehaviors.MoveAndStop(
                                                                       ctx => ((DiaObject)ctx).Position, 14f)),
                                                     new Decorator(ctx => ((DiaObject)ctx).Distance <= 14f,
                                                                   new Action(ctx =>
     {
         ((DiaObject)ctx).Interact();
         Blacklist.Add(
             ((DiaObject)ctx).
             ACDGuid,
             BlacklistFlags.All,
             TimeSpan.FromMinutes(10));
     }
                                                                              )
                                                                   )
                                                     )
                                                 )
                                   )
              ));
 }
Пример #7
0
 protected Composite Behavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => QuestId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId,
                              new Action(r =>
     {
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     })
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance,
                              new Action(ret =>
     {
         MovementManager.MoveForwardStop();
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     }
                                         )
                              ),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(ret => Talk.Next())
                              ),
                new Decorator(ret => !UseMesh,
                              new Action(ret => Navigator.PlayerMover.MoveTowards(Position))
                              ),
                new Decorator(ret => UseMesh,
                              CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)
                              ),
                new ActionAlwaysSucceed()
                ));
 }
Пример #8
0
        public Composite CreateBasicCombat()
        {
            return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter,
                                        new Decorator(ctx => ctx != null,
                                                      new PrioritySelector(
                                                          new Decorator(ctx => !RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement), new PrioritySelector(
                                                                            CommonBehaviors.MoveToLos(ctx => ctx as GameObject),
                                                                            CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange, true, "Moving to unit")
                                                                            )),
                                                          //CombatBuffs
                                                          Spell.Cast("Toad Oil", r => !Core.Me.HasAura("Toad Oil")),

                                                          //Interrupt
                                                          Spell.Cast("Flying Sardine", r => shouldFishSlap),

                                                          //Basic Combat
                                                          Spell.Cast("Triple Trident", r => Core.Me.HasAura("Tingling") && Core.Me.HasAura("Harmonized")),
                                                          Spell.Cast("Whistle", r => ActionManager.LastSpell.Name == "Tingle"),
                                                          Spell.Cast("Tingle", r => DataManager.GetSpellData(23264).Cooldown.TotalMilliseconds == 0 && Core.Me.CurrentTarget.CurrentHealthPercent > 30 && Core.Target.Distance2D(Core.Me) <= 6f),
                                                          Spell.Cast("Lucid Dreaming", r => ActionManager.HasSpell("Lucid Dreaming") && Core.Player.CurrentManaPercent < 50),
                                                          Spell.Cast("Blood Drain", r => Core.Player.CurrentManaPercent < 20),
                                                          Spell.Cast("Off-guard", r => Core.Me.CurrentTarget.CurrentHealthPercent < 50),
                                                          Spell.Cast("Bad Breath", r => ActionManager.LastSpell.Name != "Bad Breath" && Core.Me.IsFacing(Core.Target) && Core.Target.Distance2D(Core.Me) <= 8f && !Core.Target.HasAura("Poison") && Core.Me.CurrentTarget.CurrentHealthPercent > 40),
                                                          Spell.Cast("Plaincracker", r => GameObjectManager.NumberOfAttackers >= 2 && Core.Target.Distance2D(Core.Me) <= 4f),
                                                          Spell.Cast("Whistle", r => !Core.Me.HasAura("Boost") && !Core.Me.HasAura("Harmonized") && !Core.Target.HasAura("Off-guard") && ActionManager.HasSpell("Abyssal Transfixion")),
                                                          Spell.Cast("Abyssal Transfixion", r => true),
                                                          Spell.Cast("1000 Needles", r => Core.Me.CurrentTarget.CurrentHealthPercent > 75 && ActionManager.LastSpell.Name != "1000 Needles"),
                                                          Spell.Cast("Water Cannon", r => true)
                                                          ))));
        }
Пример #9
0
        protected Composite Q68123()
        {
            // (68123) Stormblood - With Heart and Steel
            Vector3 c1 = new Vector3(-299.7701f, -116.947f, -343.4173f);
            Vector3 c2 = new Vector3(-300f, -74.1117f, -416.5f);

            return(new PrioritySelector(
                       CommonBehaviors.HandleLoading,
                       new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()),
                       new Decorator(ret => QuestId == 68123 && GameObjectManager.GetObjectByNPCId(2007630) != null && GameObjectManager.GetObjectByNPCId(2007630).IsVisible,
                                     new PrioritySelector(
                                         CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2007630).Location, 1)
                                         )
                                     ),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 3,
                                     new PrioritySelector(
                                         new Decorator(ret => Core.Me.Location.Distance(c1) < 3,
                                                       new Action(r => {
                MovementManager.MoveForwardStart();
                Thread.Sleep(3000);
                MovementManager.MoveForwardStop();
            })
                                                       )
                                         )
                                     ),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 3, new Action(a => { CheckPointReached(1); })),
                       new Decorator(ret => DutyManager.InInstance && !Core.Player.InCombat && QuestId == 68123 && !HasCheckPointReached(1), CommonBehaviors.MoveAndStop(ret => c1, 3)),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(2) && Core.Me.Location.Distance(c2) < 5, new Action(a => { CheckPointReached(2); })),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(2), CommonBehaviors.MoveAndStop(ret => c2, 3)),
                       base.CreateBehavior()
                       ));
        }
Пример #10
0
        public async Task Evade()
        {
            // Don't evade if we weren't told to
            if (!WindowSettings.EnableEvade)
            {
                return;
            }

            if (!GameManager.ControlledUnit.Position.IsInDanger())
            {
                Logger.Debug("IsSafe: " + GameManager.ControlledUnit.Position);
                Evading.IsEvading = false;

                return;
            }

            List <Vector3> points = Evading.GetSafePoints();

            if (points.Count > 0)
            {
                Vector3 closest = GameManager.ControlledUnit.Position.Closest(points);

                Logger.Debug("Found safe points...");

                Logger.Debug("Evade to: " + closest);
                Evading.IsEvading = true;
                await CommonBehaviors.MoveTo(closest);
            }
        }
Пример #11
0
        //        ),
        //        new Decorator(ret => QuestId == 66633 && GameObjectManager.GetObjectByNPCId(2002522) != null && GameObjectManager.GetObjectByNPCId(2002522).IsVisible,
        //            new PrioritySelector(
        //                new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002522).Location) <= 3,
        //                    new Action(r =>
        //                    {
        //                        GameObjectManager.GetObjectByNPCId(2002522).Interact();
        //                    })
        //                ),
        //                CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002522).Location, 3)
        //            )
        //        ),
        //        new Decorator(ret => QuestId == 66448 && GameObjectManager.GetObjectByNPCId(2002279) != null && GameObjectManager.GetObjectByNPCId(2002279).IsVisible,
        //            new PrioritySelector(
        //                new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002279).Location) <= 3,
        //                    new Action(r =>
        //                    {
        //                        GameObjectManager.GetObjectByNPCId(2002279).Interact();
        //                    })
        //                ),
        //                CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002279).Location, 3)
        //            )
        //        ),
        //        new Decorator(ret => QuestId == 66057 && ((GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible) || (GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible)),
        //            new PrioritySelector(
        //new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible,
        //new PrioritySelector(
        //new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002428).Location) <= 3,
        //new Action(r =>
        //{
        //GameObjectManager.GetObjectByNPCId(2002428).Interact();
        //})
        //),
        //CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002428).Location, 3)
        //)
        //),
        //				new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible,
        //					new PrioritySelector(
        //						new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002427).Location) <= 3,
        //							new Action(r =>
        //							{
        //								GameObjectManager.GetObjectByNPCId(2002427).Interact();
        //							})
        //						),
        //						CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002427).Location, 3)
        //					)
        //				)
        //			)
        //       ),
        //		new Decorator(ret => QuestId == 66057 && ((GameObjectManager.GetObjectByNPCId(2094) != null && GameObjectManager.GetObjectByNPCId(2094).IsVisible) || (GameObjectManager.GetObjectByNPCId(1813) != null && GameObjectManager.GetObjectByNPCId(1813).IsVisible)),
        //            new PrioritySelector(
        //				new Decorator(ret => GameObjectManager.GetObjectByNPCId(2094) != null && GameObjectManager.GetObjectByNPCId(2094).IsVisible,
        //					CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2094).Location, 3)
        //				),
        //				new Decorator(ret => GameObjectManager.GetObjectByNPCId(1813) != null && GameObjectManager.GetObjectByNPCId(1813).IsVisible,
        //					CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1813).Location, 3)
        //				)
        //			)
        //        ),
        //		new Decorator(ret => QuestId == 66540 && Vector3.Distance(Core.Player.Location, ObjectXYZ) < InteractDistance,
        //            new PrioritySelector(
        //				new Decorator(ret => MovementManager.IsMoving,
        //                    new Action(r =>
        //                    {
        //                        MovementManager.MoveForwardStop();
        //                    })
        //                ),
        //                new Decorator(ret => !didthething,
        //                    new Action(r =>
        //                    {
        //                        var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)InteractNpcId);
        //							foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots)
        //						{
        //							if (slot.RawItemId == 2000771)
        //							{
        //								slot.UseItem(targetnpc);
        //								didthething = true;
        //							}
        //						}
        //                   })
        //              )
        //            )
        //        ),
        //		new Decorator(ret => QuestId == 66638 && GameObjectManager.GetObjectByNPCId(1650) != null && !GameObjectManager.GetObjectByNPCId(1650).CanAttack,
        //            new PrioritySelector(
        //				new Decorator(ret => GameObjectManager.GetObjectByNPCId(1650) != null && GameObjectManager.GetObjectByNPCId(1650).IsVisible,
        //					new PrioritySelector(
        //						new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(1650).Location) <= 3,
        //							new Action(r =>
        //							{
        //								ff14bot.Managers.Actionmanager.DoAction(190, GameObjectManager.GetObjectByNPCId(1650));
        //							})
        //						),
        //						CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1650).Location, 3)
        //					)
        //				)
        //			)
        //       ),

        protected Composite Q67124()
        {
            // (67124) Heavensward - At the end of Our Hope
            Vector3 c1 = new Vector3(175.0911f, 130.9083f, -430.1f);
            Vector3 c2 = new Vector3(362.1796f, 137.2033f, -383.6978f);
            Vector3 c3 = new Vector3(444.7922f, 160.8083f, -566.6742f);

            return(new PrioritySelector(
                       CommonBehaviors.HandleLoading,
                       new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()),
                       new Decorator(ret => QuestId == 67124 && GameObjectManager.GetObjectByNPCId(2005850) != null && GameObjectManager.GetObjectByNPCId(2005850).IsVisible&& !Core.Player.InCombat,
                                     new PrioritySelector(
                                         new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005850).Location) <= 3,
                                                       new Action(r => {
                GameObjectManager.GetObjectByNPCId(2005850).Interact();
            })
                                                       ),
                                         CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005850).Location, 3)
                                         )
                                     ),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 5, new Action(a => { CheckPointReached(1); })),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1), CommonBehaviors.MoveAndStop(ret => c1, 3)),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2) && Core.Me.Location.Distance(c2) < 5, new Action(a => { CheckPointReached(2); })),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2), CommonBehaviors.MoveAndStop(ret => c2, 3)),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3) && Core.Me.Location.Distance(c3) < 3, new Action(a => { CheckPointReached(3); })),
                       new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3), CommonBehaviors.MoveAndStop(ret => c3, 3)),
                       base.CreateBehavior()
                       ));
        }
Пример #12
0
 protected Composite Q67137()
 {
     // (67137) Heavensward -  Keeping the Flame Alive
     return(new PrioritySelector(
                CommonBehaviors.HandleLoading,
                new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()),
                new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2005546) != null && GameObjectManager.GetObjectByNPCId(2005546).IsVisible&& !Core.Player.InCombat,
                              new PrioritySelector(
                                  new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005546).Location) <= 3,
                                                new Action(r => {
         GameObjectManager.GetObjectByNPCId(2005546).Interact();
         CheckPointReached(1);
     })
                                                ),
                                  CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005546).Location, 3)
                                  )
                              ),
                new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2006332) != null && GameObjectManager.GetObjectByNPCId(2006332).IsVisible&& !Core.Player.InCombat && HasCheckPointReached(1),
                              new PrioritySelector(
                                  new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006332).Location) <= 3,
                                                new Action(r => {
         GameObjectManager.GetObjectByNPCId(2006332).Interact();
     })
                                                ),
                                  CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006332).Location, 3)
                                  )
                              ),
                base.CreateBehavior()
                ));
 }
Пример #13
0
        /// <summary>
        /// Tries to navigate to a given GameObject with the selected navigation mode.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        private async Task <bool> PerformNavigation(GameObject obj)
        {
            if (Settings.BotBase.Instance.WaypointGenerationMode == WaypointGenerationMode.Offmesh)
            {
                Navigator.PlayerMover.MoveTowards(obj.Location);
                return(await Task.FromResult(true));
            }

            if (Settings.BotBase.Instance.WaypointGenerationMode == WaypointGenerationMode.NavGraph)
            {
                if (!MovementManager.IsFlying && !MovementManager.IsDiving)
                {
                    await CommonBehaviors.MoveAndStop(
                        r => obj.Location, r => MoveToDistance, true,
                        "Following selected target")
                    .ExecuteCoroutine();
                }
                else
                {
                    Flightor.MoveTo(obj.Location);
                }

                return(await Task.FromResult(true));
            }

            return(await Task.FromResult(false));
        }
 public Composite CreateBasicPull()
 {
     return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter,
                                 new Decorator(ctx => ctx != null, new PrioritySelector(
                                                   CommonBehaviors.MoveToLos(ctx => ctx as GameObject),
                                                   CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange + (ctx as GameObject).CombatReach, true, "Moving to unit"),
                                                   Spell.PullCast("Shield Lob"),
                                                   Spell.PullCast("Fast Blade")
                                                   ))));
 }
Пример #15
0
 public static Composite CreateGetPowerGlobe()
 {
     return
         (new Decorator(
              ret => BelphegorSettings.Instance.GetPowerGlobe,
              new PrioritySelector(ctx => PowerGlobe,
                                   new Decorator(ctx => (((DiaItem)ctx)) != null,
                                                 CommonBehaviors.MoveTo(ctx => ((DiaItem)ctx).Position, "Power Globe")
                                                 ))));
 }
Пример #16
0
        public static Composite GetBehavior(AvoidanceContext context)
        {
            var reportUnknown = new Action(r => context.Capture.CaptureScreenshot(context));
            var update        = new Action(r => context.Update());
            var move          = CommonBehaviors.MoveAndStop(r => context.SafeLocation, 1f, true);
            var avoidCheck    = new PrioritySelector(new Decorator(req => context.IsAvoiding, move),
                                                     new Decorator(req => context.IsWaiting, new Action(r => RunStatus.Success)));

            return(new Sequence(update, avoidCheck));
        }
Пример #17
0
 protected override Composite CreateBehavior()
 {
     return
         (new PrioritySelector(ctx => Target,
                               CustomLogic,
                               new Decorator(ret => Hotspots.Count != 0 && Navigator.InPosition(Position, Core.Me.Location, 5f),
                                             new Action(ret => Hotspots.Next())
                                             ),
                               CommonBehaviors.MoveAndStop(ret => Position, 3f, true)
                               ));
 }
Пример #18
0
 public Composite CreateBasicPull()
 {
     return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter,
                                 new Decorator(ctx => ctx != null, new PrioritySelector(
                                                   new Decorator(ctx => !RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement), new PrioritySelector(
                                                                     CommonBehaviors.MoveToLos(ctx => ctx as GameObject),
                                                                     CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange + (ctx as GameObject).CombatReach, true, "Moving to unit")
                                                                     )),
                                                   Spell.PullCast(r => "Sticky Tongue", r => ActionManager.LastSpell.Name != "Sticky Tongue" && Core.Target.Distance2D(Core.Me) >= 5f),
                                                   Spell.PullCast(r => "Water Cannon", r => ActionManager.LastSpell.Name != "Water Cannon" && !ActionManager.HasSpell("Sticky Tongue"))
                                                   ))));
 }
Пример #19
0
        public static Composite SprintMove(ValueRetriever <Vector3> location)
        {
            var move   = CommonBehaviors.MoveAndStop(location, 1f, true);
            var sprint = new Decorator(req => CanSprint,
                                       new Action(r =>
            {
                Actionmanager.Sprint();
                return(RunStatus.Failure);
            }));

            return(new PrioritySelector(sprint, move));
        }
Пример #20
0
 public static Composite CreateGetHealthGlobe()
 {
     return
         (new Decorator(
              ret =>
              BelphegorSettings.Instance.GetHealthGlobe &&
              ZetaDia.Me.HitpointsCurrentPct <= BelphegorSettings.Instance.HealthGlobeHP,
              new PrioritySelector(ctx => HealthGlobes,
                                   new Decorator(ctx => (((DiaItem)ctx)) != null,
                                                 CommonBehaviors.MoveTo(ctx => ((DiaItem)ctx).Position, "Health Globe")
                                                 ))));
 }
Пример #21
0
 protected Composite Behavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => Condition != null && !ConditionCheck(),
                              new Action(ret => _done = true)),
                new Decorator(ret => QuestId != 0 && StepId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId,
                              new Action(r =>
     {
         _done = true;
     })
                              ),
                new Decorator(ret => Core.Player.IsMounted,
                              CommonBehaviors.Dismount()
                              ),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(r =>
     {
         Talk.Next();
     })
                              ),
                new Decorator(ret => casted,
                              new Sequence(
                                  new Sleep(3, 5),
                                  new Action(r => casted = false)
                                  )
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished,
                              new Action(ret => _done = true)),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && !casted,
                              new Action(r =>
     {
         Navigator.PlayerMover.MoveStop();
         if (!Core.Player.IsCasting)
         {
             GameObjectManager.GetObjectByNPCId(NPC).Face();
             if (ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC)))
             {
                 ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC));
                 casted = true;
             }
             else
             {
                 ActionManager.DoActionLocation(SpellID, Core.Player.Location);
                 casted = true;
             }
         }
     })
                              ),
                CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name),
                new ActionAlwaysSucceed()
                ));
 }
Пример #22
0
        internal static Composite MovementComposite()
        {
            double pullRange = 3;

            if (Me.IsHealer() || (Me.IsRangedDps() && (Me.CurrentJob != ClassJobType.RedMage || Me.ClassLevel >= 2)))
            {
                pullRange = 20;
            }

            return(new PrioritySelector(ctx => Target as BattleCharacter,
                                        new Decorator(ctx => ctx != null, new PrioritySelector(
                                                          CommonBehaviors.MoveToLos(target => Target),
                                                          CommonBehaviors.MoveAndStop(target => Target.Location, Math.Max(Target.CombatReach, Me.CombatReach) + (float)pullRange, true)))));
        }
Пример #23
0
 public static Composite CloseDistance(float range)
 {
     return(new Decorator(ret => !DefaultCombat.MovementDisabled && BuddyTor.Me.CurrentTarget != null,
                          new PrioritySelector(
                              new Decorator(ret => BuddyTor.Me.CurrentTarget.Distance < range,
                                            new Action(delegate
     {
         Navigator.MovementProvider.StopMovement();
         return RunStatus.Failure;
     })),
                              new Decorator(ret => BuddyTor.Me.CurrentTarget.Distance >= range,
                                            CommonBehaviors.MoveAndStop(location => BuddyTor.Me.CurrentTarget.Position, range, true)),
                              new Action(delegate { return RunStatus.Failure; }))));
 }
Пример #24
0
        internal static async Task <bool> TeleportToAetheryte(uint aetheryteId)
        {
            await Coroutine.Sleep(TimeSpan.FromMilliseconds(MainSettings.Instance.ActionDelay));

            await CommonBehaviors.CreateTeleportBehavior(vr => aetheryteId, vr => WorldManager.GetZoneForAetheryteId(aetheryteId)).ExecuteCoroutine();

            await Coroutine.Wait(TimeSpan.FromSeconds(10), () => !Core.Player.IsCasting || Core.Player.InCombat);

            await Coroutine.Wait(TimeSpan.FromSeconds(2), () => Core.Player.InCombat);

            await Coroutine.Wait(TimeSpan.MaxValue, () => !CommonBehaviors.IsLoading || Core.Player.InCombat);

            await Coroutine.Wait(TimeSpan.FromSeconds(2), () => Core.Player.InCombat);

            return(true);
        }
Пример #25
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(

                       CommonBehaviors.HandleLoading,
                       new Decorator(r => WorldManager.ZoneId != startmap, new Action(r => _done = true)),
                       new Decorator(ret => Navigator.InPosition(Core.Player.Location, Position, Distance), new ActionRunCoroutine(r => Destination())),
                       new Decorator(r => UseMesh, CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)),
                       new Decorator(r => !UseMesh, new Action(r =>
            {
                Core.Player.Face(Position);
                MovementManager.MoveForwardStart();
            })),
                       new ActionAlwaysSucceed()
                       ));
        }
Пример #26
0
 protected override Composite CreateBehavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => !ConditionCheck(),
                              new Action(ret => _done = true)),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(r =>
     {
         Talk.Next();
     })
                              ),
                new Decorator(ret => casted,
                              new Sequence(
                                  new Sleep(3, 5),
                                  new Action(r => casted = false)
                                  )
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished,
                              new Action(ret => _done = true)),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance,
                              new PrioritySelector(
                                  new Decorator(ret => ActionManager.InSpellInRangeLOS(1, GameObjectManager.GetObjectByNPCId(NPC)) == Enums.SpellRangeCheck.ErrorNotInLineOfSight,
                                                CommonBehaviors.MoveToLos(r => GameObjectManager.GetObjectByNPCId(NPC), true)
                                                ),
                                  new Decorator(ret => true,
                                                new Action(r =>
     {
         if (Core.Player.IsMounted)
         {
             ActionManager.Dismount();
         }
         Navigator.PlayerMover.MoveStop();
         if (!Core.Player.IsCasting)
         {
             ActionManager.DoActionLocation(Enums.ActionType.KeyItem, ItemID, XYZ);
             casted = true;
         }
     })
                                                )
                                  )
                              ),
                CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)
                ));
 }
Пример #27
0
 protected Composite Q65886()
 {
     // (65886) A Realm Reborn - The Threat Of Superiority
     return(new PrioritySelector(
                CommonBehaviors.HandleLoading,
                new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()),
                new Decorator(ret => QuestId == 65886 && GameObjectManager.GetObjectByNPCId(2001471) != null && GameObjectManager.GetObjectByNPCId(2001471).IsVisible&& !Core.Player.InCombat,
                              new PrioritySelector(
                                  new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2001471).Location) <= 3,
                                                new Action(r => {
         GameObjectManager.GetObjectByNPCId(2001471).Interact();
     })
                                                ),
                                  CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2001471).Location, 3)
                                  )
                              ),
                base.CreateBehavior()
                ));
 }
Пример #28
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       ctx => NPC,

                       new Decorator(r => SelectIconString.IsOpen, new Action(r =>
            {
                if (DialogOption1 == -1)
                {
                    TreeRoot.Stop("No DialogOption1 supplied, but found dialog window.");
                    throw new ArgumentException("No DialogOption1 supplied, but found dialog window.");
                    return RunStatus.Failure;
                }

                SelectIconString.ClickSlot((uint)DialogOption1);
                return RunStatus.Success;
            })),

                       new Decorator(r => SelectString.IsOpen, new Action(r =>
            {
                if (DialogOption2 == -1)
                {
                    TreeRoot.Stop("No DialogOption2 supplied, but found dialog window.");
                    throw new ArgumentException("No DialogOption2 supplied, but found dialog window.");
                    return RunStatus.Failure;
                }

                SelectString.ClickSlot((uint)DialogOption2);
                return RunStatus.Success;
            })),

                       new Decorator(r => dialogwasopen && !Core.Player.HasTarget, new Action(r => { DoneTalking = true; return RunStatus.Success; })),
                       new Decorator(r => Talk.DialogOpen, new Action(r => { Talk.Next(); return RunStatus.Success; })),
                       //new Action(r => { dialogwasopen = true; return RunStatus.Success; })
                       new Decorator(r => Shop.Open, new ActionRunCoroutine(ctx => BuyItems())),


                       CommonBehaviors.MoveAndStop(ret => XYZ, ret => InteractDistance, true, ret => $"[{GetType().Name}] Moving to {XYZ} so we can buy {ItemNames} from {vendorName}"),
                       new Decorator(ret => NPC == null, new Sequence(new SucceedLogger(r => $"Waiting at {Core.Player.Location} for {vendorName} to spawn so we can purchase {ItemNames}"), new WaitContinue(5, ret => NPC != null, new Action(ret => RunStatus.Failure)))),
                       new Action(ret => NPC.Interact())
                       ));
        }
Пример #29
0
        public virtual async Task CombatTask()
        {
            if (InstanceManager.Target == null)
            {
                return;
            }

            //if (GameManager.LocalPlayer.IsMoving)
            //Navigator.Stop();

            Tuple <SpellManager.SpellInformation, CastAction> currentBestAbility = Combat.GetHighestPriorityTuple(InstanceManager.Target);


            if (currentBestAbility != null && currentBestAbility.Item1.CanCast)             // sanity check on CanCast
            {
                // move within range of spell
                if (InstanceManager.Target.Distance > currentBestAbility.Item1.TargetMaxRange && Omnibus.WindowSettings.EnableMovement)
                {
                    if (await CommonBehaviors.MoveWithin(InstanceManager.Target.Position, currentBestAbility.Item1.TargetMaxRange, true) == CommonBehaviors.BehaviorResult.CombatStop) // move unless combat stops
                    {
                        return;                                                                                                                                                        // stop combat
                    }
                }

                Omnibus.Logger.Debug(string.Format("[COMBAT] FaceCast [Name {0}, SpellBarIndex {1}]",
                                                   currentBestAbility.Item1.Name,
                                                   currentBestAbility.Item1.SpellBarIndex));
                // NOTE: this needs to change. Since abilities need different casting methods.
                // ChargeAndRelease requires at least N charges before firing it off
                // ChanneledArea or something needs to be cast -> cast again at the location [2+ frames]

                // TODO: Add a "continuous face" into SpellCastBeahviors.CastSimple
                if (Omnibus.WindowSettings.EnableMovement)
                {
                    InstanceManager.Target.Face();
                }

                //await SpellCastBehaviors.CastSimple(currentBestAbility, () => InstanceManager.Target, true);
                await currentBestAbility.Item2(InstanceManager.Target);
            }
        }
Пример #30
0
        public override async Task Pull(object target)
        {
            var pullTarget = (target as Actor);

            if (pullTarget == null)
            {
                return;
            }

            Targeting.PullTarget = pullTarget;

            if (pullTarget.Distance > Routine.PullRange)
            {
                Logger.Debug(string.Format("[MoveWithin] {0} -> {1} (Distance {2})", GameManager.ControlledUnit.Position, pullTarget.Position, pullTarget.Distance));

                // Stop within pull range, also stop early if we happen to body pull something.
                if (await CommonBehaviors.MoveWithin(pullTarget.Position, Routine.PullRange, true, true) == CommonBehaviors.BehaviorResult.CombatStop)
                {
                    // Return only if we body pulled. Chances are, we pulled something we don't actually want.
                    return;
                }
                // NOTE: Do not "return" after moving within range.
                //return;
            }

            SpellManager.SpellInformation pullAbility = Routine.Pull.ToValidAbilityList(pullTarget).FirstOrDefault();

            if (pullAbility == null)
            {
                throw new Exception("Could not find a usable pull ability. Is pull not implemented for this class?");
            }

            Logger.Debug(string.Format("[PULL] FaceCast [Name {0}, SpellBarIndex {1}]", pullAbility.Name, pullAbility.SpellBarIndex));

            if (WindowSettings.EnableMovement)
            {
                pullTarget.Face();
            }

            await SpellCastBehaviors.CastSimple(pullAbility, () => pullTarget, true);
        }
Пример #31
0
		public static Composite CastOnGround(string spell, CommonBehaviors.Retrieval<Vector3> location,
			Selection<bool> reqs = null)
		{
			return
				new Decorator(
					ret =>
						(reqs == null || reqs(ret)) && location != null && location(ret) != Vector3.Zero &&
						AbilityManager.CanCast(spell, BuddyTor.Me.CurrentTarget),
					new Action(ret => AbilityManager.Cast(spell, location(ret))));
		}