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);
 }
示例#2
0
        public static void PulseUpdates()
        {
            var curFrame = ZetaDia.Memory.Executor.FrameCount;

            if (curFrame == _lastUpdate)
            {
                return;
            }
            _lastUpdate = curFrame;
            ScenesStorage.Update();
            ExplorationGrid.PulseSetVisited();
            BountyStatistics.Pulse();
        }
示例#3
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);
        }
        private async Task <bool> RunningBounties()
        {
            if (_currentBountyCoroutine == null)
            {
                if (_bountyCoroutines.Count != 0)
                {
                    //if (TrinityPluginSettings.Settings.Advanced.BetaPlayground)
                    //{
                    //    try
                    //    {
                    //        if (Core.Player.IsInParty)
                    //        {
                    //            if (BountyCoroutine.currentRandomizedBounty < 0 ||
                    //                BountyCoroutine.currentRandomizedBounty > _bountyCoroutines.Count)
                    //            {
                    //                BountyCoroutine.currentRandomizedBounty =
                    //                    Randomizer.GetRandomNumber(_bountyCoroutines.Count);
                    //                Core.Logger.Log("[ActBounties] Randomized Bounty Complete.", Act);
                    //            }
                    //        }
                    //        else
                    //            BountyCoroutine.currentRandomizedBounty = 0;

                    //        if (BountyCoroutine.currentRandomizedBounty < 0 ||
                    //            BountyCoroutine.currentRandomizedBounty > _bountyCoroutines.Count)
                    //            BountyCoroutine.currentRandomizedBounty = 0;

                    //        _currentBountyCoroutine = _bountyCoroutines[BountyCoroutine.currentRandomizedBounty];
                    //    }
                    //    catch (Exception ex)
                    //    {
                    //        Core.Logger.Log(BountyCoroutine.currentRandomizedBounty + " | " + _bountyCoroutines.Count, Act);
                    //        BountyCoroutine.currentRandomizedBounty = 0;
                    //        _currentBountyCoroutine = _bountyCoroutines[0];
                    //    }
                    //}
                    //else
                    //{
                    _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();
            Core.Scenes.Reset();
            if (_currentBountyCoroutine.State == BountyCoroutine.States.Failed)
            {
                //Core.Logger.Log("[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);
        }
示例#5
0
 protected override void OnPulse()
 {
     ExplorationGrid.PulseSetVisited();
     BountyStatistics.Pulse();
 }
示例#6
0
 protected override void OnBotStop()
 {
     BountyStatistics.Report();
 }
示例#7
0
 public static void OnBotStop(IBot bot)
 {
     Pulsator.OnPulse -= Pulsator_OnPulse;
     BountyStatistics.Report();
 }