Exemple #1
0
        public virtual async Task <bool> OutOfGameTask()
        {
            if (!AutoFollow.Enabled)
            {
                return(false);
            }

            // Pulse does fire while out of game. Need to be very careful how waits are handled.
            // Don't use long Coroutine.Sleeps out of game as it will prevent player updates for the duration.
            AutoFollow.Pulse();

            if (Service.IsConnected && AutoFollow.NumberOfConnectedBots == 0)
            {
                Log.Info("Waiting for bots to connect...");
                await Coroutine.Sleep(500);

                return(true);
            }

            if (DateTime.UtcNow < Coordination.WaitUntil)
            {
                Log.Debug("Waiting... (Generic OOC) Remaining={0}s", Coordination.WaitUntil.Subtract(DateTime.UtcNow).TotalSeconds);
                await Coroutine.Sleep(500);

                return(true);
            }

            if (!IsGameReady || ZetaDia.IsInGame || Party.IsLocked || !ZetaDia.Service.IsValid || !ZetaDia.Service.Hero.IsValid)
            {
                Log.Verbose("Waiting... (Invalid State)");
                await Coroutine.Sleep(500);

                return(true);
            }

            GameUI.SafeCheckClickButtons();

            if (AutoFollow.CurrentBehavior.GetType() == typeof(BaseBehavior) && !ProfileUtils.ProfileIsYarKickstart)
            {
                return(true);
            }

            return(false);
        }
        private async Task <bool> DefaultOutOfGameChecks()
        {
            if (!AutoFollow.Enabled)
            {
                return(false);
            }

            if (!IsGameReady || Party.IsLocked)
            {
                Log.Verbose("Waiting (Invalid State)");
                await Coroutine.Sleep(1000);

                return(true);
            }

            // Pulse does not fire while out of game. Need to be very careful how waits are handled.
            // Don't use long Coroutine.Sleeps out of game as it will prevent player updates for the duration.

            AutoFollow.Pulse();

            if (!Player.IsServer && Service.IsConnected && AutoFollow.NumberOfConnectedBots == 0)
            {
                Log.Info("Waiting for connection initialization. ");
                await Coroutine.Sleep(500);

                return(true);
            }

            if (DateTime.UtcNow < Coordination.WaitUntil)
            {
                Log.Debug("Waiting... (Generic OOC) Remaining={0}s", Coordination.WaitUntil.Subtract(DateTime.UtcNow).TotalSeconds);
                await Coroutine.Sleep(500);

                return(true);
            }

            GameUI.SafeCheckClickButtons();
            return(false);
        }