Ejemplo n.º 1
0
        public void SendTag(TeamPlayerId teamPlayerId, int damage)
        {
            var signature = PacketPacker.Tag(teamPlayerId, damage);

            TransmitSignature(signature);
            Log.Add(Log.Severity.Information, "Shot {0} tags as player {1}.", damage, teamPlayerId);
        }
Ejemplo n.º 2
0
        private static void ProcessTag(Signature signature)
        {
            var teamPlayerId = TeamPlayerId.FromPacked23((UInt16)((signature.Data >> 2) & 0x1f));
            var strength     = (signature.Data & 0x3) + 1;

            Log.Add(Log.Severity.Debug, "Received shot from player {0} with {1} tags.", teamPlayerId, strength);
        }
Ejemplo n.º 3
0
 public Player Player(TeamPlayerId teamPlayerId)
 {
     try
     {
         return(_players.FirstOrDefault(player => player.TeamPlayerId == teamPlayerId));
     }
     catch (InvalidOperationException)
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public static Packet RequestTagReport(UInt16 gameId, TeamPlayerId teamPlayerId)
        {
            var packet = new Packet();

            packet.Type = PacketType.RequestTagReport;
            packet.Data.Add(new Signature(SignatureType.Data, gameId));
            packet.Data.Add(new Signature(SignatureType.Data, teamPlayerId.Packed44));
            packet.Data.Add(new Signature(SignatureType.Data, 0x0f));         // TODO: Magic Number
            packet.PopulateChecksum();

            return(packet);
        }
Ejemplo n.º 5
0
        public static Packet AssignPlayer(UInt16 gameId, UInt16 taggerId, TeamPlayerId teamPlayerId)
        {
            var packet = new Packet();

            packet.Type = PacketType.AssignPlayer;
            packet.Data.Add(new Signature(SignatureType.Data, gameId));
            packet.Data.Add(new Signature(SignatureType.Data, taggerId));
            packet.Data.Add(new Signature(SignatureType.Data, teamPlayerId.Packed23));
            packet.PopulateChecksum();

            return(packet);
        }
Ejemplo n.º 6
0
 public bool Remove(TeamPlayerId teamPlayerId)
 {
     return(_players.Remove(Player(teamPlayerId)));
 }
Ejemplo n.º 7
0
        public static Signature Tag(TeamPlayerId teamPlayerId, int damage)
        {
            var flags = (byte)((teamPlayerId.Packed23 << 2) | (damage & 0x3));

            return(new Signature(SignatureType.Tag, flags, 7));
        }