Exemplo n.º 1
0
        public async Task <bool> Run()
        {
            //we are inside POTD
            if (Constants.InDeepDungeon || Constants.InExitLevel)
            {
                return(false);
            }

            if (WorldManager.ZoneId != Constants.SouthShroudZoneId ||
                GameObjectManager.GetObjectByNPCId(Constants.CaptainNpcId) == null ||
                GameObjectManager.GetObjectByNPCId(Constants.CaptainNpcId).Distance2D(Core.Me.Location) > 35)
            {
                if (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(500);

                    return(true);
                }

                if (!WorldManager.TeleportById(5))
                {
                    Logger.Error("We can't get to Quarrymill. something is very wrong...");
                    TreeRoot.Stop();
                    return(false);
                }
                await Coroutine.Sleep(1000);

                return(true);
            }
            if (GameObjectManager.GetObjectByNPCId(Constants.CaptainNpcId) == null || GameObjectManager.GetObjectByNPCId(Constants.CaptainNpcId).Distance2D(Core.Me.Location) > 4f)
            {
                return(await CommonTasks.MoveAndStop(new MoveToParameters(Constants.CaptainNpcPosition, "Moving toward NPC"), 4f, true));
            }
            return(false);
        }
Exemplo n.º 2
0
        public async Task <bool> KelpieHandler(BattleCharacter c)
        {
            if (c.IsCasting && _hydroPull.Contains(c.CastingSpellId))
            {
                if (Core.Me.Location.Distance(c.CalculatePointInFront(8f)) > 1f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.CalculatePointInFront(8f), "Kelpie"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }
            if (c.IsCasting && _hydroPush.Contains(c.CastingSpellId))
            {
                if (Core.Me.Location.Distance(c.CalculatePointInFront(30f)) > 1f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.CalculatePointInFront(30f), "Kelpie"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public async Task <bool> ZenosYaeGalvusHandler(BattleCharacter c)
        {
            if (c.IsCasting && _artOfTheSwell.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 5f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Zenos yae Galvus"), 5f, true);

                    return(true);
                }
            }

            //todo detect if we have the tether
            //if(HAVE TETHER){
            //249.99f, 122.00f, -365.01

            //var headingInRad = MoveResultExtensions.CalculateNeededFacing(CurrentBoss.Location, c.Location);
            //var pointClosestToWall = MathEx.GetPointAt(c.Location, 3, headingInRad);
            //Move toward that point
            //await CommonTasks.MoveTo(pointClosestToWall);
            //return true
            //}

            return(false);
        }
Exemplo n.º 4
0
        public async Task <bool> TitanHandler(BattleCharacter c)
        {
            if (!c.HasTarget && c.CurrentHealthPercent > 50f)
            {
                if (Core.Me.Location.Distance(new Vector3(1.102976f, 3.576279E-07f, -0.1875899f)) < 10f)
                {
                    // Use random point @ 19y radius instead of a specific point.
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(new Vector3(-1.27678f, -0.002887249f, 19.67578f), "Geocrush"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }
            if (!c.HasTarget && c.CurrentHealthPercent < 50f)
            {
                if (Core.Me.Location.Distance(new Vector3(1.102976f, 3.576279E-07f, -0.1875899f)) < 10f)
                {
                    // Use random point @ 17y radius instead of a specific point.
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(new Vector3(0.1695436f, -0.002887011f, -18.18046f), "Geocrush"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }

            return(false);
        }
        public async Task <bool> MagitekTerminalHandler7(GameObject context)
        {
            var MagitekTerminalVIII = GameObjectManager.GetObjectByNPCId(2000483);
            var MagitekTerminalIX   = GameObjectManager.GetObjectByNPCId(2000484);

            if (ScriptHelper.InCombat())
            {
                return(false);
            }
            if (MagitekTerminalVIII.IsVisible && Core.Me.Distance2D(MagitekTerminalVIII.Location) > 1f)
            {
                await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(MagitekTerminalVIII.Location, "Magitek Terminal VIII"), 0.5f, true);

                while (MagitekTerminalVIII.IsVisible)
                {
                    await CommonTasks.StopMoving();
                }
                return(true);
            }
            if (MagitekTerminalIX.IsVisible && Core.Me.Distance2D(MagitekTerminalIX.Location) > 1f)
            {
                await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(MagitekTerminalIX.Location, "Magitek Terminal IX"), 0.5f, true);

                while (MagitekTerminalIX.IsVisible)
                {
                    await CommonTasks.StopMoving();
                }
                return(true);
            }

            return(false);
        }
Exemplo n.º 6
0
        public async Task <bool> Run()
        {
            if (WorldManager.ZoneId != 570)
            {
                return(false);
            }
            TreeRoot.StatusText = "Lobby Room";
            if (_target == null || !_target.IsValid)
            {
                Logger.Warn($"Unable to find Lobby Target");
                return(false);
            }
            if (!Navigator.InPosition(_target.Location, Core.Me.Location, 3))
            {
                if (!await CommonTasks.MoveAndStop(new MoveToParameters(_target.Location, "Moving to Lobby Exit"), 3))
                {
                    Logger.Warn("Failed to move toward the exit?");
                }
                return(true);
            }
            _target.Interact();
            await Coroutine.Wait(250, () => SelectYesno.IsOpen);

            SelectYesno.ClickYes();
            return(true);
        }
Exemplo n.º 7
0
        public async Task <bool> Run()
        {
            if (Target.Type != PoiType.Wait)
            {
                return(false);
            }

            //let the navigator handle movement if we are far away
            if (Target.Location.Distance2D(Core.Me.Location) > 3)
            {
                return(false);
            }

            // move closer plz
            if (Target.Location.Distance2D(Core.Me.Location) >= 2)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Floor Exit"), 0.5f, true);

                return(true);
            }
            else
            {
                await CommonTasks.StopMoving();
            }

            var _level = DeepDungeonManager.Level;
            await Coroutine.Wait(-1, () => Core.Me.InCombat || _level != DeepDungeonManager.Level || CommonBehaviors.IsLoading || QuestLogManager.InCutscene);

            Poi.Clear("Floor has changed or we have entered combat");
            Navigator.Clear();
            return(true);
        }
Exemplo n.º 8
0
        public async Task <bool> Run()
        {
            if (!Constants.InDeepDungeon)
            {
                return(false);
            }

            if (Target == null)
            {
                return(false);
            }

            if (AvoidanceManager.IsRunningOutOfAvoid)
            {
                return(false);
            }

            if (Navigator.InPosition(Core.Me.Location, Target.Location, 3f) &&
                Target.Type == (PoiType)PoiTypes.ExplorePOI)
            {
                Poi.Clear("We have reached our destination");
                return(true);
            }

            var status =
                $"Current Level {DeepDungeonManager.Level}. Level Status: {PortalPercent}% \"Done\": {DDTargetingProvider.Instance.LevelComplete}";

            TreeRoot.StatusText = status;

            if (ActionManager.IsSprintReady && Target.Location.Distance2D(Core.Me.Location) > 5 &&
                MovementManager.IsMoving)
            {
                ActionManager.Sprint();
                return(true);
            }

            var res = await CommonTasks.MoveAndStop(
                new MoveToParameters(Target.Location, "Moving toward POTD Objective"), 1.5f);

            if (res == false)
            {
                if (Poi.Current.Unit != null)
                {
                    DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, $"Move Failed: Blacklisted {Poi.Current.Unit.EnglishName}");
                }

                Poi.Clear("Clearing poi: Move Failed");
            }

            //if (Target.Unit != null)
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Unit.Name}\" LOS: {Target.Unit.InLineOfSight()}");
            //}
            //else
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Name}\" ");
            //}

            return(res);
        }
Exemplo n.º 9
0
        public async Task <bool> Run()
        {
            if (Target.Type != PoiType.Wait)
            {
                return(false);
            }

            //let the navigator handle movement if we are far away
            if (Target.Location.Distance2D(Core.Me.Location) > 3)
            {
                return(false);
            }

            // move closer plz
            if (Target.Location.Distance2D(Core.Me.Location) >= 2)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Floor Exit"), 0.5f, true);

                return(true);
            }

            await CommonTasks.StopMoving();

            int _level = DeepDungeonManager.Level;

            _moveTimer.Reset();
            await Coroutine.Wait(-1,
                                 () => Core.Me.InCombat || _level != DeepDungeonManager.Level || CommonBehaviors.IsLoading ||
                                 QuestLogManager.InCutscene || _moveTimer.IsFinished);

            if (_moveTimer.IsFinished)
            {
                if (Poi.Current.Unit != null)
                {
                    if (!Poi.Current.Unit.IsValid)
                    {
                        Logger.Debug("Waited 5 minutes at exit: Blacklisting current exit for 10min not valid");
                        DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, TimeSpan.FromMinutes(10),
                                                                    "Waited at exit(not valid) for 5 minutes");
                    }
                    else
                    {
                        Logger.Debug("Waited 5 minutes at exit: Blacklisting current exit for 5 min");
                        DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, TimeSpan.FromMinutes(5),
                                                                    "Waited at exit for 5 minutes");
                    }
                }
                else
                {
                    Logger.Debug("Waited 5 minutes at exit but poi is null");
                }
                blackList.Add(location);
            }

            GameObjectManager.Update();
            location = Vector3.Zero;
            Poi.Clear("Floor has changed or we have entered combat");
            Navigator.Clear();
            return(true);
        }
Exemplo n.º 10
0
        public async Task <bool> ThunderclapGuivreHandler(BattleCharacter c)
        {
            var electrifiedWaterId = GameObjectManager.GetObjectByNPCId(2001648);

            if (!electrifiedWaterId.IsVisible)
            {
                var lightningSpriteId = GameObjectManager.GetObjectByNPCId(117);

                if (Core.Me.HasAura(288))
                {
                    var safeSpotLeft  = new Vector3(-161.57f, -7.15f, -102.57f);
                    var safeSpotRight = new Vector3(-149.98f, -9.59f, -152.10f);

                    // Find both points, but go to the closest one, or the one the group is going to/at currently.
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(safeSpotLeft, "Left Safe Spot"), 1f, true);

                    // await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(new Vector3(safeSpotRight), "Right Safe Spot"), 1f, true);
                    return(true);
                }
                if (lightningSpriteId.IsVisible)
                {
                    return(false);
                }
                return(true);
            }

            return(false);
        }
Exemplo n.º 11
0
        public async Task <bool> Run()
        {
            if (!Constants.InDeepDungeon)
            {
                return(false);
            }

            if (Target == null)
            {
                return(false);
            }

            /*
             * if (!Core.Me.InCombat && Target.Type == PoiType.Quest && DeepDungeonManager.BossFloor)
             * {
             *  Poi.Clear("QUEST_POI");
             *  Navigator.Clear();
             *  foreach (Avoid a in AvoidanceManager.Avoids)
             *      AvoidanceManager.RemoveAvoid(a.AvoidInfo);
             *
             *  AvoidanceManager.ResetNavigation();
             *  Navigator.NavigationProvider.ClearStuckInfo();
             *  GameObjectManager.Update();
             *
             * }
             */
            if (Navigator.InPosition(Core.Me.Location, Target.Location, 3f) &&
                Target.Type == (PoiType)PoiTypes.ExplorePOI)
            {
                Poi.Clear("We have reached our destination");
                return(true);
            }

            string status = string.Format("Current Level {0}. Level Status: {1}% \"Done\": {2}",
                                          DeepDungeonManager.Level,
                                          PortalPercent, DDTargetingProvider.Instance.LevelComplete);

            TreeRoot.StatusText = status;

            if (ActionManager.IsSprintReady && Target.Location.Distance2D(Core.Me.Location) > 5 &&
                MovementManager.IsMoving)
            {
                ActionManager.Sprint();
                return(true);
            }

            bool res = await CommonTasks.MoveAndStop(
                new MoveToParameters(Target.Location, $"Moving toward HoH Objective: {Target.Name}"), 1.5f);

            //            if (Target.Unit != null)
            //                Logger.Verbose(
            //                    $"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Unit.Name}\" LOS: {Target.Unit.InLineOfSight()}");
            //            else
            //                Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Name}\" ");


            return(res);
        }
Exemplo n.º 12
0
        public async Task <bool> Run()
        {
            //we are inside POTD
            if (Constants.InDeepDungeon || Constants.InExitLevel)
            {
                return(false);
            }

            if (WorldManager.ZoneId != Constants.EntranceZoneId ||
                GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) == null ||
                GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId).Distance2D(Core.Me.Location) > 110)
            {
                if (Core.Me.IsCasting)
                {
                    await Coroutine.Sleep(1000);

                    return(true);
                }

                if (!ConditionParser.HasAetheryte(Constants.EntranceZone.Id))
                {
                    Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. You don't have that Aetheryte so do something about it...");
                    TreeRoot.Stop();
                    return(false);
                }

                if (!WorldManager.TeleportById(Constants.EntranceZone.Id))
                {
                    Logger.Error($"We can't get to {Constants.EntranceZone.CurrentLocaleAethernetName}. something is very wrong...");
                    TreeRoot.Stop();
                    return(false);
                }

                await Coroutine.Sleep(5000);

                return(true);
            }

            if (GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) != null &&
                !(Constants.EntranceNpcPosition.Distance2D(Core.Me.Location) > 5f))
            {
                return(false);
            }
            Logger.Verbose("at Move");

            if (GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId) != null)
            {
                return(await CommonTasks.MoveAndStop(
                           new MoveToParameters(GameObjectManager.GetObjectByNPCId(Constants.EntranceNpcId).Location,
                                                "Moving toward NPC"), 5f, true));
            }

            return(await CommonTasks.MoveAndStop(
                       new MoveToParameters(Constants.EntranceNpcPosition, "Moving toward NPC"), 5f, true));
        }
        public async Task <bool> ByakkoHandler(BattleCharacter c)
        {
            if (c.IsCasting && _distantClap.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 5f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Byakko"), 5f, true);

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 14
0
        public async Task <bool> RangdaHandler(BattleCharacter c)
        {
            if (c.IsCasting && _electricCachexia.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 5f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Rangda"), 5f, true);

                    return(true);
                }
            }

            return(false);
        }
        public async Task <bool> ChudoYudoHandler(BattleCharacter c)
        {
            var isgebindId     = GameObjectManager.GetObjectByNPCId(1680);
            var berthaLeftId   = GameObjectManager.GetObjectByNPCId(2001884);
            var berthaCenterId = GameObjectManager.GetObjectByNPCId(2001885);
            var berthaRightId  = GameObjectManager.GetObjectByNPCId(2001886);

            if ((berthaLeftId != null && berthaLeftId.IsVisible) && (berthaCenterId != null && berthaCenterId.IsVisible) && (berthaRightId != null && berthaRightId.IsVisible))
            {
                var berthaLeftDistance   = berthaLeftId.Location.Distance(isgebindId.Location);
                var berthaCenterDistance = berthaCenterId.Location.Distance(isgebindId.Location);
                var berthaRightDistance  = berthaRightId.Location.Distance(isgebindId.Location);

                if (berthaLeftDistance > berthaCenterDistance && berthaLeftDistance > berthaRightDistance)
                {
                    if (Core.Me.Distance2D(berthaLeftId.Location) > 3f)
                    {
                        await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(berthaLeftId.Location, "Left Bertha"), 2f, true);

                        return(true);
                    }
                    berthaLeftId.Interact();
                    return(true);
                }
                if (berthaCenterDistance > berthaLeftDistance && berthaCenterDistance > berthaRightDistance)
                {
                    if (Core.Me.Distance2D(berthaCenterId.Location) > 3f)
                    {
                        await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(berthaCenterId.Location, "Center Bertha"), 2f, true);

                        return(true);
                    }
                    berthaCenterId.Interact();
                    return(true);
                }
                if (berthaRightDistance > berthaLeftDistance && berthaRightDistance > berthaCenterDistance)
                {
                    if (Core.Me.Distance2D(berthaRightId.Location) > 3f)
                    {
                        await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(berthaRightId.Location, "Right Bertha"), 2f, true);

                        return(true);
                    }
                    berthaRightId.Interact();
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 16
0
        public async Task <bool> CoincounterHandler(BattleCharacter c)
        {
            if (c.IsCasting && _eyeOfTheBeholder.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 7f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Coincounter"), 7f, true);

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 17
0
        public async Task <bool> QitianDashengHandler(BattleCharacter c)
        {
            if (c.IsCasting && _fiveFingeredPunishment.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 5f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Qitian Dasheng"), 3f, true);

                    return(true);
                }
            }

            return(false);
        }
        public async Task <bool> ZuikomaruHandler(BattleCharacter c)
        {
            if (c.IsCasting && _helmCrack.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 5f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Zuiko-maru"), 3f, true);

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 19
0
        public async Task <bool> ChimeraHandler(BattleCharacter c)
        {
            if (c.IsCasting && _theDragonsVoice.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 7f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Chimera"), 7f, true);

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 20
0
        public async Task <bool> Run()
        {
            if (!Constants.InDeepDungeon)
            {
                return(false);
            }


            if (Target == null)
            {
                return(false);
            }


            if (Target.Location == Vector3.Zero)
            {
                return(true);
            }

            if (Navigator.InPosition(Core.Me.Location, Target.Location, 3f) && Target.Type == (PoiType)PoiTypes.ExplorePOI)
            {
                Poi.Clear("We have reached our destination");
                return(true);
            }
            var status = string.Format("Current Level {0}. Level Status: {1}% \"Done\": {2}", DeepDungeonManager.Level,
                                       PortalPercent, DDTargetingProvider.Instance.LevelComplete);

            TreeRoot.StatusText = status;

            if (ActionManager.IsSprintReady && Target.Location.Distance2D(Core.Me.Location) > 5 && MovementManager.IsMoving)
            {
                ActionManager.Sprint();
                return(true);
            }

            var res = await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Moving toward POTD Objective:" + Target.Name), 1.5f);

            //if (Target.Unit != null)
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Unit.Name}\" LOS: {Target.Unit.InLineOfSight()}");
            //}
            //else
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Name}\" ");
            //}


            return(res);
        }
Exemplo n.º 21
0
        /// <summary>
        ///     Handles Cache of the Hoard
        /// </summary>
        /// <returns></returns>
        private async Task <bool> HandleCacheOfTheHoard()
        {
            TreeRoot.StatusText = "Banded Coffer";

            if (
                GameObjectManager.GameObjects.Any(
                    i => Constants.TrapIds.Contains(i.NpcId) && i.Distance2D(Target.Location) < 2))
            {
                Blacklist.Add(Target.Unit, BlacklistFlags.All, TimeSpan.FromMinutes(3), "A trap is close to the Hoard Spawn location. Skipping.");
                Poi.Clear("A trap is close to the Hoard Spawn location. Skipping.");
                await Coroutine.Sleep(250);

                return(true);
            }

            if (Target.Location.Distance2D(Core.Me.Location) >= 2)
            {
                Logger.Info("Banded Coffer is >= 3");
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Banded Coffer"), 0.5f, true);

                return(true);
            }

            await CommonTasks.StopMoving("Spawning Coffer");

            Logger.Info("Found a Cache of the Horde. Waiting for it to spawn... (Giving it a few seconds to spawn)");


            //target will change after the banded coffer is spawned
            var org = Target.Unit;

            //wait for the chest or for us to get into combat.
            await Coroutine.Wait(TimeSpan.FromSeconds(10),
                                 () =>
                                 Core.Me.InCombat || GameObjectManager.NumberOfAttackers > 0 || DeepDungeonCombined.StopPlz ||
                                 GameObjectManager.GetObjectsOfType <EventObject>().Any(i => i.NpcId == EntityNames.BandedCoffer)
                                 );

            if (Core.Me.InCombat || GameObjectManager.NumberOfAttackers > 0)
            {
                Logger.Info("Entered Combat waiting on coffer to spawn.");
                return(true);
            }


            Blacklist.Add(org, BlacklistFlags.All | (BlacklistFlags)DeepDungeonManager.Level, TimeSpan.FromMinutes(3), "Spawned the Coffer or used all of our time...");
            Poi.Clear("Hidden added to blacklist");
            return(true);
        }
Exemplo n.º 22
0
        private async Task CastPomanderAbility(SpellData spell)
        {
            if (!RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement | CapabilityFlags.Facing))
            {
                if (!ActionManager.CanCast(spell, Poi.Current.BattleCharacter) || Poi.Current.BattleCharacter.Distance2D() > (float)spell.Range + Poi.Current.BattleCharacter.CombatReach)
                {
                    await CommonTasks.MoveAndStop(new MoveToParameters(Core.Target.Location, $"Moving to {Poi.Current.Name} to cast {spell.Name}"),
                                                  (float)spell.Range + Poi.Current.BattleCharacter.CombatReach, true);
                }

                Poi.Current.BattleCharacter.Face2D();
            }

            ActionManager.DoAction(spell, Poi.Current.BattleCharacter);
            await Coroutine.Yield();
        }
Exemplo n.º 23
0
        public async Task <bool> TransfigurationHandler(GameObject context)
        {
            if (!Core.Me.HasAura(565))
            {
                if (Core.Me.Location.Distance(new Vector3(276.3167f, -12f, -47.89919f)) > 1f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(new Vector3(276.3167f, -12f, -47.89919f), "Transfiguration Glyph"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }

            return(false);
        }
Exemplo n.º 24
0
        public async Task <bool> IchorousIreHandler(BattleCharacter c)
        {
            var improvedBlastingDeviceId = GameObjectManager.GetObjectByNPCId(2000184);

            if (improvedBlastingDeviceId.IsVisible)
            {
                if (Core.Me.Distance2D(improvedBlastingDeviceId.Location) > 3f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(improvedBlastingDeviceId.Location, "Improved Blasting Device"), 2f, true);

                    return(true);
                }
                improvedBlastingDeviceId.Interact();
                return(true);
            }

            return(false);
        }
        public async Task <bool> AscianPrimeHandler(BattleCharacter c)
        {
            var firesphereId     = GameObjectManager.GetObjectByNPCId(4384);
            var blizzardsphereId = GameObjectManager.GetObjectByNPCId(4383);
            var aetherialTearId  = GameObjectManager.GetObjectByNPCId(3293);

            while (blizzardsphereId != null && blizzardsphereId.IsVisible && blizzardsphereId.IsTargetable)
            {
                if (!Navigator.InPosition(blizzardsphereId.Location, Core.Me.Location, 3f))
                {
                    Navigator.PlayerMover.MoveTowards(blizzardsphereId.Location);
                    await Coroutine.Yield();
                }
                blizzardsphereId.Interact();
                return(true);
            }
            while (firesphereId != null && firesphereId.IsVisible && firesphereId.IsTargetable)
            {
                if (!Navigator.InPosition(firesphereId.Location, Core.Me.Location, 3f))
                {
                    Navigator.PlayerMover.MoveTowards(firesphereId.Location);
                    await Coroutine.Yield();
                }
                firesphereId.Interact();
                return(true);
            }
            while (c.IsCasting && _universalManipulation.Contains(c.CastingSpellId))
            {
                await Coroutine.Sleep(1000);

                if (Core.Me.Distance2D(aetherialTearId.Location) > 1f)
                {
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(aetherialTearId.Location, "Aetherial Tear"), 1f, true);

                    return(true);
                }
                await CommonTasks.StopMoving();

                return(true);
            }

            return(false);
        }
Exemplo n.º 26
0
        private async Task <bool> CombatInteract()
        {
            if (HasInteractObjects && InteractableTarget != null)
            {
                if (Core.Player.Distance(InteractableTarget.Location) > 5)
                {
                    return(await CommonTasks.MoveAndStop(new MoveToParameters(InteractableTarget.Location), 3));
                }

                if (Core.Player.Distance(InteractableTarget.Location) < 5)
                {
                    InteractableTarget.Interact();
                    await Coroutine.Wait(10000, () => !Core.Player.IsCasting);
                }

                await Coroutine.Yield();
            }

            return(false);
        }
        /// <inheritdoc/>
        public override async Task <bool> Run()
        {
            if (_waypoints == null)
            {
                _waypoints = _routeCalculator.Calculate(WorldManager.ZoneId, Core.Player.Location);
            }

            if (_current == null)
            {
                if (_waypoints.Count == 0)
                {
                    // Nowhere left to go (end of dungeon?)
                    Logger.LogInformation(Translations.LOG_NAVIGATION_NO_WAYPOINT);

                    return(PASS_EXECUTION);
                }
                else
                {
                    _current = _waypoints.Dequeue();
                    Logger.LogInformation(Translations.LOG_NAVIGATION_NEW_WAYPOINT, _current.ZoneId, _current.SubZoneId, _current.Location);
                }
            }

            if (_current.Location.Distance(Core.Player.Location) > _minDistance)
            {
                if (_moveParams == null)
                {
                    _moveParams = new MoveToParameters(_current.Location, _current.Description);
                }

                await CommonTasks.MoveAndStop(_moveParams, _minDistance, stopInRange : true);
            }
            else
            {
                _moveParams = null;
                _current    = null;
                Logger.LogInformation(Translations.LOG_NAVIGATION_REACHED_WAYPOINT, _current.Description);
            }

            return(HANDLED_EXECUTION);
        }
Exemplo n.º 28
0
        public async Task <bool> LakshmiHandler(BattleCharacter c)
        {
            //var dreamingKshatriyaId = GameObjectManager.GetObjectByNPCId(6386);

            if (c.IsCasting && _devineDenial.Contains(c.CastingSpellId))
            {
                if (Core.Me.Distance2D(c) > 3f)
                {
                    // TO DO: Use duty action button.
                    await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Lakshmi"), 3f, true);

                    return(true);
                }
            }
            //while (dreamingKshatriyaId.IsCasting && _innerDemons.Contains(dreamingKshatriyaId.CastingSpellId))
            //{
            //    ScriptHelper.LookAway(c);
            //    await Coroutine.Yield();
            //}

            return(false);
        }
Exemplo n.º 29
0
 private async Task <bool> MoveAndStop(Vector3 location, float distance, bool stopInRange = false, string destinationName = null)
 {
     return(await CommonTasks.MoveAndStop(new Pathing.MoveToParameters(location, destinationName), distance, stopInRange));
 }
Exemplo n.º 30
0
        public async Task <bool> Cast(GameObject target = null, bool checkGCDType = true)
        {
            #region Target

            if (target == null)
            {
                switch (CastType)
                {
                case CastType.Target:
                case CastType.TargetLocation:
                    if (!Core.Player.HasTarget)
                    {
                        return(false);
                    }
                    target = Core.Player.CurrentTarget;
                    break;

                default:
                    target = Core.Player;
                    break;
                }
            }

            #endregion

            #region RecentSpell

            RecentSpell.RemoveAll(t => DateTime.UtcNow > t);
            if (RecentSpell.ContainsKey(target.ObjectId.ToString("X") + "-" + Name))
            {
                return(false);
            }

            #endregion

            #region CapabilityManager

            if (RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement | CapabilityFlags.Facing))
            {
                return(false);
            }

            #endregion

            #region Cooldown

            if (ShinraEx.Settings.CooldownMode == CooldownModes.Disabled)
            {
                if ((SpellType == SpellType.Buff || SpellType == SpellType.Cooldown) && Cooldown(true) > 2500)
                {
                    return(false);
                }
            }

            #endregion

            #region AoE

            if (SpellType == SpellType.AoE && ShinraEx.Settings.RotationMode != Modes.Multi)
            {
                if (RoutineManager.IsAnyDisallowed(CapabilityFlags.Aoe))
                {
                    return(false);
                }

                var enemyCount =
                    Helpers.Enemies.Count(eu => eu.Distance2D(target) - eu.CombatReach - target.CombatReach <=
                                          DataManager.GetSpellData(ID).Radius);

                if (ShinraEx.Settings.CustomAoE)
                {
                    if (enemyCount < ShinraEx.Settings.CustomAoECount)
                    {
                        return(false);
                    }
                }
                else
                {
                    switch (Core.Player.CurrentJob)
                    {
                    case ClassJobType.Arcanist:
                    case ClassJobType.Summoner:
                        if (enemyCount < 2)
                        {
                            return(false);
                        }
                        break;

                    default:
                        if (enemyCount < 3)
                        {
                            return(false);
                        }
                        break;
                    }
                }
            }

            #endregion

            #region Directional

            switch (ID)
            {
            // Cone
            case 41:
            case 70:
            case 106:
            case 7483:
            case 7488:
            {
                if (!Helpers.InView(Core.Player.Location, Core.Player.Heading, target.Location))
                {
                    return(false);
                }
                break;
            }

            // Line
            case 86:
            case 7496:
            {
                if (!Core.Player.IsFacing(target))
                {
                    return(false);
                }
                break;
            }
            }

            #endregion

            #region Pet

            switch (SpellType)
            {
            case SpellType.Pet when Core.Player.Pet == null:
            case SpellType.Pet when PetManager.PetMode != PetMode.Obey:
            case SpellType.Pet when Core.Player.IsMounted:
            case SpellType.Pet when !PetManager.CanCast(Name, target):
            case SpellType.Pet when !await Coroutine.Wait(5000, () => PetManager.DoAction(Name, target)):
                return(false);

            case SpellType.Pet:
            {
                ShinraEx.LastSpell = this;

                #region AddRecent

                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + TimeSpan.FromSeconds(3);
                RecentSpell.Add(key, val);

                #endregion

                Logging.Write(Colors.GreenYellow, $@"[ShinraEx] Casting >>> {Name}");
                return(true);
            }

            case SpellType.Card when Core.Player.IsMounted:
            case SpellType.Card when !ActionManager.CanCast(ID, target) || RecentSpell.ContainsKey("Card"):
            case SpellType.Card when !await Coroutine.Wait(1000, () => ActionManager.DoAction(ID, target)):
                return(false);

            case SpellType.Card:
            {
                ShinraEx.LastSpell = this;

                #region AddRecent

                var val = DateTime.UtcNow + TimeSpan.FromSeconds(.5);

                if (ID == 3593)
                {
                    val += TimeSpan.FromSeconds(2);
                }
                RecentSpell.Add("Card", val);

                #endregion

                Logging.Write(Colors.GreenYellow, $@"[ShinraEx] Casting >>> {Name}");
                return(true);
            }
            }

            #endregion

            #region Card

            if (ShinraEx.Settings.AstrologianCardOnly && Core.Player.CurrentJob == ClassJobType.Astrologian)
            {
                return(false);
            }

            #endregion

            #region Ninjutsu

            if (SpellType == SpellType.Ninjutsu || SpellType == SpellType.Mudra)
            {
                #region Movement

                if (BotManager.Current.IsAutonomous)
                {
                    switch (ActionManager.InSpellInRangeLOS(2247, target))
                    {
                    case SpellRangeCheck.ErrorNotInLineOfSight:
                        await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                        return(false);

                    case SpellRangeCheck.ErrorNotInRange:
                        await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                        return(false);

                    case SpellRangeCheck.ErrorNotInFront:
                        if (!target.InLineOfSight())
                        {
                            await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                            return(false);
                        }

                        target.Face();
                        return(false);

                    case SpellRangeCheck.Success:
                        if (MovementManager.IsMoving)
                        {
                            Navigator.PlayerMover.MoveStop();
                        }
                        break;
                    }
                }

                #endregion

                #region IsMounted

                if (Core.Player.IsMounted)
                {
                    return(false);
                }

                #endregion

                #region CanCast

                if (ShinraEx.Settings.QueueSpells &&
                    !ActionManager.CanCastOrQueue(DataManager.GetSpellData(ID), target) ||
                    !ActionManager.CanCast(ID, target))
                {
                    return(false);
                }

                #endregion

                #region DoAction

                if (!await Coroutine.Wait(1000, () => ActionManager.DoAction(ID, target)))
                {
                    return(false);
                }

                #endregion

                #region Wait

                await Coroutine.Wait(2000, () => !ActionManager.CanCast(ID, target));

                #endregion

                ShinraEx.LastSpell = this;

                #region AddRecent

                if (SpellType == SpellType.Mudra)
                {
                    var key = target.ObjectId.ToString("X") + "-" + Name;
                    var val = DateTime.UtcNow + TimeSpan.FromSeconds(1);
                    RecentSpell.Add(key, val);
                }

                #endregion

                Logging.Write(Colors.GreenYellow, $@"[ShinraEx] Casting >>> {Name}");
                return(true);
            }

            #endregion

            #region CanAttack

            var bc = target as BattleCharacter;

            if (!target.CanAttack && CastType != CastType.Self && CastType != CastType.SelfLocation &&
                (bc == null || !bc.IsFate))
            {
                switch (SpellType)
                {
                case SpellType.Damage:
                case SpellType.DoT:
                case SpellType.Cooldown:
                    return(false);
                }
            }

            #endregion

            #region HasSpell

            if (!ActionManager.HasSpell(ID))
            {
                return(false);
            }

            #endregion

            #region Movement

            if (BotManager.Current.IsAutonomous)
            {
                switch (ActionManager.InSpellInRangeLOS(ID, target))
                {
                case SpellRangeCheck.ErrorNotInLineOfSight:
                    await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                    Helpers.Debug($"LineOfSight >>> {Name}");
                    return(false);

                case SpellRangeCheck.ErrorNotInRange:
                    await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                    Helpers.Debug($"Range >>> {Name}");
                    return(false);

                case SpellRangeCheck.ErrorNotInFront:
                    if (!target.InLineOfSight())
                    {
                        await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                        Helpers.Debug($"Facing >>> {Name}");
                        return(false);
                    }

                    target.Face();
                    return(false);

                case SpellRangeCheck.Success:
                    if (CastType == CastType.TargetLocation && Core.Player.Distance2D(target) +
                        Core.Player.CombatReach +
                        target.CombatReach > 25)
                    {
                        await CommonTasks.MoveAndStop(new MoveToParameters(target.Location), 0f);

                        await Coroutine.Wait(1000,
                                             () => Core.Player.Distance2D(target) + Core.Player.CombatReach + target.CombatReach <=
                                             25);

                        return(false);
                    }

                    Navigator.PlayerMover.MoveStop();
                    break;
                }

                if (Core.Player.HasTarget && !MovementManager.IsMoving && Core.Player.IsMounted)
                {
                    Logging.Write(Colors.Yellow, @"[ShinraEx] Dismounting...");
                    ActionManager.Dismount();
                    await Coroutine.Sleep(1000);
                }
            }

            #endregion

            #region IsMounted

            if (Core.Player.IsMounted)
            {
                return(false);
            }

            #endregion

            #region StopCasting

            if (SpellType == SpellType.Heal)
            {
                if (Core.Player.IsCasting && !Helpers.HealingSpells.Contains(Core.Player.SpellCastInfo.Name))
                {
                    var stopCasting = false;
                    switch (Core.Player.CurrentJob)
                    {
                    case ClassJobType.Astrologian:
                        stopCasting = ShinraEx.Settings.AstrologianInterruptDamage;
                        break;

                    case ClassJobType.Scholar:
                        stopCasting = ShinraEx.Settings.ScholarInterruptDamage;
                        break;

                    case ClassJobType.WhiteMage:
                        stopCasting = ShinraEx.Settings.WhiteMageInterruptDamage;
                        break;
                    }

                    if (stopCasting)
                    {
                        Helpers.Debug($@"Trying to cast {Name}");
                        Logging.Write(Colors.Yellow, $@"[ShinraEx] Interrupting >>> {Core.Player.SpellCastInfo.Name}");
                        ActionManager.StopCasting();
                        await Coroutine.Wait(500, () => !Core.Player.IsCasting);
                    }
                }
            }

            #endregion

            #region CanCast

            switch (CastType)
            {
            case CastType.TargetLocation:
            case CastType.SelfLocation:
                if (!ActionManager.CanCastLocation(ID, target.Location) || Core.Player.IsCasting)
                {
                    return(false);
                }
                break;

            default:
                if (ShinraEx.Settings.QueueSpells && GCDType == GCDType.On)
                {
                    if (!ActionManager.CanCastOrQueue(DataManager.GetSpellData(ID), target))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!ActionManager.CanCast(ID, target))
                    {
                        return(false);
                    }
                }

                break;
            }

            if (MovementManager.IsMoving && DataManager.GetSpellData(ID).AdjustedCastTime.TotalMilliseconds > 0)
            {
                if (!BotManager.Current.IsAutonomous)
                {
                    return(false);
                }
                Navigator.PlayerMover.MoveStop();
            }

            #endregion

            #region InView

            if (GameSettingsManager.FaceTargetOnAction == false && CastType == CastType.Target &&
                SpellType != SpellType.Heal &&
                SpellType != SpellType.Buff &&
                !Helpers.InView(Core.Player.Location, Core.Player.Heading, target.Location))
            {
                return(false);
            }

            #endregion

            #region GCD

            if (GCDType == GCDType.Off && checkGCDType)
            {
                switch (Core.Player.CurrentJob)
                {
                case ClassJobType.Arcanist:
                case ClassJobType.Scholar:
                case ClassJobType.Summoner:
                    if (DataManager.GetSpellData(163).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Archer:
                case ClassJobType.Bard:
                    if (DataManager.GetSpellData(97).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Astrologian:
                    if (DataManager.GetSpellData(3594).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Conjurer:
                case ClassJobType.WhiteMage:
                    if (DataManager.GetSpellData(119).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.DarkKnight:
                    if (DataManager.GetSpellData(3617).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Gladiator:
                case ClassJobType.Paladin:
                    if (DataManager.GetSpellData(9).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Lancer:
                case ClassJobType.Dragoon:
                    if (ID == 8801 || ID == 8802)
                    {
                        if (DataManager.GetSpellData(75).Cooldown.TotalMilliseconds < 1500)
                        {
                            return(false);
                        }
                        else if (DataManager.GetSpellData(75).Cooldown.TotalMilliseconds < 1000)
                        {
                            return(false);
                        }
                    }

                    break;

                case ClassJobType.Machinist:
                    if (DataManager.GetSpellData(2866).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Marauder:
                case ClassJobType.Warrior:
                    if (DataManager.GetSpellData(31).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Pugilist:
                case ClassJobType.Monk:
                    if (DataManager.GetSpellData(53).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.RedMage:
                    if (DataManager.GetSpellData(7504).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Rogue:
                case ClassJobType.Ninja:
                    if (DataManager.GetSpellData(2240).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Samurai:
                    if (DataManager.GetSpellData(7477).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Thaumaturge:
                case ClassJobType.BlackMage:
                    if (DataManager.GetSpellData(142).Cooldown.TotalMilliseconds < 1000)
                    {
                        return(false);
                    }
                    break;
                }
            }

            #endregion

            #region DoAction

            switch (CastType)
            {
            case CastType.TargetLocation:
                if (ShinraEx.Settings.RandomCastLocations)
                {
                    var randX       = target.CombatReach * _rand.NextDouble() * GetMultiplier();
                    var randZ       = target.CombatReach * _rand.NextDouble() * GetMultiplier();
                    var randXYZ     = new Vector3((float)randX, 0f, (float)randZ);
                    var newLocation = target.Location + randXYZ;

                    if (!await Coroutine.Wait(1000, () => ActionManager.DoActionLocation(ID, newLocation)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!await Coroutine.Wait(1000, () => ActionManager.DoActionLocation(ID, target.Location)))
                    {
                        return(false);
                    }
                }

                break;

            case CastType.SelfLocation:
                if (ShinraEx.Settings.RandomCastLocations)
                {
                    var randX       = (1f * _rand.NextDouble() + 1f) * GetMultiplier();
                    var randZ       = (1f * _rand.NextDouble() + 1f) * GetMultiplier();
                    var randXYZ     = new Vector3((float)randX, 0f, (float)randZ);
                    var newLocation = target.Location + randXYZ;

                    if (!await Coroutine.Wait(1000, () => ActionManager.DoActionLocation(ID, newLocation)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!await Coroutine.Wait(1000, () => ActionManager.DoActionLocation(ID, target.Location)))
                    {
                        return(false);
                    }
                }

                break;

            default:
                if (SpellType == SpellType.PVP)
                {
                    if (!await Coroutine.Wait(1000, () => ActionManager.DoPvPCombo(Combo, target)))
                    {
                        return(false);
                    }
                    Logging.Write(Colors.Orange, $@"DoAction Combo {Combo} 0x{target.ObjectId:X}");
                }
                else
                {
                    if (!await Coroutine.Wait(1000, () => ActionManager.DoAction(ID, target)))
                    {
                        return(false);
                    }
                }

                break;
            }

            #endregion

            #region Wait

            switch (CastType)
            {
            case CastType.SelfLocation:
            case CastType.TargetLocation:
                await Coroutine.Wait(3000, () => !ActionManager.CanCastLocation(ID, target.Location));

                break;

            default:
                await Coroutine.Wait(3000, () => !ActionManager.CanCast(ID, target));

                break;
            }

            #endregion

            ShinraEx.LastSpell = this;
            Logging.Write(Colors.GreenYellow,
                          $@"[ShinraEx] Casting >>> {Name}{(SpellType == SpellType.PVP ? " Combo" : "")}");

            #region AddRecent

            if (SpellType != SpellType.Damage && SpellType != SpellType.AoE && SpellType != SpellType.Heal &&
                SpellType != SpellType.PVP &&
                await CastComplete(this))
            {
                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + DataManager.GetSpellData(ID).AdjustedCastTime + TimeSpan.FromSeconds(3);
                RecentSpell.Add(key, val);
            }

            if (SpellType == SpellType.Damage || SpellType == SpellType.DoT)
            {
                if (!Helpers.OpenerFinished && !RecentSpell.ContainsKey("Opener") && await CastComplete(this, true))
                {
                    var val = DateTime.UtcNow + DataManager.GetSpellData(ID).AdjustedCastTime + TimeSpan.FromSeconds(3);
                    RecentSpell.Add("Opener", val);
                }
            }

            #endregion

            return(true);
        }