Пример #1
0
        public void Update()
        {
            if (_loginRequested)
            {
                LoginUpdate();
                _loginRequested = false;
                return;
            }

            if (Game != null && Game.IsInBattle && Game.IsInactive && AI != null && AI.UseMandatoryAction())
            {
                return;
            }

            AutoReconnector.Update();
            AutoLootBoxOpener.Update();
            QuestManager.Update();

            if (_npcBattler != null && Game.DistanceFrom(_npcBattler.PositionX, _npcBattler.PositionY) > 1 &&
                Game != null && Game.IsMapLoaded && Game.IsInactive && !Game.IsInBattle)
            {
                Game.ClearPath();
                MoveToCell(_npcBattler.PositionX, _npcBattler.PositionY, 1);
                _npcBattler = null;
                return;
            }
            if (_npcBattler != null && Game != null && Game?.DistanceFrom(_npcBattler.PositionX, _npcBattler.PositionY) <= 1)
            {
                _npcBattler = null;
            }

            if (Script?.IsLoaded == true)
            {
                Script?.Update();
            }

            if (Running != State.Started)
            {
                return;
            }

            if (PokemonEvolver.Update())
            {
                return;
            }
            if (MoveTeacher.Update())
            {
                return;
            }
            if (AI != null && AI.IsBusy)
            {
                return;
            }

            if (Game.IsMapLoaded && Game.AreNpcReceived && Game.IsInactive)
            {
                ExecuteNextAction();
            }
        }
Пример #2
0
        public void Update()
        {
            if (_loginRequested)
            {
                LoginUpdate();
                _loginRequested = false;
                return;
            }

            AutoReconnector.Update();
            AutoLootBoxOpener.Update();
            QuestManager.Update();

            if (_npcBattler != null && Game != null && Game.IsMapLoaded && Game.IsInactive)
            {
                if (GameClient.DistanceBetween(Game.PlayerX, Game.PlayerY, _npcBattler.PositionX, _npcBattler.PositionY) == 1)
                {
                    TalkToNpc(_npcBattler);
                    _npcBattler = null;
                }
                else
                {
                    TalkToNpc(_npcBattler);
                }
                return;
            }

            if (Script?.IsLoaded == true)
            {
                Script?.Update();
            }

            if (Running != State.Started)
            {
                return;
            }

            if (PokemonEvolver.Update())
            {
                return;
            }
            if (MoveTeacher.Update())
            {
                return;
            }
            if (AI != null && AI.IsBusy)
            {
                return;
            }

            if (Game.IsMapLoaded && Game.AreNpcReceived && Game.IsInactive)
            {
                ExecuteNextAction();
            }
        }