public void FromGameServerItem(gameserveritem_t item)
 {
     serverID            = item.m_steamID;
     serverName          = item.GetServerName();
     serverDescription   = item.GetGameDescription();
     mapName             = item.GetMap();
     isPasswordProtected = item.m_bPassword;
     isVAC              = item.m_bSecure;
     maxPlayerCount     = item.m_nMaxPlayers;
     currentPlayerCount = item.m_nPlayers;
     botPlayers         = item.m_nBotPlayers;
     ping           = item.m_nPing;
     serverVersion  = item.m_nServerVersion;
     tags           = item.GetGameTags();
     address        = item.m_NetAdr;
     lastTimePlayed = SteamUtilities.ConvertUnixDate(item.m_ulTimeLastPlayed);
 }
Esempio n. 2
0
 private string GameServerItemFormattedString(gameserveritem_t gsi)
 {
     return("m_NetAdr: " + gsi.m_NetAdr.GetConnectionAddressString() + "\n" +
            "m_nPing: " + gsi.m_nPing + "\n" +
            "m_bHadSuccessfulResponse: " + gsi.m_bHadSuccessfulResponse + "\n" +
            "m_bDoNotRefresh: " + gsi.m_bDoNotRefresh + "\n" +
            "m_szGameDir: " + gsi.GetGameDir() + "\n" +
            "m_szMap: " + gsi.GetMap() + "\n" +
            "m_szGameDescription: " + gsi.GetGameDescription() + "\n" +
            "m_nAppID: " + gsi.m_nAppID + "\n" +
            "m_nPlayers: " + gsi.m_nPlayers + "\n" +
            "m_nMaxPlayers: " + gsi.m_nMaxPlayers + "\n" +
            "m_nBotPlayers: " + gsi.m_nBotPlayers + "\n" +
            "m_bPassword: "******"\n" +
            "m_bSecure: " + gsi.m_bSecure + "\n" +
            "m_ulTimeLastPlayed: " + gsi.m_ulTimeLastPlayed + "\n" +
            "m_nServerVersion: " + gsi.m_nServerVersion + "\n" +
            "m_szServerName: " + gsi.GetServerName() + "\n" +
            "m_szGameTags: " + gsi.GetGameTags() + "\n" +
            "m_steamID: " + gsi.m_steamID + "\n");
 }
Esempio n. 3
0
        private void OnPingResponded(gameserveritem_t data)
        {
            LogUtils.Log("Server is up, connecting...");
            CleanupServerQuery();
            if ((AppId_t)data.m_nAppID == GameInfo.ID)
            {
                ServerInfo info = new ServerInfo
                {
                    ServerID    = (SteamIdentity)data.m_steamID,
                    Name        = data.GetServerName(),
                    Map         = data.GetMap(),
                    Ping        = data.m_nPing,
                    Players     = data.m_nPlayers,
                    MaxPlayers  = data.m_nMaxPlayers,
                    HasPassword = data.m_bPassword,
                    IsSecure    = data.m_bSecure,
                };


                if (!data.m_bPassword || (((ClientConnection)Connection).CurrentPassword != String.Empty))
                {
                    if (((info.Players >= info.MaxPlayers) || (info.MaxPlayers < MIN_PLAYERS)) ||
                        (info.MaxPlayers > MAX_PLAYERS))
                    {
                        return;
                    }
                    CurrentServer = info;
                    ((ClientConnection)Connection).Connect(info);
                    return;
                    // Todo: server full
                }
                // Todo: no password
            }
            else
            {
                CleanupServerQuery();
                LogUtils.Log("Wrong game ID received: " + data.m_nAppID + ", expected: " + GameInfo.ID);
                //Todo: Timeout
            }
        }
Esempio n. 4
0
        // Token: 0x06003089 RID: 12425 RVA: 0x0013EC70 File Offset: 0x0013D070
        public SteamServerInfo(gameserveritem_t data)
        {
            this._steamID = data.m_steamID;
            this._ip      = data.m_NetAdr.GetIP();
            this._port    = data.m_NetAdr.GetConnectionPort();
            this._name    = data.GetServerName();
            if (OptionsSettings.filter)
            {
                this._name = ChatManager.filter(this.name);
            }
            this._map = data.GetMap();
            string gameTags = data.GetGameTags();

            if (gameTags.Length > 0)
            {
                this._isPvP      = (gameTags.IndexOf("PVP") != -1);
                this._hasCheats  = (gameTags.IndexOf("CHEATS") != -1);
                this._isWorkshop = (gameTags.IndexOf("WORK") != -1);
                if (gameTags.IndexOf("EASY") != -1)
                {
                    this._mode = EGameMode.EASY;
                }
                else if (gameTags.IndexOf("HARD") != -1)
                {
                    this._mode = EGameMode.HARD;
                }
                else
                {
                    this._mode = EGameMode.NORMAL;
                }
                if (gameTags.IndexOf("FIRST") != -1)
                {
                    this._cameraMode = ECameraMode.FIRST;
                }
                else if (gameTags.IndexOf("THIRD") != -1)
                {
                    this._cameraMode = ECameraMode.THIRD;
                }
                else if (gameTags.IndexOf("BOTH") != -1)
                {
                    this._cameraMode = ECameraMode.BOTH;
                }
                else
                {
                    this._cameraMode = ECameraMode.VEHICLE;
                }
                if (gameTags.IndexOf("GOLDONLY") != -1)
                {
                    this._isPro = true;
                }
                else
                {
                    this._isPro = false;
                }
                this.IsBattlEyeSecure = (gameTags.IndexOf("BATTLEYE_ON") != -1);
                int num  = gameTags.IndexOf(",GAMEMODE:");
                int num2 = gameTags.IndexOf(",", num + 1);
                if (num != -1 && num2 != -1)
                {
                    num          += 10;
                    this.gameMode = gameTags.Substring(num, num2 - num);
                }
                else
                {
                    this.gameMode = null;
                }
            }
            else
            {
                this._isPvP           = true;
                this._hasCheats       = false;
                this._mode            = EGameMode.NORMAL;
                this._cameraMode      = ECameraMode.FIRST;
                this._isPro           = true;
                this.IsBattlEyeSecure = false;
                this.gameMode         = null;
            }
            this._ping         = data.m_nPing;
            this._players      = data.m_nPlayers;
            this._maxPlayers   = data.m_nMaxPlayers;
            this._isPassworded = data.m_bPassword;
            this.IsVACSecure   = data.m_bSecure;
        }