コード例 #1
0
        public override async Task <bool> MainTask()
        {
            if (Adventurer.TimeSinceWorldChange < 1000)
            {
                Core.Logger.Debug("[Bounties] Sleeping 1 second due to world change");
                await Coroutine.Sleep(1000);
            }

            if (_currentActBountiesCoroutine == null)
            {
                if (_currentAct != Act.Invalid)
                {
                    if (!BountyHelpers.AreAllActBountiesCompleted(_currentAct))
                    {
                        _currentActBountiesCoroutine = new ActBountiesCoroutine(_currentAct);
                    }
                    else
                    {
                        if (!TrySelectActCoroutine())
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }

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

            _completedActs.Add(_currentAct);

            if (_acts.Any())
            {
                _acts.Remove(_currentAct);

                if (_acts.Count == 0)
                {
                    Core.Logger.Log("All Acts Complete");
                    return(true);
                }
            }

            return(TrySelectActCoroutine());
        }
コード例 #2
0
        private async Task <bool> GetCoroutine()
        {
            if (_isDone)
            {
                return(true);
            }
            PluginEvents.PulseUpdates();
            if (_currentActBountiesCoroutine == null)
            {
                _isDone = true;
                return(true);
            }

            if (PluginEvents.TimeSinceWorldChange < 1000)
            {
                Logger.Debug("[Bounties] Sleeping 1 second due to world change");
                await Coroutine.Sleep(1000);
            }
            if (!await _currentActBountiesCoroutine.GetCoroutine())
            {
                return(false);
            }
            _completedActs.Add(_currentAct);
            if (PluginSettings.Current.BountyMode3.HasValue && PluginSettings.Current.BountyMode3.Value)
            {
                _acts.Remove(_currentAct);
                if (_acts.Count == 0)
                {
                    _isDone = true;
                    return(true);
                }
            }
            _currentActBountiesCoroutine = GetNextAct();
            if (_currentActBountiesCoroutine != null)
            {
                Logger.Info("[Bounties] Picked {0} as new target. (BonusAct: {1})", _currentActBountiesCoroutine.Act, _currentActBountiesCoroutine.Act == ZetaDia.CurrentBonusAct);
            }
            return(true);
        }