Example #1
0
        public override bool HandlePacket(Peer peer, byte[] data)
        {
            var version = new SynchVersionRequest(data);
            //Logging->writeLine("Client version: %s", version->version);

            var mapId = _game.Config.GameConfig.Map;

            _logger.LogCoreInfo("Current map: " + mapId);

            bool versionMatch = true;

            // Version might be an invalid value, currently it trusts the client
            if (version.version != Config.VERSION)
            {
                versionMatch = false;
                _logger.LogCoreWarning("Client " + version.version + " does not match Server " + Config.VERSION);
            }
            else
            {
                _logger.LogCoreInfo("Accepted client version (" + version.version + ")");
            }

            foreach (var player in _playerManager.GetPlayers())
            {
                if (player.Item1 == peer.Address.port)
                {
                    player.Item2.IsMatchingVersion = versionMatch;
                    break;
                }
            }
            var answer = new SynchVersionResponse(_playerManager.GetPlayers(), Config.VERSION, "CLASSIC", mapId);

            return(_game.PacketHandlerManager.sendPacket(peer, answer, Channel.CHL_S2C));
        }
Example #2
0
        public void NotifySynchVersion(int userId, List <Pair <uint, ClientInfo> > players, string version, string gameMode, int mapId)
        {
            var response = new SynchVersionResponse(players, version, "CLASSIC", mapId);

            _packetHandlerManager.SendPacket(userId, response, Channel.CHL_S2C);
        }