private async Task <bool> RunningBounties()
 {
     if (_currentBountyCoroutine == null)
     {
         if (_bountyCoroutines.Count != 0)
         {
             _currentBountyCoroutine = _bountyCoroutines[0];
         }
         else
         {
             if (BountyHelpers.IsActTurninInProgress(Act))
             {
                 State = States.TurningInTheActQuest;
                 return(false);
             }
             State = States.Failed;
             return(false);
         }
     }
     if (!await _currentBountyCoroutine.GetCoroutine())
     {
         return(false);
     }
     BountyStatistics.Report();
     ScenesStorage.Reset();
     if (_currentBountyCoroutine.State == BountyCoroutine.States.Failed)
     {
         //Logger.Info("[ActBounties] Looks like the bounty has failed, skipping the rest of the act.");
         State = States.Failed;
         return(false);
     }
     _bountyCoroutines.Remove(_currentBountyCoroutine);
     _currentBountyCoroutine = null;
     return(false);
 }
Exemple #2
0
        public override void OnStart()
        {
            var bountyInfo = ZetaDia.ActInfo.Bounties.FirstOrDefault(b => (int)b.Quest == QuestId);

            _bounty = BountyCoroutineFactory.GetBounty(bountyInfo);
            if (_bounty == null)
            {
                Logger.Error("[RunBountyTag] Unsupported QuestId ({0}), ending tag.", QuestId);
                _isDone = true;
            }
        }
 private async Task<bool> RunningBounties()
 {
     if (_currentBountyCoroutine == null)
     {
         if (_bountyCoroutines.Count != 0)
         {
             _currentBountyCoroutine = _bountyCoroutines[0];
         }
         else
         {
             if (BountyHelpers.IsActTurninInProgress(Act))
             {
                 State = States.TurningInTheActQuest;
                 return false;
             }
             State = States.Failed;
             return false;
         }
     }
     if (!await _currentBountyCoroutine.GetCoroutine()) return false;
     BountyStatistics.Report();
     ScenesStorage.Reset();
     if (_currentBountyCoroutine.State == BountyCoroutine.States.Failed)
     {
         //Logger.Info("[ActBounties] Looks like the bounty has failed, skipping the rest of the act.");
         State=States.Failed;
         return false;
     }
     _bountyCoroutines.Remove(_currentBountyCoroutine);
     _currentBountyCoroutine = null;
     return false;
 }
Exemple #4
0
        //public override void OnDone()
        //{
        //    if (_bounty != null)
        //    {
        //        _bounty.ResetState();
        //    }
        //}

        public override void ResetCachedDone(bool force = false)
        {
            _bounty = null;
            _isDone = false;
        }
        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;

        }