Пример #1
0
        private static void HandleClientUpdate(ClientStatusUpdate <Client> clientStatus)
        {
            Client     clientObject = clientStatus.ClientObject;
            Connection connection   = GetConnection(clientObject);

            if (connection == null)
            {
                ConsoleSystem.LogError(string.Concat("EAC status update for invalid client: ", clientObject.ClientID));
            }
            else if (!ShouldIgnore(connection))
            {
                if (clientStatus.RequiresKick)
                {
                }
                else if (clientStatus.Status == ClientStatus.ClientAuthenticatedLocal)
                {
                    OnAuthenticatedLocal(connection);
                    easyAntiCheat.SetClientNetworkState(clientObject, false);
                }
                else if (clientStatus.Status == ClientStatus.ClientAuthenticatedRemote)
                {
                    OnAuthenticatedRemote(connection);
                }
                OnAuthenticatedLocal(connection);
                easyAntiCheat.SetClientNetworkState(clientObject, false);
            }
        }
Пример #2
0
    public static Connection GetConnection(EasyAntiCheat.Server.Hydra.Client client)
    {
        Connection value;

        client2connection.TryGetValue(client, out value);
        return(value);
    }
Пример #3
0
    public static Connection GetConnection(EasyAntiCheat.Server.Hydra.Client client)
    {
        Connection connection;

        EACServer.client2connection.TryGetValue(client, out connection);
        return(connection);
    }
Пример #4
0
        public static Connection GetConnection(Client client)
        {
            Connection connection;

            client2connection.TryGetValue(client, out connection);
            return(connection);
        }
Пример #5
0
 public static void OnStartLoading(Connection connection)
 {
     if (EACServer.easyAntiCheat != null)
     {
         EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(connection);
         EACServer.easyAntiCheat.SetClientNetworkState(client, false);
     }
 }
Пример #6
0
 public static void OnStartLoading(Connection connection)
 {
     if (easyAntiCheat != null)
     {
         Client client = GetClient(connection);
         easyAntiCheat.SetClientNetworkState(client, false);
     }
 }
Пример #7
0
 public static void OnFinishLoading(Connection connection)
 {
     if (easyAntiCheat != null)
     {
         EasyAntiCheat.Server.Hydra.Client client = GetClient(connection);
         easyAntiCheat.SetClientNetworkState(client, true);
     }
 }
Пример #8
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);
             }
         }
     }
 }
Пример #9
0
 public static void OnFinishLoading(Connection connection)
 {
     if (EACServer.easyAntiCheat == null)
     {
         return;
     }
     EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(connection);
     EACServer.easyAntiCheat.SetClientNetworkState(client, true);
 }
Пример #10
0
        private static void SendToClient(Client client, byte[] message, int messageLength)
        {
            Connection connection = GetConnection(client);

            if (connection == null)
            {
                ConsoleSystem.LogError(string.Concat("EAC network packet for invalid client: ", client.ClientID));
                return;
            }
        }
Пример #11
0
 public static void OnLeaveGame(Connection connection)
 {
     if (easyAntiCheat != null)
     {
         Client client = GetClient(connection);
         easyAntiCheat.UnregisterClient(client);
         client2connection.Remove(client);
         connection2client.Remove(connection);
         connection2status.Remove(connection);
     }
 }
Пример #12
0
 public static void OnLeaveGame(Connection connection)
 {
     if (EACServer.easyAntiCheat != null)
     {
         EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(connection);
         EACServer.easyAntiCheat.UnregisterClient(client);
         EACServer.client2connection.Remove(client);
         EACServer.connection2client.Remove(connection);
         EACServer.connection2status.Remove(connection);
     }
 }
Пример #13
0
        public static void OnMessageReceived(Message message)
        {
            if (!connection2client.ContainsKey(message.connection))
            {
                ConsoleSystem.LogError(string.Concat("EAC network packet from invalid connection: ", message.connection.userid));
                return;
            }
            Client       client       = GetClient(message.connection);
            MemoryStream memoryStream = message.read.MemoryStreamWithSize();

            easyAntiCheat.PushNetworkMessage(client, memoryStream.GetBuffer(), (int)memoryStream.Length);
        }
Пример #14
0
 public static void OnMessageReceived(Message message)
 {
     if (!EACServer.connection2client.ContainsKey((Connection)message.connection))
     {
         Debug.LogError((object)("EAC network packet from invalid connection: " + (object)(ulong)((Connection)message.connection).userid));
     }
     else
     {
         EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient((Connection)message.connection);
         MemoryStream memoryStream = message.get_read().MemoryStreamWithSize();
         EACServer.easyAntiCheat.PushNetworkMessage(client, memoryStream.GetBuffer(), (int)memoryStream.Length);
     }
 }
