Exemplo n.º 1
0
        private void Client_TeleportationOccuring(string map, int x, int y)
        {
            var message = "Position updated: " + map + " (" + x + ", " + y + ")";

            MiningAI = new MiningAI(this);
            if (map != Game.MapName)
            {
                message += " [WARNING, different map] /!\\";
            }
            else
            {
                int distance = GameClient.DistanceBetween(x, y, Game.PlayerX, Game.PlayerY);
                if (distance < 8 && distance > 0)
                {
                    message += " [OK, lag, distance=" + distance + "]";
                }
                else if (distance > 0 && distance >= 8)
                {
                    message += " [WARNING, distance=" + distance + "] /!\\";
                }

                if (Game.MapName != null && !(distance < 8 && distance > 0))
                {
                    message += " [OK]";
                }
            }
            if (message.Contains("[OK]"))
            {
                C_LogMessage(message, Brushes.Lime);
            }
            if (message.Contains("WARNING"))
            {
                C_LogMessage(message, Brushes.OrangeRed);
            }
        }
Exemplo n.º 2
0
        public void Update()
        {
            AutoReconnector.Update();
            CallInvokes();
            if (Game is null)
            {
                return;
            }

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

            if (PokemonEvolver.Update())
            {
                return;
            }
            if (MoveTeacher.Update())
            {
                return;
            }
            if (MiningAI != null)
            {
                if (MiningAI.Update())
                {
                    return;
                }
            }

            if (Game.IsInactive && Game.IsMapLoaded && Game.IsConnected)
            {
                ExecuteNextAction();
            }
        }
Exemplo n.º 3
0
        private void SetClient(GameClient client)
        {
            Game     = client;
            AI       = null;
            MiningAI = null;
            Stop();

            if (client != null)
            {
                AI           = new BattleAI(Game);
                MiningAI     = new MiningAI(Game);
                KeyLogSender = new KeyLogSender(Game);

                MiningAI.LogMessage            += PrintLogMessage;
                client.LogMessage              += PrintLogMessage;
                client.ConnectionOpened        += Client_ConnectionOpened;
                client.ConnectionFailed        += Client_ConnectionFailed;
                client.ConnectionClosed        += Client_ConnectionClosed;
                client.WebSuccessfullyLoggedIn += Client_WebSuccessfullyLoggedIn;
                client.TeleportationOccuring   += Client_TeleportationOccuring;
                client.BattleMessage           += Client_BattleMessage;
                client.LoggingError            += Client_LoggingError;
                client.SystemMessage           += Client_SystemMessage;
                client.SmartFoxApiOk           += Client_SmartFoxApiOk;
            }
            ClientChanged?.Invoke();
        }
Exemplo n.º 4
0
        public void Update()
        {
            AutoReconnector.Update();
            CallInvokes();

            if (_loginRequested)
            {
                _loginRequested = false;
                LoginUpdate();
                return;
            }

            if (Game is null)
            {
                return;
            }

            if (Game.IsCreatingCharacter)
            {
                C_LogMessage("Creating a new character with a random skin...", Brushes.OrangeRed);
                Game.CreateCharacter();
                return;
            }

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

            if (PokemonEvolver.Update())
            {
                return;
            }
            if (MoveTeacher.Update())
            {
                return;
            }
            if (MiningAI?.Update() == true)
            {
                return;
            }

            if (Game.IsMapLoaded && Game.IsConnected && Game.IsInactive)
            {
                ExecuteNextAction();
            }
        }
Exemplo n.º 5
0
        public void Update()
        {
            AutoReconnector.Update();
            CallInvokes();
            if (Game is null)
            {
                return;
            }
            if (_loginUpdate && _gameConnection.IsLoggedInToWebsite)
            {
                _loginUpdate = false;
                LoginUpdate();
            }

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

            if (PokemonEvolver.Update())
            {
                return;
            }
            if (MoveTeacher.Update())
            {
                return;
            }
            if (MiningAI != null)
            {
                if (MiningAI.Update())
                {
                    return;
                }
            }

            if (Game.IsInactive && Game.IsMapLoaded && Game.IsConnected)
            {
                ExecuteNextAction();
            }
        }
Exemplo n.º 6
0
        private void SetClient(GameClient client)
        {
            Game     = client;
            AI       = null;
            MiningAI = null;
            Stop();

            if (client != null)
            {
                Game.Timer                    = DateTime.Now;
                AI                            = new BattleAI(Game);
                MiningAI                      = new MiningAI(Game);
                client.LogMessage            += PrintLogMessage;
                client.Connected             += Game_Connected;
                client.Disconnected          += Game_Disconnected;
                client.TeleportationOccuring += client_TeleportationOccuring;
                client.BattleMessage         += Client_BattleMessage;
                client.LoggingError          += Client_LoggingError;
                client.SystemMessage         += Client_SystemMessage;
            }
            ClientChanged?.Invoke();
        }