示例#1
0
 private static void HandleClientUpdate(ClientStatusUpdate <EasyAntiCheat.Server.Hydra.Client> clientStatus)
 {
     using (TimeWarning.New("AntiCheatKickPlayer", 10L))
     {
         EasyAntiCheat.Server.Hydra.Client client = clientStatus.get_Client();
         Connection connection = EACServer.GetConnection(client);
         if (connection == null)
         {
             Debug.LogError((object)("EAC status update for invalid client: " + (object)((EasyAntiCheat.Server.Hydra.Client) ref client).get_ClientID()));
         }
         else
         {
             if (EACServer.ShouldIgnore(connection))
             {
                 return;
             }
             if (clientStatus.get_RequiresKick())
             {
                 string message = clientStatus.get_Message();
                 if (string.IsNullOrEmpty(message))
                 {
                     message = clientStatus.get_Status().ToString();
                 }
                 Debug.Log((object)("[EAC] Kicking " + (object)(ulong)connection.userid + " (" + message + ")"));
                 connection.authStatus = (__Null)"eac";
                 ((Network.Server)Net.sv).Kick(connection, "EAC: " + message);
                 DateTime?nullable = new DateTime?();
                 if (clientStatus.IsBanned(ref nullable))
                 {
                     connection.authStatus = (__Null)"eacbanned";
                     Interface.CallHook("OnPlayerBanned", (object)connection, (object)connection.authStatus);
                     ConsoleNetwork.BroadcastToAllClients("chat.add", (object)0, (object)("<color=#fff>SERVER</color> Kicking " + (string)connection.username + " (banned by anticheat)"));
                     if (!nullable.HasValue)
                     {
                         Entity.DeleteBy((ulong)connection.userid);
                     }
                 }
                 EACServer.easyAntiCheat.UnregisterClient(client);
                 EACServer.client2connection.Remove(client);
                 EACServer.connection2client.Remove(connection);
                 EACServer.connection2status.Remove(connection);
             }
             else if (clientStatus.get_Status() == 2)
             {
                 EACServer.OnAuthenticatedLocal(connection);
                 EACServer.easyAntiCheat.SetClientNetworkState(client, false);
             }
             else
             {
                 if (clientStatus.get_Status() != 5)
                 {
                     return;
                 }
                 EACServer.OnAuthenticatedRemote(connection);
             }
         }
     }
 }
 private static void HandleClientUpdate(ClientStatusUpdate <EasyAntiCheat.Server.Hydra.Client> clientStatus)
 {
     using (TimeWarning timeWarning = TimeWarning.New("AntiCheatKickPlayer", (long)10))
     {
         EasyAntiCheat.Server.Hydra.Client client = clientStatus.Client;
         Connection connection = EACServer.GetConnection(client);
         if (connection == null)
         {
             Debug.LogError(string.Concat("EAC status update for invalid client: ", client.ClientID));
         }
         else if (!EACServer.ShouldIgnore(connection))
         {
             if (clientStatus.RequiresKick)
             {
                 string message = clientStatus.Message;
                 if (string.IsNullOrEmpty(message))
                 {
                     message = clientStatus.Status.ToString();
                 }
                 Debug.Log(string.Concat(new object[] { "[EAC] Kicking ", connection.userid, " (", message, ")" }));
                 connection.authStatus = "eac";
                 Network.Net.sv.Kick(connection, string.Concat("EAC: ", message));
                 DateTime?nullable = null;
                 if (clientStatus.IsBanned(out nullable))
                 {
                     connection.authStatus = "eacbanned";
                     Interface.CallHook("OnPlayerBanned", connection, connection.authStatus);
                     ConsoleNetwork.BroadcastToAllClients("chat.add", new object[] { 0, string.Concat("<color=#fff>SERVER</color> Kicking ", connection.username, " (banned by anticheat)") });
                     if (!nullable.HasValue)
                     {
                         Entity.DeleteBy(connection.userid);
                     }
                 }
                 EACServer.easyAntiCheat.UnregisterClient(client);
                 EACServer.client2connection.Remove(client);
                 EACServer.connection2client.Remove(connection);
                 EACServer.connection2status.Remove(connection);
             }
             else if (clientStatus.Status == ClientStatus.ClientAuthenticatedLocal)
             {
                 EACServer.OnAuthenticatedLocal(connection);
                 EACServer.easyAntiCheat.SetClientNetworkState(client, false);
             }
             else if (clientStatus.Status == ClientStatus.ClientAuthenticatedRemote)
             {
                 EACServer.OnAuthenticatedRemote(connection);
             }
         }
     }
 }
    private static void SendToClient(EasyAntiCheat.Server.Hydra.Client client, byte[] message, int messageLength)
    {
        Connection connection = EACServer.GetConnection(client);

        if (connection == null)
        {
            Debug.LogError(string.Concat("EAC network packet for invalid client: ", client.ClientID));
            return;
        }
        if (Network.Net.sv.write.Start())
        {
            Network.Net.sv.write.PacketID(Message.Type.EAC);
            Network.Net.sv.write.UInt32((uint)messageLength);
            Network.Net.sv.write.Write(message, 0, messageLength);
            Network.Net.sv.write.Send(new SendInfo(connection));
        }
    }
示例#4
0
    private static void SendToClient(EasyAntiCheat.Server.Hydra.Client client, byte[] message, int messageLength)
    {
        Connection connection = EACServer.GetConnection(client);

        if (connection == null)
        {
            Debug.LogError((object)("EAC network packet for invalid client: " + (object)((EasyAntiCheat.Server.Hydra.Client) ref client).get_ClientID()));
        }
        else
        {
            if (!((Write)((NetworkPeer)Net.sv).write).Start())
            {
                return;
            }
            ((Write)((NetworkPeer)Net.sv).write).PacketID((Message.Type) 22);
            ((Write)((NetworkPeer)Net.sv).write).UInt32((uint)messageLength);
            ((Stream)((NetworkPeer)Net.sv).write).Write(message, 0, messageLength);
            ((Write)((NetworkPeer)Net.sv).write).Send(new SendInfo(connection));
        }
    }