Пример #15
0
 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);
             }
         }
     }
 }
Пример #16
0
    private static void SendToClient(EasyAntiCheat.Server.Hydra.Client client, byte[] message, int messageLength)
    {
        Connection connection = GetConnection(client);

        if (connection == null)
        {
            Debug.LogError("EAC network packet for invalid client: " + client.ClientID);
        }
        else 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));
        }
    }
Пример #17
0
    public static void OnMessageReceived(Message message)
    {
        if (!connection2client.ContainsKey(message.connection))
        {
            Debug.LogError("EAC network packet from invalid connection: " + message.connection.userid);
            return;
        }
        EasyAntiCheat.Server.Hydra.Client client = GetClient(message.connection);
        byte[] buffer;
        int    size;

        if (message.read.TemporaryBytesWithSize(out buffer, out size))
        {
            easyAntiCheat.PushNetworkMessage(client, buffer, size);
        }
    }
Пример #18
0
    public static void OnMessageReceived(Message message)
    {
        byte[] numArray;
        int    num;

        if (!EACServer.connection2client.ContainsKey(message.connection))
        {
            Debug.LogError(string.Concat("EAC network packet from invalid connection: ", message.connection.userid));
            return;
        }
        EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(message.connection);
        if (!message.read.TemporaryBytesWithSize(out numArray, out num))
        {
            return;
        }
        EACServer.easyAntiCheat.PushNetworkMessage(client, numArray, num);
    }
Пример #19
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));
        }
    }
Пример #20
0
 public static void OnJoinGame(Connection connection)
 {
     if (easyAntiCheat == null)
     {
         OnAuthenticatedLocal(connection);
         OnAuthenticatedRemote(connection);
     }
     else
     {
         Client client = easyAntiCheat.GenerateCompatibilityClient();
         easyAntiCheat.RegisterClient(client, connection.userid.ToString(), "127.0.0.1", Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), (connection.authLevel <= 0 ? PlayerRegisterFlags.PlayerRegisterFlagNone : PlayerRegisterFlags.PlayerRegisterFlagAdmin));
         client2connection.Add(client, connection);
         connection2client.Add(connection, client);
         connection2status.Add(connection, ClientStatus.ClientDisconnected);
         if (ShouldIgnore(connection))
         {
             OnAuthenticatedLocal(connection);
             OnAuthenticatedRemote(connection);
         }
     }
 }
Пример #21
0
 public static void OnJoinGame(Connection connection)
 {
     if (easyAntiCheat != null)
     {
         EasyAntiCheat.Server.Hydra.Client client = easyAntiCheat.GenerateCompatibilityClient();
         easyAntiCheat.RegisterClient(client, connection.userid.ToString(), connection.ipaddress, connection.ownerid.ToString(), connection.username, (connection.authLevel != 0) ? PlayerRegisterFlags.PlayerRegisterFlagAdmin : PlayerRegisterFlags.PlayerRegisterFlagNone);
         client2connection.Add(client, connection);
         connection2client.Add(connection, client);
         connection2status.Add(connection, ClientStatus.Reserved);
         if (ShouldIgnore(connection))
         {
             OnAuthenticatedLocal(connection);
             OnAuthenticatedRemote(connection);
         }
     }
     else
     {
         OnAuthenticatedLocal(connection);
         OnAuthenticatedRemote(connection);
     }
 }
Пример #22
0
 public static void OnJoinGame(Connection connection)
 {
     if (EACServer.easyAntiCheat == null)
     {
         EACServer.OnAuthenticatedLocal(connection);
         EACServer.OnAuthenticatedRemote(connection);
     }
     else
     {
         EasyAntiCheat.Server.Hydra.Client client = EACServer.easyAntiCheat.GenerateCompatibilityClient();
         EACServer.easyAntiCheat.RegisterClient(client, connection.userid.ToString(), connection.ipaddress, connection.ownerid.ToString(), connection.username, (connection.authLevel > 0 ? PlayerRegisterFlags.PlayerRegisterFlagAdmin : PlayerRegisterFlags.PlayerRegisterFlagNone));
         EACServer.client2connection.Add(client, connection);
         EACServer.connection2client.Add(connection, client);
         EACServer.connection2status.Add(connection, ClientStatus.ClientDisconnected);
         if (EACServer.ShouldIgnore(connection))
         {
             EACServer.OnAuthenticatedLocal(connection);
             EACServer.OnAuthenticatedRemote(connection);
             return;
         }
     }
 }
Пример #23
0
 public static void OnJoinGame(Connection connection)
 {
     if (EACServer.easyAntiCheat != null)
     {
         EasyAntiCheat.Server.Hydra.Client compatibilityClient = EACServer.easyAntiCheat.GenerateCompatibilityClient();
         // ISSUE: explicit non-virtual call
         // ISSUE: explicit non-virtual call
         EACServer.easyAntiCheat.RegisterClient(compatibilityClient, __nonvirtual(connection.userid.ToString()), (string)connection.ipaddress, __nonvirtual(connection.ownerid.ToString()), (string)connection.username, connection.authLevel > 0 ? (PlayerRegisterFlags)1 : (PlayerRegisterFlags)0);
         EACServer.client2connection.Add(compatibilityClient, connection);
         EACServer.connection2client.Add(connection, compatibilityClient);
         EACServer.connection2status.Add(connection, (ClientStatus)0);
         if (!EACServer.ShouldIgnore(connection))
         {
             return;
         }
         EACServer.OnAuthenticatedLocal(connection);
         EACServer.OnAuthenticatedRemote(connection);
     }
     else
     {
         EACServer.OnAuthenticatedLocal(connection);
         EACServer.OnAuthenticatedRemote(connection);
     }
 }
Пример #24
0
 private static void HandleClientUpdate(ClientStatusUpdate <EasyAntiCheat.Server.Hydra.Client> clientStatus)
 {
     using (TimeWarning.New("AntiCheatKickPlayer", 10))
     {
         EasyAntiCheat.Server.Hydra.Client client = clientStatus.Client;
         Connection connection = GetConnection(client);
         if (connection == null)
         {
             Debug.LogError("EAC status update for invalid client: " + client.ClientID);
         }
         else
         {
             if (ShouldIgnore(connection))
             {
                 return;
             }
             if (clientStatus.RequiresKick)
             {
                 string text = clientStatus.Message;
                 if (string.IsNullOrEmpty(text))
                 {
                     text = clientStatus.Status.ToString();
                 }
                 Debug.Log($"[EAC] Kicking {connection.userid} / {connection.username} ({text})");
                 connection.authStatus = "eac";
                 Network.Net.sv.Kick(connection, "EAC: " + text);
                 Interface.CallHook("OnPlayerKicked", connection, text);
                 DateTime?timeBanExpires;
                 if (clientStatus.IsBanned(out timeBanExpires))
                 {
                     connection.authStatus = "eacbanned";
                     object[] args = new object[3]
                     {
                         2,
                         0,
                         "<color=#fff>SERVER</color> Kicking " + connection.username + " (banned by anticheat)"
                     };
                     Interface.CallHook("OnPlayerBanned", connection, text);
                     ConsoleNetwork.BroadcastToAllClients("chat.add", args);
                     if (!timeBanExpires.HasValue)
                     {
                         Entity.DeleteBy(connection.userid);
                     }
                 }
                 easyAntiCheat.UnregisterClient(client);
                 client2connection.Remove(client);
                 connection2client.Remove(connection);
                 connection2status.Remove(connection);
             }
             else if (clientStatus.Status == ClientStatus.ClientAuthenticatedLocal)
             {
                 OnAuthenticatedLocal(connection);
                 easyAntiCheat.SetClientNetworkState(client, false);
             }
             else if (clientStatus.Status == ClientStatus.ClientAuthenticatedRemote)
             {
                 OnAuthenticatedRemote(connection);
             }
             return;
         }
     }
 }
Пример #25
0
    private void CLProject(BaseEntity.RPCMessage msg)
    {
        BasePlayer basePlayer = msg.player;

        if (!this.VerifyClientAttack(basePlayer))
        {
            base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
            return;
        }
        if (this.reloadFinished && this.HasReloadCooldown())
        {
            AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Reloading (", base.ShortPrefabName, ")"));
            basePlayer.stats.combat.Log(this, "reload_cooldown");
            return;
        }
        this.reloadStarted  = false;
        this.reloadFinished = false;
        if (this.primaryMagazine.contents <= 0 && !this.UsingInfiniteAmmoCheat)
        {
            AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Magazine empty (", base.ShortPrefabName, ")"));
            basePlayer.stats.combat.Log(this, "ammo_missing");
            return;
        }
        ItemDefinition  itemDefinition  = this.primaryMagazine.ammoType;
        ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read);

        if (itemDefinition.itemid != projectileShoot.ammoType)
        {
            AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Ammo mismatch (", base.ShortPrefabName, ")"));
            basePlayer.stats.combat.Log(this, "ammo_mismatch");
            return;
        }
        if (!this.UsingInfiniteAmmoCheat)
        {
            this.primaryMagazine.contents--;
        }
        ItemModProjectile component = itemDefinition.GetComponent <ItemModProjectile>();

        if (component == null)
        {
            AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Item mod not found (", base.ShortPrefabName, ")"));
            basePlayer.stats.combat.Log(this, "mod_missing");
            return;
        }
        if (projectileShoot.projectiles.Count > component.numProjectiles)
        {
            AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Count mismatch (", base.ShortPrefabName, ")"));
            basePlayer.stats.combat.Log(this, "count_mismatch");
            return;
        }
        Interface.CallHook("OnWeaponFired", this, msg.player, component, projectileShoot);
        base.SignalBroadcast(BaseEntity.Signal.Attack, string.Empty, msg.connection);
        basePlayer.CleanupExpiredProjectiles();
        foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles)
        {
            if (!basePlayer.HasFiredProjectile(projectile.projectileID))
            {
                if (!base.ValidateEyePos(basePlayer, projectile.startPos))
                {
                    continue;
                }
                basePlayer.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, itemDefinition, null);
                this.CreateProjectileEffectClientside(component.projectileObject.resourcePath, projectile.startPos, projectile.startVel, projectile.seed, msg.connection, this.IsSilenced(), false);
            }
            else
            {
                AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Duplicate ID (", projectile.projectileID, ")"));
                basePlayer.stats.combat.Log(this, "duplicate_id");
            }
        }
        basePlayer.stats.Add(string.Concat(component.category, "_fired"), projectileShoot.projectiles.Count <ProjectileShoot.Projectile>(), Stats.Steam);
        base.StartAttackCooldown(this.ScaleRepeatDelay(this.repeatDelay) + this.animationDelay);
        basePlayer.MarkHostileFor(60f);
        this.UpdateItemCondition();
        this.DidAttackServerside();
        float single = 0f;

        if (component.projectileObject != null)
        {
            GameObject gameObject = component.projectileObject.Get();
            if (gameObject != null)
            {
                Projectile component1 = gameObject.GetComponent <Projectile>();
                if (component1 != null)
                {
                    foreach (DamageTypeEntry damageType in component1.damageTypes)
                    {
                        single += damageType.amount;
                    }
                }
            }
        }
        float noiseRadius = this.NoiseRadius;

        if (this.IsSilenced())
        {
            noiseRadius *= AI.npc_gun_noise_silencer_modifier;
        }
        Sensation sensation = new Sensation()
        {
            Type            = SensationType.Gunshot,
            Position        = basePlayer.transform.position,
            Radius          = noiseRadius,
            DamagePotential = single,
            InitiatorPlayer = basePlayer,
            Initiator       = basePlayer
        };

        Sense.Stimulate(sensation);
        if (EACServer.playerTracker != null)
        {
            using (TimeWarning timeWarning = TimeWarning.New("LogPlayerShooting", 0.1f))
            {
                UnityEngine.Vector3    networkPosition = basePlayer.GetNetworkPosition();
                UnityEngine.Quaternion networkRotation = basePlayer.GetNetworkRotation();
                Item item = this.GetItem();
                int  num  = (item != null ? item.info.itemid : 0);
                EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(basePlayer.net.connection);
                PlayerUseWeapon playerUseWeapon          = new PlayerUseWeapon()
                {
                    Position     = new EasyAntiCheat.Server.Cerberus.Vector3(networkPosition.x, networkPosition.y, networkPosition.z),
                    ViewRotation = new EasyAntiCheat.Server.Cerberus.Quaternion(networkRotation.x, networkRotation.y, networkRotation.z, networkRotation.w),
                    WeaponID     = num
                };
                EACServer.playerTracker.LogPlayerUseWeapon(client, playerUseWeapon);
            }
        }
    }
Пример #26
0
    private void CLProject(RPCMessage msg)
    {
        BasePlayer player = msg.player;

        if (!VerifyClientAttack(player))
        {
            SendNetworkUpdate();
            return;
        }
        if (reloadFinished && HasReloadCooldown())
        {
            AntiHack.Log(player, AntiHackType.ProjectileHack, "Reloading (" + base.ShortPrefabName + ")");
            player.stats.combat.Log(this, "reload_cooldown");
            return;
        }
        reloadStarted  = false;
        reloadFinished = false;
        if (primaryMagazine.contents <= 0 && !UsingInfiniteAmmoCheat)
        {
            AntiHack.Log(player, AntiHackType.ProjectileHack, "Magazine empty (" + base.ShortPrefabName + ")");
            player.stats.combat.Log(this, "ammo_missing");
            return;
        }
        ItemDefinition  primaryMagazineAmmo = PrimaryMagazineAmmo;
        ProjectileShoot projectileShoot     = ProjectileShoot.Deserialize(msg.read);

        if (primaryMagazineAmmo.itemid != projectileShoot.ammoType)
        {
            AntiHack.Log(player, AntiHackType.ProjectileHack, "Ammo mismatch (" + base.ShortPrefabName + ")");
            player.stats.combat.Log(this, "ammo_mismatch");
            return;
        }
        if (!UsingInfiniteAmmoCheat)
        {
            primaryMagazine.contents--;
        }
        ItemModProjectile component = primaryMagazineAmmo.GetComponent <ItemModProjectile>();

        if (component == null)
        {
            AntiHack.Log(player, AntiHackType.ProjectileHack, "Item mod not found (" + base.ShortPrefabName + ")");
            player.stats.combat.Log(this, "mod_missing");
            return;
        }
        if (projectileShoot.projectiles.Count > component.numProjectiles)
        {
            AntiHack.Log(player, AntiHackType.ProjectileHack, "Count mismatch (" + base.ShortPrefabName + ")");
            player.stats.combat.Log(this, "count_mismatch");
            return;
        }
        Interface.CallHook("OnWeaponFired", this, msg.player, component, projectileShoot);
        if (player.InGesture)
        {
            return;
        }
        SignalBroadcast(Signal.Attack, string.Empty, msg.connection);
        player.CleanupExpiredProjectiles();
        foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles)
        {
            if (player.HasFiredProjectile(projectile.projectileID))
            {
                AntiHack.Log(player, AntiHackType.ProjectileHack, "Duplicate ID (" + projectile.projectileID + ")");
                player.stats.combat.Log(this, "duplicate_id");
            }
            else if (ValidateEyePos(player, projectile.startPos))
            {
                player.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, primaryMagazineAmmo);
                if (!player.limitNetworking)
                {
                    CreateProjectileEffectClientside(component.projectileObject.resourcePath, projectile.startPos, projectile.startVel, projectile.seed, msg.connection, IsSilenced());
                }
            }
        }
        player.MakeNoise(player.transform.position, BaseCombatEntity.ActionVolume.Loud);
        player.stats.Add(component.category + "_fired", projectileShoot.projectiles.Count(), (Stats)5);
        player.LifeStoryShotFired(this);
        StartAttackCooldown(ScaleRepeatDelay(repeatDelay) + animationDelay);
        player.MarkHostileFor();
        UpdateItemCondition();
        DidAttackServerside();
        float num = 0f;

        if (component.projectileObject != null)
        {
            GameObject gameObject = component.projectileObject.Get();
            if (gameObject != null)
            {
                Projectile component2 = gameObject.GetComponent <Projectile>();
                if (component2 != null)
                {
                    foreach (DamageTypeEntry damageType in component2.damageTypes)
                    {
                        num += damageType.amount;
                    }
                }
            }
        }
        float num2 = NoiseRadius;

        if (IsSilenced())
        {
            num2 *= AI.npc_gun_noise_silencer_modifier;
        }
        Sensation sensation = default(Sensation);

        sensation.Type            = SensationType.Gunshot;
        sensation.Position        = player.transform.position;
        sensation.Radius          = num2;
        sensation.DamagePotential = num;
        sensation.InitiatorPlayer = player;
        sensation.Initiator       = player;
        Sense.Stimulate(sensation);
        if (EACServer.playerTracker != null)
        {
            using (TimeWarning.New("LogPlayerShooting"))
            {
                UnityEngine.Vector3    networkPosition = player.GetNetworkPosition();
                UnityEngine.Quaternion networkRotation = player.GetNetworkRotation();
                int weaponID = GetItem()?.info.itemid ?? 0;
                EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(player.net.connection);
                PlayerUseWeapon eventParams = default(PlayerUseWeapon);
                eventParams.Position     = new EasyAntiCheat.Server.Cerberus.Vector3(networkPosition.x, networkPosition.y, networkPosition.z);
                eventParams.ViewRotation = new EasyAntiCheat.Server.Cerberus.Quaternion(networkRotation.w, networkRotation.x, networkRotation.y, networkRotation.z);
                eventParams.WeaponID     = weaponID;
                EACServer.playerTracker.LogPlayerUseWeapon(client, eventParams);
            }
        }
    }