Ejemplo n.º 1
0
        private async Task <bool> MoveToMarker()
        {
            if (_markerCooldownUntil > DateTime.UtcNow)
            {
                return(true);
            }

            var marker = GetKeywardenMarker();

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

            if (marker.Position.Distance(AdvDia.MyPosition) < 20f)
            {
                Logger.Info("[Keywarden] Finished Following marker");
                return(true);
            }

            if (_markerCoroutine == null)
            {
                Logger.Info("[Keywarden] Following a keywarden marker, lets see where it goes");
                _markerCoroutine = new MoveToMapMarkerCoroutine(-1, AdvDia.CurrentWorldId, marker.NameHash, 0, false);
            }

            if (!_markerCoroutine.IsDone)
            {
                if (!await _markerCoroutine.GetCoroutine())
                {
                    return(false);
                }
            }

            if (_markerCoroutine.State == MoveToMapMarkerCoroutine.States.Failed)
            {
                _markerCooldownUntil = DateTime.UtcNow.Add(TimeSpan.FromMinutes(1));
                Logger.Info("[Keywarden] Looks like we can't find a path to the keywarden marker :(");
                return(true);
            }

            Logger.Info("[Keywarden] Finished Following marker");
            return(true);
        }
Ejemplo n.º 2
0
        private async Task <bool> MoveToMarker()
        {
            if (!CanMoveToMarker())
            {
                return(true);
            }

            if (_minimapMarker.Position.Distance(AdvDia.MyPosition) < 20f)
            {
                Core.Logger.Log("[Keywarden] Finished Following marker");
                return(true);
            }

            if (_markerCoroutine == null)
            {
                Core.Logger.Log("[Keywarden] Following a keywarden marker, lets see where it goes");
                _markerCoroutine = new MoveToMapMarkerCoroutine(-1, AdvDia.CurrentWorldId, _minimapMarker.NameHash);
            }

            if (!_markerCoroutine.IsDone)
            {
                if (!await _markerCoroutine.GetCoroutine())
                {
                    return(false);
                }
            }

            if (_markerCoroutine.State == MoveToMapMarkerCoroutine.States.Failed)
            {
                var cooldownDurationSeconds = 15 + _markerMoveFailures * 2;
                _markerMoveFailures++;
                _markerCooldownUntil = DateTime.UtcNow.Add(TimeSpan.FromSeconds(cooldownDurationSeconds));
                _markerCoroutine     = null;
                Core.Logger.Log($"[Keywarden] Looks like we can't find a path to the keywarden marker :( on cooldown for {cooldownDurationSeconds} seconds");
                return(true);
            }

            Core.Logger.Log("[Keywarden] Finished Following marker");
            _markerCoroutine = null;
            return(true);
        }