public void summarizePlayer(int playerID) { Player p = players.get(playerID); Map<Integer, Playing> playersGames = p.games; Set<Integer> gamesKeys = playersGames.keySet(); Integer[] gameIDs = gamesKeys.toArray(new Integer[gamesKeys.size()]); System.out.println("Player: " + p); System.out.println("Total Gamerscore: " + p.getGamerScore()); System.out.printf( "%4s %-20s %-16s %-16s %-16s \n", " ", "Game", "Achievements", "Gamerscore", "IGN"); System.out.println( "--------------------------------------------------------------------------------"); for (int i = 0; i < gameIDs.length; i++) { Game g = games.get(gameIDs[i]); Playing playerInfo = p.games.get(gameIDs[i]); int nPlayerAchieve = playerInfo.achievements.size(); int nTotalAchieve = g.achievements.size(); System.out.printf( "%4s %-20s %-16s %-16s %-16s \n", (i + 1 + "."), g, (nPlayerAchieve + "/" + nTotalAchieve), (playerInfo.getPoints() + " pts"), playerInfo.ign); } System.out.printf("\n%4s %-16s %-16s \n", " ", "Friend", "Gamerscore"); System.out.println( "--------------------------------------------------------------------------------"); printSortedPlayers(p.friends); }
public void printComparisonData(Player p, Game g) { Playing gameInfo = p.games.get(g.gameID); ArrayList<Integer> achieved = gameInfo.achievements; System.out.println("Player: " + p); System.out.printf( "%d of %d total achievements achieved, %d pts \n", achieved.size(), g.achievements.size(), gameInfo.getPoints()); for (int a : achieved) { System.out.printf("%4s %s \n", "-", achievements.get(a)); } System.out.println(); }