Esempio n. 1
0
 protected override Composite CreateBehavior()
 {
     if (_bounty == null)
     {
         return(null);
     }
     return(new ActionRunCoroutine(ctx => _bounty.GetCoroutine()));
 }
Esempio n. 2
0
        public override async Task <bool> MainTask()
        {
            if (!_bounty.IsDone && !await _bounty.GetCoroutine())
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public override async Task <bool> MainTask()
        {
            if (!_bounty.IsDone && !await _bounty.GetCoroutine())
            {
                return(false);
            }

            _bounty = null;
            return(await StartTask());
        }
Esempio n. 4
0
        private async Task <bool> GetCoroutine()
        {
            if (_isDone)
            {
                return(true);
            }

            if (PluginEvents.TimeSinceWorldChange < 1000)
            {
                Logger.Debug("[RunActBountiesTag] Sleeping 1 second due to world change");
                await Coroutine.Sleep(1000);
            }

            if (_bounties == null || _bounties.Count == 0)
            {
                if (BountyHelpers.AreAllActBountiesCompleted(Act))
                {
                    if (await _completeActBountiesCoroutine.GetCoroutine())
                    {
                        _isDone = true;
                        return(true);
                    }
                    return(true);
                }
                _isDone = true;
                return(true);
            }
            _currentBounty = _bounties.FirstOrDefault();
            if (_currentBounty != null)
            {
                if (_currentBounty.State != BountyCoroutine.States.Completed && _currentBounty.State != BountyCoroutine.States.Failed)
                {
                    return(await _currentBounty.GetCoroutine());
                }
                ScenesStorage.Reset();

                _bounties.Remove(_currentBounty);
                BountyStatistics.Report();
            }
            return(true);
        }