public void FromPacked23Test() { var expected = new TeamPlayerId(0); var actual = TeamPlayerId.FromPacked23(0x0); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(1); actual = TeamPlayerId.FromPacked23(0x8); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(8); actual = TeamPlayerId.FromPacked23(0xf); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(9); actual = TeamPlayerId.FromPacked23(0x10); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(16); actual = TeamPlayerId.FromPacked23(0x17); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(17); actual = TeamPlayerId.FromPacked23(0x18); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(24); actual = TeamPlayerId.FromPacked23(0x1f); Assert.AreEqual(expected, actual); }
public void FromPacked44Test() { var expected = new TeamPlayerId(0); var actual = TeamPlayerId.FromPacked44(0x0); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(1); actual = TeamPlayerId.FromPacked44(0x10); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(8); actual = TeamPlayerId.FromPacked44(0x17); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(9); actual = TeamPlayerId.FromPacked44(0x20); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(16); actual = TeamPlayerId.FromPacked44(0x27); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(17); actual = TeamPlayerId.FromPacked44(0x30); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(24); actual = TeamPlayerId.FromPacked44(0x37); Assert.AreEqual(expected, actual); }
public void FromPacked34Test() { var expected = new TeamPlayerId(0); var actual = TeamPlayerId.FromPacked34(0x0); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(1); actual = TeamPlayerId.FromPacked34(0x10); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(8); actual = TeamPlayerId.FromPacked34(0x17); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(9); actual = TeamPlayerId.FromPacked34(0x20); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(16); actual = TeamPlayerId.FromPacked34(0x27); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(17); actual = TeamPlayerId.FromPacked34(0x30); Assert.AreEqual(expected, actual); expected = new TeamPlayerId(24); actual = TeamPlayerId.FromPacked34(0x37); Assert.AreEqual(expected, actual); }
public void TeamPlayerIdConstructorTest() { var target = new TeamPlayerId(0, 0); Assert.AreEqual(0, target.PlayerNumber); Assert.AreEqual(0, target.TeamNumber); Assert.AreEqual(0, target.TeamPlayerNumber); Assert.AreEqual(0x0, target.Packed23); Assert.AreEqual(0x0, target.Packed34); Assert.AreEqual(0x0, target.Packed44); target = new TeamPlayerId(1, 1); Assert.AreEqual(1, target.PlayerNumber); Assert.AreEqual(1, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x8, target.Packed23); Assert.AreEqual(0x10, target.Packed34); Assert.AreEqual(0x10, target.Packed44); target = new TeamPlayerId(1, 8); Assert.AreEqual(8, target.PlayerNumber); Assert.AreEqual(1, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0xf, target.Packed23); Assert.AreEqual(0x17, target.Packed34); Assert.AreEqual(0x17, target.Packed44); target = new TeamPlayerId(2, 1); Assert.AreEqual(9, target.PlayerNumber); Assert.AreEqual(2, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x10, target.Packed23); Assert.AreEqual(0x20, target.Packed34); Assert.AreEqual(0x20, target.Packed44); target = new TeamPlayerId(2, 8); Assert.AreEqual(16, target.PlayerNumber); Assert.AreEqual(2, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0x17, target.Packed23); Assert.AreEqual(0x27, target.Packed34); Assert.AreEqual(0x27, target.Packed44); target = new TeamPlayerId(3, 1); Assert.AreEqual(17, target.PlayerNumber); Assert.AreEqual(3, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x18, target.Packed23); Assert.AreEqual(0x30, target.Packed34); Assert.AreEqual(0x30, target.Packed44); target = new TeamPlayerId(3, 8); Assert.AreEqual(24, target.PlayerNumber); Assert.AreEqual(3, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0x1f, target.Packed23); Assert.AreEqual(0x37, target.Packed34); Assert.AreEqual(0x37, target.Packed44); }
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; }
public void ToStringTest1() { var target = new TeamPlayerId(0); Assert.AreEqual("T0:P0", target.ToString(true)); target = new TeamPlayerId(1); Assert.AreEqual("T1:P1", target.ToString(true)); target = new TeamPlayerId(8); Assert.AreEqual("T1:P8", target.ToString(true)); target = new TeamPlayerId(9); Assert.AreEqual("T2:P1", target.ToString(true)); target = new TeamPlayerId(16); Assert.AreEqual("T2:P8", target.ToString(true)); target = new TeamPlayerId(17); Assert.AreEqual("T3:P1", target.ToString(true)); target = new TeamPlayerId(24); Assert.AreEqual("T3:P8", target.ToString(true)); }
public void ToStringTest() { var target = new TeamPlayerId(0); Assert.AreEqual("0", target.ToString()); target = new TeamPlayerId(1); Assert.AreEqual("1", target.ToString()); target = new TeamPlayerId(8); Assert.AreEqual("8", target.ToString()); target = new TeamPlayerId(9); Assert.AreEqual("9", target.ToString()); target = new TeamPlayerId(16); Assert.AreEqual("16", target.ToString()); target = new TeamPlayerId(17); Assert.AreEqual("17", target.ToString()); target = new TeamPlayerId(24); Assert.AreEqual("24", target.ToString()); }
public bool SetPlayerName(TeamPlayerId teamPlayerId, string name) { var player = Players.Player(teamPlayerId); if (player == null) { Log.Add(Log.Severity.Warning, "Player not found."); return false; } player.Name = name; return true; }
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); }
private void CalculateScoresTeamGames() { var teamCount = GameDefinition.TeamCount; var teamSurvivedPlayerCounts = new int[teamCount]; var teamSurvivedPlayerScoreTotals = new int[teamCount]; // Calculate player scores foreach (var player in _players) { // Players lose 1 point for each tag they receive from another player var score = -player.TagsTaken; for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { for (var playerNumber = 1; playerNumber <= 8; playerNumber++) { var teamPlayerId = new TeamPlayerId(teamNumber, playerNumber); if (player.TeamPlayerId.TeamNumber == teamNumber) { // Players lose 2 points for each tag they land on players on their own team score -= 2 * player.TaggedPlayerCounts[teamPlayerId.PlayerNumber - 1]; } else { // Players receive 2 points for each tag they land on players from other teams score += 2 * player.TaggedPlayerCounts[teamPlayerId.PlayerNumber - 1]; } } } player.Score = score; if (player.Survived) { teamSurvivedPlayerCounts[player.TeamPlayerId.TeamNumber - 1]++; teamSurvivedPlayerScoreTotals[player.TeamPlayerId.TeamNumber - 1] += score; } } // Calculate team scores for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { var teamScore = (teamSurvivedPlayerCounts[teamNumber - 1] << 10) + (teamSurvivedPlayerScoreTotals[teamNumber - 1] << 2); Teams.Team(teamNumber).Score = teamScore; Log.Add(Log.Severity.Information, "Team {0} had {1} surviving players.", teamNumber, teamSurvivedPlayerCounts[teamNumber - 1]); Log.Add(Log.Severity.Information, "The total score of the surviving players was {0}.", teamSurvivedPlayerScoreTotals[teamNumber - 1]); Log.Add(Log.Severity.Information, "Team {0}'s final score was {1}.", teamNumber, teamScore); } Teams.CalculateRanks(); Players.CalculateRanks(); }
private void PrintScoreReport() { foreach (var player in _players) { Log.Add(Log.Severity.Information, "{0} ({1})", player.NameAndNumber, player.TaggerId); if (_gameDefinition.IsTeamGame) { Log.Add(Log.Severity.Information, "\tPlayer Rank: {0}, Team Rank: {1}, Score: {2}", player.Rank, player.Team.Rank, player.Score); for (var teamNumber = 1; teamNumber <= 3; teamNumber++) { var taggedByPlayerCounts = new int[8]; for (var playerNumber = 1; playerNumber <= 8; playerNumber++) { var teamPlayerId = new TeamPlayerId(teamNumber, playerNumber); taggedByPlayerCounts[playerNumber - 1] = player.TaggedByPlayerCounts[teamPlayerId.PlayerNumber - 1]; } Log.Add(Log.Severity.Information, "\tTags taken from team {0}: {1}", teamNumber, String.Join(", ", taggedByPlayerCounts)); } } else { Log.Add(Log.Severity.Information, "\tPlayer Rank: {0}, Score: {1}", player.Rank, player.Score); var taggedByPlayerCounts = new int[24]; for (var playerNumber = 1; playerNumber <= 24; playerNumber++) { var teamPlayerId = new TeamPlayerId(playerNumber); taggedByPlayerCounts[playerNumber - 1] = player.TaggedByPlayerCounts[teamPlayerId.PlayerNumber - 1]; } Log.Add(Log.Severity.Information, "\tTags taken from players: {0}", String.Join(", ", taggedByPlayerCounts)); } } }
public static Signature Tag(TeamPlayerId teamPlayerId, int damage) { var flags = (byte) ((teamPlayerId.Packed23 << 2) | (damage & 0x3)); return new Signature(SignatureType.Tag, flags, 7); }
public void DropPlayer(TeamPlayerId teamPlayerId) { var player = Players.Player(teamPlayerId); if (player == null) { Log.Add(Log.Severity.Warning, "Player not found."); return; } var changed = false; switch (HostingState) { case HostingStates.Adding: case HostingStates.AcknowledgePlayerAssignment: case HostingStates.Countdown: _players.Remove(player.TeamPlayerId); changed = true; break; case HostingStates.Playing: case HostingStates.ResendCountdown: case HostingStates.Summary: if (player.AllTagReportsReceived()) return; player.Dropped = true; player.SurviveTime = new TimeSpan(); player.Survived = false; changed = true; break; case HostingStates.Idle: case HostingStates.GameOver: default: Log.Add(Log.Severity.Warning, "Players cannot be dropped while in the {0} hosting state.", HostingState); break; } if (changed) OnPlayerListChanged(new PlayerListChangedEventArgs(Players)); }
private bool ProcessTeamTagReport(Packet packet) { if (packet.Data.Count < 4) return false; var gameId = packet.Data[0].Data; if (gameId != _gameDefinition.GameId) { Log.Add(Log.Severity.Warning, "Wrong game ID."); return false; } // what team do the scores relate to hits from var taggedByTeamNumber = (int)(packet.PacketTypeSignature.Data - PacketType.TeamOneTagReport + 1); var teamPlayerId = TeamPlayerId.FromPacked44(packet.Data[1].Data); var player = Players.Player(teamPlayerId); if (player == null) return false; if (player.TagSummaryReceived && !player.TeamTagReportsExpected[taggedByTeamNumber - 1]) { Log.Add(Log.Severity.Warning, "A tag report from player {0} for team {1} was not expected.", player.TeamPlayerId, taggedByTeamNumber); } if (player.TeamTagReportsReceived[taggedByTeamNumber - 1]) { Log.Add(Log.Severity.Warning, "A tag report from player {0} for team {1} was already received. Discarding.", player.TeamPlayerId, taggedByTeamNumber); return false; } player.TeamTagReportsReceived[taggedByTeamNumber - 1] = true; var scoreBitmask = packet.Data[2].Data; var packetIndex = 3; var mask = scoreBitmask; for (var taggedByTeamPlayerNumber = 1; taggedByTeamPlayerNumber <= 8; taggedByTeamPlayerNumber++) { var taggedByTeamPlayerId = new TeamPlayerId(taggedByTeamNumber, taggedByTeamPlayerNumber); var hasTags = ((mask >> (taggedByTeamPlayerNumber - 1)) & 0x1) != 0; if (!hasTags) continue; if (packet.Data.Count <= packetIndex) { Log.Add(Log.Severity.Warning, "Ran off end of score report"); return false; } var tagsTaken = BinaryCodedDecimal.ToDecimal(packet.Data[packetIndex].Data); player.TaggedByPlayerCounts[taggedByTeamPlayerId.PlayerNumber - 1] = tagsTaken; var taggedByPlayer = Players.Player(taggedByTeamPlayerId); if (taggedByPlayer == null) continue; taggedByPlayer.TaggedPlayerCounts[player.TeamPlayerId.PlayerNumber - 1] = tagsTaken; packetIndex++; } OnPlayerListChanged(new PlayerListChangedEventArgs(Players)); return true; }
private void SendPlayerAssignment(TeamPlayerId teamPlayerId) { if (HostingState != HostingStates.Adding && HostingState != HostingStates.AcknowledgePlayerAssignment) return; var gameId = _gameDefinition.GameId; var player = Players.Player(teamPlayerId); var taggerId = player.TaggerId; var packet = PacketPacker.AssignPlayer(gameId, taggerId, teamPlayerId); Protocol.TransmitPacket(packet); }
public void TeamPlayerIdConstructorTest1() { var target = new TeamPlayerId(0); Assert.AreEqual(0, target.PlayerNumber); Assert.AreEqual(0, target.TeamNumber); Assert.AreEqual(0, target.TeamPlayerNumber); Assert.AreEqual(0x0, target.Packed23); Assert.AreEqual(0x0, target.Packed34); Assert.AreEqual(0x0, target.Packed44); target = new TeamPlayerId(1); Assert.AreEqual(1, target.PlayerNumber); Assert.AreEqual(1, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x8, target.Packed23); Assert.AreEqual(0x10, target.Packed34); Assert.AreEqual(0x10, target.Packed44); target = new TeamPlayerId(8); Assert.AreEqual(8, target.PlayerNumber); Assert.AreEqual(1, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0xf, target.Packed23); Assert.AreEqual(0x17, target.Packed34); Assert.AreEqual(0x17, target.Packed44); target = new TeamPlayerId(9); Assert.AreEqual(9, target.PlayerNumber); Assert.AreEqual(2, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x10, target.Packed23); Assert.AreEqual(0x20, target.Packed34); Assert.AreEqual(0x20, target.Packed44); target = new TeamPlayerId(16); Assert.AreEqual(16, target.PlayerNumber); Assert.AreEqual(2, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0x17, target.Packed23); Assert.AreEqual(0x27, target.Packed34); Assert.AreEqual(0x27, target.Packed44); target = new TeamPlayerId(17); Assert.AreEqual(17, target.PlayerNumber); Assert.AreEqual(3, target.TeamNumber); Assert.AreEqual(1, target.TeamPlayerNumber); Assert.AreEqual(0x18, target.Packed23); Assert.AreEqual(0x30, target.Packed34); Assert.AreEqual(0x30, target.Packed44); target = new TeamPlayerId(24); Assert.AreEqual(24, target.PlayerNumber); Assert.AreEqual(3, target.TeamNumber); Assert.AreEqual(8, target.TeamPlayerNumber); Assert.AreEqual(0x1f, target.Packed23); Assert.AreEqual(0x37, target.Packed34); Assert.AreEqual(0x37, target.Packed44); }
private bool AssignTeamAndPlayer(int requestedTeam, Player newPlayer) { int assignedTeamNumber = 0; var assignedPlayerNumber = 0; if (_players.Count >= TeamPlayerId.MaximumPlayerNumber) { Log.Add(Log.Severity.Information, "Cannot add player. The game is full."); return false; } if (GameDefinition.IsTeamGame) { var isTagMasterGame = ( GameDefinition.GameType == GameType.TagMasterHideAndSeek || GameDefinition.GameType == GameType.TagMasterHuntThePrey || GameDefinition.GameType == GameType.HuntTheTagMasterTwoTeams); // Count the players on each team and find the smallest team var teamPlayerCounts = new int[_gameDefinition.TeamCount]; var smallestTeamNumber = 0; var smallestTeamPlayerCount = 8; for (var teamNumber = 1; teamNumber <= _gameDefinition.TeamCount; teamNumber++) { var teamPlayerCount = 0; foreach (var player in _players) { if (player.TeamPlayerId.TeamNumber == teamNumber) teamPlayerCount++; } // In Tag Master games, team 1 is full once it has a player if (isTagMasterGame && teamNumber == 1 && teamPlayerCount > 0) teamPlayerCount = 8; if (teamPlayerCount < smallestTeamPlayerCount) { smallestTeamNumber = teamNumber; smallestTeamPlayerCount = teamPlayerCount; } teamPlayerCounts[teamNumber - 1] = teamPlayerCount; } if (smallestTeamNumber == 0) { Log.Add(Log.Severity.Information, "All teams are full."); return false; } if (requestedTeam > 0 && requestedTeam <= _gameDefinition.TeamCount && teamPlayerCounts[requestedTeam - 1] < 8) { assignedTeamNumber = requestedTeam; } else { assignedTeamNumber = smallestTeamNumber; } for (var playerNumber = 1; playerNumber <= 8; playerNumber++) { if (_players.Player(new TeamPlayerId(assignedTeamNumber, playerNumber)) == null) { assignedPlayerNumber = playerNumber; break; } } } else { // Assign player to the first open player number for (var playerNumber = 1; playerNumber <= 24; playerNumber++) { var teamPlayerId = new TeamPlayerId(playerNumber); if (_players.Player(teamPlayerId) != null) continue; assignedTeamNumber = teamPlayerId.TeamNumber; assignedPlayerNumber = playerNumber; break; } } if (assignedTeamNumber == 0 || assignedPlayerNumber == 0) { Log.Add(Log.Severity.Warning, "Unable to assign a player number."); return false; } if (_gameDefinition.IsTeamGame) { newPlayer.TeamPlayerId = new TeamPlayerId(assignedTeamNumber, assignedPlayerNumber); } else { newPlayer.TeamPlayerId = new TeamPlayerId(assignedPlayerNumber); } newPlayer.Team = Teams.Team(assignedTeamNumber); Teams.Team(assignedTeamNumber).Players.Add(newPlayer); return true; }
private void CalculateScoresHuntTheTagMasterTwoTeams() { var teamCount = GameDefinition.TeamCount; var teamSurvivedPlayerCounts = new int[teamCount]; var teamScoreTotals = new int[teamCount]; // Calculate player scores foreach (var player in _players) { var score = 0; for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { for (var teamPlayerNumber = 1; teamPlayerNumber <= 8; teamPlayerNumber++) { var playerNumber = new TeamPlayerId(teamNumber, teamPlayerNumber).PlayerNumber; if (player.TeamPlayerId.TeamNumber == 1) // Tag Master { if (teamNumber != 1) // vs other players { // The Tag Master loses 1 point for each tag they received from other players score -= player.TaggedByPlayerCounts[playerNumber - 1]; // The Tag Master receives 2 points for each tag they land on other players score += 2*player.TaggedPlayerCounts[playerNumber - 1]; } } else // other players { if (teamNumber == 1) // vs Tag Master { // Players lose 1 point for each tag they received from the Tag Master score -= player.TaggedByPlayerCounts[playerNumber - 1]; // Players receive 2 points for each tag they land on the Tag Master score += 2*player.TaggedPlayerCounts[playerNumber - 1]; } else if (teamNumber == player.TeamPlayerId.TeamNumber) // vs same team { // Players lose 2 points for each tag they land on players on their own team score -= 2*player.TaggedPlayerCounts[playerNumber - 1]; } // Score is not affected by players tagging or being tagged by the other team } } } player.Score = score; teamScoreTotals[player.TeamPlayerId.TeamNumber - 1] += score; if (player.Survived) teamSurvivedPlayerCounts[player.TeamPlayerId.TeamNumber - 1]++; } // Calculate team scores for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { var teamScore = teamScoreTotals[teamNumber - 1]; Teams.Team(teamNumber).Score = teamScore; Log.Add(Log.Severity.Information, "Team {0} had {1} surviving players.", teamNumber, teamSurvivedPlayerCounts[teamNumber - 1]); Log.Add(Log.Severity.Information, "The total score of the team was {0}.", teamScore); } Teams.CalculateRanks(); Players.CalculateRanks(); // Adjust the ranks based on whether or not the Tag Master survived if (Players.Player(new TeamPlayerId(1, 1)).Survived) // The Tag Master survived { Teams.Team(1).Rank = 1; if (Teams.Team(2).Rank < Teams.Team(3).Rank) { Teams.Team(2).Rank = 2; Teams.Team(3).Rank = 3; } else if (Teams.Team(2).Rank == Teams.Team(3).Rank) { Teams.Team(2).Rank = 2; Teams.Team(3).Rank = 2; } else { Teams.Team(2).Rank = 3; Teams.Team(3).Rank = 2; } } else // the Tag Master did not survive { Teams.Team(1).Rank = 3; if (Teams.Team(2).Rank < Teams.Team(3).Rank) { Teams.Team(2).Rank = 1; Teams.Team(3).Rank = 2; } else if (Teams.Team(2).Rank == Teams.Team(3).Rank) { Teams.Team(2).Rank = 1; Teams.Team(3).Rank = 1; } else { Teams.Team(2).Rank = 2; Teams.Team(3).Rank = 1; } } }
private void CalculateScoresOneOnOne() { var teamCount = GameDefinition.TeamCount; var teamSurvivedPlayerCounts = new int[teamCount]; var teamScoreTotals = new int[teamCount]; // Calculate player scores foreach (var player in _players) { // Players lose 1 point for each tag they receive from another player var score = -player.TagsTaken; for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { for (var playerNumber = 1; playerNumber <= 8; playerNumber++) { var teamPlayerId = new TeamPlayerId(teamNumber, playerNumber); if (player.TeamPlayerId.TeamNumber == teamNumber) { // Players lose 2 points for each tag they land on players on their own team score -= 2*player.TaggedPlayerCounts[teamPlayerId.PlayerNumber - 1]; } else { // Players receive 2 points for each tag they land on their principal opponent // Players receive 1 point for each tag they land on other players from other teams var isPrincipalOpponent = playerNumber == player.TeamPlayerId.TeamPlayerNumber; var multiplier = isPrincipalOpponent ? 2 : 1; score += multiplier*player.TaggedPlayerCounts[teamPlayerId.PlayerNumber - 1]; } } } player.Score = score; teamScoreTotals[player.TeamPlayerId.TeamNumber - 1] += score; if (player.Survived) teamSurvivedPlayerCounts[player.TeamPlayerId.TeamNumber - 1]++; } // Calculate team scores for (var teamNumber = 1; teamNumber <= teamCount; teamNumber++) { var teamScore = teamScoreTotals[teamNumber - 1]; Teams.Team(teamNumber).Score = teamScore; // TODO: Break ties based on survived player count Log.Add(Log.Severity.Information, "Team {0} had {1} surviving players.", teamNumber, teamSurvivedPlayerCounts[teamNumber - 1]); Log.Add(Log.Severity.Information, "The total score of the team was {0}.", teamScore); } Teams.CalculateRanks(); Players.CalculateRanks(); }
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; }