ACR_ServerCommunicator.ACR_ServerCommunicator.ShowServerLatency C# (CSharp) Method

ShowServerLatency() private method

This method sends a description of the server's latency characteristics to a player.
private ShowServerLatency ( uint PlayerObject ) : void
PlayerObject uint Supplies the requesting player's object /// id.
return void
        private void ShowServerLatency(uint PlayerObject)
        {
            int ServerLatency = GetGlobalInt("ACR_SERVER_LATENCY");
            int VaultLatency = GetGlobalInt("ACR_VAULT_LATENCY");
            PlayerState State = TryGetPlayerState(PlayerObject);
            string Description;

            if (State == null)
                return;

            if (ServerLatency == -1)
                Description = "off-scale high";
            else
                Description = String.Format("{0}ms", ServerLatency);

            SendMessageToPC(PlayerObject, String.Format(
                "Server internal latency is: {0} (median for past 14 samples: {1}ms, GameObjUpdate: {2}ms)",
                Description,
                GetGlobalInt("ACR_SERVER_LATENCY_MEDIAN"),
                ALFA.SystemInfo.GetGameObjUpdateTime(this)));

            if (VaultLatency == -1)
                Description = "off-scale high";
            else
                Description = String.Format("{0}ms", VaultLatency);

            SendMessageToPC(PlayerObject, String.Format(
                "Vault transaction latency is: {0}", Description));

            SendMessageToPC(PlayerObject, String.Format(
                "Your ping time to server: {0}ms", State.LatencyToServer));

            GetDatabase().ACR_IncrementStatistic("SHOW_SERVER_LATENCY");
        }
ACR_ServerCommunicator