示例#1
0
 public MessageResult Message(Message message)
 {
     if (message.Id == Events.Messages.AreaChanged)
     {
         TownQuestgiversLogic.Reset();
         return(MessageResult.Processed);
     }
     return(MessageResult.Unprocessed);
 }
示例#2
0
        public async Task <bool> Run()
        {
            if (_handler == null)
            {
                _handler = QuestManager.GetQuestHandler();
                if (_handler == null)
                {
                    GlobalLog.Error("[QuestTask] QuestManager returned null. Lets wait and see maybe something will change in game memory.");
                    ErrorManager.ReportError();
                    await Wait.SleepSafe(500);

                    return(true);
                }
                if (_handler == QuestHandler.QuestAddedToCache)
                {
                    GlobalLog.Debug("[QuestTask] Quest was added to Completed quests cache. Now requesting quest handler again.");
                    _handler = null;
                    return(true);
                }
                if (_handler == QuestHandler.AllQuestsDone)
                {
                    GlobalLog.Warn("[QuestTask] It seems like all quests are completed.");
                    _handler = null;
                    BotManager.Stop();
                    return(true);
                }
                _handler.Tick?.Invoke();
            }

            if (Settings.Instance.TalkToQuestgivers && World.CurrentArea.IsTown)
            {
                if (TownQuestgiversLogic.ShouldExecute && await TownQuestgiversLogic.Execute())
                {
                    return(true);
                }
            }

            if (!await _handler.Execute())
            {
                _handler = null;
            }

            return(true);
        }
示例#3
0
        public void Tick()
        {
            if (!_scanInterval.Elapsed)
            {
                return;
            }

            if (!LokiPoe.IsInGame || LokiPoe.Me.IsDead)
            {
                return;
            }

            if (Settings.Instance.TalkToQuestgivers && World.CurrentArea.IsTown)
            {
                TownQuestgiversLogic.Tick();
            }

            _handler?.Tick?.Invoke();
        }