mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Add rating to the client (#1498)
This commit is contained in:
parent
972d59aa37
commit
c781728b97
16 changed files with 234 additions and 52 deletions
|
|
@ -578,8 +578,11 @@ public class User {
|
|||
}
|
||||
|
||||
public static String userStatsToHistory(ResultProtos.UserStatsProto proto) {
|
||||
// todo: add preference to hide rating?
|
||||
return "Matches:" + userStatsToMatchHistory(proto)
|
||||
+ " Tourneys: " + userStatsToTourneyHistory(proto);
|
||||
+ ", Tourneys: " + userStatsToTourneyHistory(proto)
|
||||
+ ", Constructed Rating: " + userStatsToConstructedRating(proto)
|
||||
+ ", Limited Rating: " + userStatsToLimitedRating(proto);
|
||||
}
|
||||
|
||||
public int getTourneyQuitRatio() {
|
||||
|
|
|
|||
|
|
@ -199,14 +199,16 @@ public class UserManager {
|
|||
|
||||
public String getUserHistory(String userName) {
|
||||
User user = getUserByName(userName);
|
||||
if (user == null) {
|
||||
UserStats userStats = UserStatsRepository.instance.getUser(userName);
|
||||
if (userStats == null) {
|
||||
return "User " + userName + " not found";
|
||||
}
|
||||
return "History of user " + userName + ": " + User.userStatsToHistory(userStats.getProto());
|
||||
if (user != null) {
|
||||
return "History of user " + userName + " - " + user.getUserData().getHistory();
|
||||
}
|
||||
return "History of user " + userName + ": " + user.getUserData().getHistory();
|
||||
|
||||
UserStats userStats = UserStatsRepository.instance.getUser(userName);
|
||||
if (userStats != null) {
|
||||
return "History of user " + userName + " - " + User.userStatsToHistory(userStats.getProto());
|
||||
}
|
||||
|
||||
return "User " + userName + " not found";
|
||||
}
|
||||
|
||||
public void updateUserHistory() {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,9 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
|||
try {
|
||||
users.add(new UsersView(user.getUserData().getFlagName(), user.getName(),
|
||||
user.getMatchHistory(), user.getMatchQuitRatio(), user.getTourneyHistory(),
|
||||
user.getTourneyQuitRatio(), user.getGameInfo(), user.getPingInfo()));
|
||||
user.getTourneyQuitRatio(), user.getGameInfo(), user.getPingInfo(),
|
||||
user.getUserData().getGeneralRating(), user.getUserData().getConstructedRating(),
|
||||
user.getUserData().getLimitedRating()));
|
||||
} catch (Exception ex) {
|
||||
LOGGER.fatal("User update exception: " + user.getName() + " - " + ex.toString(), ex);
|
||||
users.add(new UsersView(
|
||||
|
|
@ -127,7 +129,10 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
|||
user.getTourneyHistory() != null ? user.getTourneyHistory() : "<no tourney history>",
|
||||
user.getTourneyQuitRatio(),
|
||||
"[exception]",
|
||||
user.getPingInfo() != null ? user.getPingInfo() : "<no ping>"));
|
||||
user.getPingInfo() != null ? user.getPingInfo() : "<no ping>",
|
||||
user.getUserData() != null ? user.getUserData().getGeneralRating() : 0,
|
||||
user.getUserData() != null ? user.getUserData().getConstructedRating() : 0,
|
||||
user.getUserData() != null ? user.getUserData().getLimitedRating() : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue