forked from External/mage
Add "minimum rating" option to matches and tournaments
This commit is contained in:
parent
6e26719367
commit
81c2a62250
9 changed files with 126 additions and 19 deletions
|
|
@ -172,6 +172,21 @@ public class TableController {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check minimum rating.
|
||||
int minimumRating = table.getTournament().getOptions().getMinimumRating();
|
||||
int userRating;
|
||||
if (table.getTournament().getOptions().getMatchOptions().isLimited()) {
|
||||
userRating = user.getUserData().getLimitedRating();
|
||||
} else {
|
||||
userRating = user.getUserData().getConstructedRating();
|
||||
}
|
||||
if (userRating < minimumRating) {
|
||||
String message = new StringBuilder("Your rating ").append(userRating)
|
||||
.append(" is lower than the table requirement ").append(minimumRating).toString();
|
||||
user.showUserMessage("Join Table", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<Player> playerOptional = createPlayer(name, seat.getPlayerType(), skill);
|
||||
if (playerOptional.isPresent()) {
|
||||
Player player = playerOptional.get();
|
||||
|
|
@ -272,6 +287,21 @@ public class TableController {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check minimum rating.
|
||||
int minimumRating = table.getMatch().getOptions().getMinimumRating();
|
||||
int userRating;
|
||||
if (table.getMatch().getOptions().isLimited()) {
|
||||
userRating = user.getUserData().getLimitedRating();
|
||||
} else {
|
||||
userRating = user.getUserData().getConstructedRating();
|
||||
}
|
||||
if (userRating < minimumRating) {
|
||||
String message = new StringBuilder("Your rating ").append(userRating)
|
||||
.append(" is lower than the table requirement ").append(minimumRating).toString();
|
||||
user.showUserMessage("Join Table", message);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check power level for table (currently only used for EDH/Commander table)
|
||||
int edhPowerLevel = table.getMatch().getOptions().getEdhPowerLevel();
|
||||
if (edhPowerLevel > 0 && table.getValidator().getName().toLowerCase(Locale.ENGLISH).equals("commander")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue