mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
GUI, table: allow unlimited draft bots amount, fixed computer names in 10+ tables (part of #13701)
This commit is contained in:
parent
336ab738f0
commit
2e7e78d1e5
10 changed files with 40 additions and 27 deletions
|
|
@ -21,7 +21,7 @@
|
|||
minUserNameLength - minmal allowed length of a user name to connect to the server
|
||||
maxUserNameLength - maximal allowed length of a user name to connect to the server
|
||||
userNamePattern - pattern for user name validity check
|
||||
maxAiOpponents - number of allowed AI opponents on the server
|
||||
maxAiOpponents - number of allowed workable AI opponents on the server (draft bots are unlimited)
|
||||
saveGameActivated - allow game save and replay options (not working correctly yet)
|
||||
|
||||
authenticationActivated - "true" = user have to register to signon "false" = user need not to register
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
minUserNameLength - minmal allowed length of a user name to connect to the server
|
||||
maxUserNameLength - maximal allowed length of a user name to connect to the server
|
||||
userNamePattern - pattern for user name validity check
|
||||
maxAiOpponents - number of allowed AI opponents on the server
|
||||
maxAiOpponents - number of allowed workable AI opponents on the server (draft bots are unlimited)
|
||||
saveGameActivated - allow game save and replay options (not working correctly yet)
|
||||
authenticationActivated - "true" = user have to register to signon "false" = user need not to register
|
||||
* mail configs only needed if authentication is activated:
|
||||
|
|
|
|||
|
|
@ -222,15 +222,12 @@ public class MageServerImpl implements MageServer {
|
|||
throw new MageException("No message");
|
||||
}
|
||||
|
||||
// check AI players max
|
||||
// limit number of workable AI opponents (draft bots are unlimited)
|
||||
String maxAiOpponents = managerFactory.configSettings().getMaxAiOpponents();
|
||||
if (maxAiOpponents != null) {
|
||||
int aiPlayers = 0;
|
||||
for (PlayerType playerType : options.getPlayerTypes()) {
|
||||
if (playerType != PlayerType.HUMAN) {
|
||||
aiPlayers++;
|
||||
}
|
||||
}
|
||||
int aiPlayers = options.getPlayerTypes().stream()
|
||||
.mapToInt(t -> t.isAI() && t.isWorkablePlayer() ? 1 : 0)
|
||||
.sum();
|
||||
int max = Integer.parseInt(maxAiOpponents);
|
||||
if (aiPlayers > max) {
|
||||
user.showUserMessage("Create tournament", "It's only allowed to use a maximum of " + max + " AI players.");
|
||||
|
|
@ -324,7 +321,7 @@ public class MageServerImpl implements MageServer {
|
|||
UUID userId = session.get().getUserId();
|
||||
if (logger.isTraceEnabled()) {
|
||||
Optional<User> user = managerFactory.userManager().getUser(userId);
|
||||
user.ifPresent(user1 -> logger.trace("join tourn. tableId: " + tableId + ' ' + name));
|
||||
user.ifPresent(user1 -> logger.trace("join tourney tableId: " + tableId + ' ' + name));
|
||||
}
|
||||
if (userId == null) {
|
||||
logger.fatal("Got no userId from sessionId" + sessionId + " tableId" + tableId);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class TableController {
|
|||
}
|
||||
table = new Table(roomId, options.getTournamentType(), options.getName(), controllerName, DeckValidatorFactory.instance.createDeckValidator(options.getMatchOptions().getDeckType()),
|
||||
options.getPlayerTypes(), new TableRecorderImpl(managerFactory.userManager()), tournament, options.getMatchOptions().getBannedUsers(), options.isPlaneChase());
|
||||
chatId = managerFactory.chatManager().createChatSession("Tourn. table " + table.getId());
|
||||
chatId = managerFactory.chatManager().createChatSession("Tourney table " + table.getId());
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
|
@ -575,7 +575,7 @@ public class TableController {
|
|||
logger.error("No tournament object - userId: " + userId + " table: " + table.getId());
|
||||
return;
|
||||
}
|
||||
if (this.userId != null && this.userId.equals(userId) // tourn. sub tables have no creator user
|
||||
if (this.userId != null && this.userId.equals(userId) // tourney sub tables have no creator user
|
||||
&& (table.getState() == TableState.WAITING
|
||||
|| table.getState() == TableState.READY_TO_START)) {
|
||||
// table not started yet and user is the owner, removeUserFromAllTablesAndChat the table
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue