Esempio n. 1
0
        internal static async Task <bool> HandleReturnToAetheryte()
        {
            if (Core.Player.Location.Distance2D(Poi.Current.Location) < 15f)
            {
                if (OracleCombatManager.IsPlayerBeingAttacked() && Poi.Current.Type != PoiType.Kill && Poi.Current.Type != PoiType.None)
                {
                    OracleFateManager.ClearPoi("We're being attacked.", false);
                }

                return(true);
            }

            if (!OracleMovementManager.IsFlightMeshLoaded())
            {
                await OracleMovementManager.LoadFlightMeshIfAvailable();

                if (!OracleMovementManager.IsFlightMeshLoaded())
                {
                    await OracleMovementManager.NavigateToLocation(Poi.Current.Location, 15f, true);

                    return(true);
                }
            }

            await OracleMovementManager.FlyToLocation(Poi.Current.Location, 15f, true, true);

            return(true);
        }
Esempio n. 2
0
        internal static async Task <bool> HandleGrindMobs()
        {
            if (OracleCombatManager.IsPlayerBeingAttacked() && Poi.Current.Type != PoiType.Kill && Poi.Current.Type != PoiType.None)
            {
                OracleFateManager.ClearPoi("We're being attacked.", false);
                return(true);
            }

            await OracleCombatManager.SelectGrindTarget();

            return(true);
        }
Esempio n. 3
0
        internal static async Task <bool> HandleWait()
        {
            if (OracleCombatManager.IsPlayerBeingAttacked() && !Core.Player.IsMounted && Poi.Current.Type != PoiType.Kill && Poi.Current.Type != PoiType.None)
            {
                OracleFateManager.ClearPoi("We're being attacked.", false);
                return(true);
            }

            if (await OracleFateManager.AnyViableFates())
            {
                OracleFateManager.ClearPoi("Viable FATE detected.");
                return(true);
            }

            return(await RunWait());
        }
Esempio n. 4
0
        internal static async Task <bool> Main()
        {
            if (Poi.Current.Type != PoiType.Kill)
            {
                return(false);
            }

            OracleFateManager.ForceUpdateGameCache();
            if (!Poi.Current.BattleCharacter.IsValid || Poi.Current.BattleCharacter.IsDead)
            {
                OracleFateManager.ClearPoi("Mob is "
                                           + "no longer"
                                           + " valid.",
                                           false);
                return(false);
            }

            if (Core.Player.CurrentHealthPercent < MainSettings.Instance.RestHealthPercent)
            {
                WaitForPlayerRegeneration();
                return(true);
            }

            if (OracleClassManager.IsTankClassJob(Core.Player.CurrentJob) || OracleClassManager.IsMeleeDpsClassJob(Core.Player.CurrentJob) ||
                OracleClassManager.IsRangedDpsClassJob(Core.Player.CurrentJob))
            {
                if (Core.Player.CurrentTPPercent < MainSettings.Instance.RestTPManaPercent)
                {
                    WaitForPlayerRegeneration();
                    return(true);
                }
            }

            if (OracleClassManager.IsCasterClassJob(Core.Player.CurrentJob) || OracleClassManager.IsHealerClassJob(Core.Player.CurrentJob))
            {
                if (Core.Player.CurrentManaPercent < MainSettings.Instance.RestTPManaPercent)
                {
                    WaitForPlayerRegeneration();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 5
0
        internal static async Task <bool> HandleFate()
        {
            var currentFate = OracleFateManager.GetCurrentFateData();

            if (currentFate == null)
            {
                Logger.SendDebugLog("Current FATE could not be found, assuming it's finished.");
                OracleFateManager.ClearCurrentFate("FATE is "
                                                   + "no longer"
                                                   + " active.");
                return(false);
            }

            if (currentFate.Status == FateStatus.NOTACTIVE)
            {
                OracleFateManager.ClearCurrentFate("FATE is no longer active.");
                return(false);
            }

            if (Core.Player.Distance(currentFate.Location) > currentFate.Radius * 1.05f)
            {
                await OracleMovementManager.MoveToCurrentFate(false);

                if (OracleFateManager.CurrentFateId == 0)
                {
                    return(true);
                }
            }

            if (OracleCombatManager.IsPlayerBeingAttacked() && Poi.Current.Type != PoiType.Kill && Poi.Current.Type != PoiType.None)
            {
                OracleFateManager.ClearPoi("We're being attacked.", false);
                return(true);
            }

            if (OracleFateManager.IsLevelSyncNeeded(currentFate))
            {
                await OracleFateManager.SyncLevel(currentFate);

                return(true);
            }

            return(await RunFate());
        }
Esempio n. 6
0
        internal static async Task <bool> HandleWaitInPlace()
        {
            if (OracleCombatManager.IsPlayerBeingAttacked() && Poi.Current.Type != PoiType.Kill && Poi.Current.Type != PoiType.None)
            {
                OracleFateManager.ClearPoi("We're being attacked.", false);
                return(true);
            }

            if (Poi.Current.Type != PoiType.Wait)
            {
                return(false);
            }

            if (await OracleFateManager.AnyViableFates())
            {
                OracleFateManager.ClearPoi("Found a FATE.");
            }

            return(true);
        }
Esempio n. 7
0
        internal static async Task <bool> HandleCombat()
        {
            var currentBc = Poi.Current.BattleCharacter;

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

            if (!currentBc.IsValid)
            {
                OracleFateManager.ClearPoi("Targeted unit is not valid.", false);
                return(true);
            }

            if (mostRecentBc == null || mostRecentBc != currentBc)
            {
                mostRecentBc    = currentBc;
                lastHpValue     = mostRecentBc.CurrentHealth;
                noDamageTimeout = Stopwatch.StartNew();
            }

            if (lastHpValue != mostRecentBc.CurrentHealth)
            {
                noDamageTimeout.Restart();
                lastHpValue = mostRecentBc.CurrentHealth;
            }

            if (ShouldBlacklistCombatPoi())
            {
                OracleFateManager.ClearPoi("Mob's HP has not changed in " + MainSettings.Instance.CombatNoDamageTimeout / 1000
                                           + " seconds, blacklisting and selecting a new mob.");
                Blacklist.Add(currentBc, BlacklistFlags.Combat, TimeSpan.FromMinutes(1), "No damage taken timeout triggered.");
                mostRecentBc    = null;
                noDamageTimeout = null;

                Core.Player.ClearTarget();
                return(true);
            }

            if (!currentBc.IsFate && !currentBc.IsDead && GameObjectManager.Attackers.All(mob => mob.ObjectId != currentBc.ObjectId) &&
                OracleFateManager.CurrentFateId != 0)
            {
                OracleFateManager.ClearPoi("Targeted unit is not in combat with us, nor part of the current FATE.", false);
                Blacklist.Add(currentBc, BlacklistFlags.Combat, TimeSpan.FromSeconds(30), "Not a FATE mob.");
                return(true);
            }

            // If target is not a FATE mob and is tapped by someone else.
            if (!currentBc.IsFate && currentBc.TappedByOther)
            {
                OracleFateManager.ClearPoi("Targeted unit is not a FATE mob and is tapped by someone else.");
                Blacklist.Add(currentBc, BlacklistFlags.Combat, TimeSpan.FromSeconds(30), "Tapped by another person.");
                Core.Player.ClearTarget();

                if (WaitSettings.Instance.FateWaitMode == FateWaitMode.GrindMobs)
                {
                    var target = await OracleCombatManager.GetGrindTarget();

                    if (target == null)
                    {
                        return(true);
                    }

                    Logger.SendLog("Selecting " + target.Name + " (" + target.ObjectId.ToString("X") + ") as the next target to kill.", true);
                    Poi.Current = new Poi(target, PoiType.Kill);
                }

                return(true);
            }

            // If target is a FATE mob, we need to handle several potential issues.
            if (currentBc.IsFate)
            {
                var fate = FateManager.GetFateById(Poi.Current.BattleCharacter.FateId);

                if (fate == null)
                {
                    return(true);
                }

                if (!OracleFateManager.IsLevelSyncNeeded(fate))
                {
                    return(true);
                }

                if (fate.Status != FateStatus.NOTACTIVE)
                {
                    if (fate.Within2D(Core.Player.Location))
                    {
                        await OracleFateManager.SyncLevel(fate);
                    }
                    else if (GameObjectManager.Attackers.Contains(Poi.Current.BattleCharacter))
                    {
                        await OracleMovementManager.MoveToCurrentFate(true);

                        await OracleFateManager.SyncLevel(fate);
                    }
                }
            }

            return(true);
        }