[chuni] Add team name customization

This commit is contained in:
Dom Eori 2021-06-26 22:15:33 +09:00
parent b72121bc95
commit e7ae5de92c
3 changed files with 26 additions and 12 deletions

View File

@ -38,7 +38,8 @@ And you can switch to MySQL(MariaDB) database by commenting the Sqlite part.
#### Game specific setting:
##### CHUNITHM:
Support auto profile downgrade now. You can just run any legacy version, but works better if you set a different keychip serial.
- Support auto profile downgrade now. You can just run any legacy version, but works better if you set a different keychip serial.
- You can enable team function and customize team name by changing `game.chunithm.team-name` value. Leave this blank to disable team function.
### Other Information:
This server provide a simple API for changing some DIVA's setting.

View File

@ -5,6 +5,7 @@ import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
@ -17,9 +18,12 @@ public class GetUserTeamHandler implements BaseHandler {
private final StringMapper mapper;
private final String teamName;
public GetUserTeamHandler(StringMapper mapper) {
public GetUserTeamHandler(StringMapper mapper, @Value("${game.chunithm.team-name:#{null}}") String teamName) {
this.mapper = mapper;
this.teamName = teamName;
}
@Override
@ -29,18 +33,23 @@ public class GetUserTeamHandler implements BaseHandler {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("teamId", 1);
resultMap.put("teamRank", 1);
resultMap.put("teamName", "AQUA");
Map<String, Object> userTeamMap = new LinkedHashMap<>();
userTeamMap.put("userId", userId);
userTeamMap.put("teamId", 1);
userTeamMap.put("orderId", 1);
userTeamMap.put("teamPoint", 1);
userTeamMap.put("aggrDate", playDate);
if (teamName != null && !teamName.isEmpty()) {
resultMap.put("teamId", 1);
resultMap.put("teamRank", 1);
resultMap.put("teamName", teamName);
resultMap.put("userTeamPoint", userTeamMap);
Map<String, Object> userTeamMap = new LinkedHashMap<>();
userTeamMap.put("userId", userId);
userTeamMap.put("teamId", 1);
userTeamMap.put("orderId", 1);
userTeamMap.put("teamPoint", 1);
userTeamMap.put("aggrDate", playDate);
resultMap.put("userTeamPoint", userTeamMap);
} else {
resultMap.put("teamId", 0);
}
String json = mapper.write(resultMap);
logger.info("Response: " + json);

View File

@ -11,6 +11,10 @@ allnet.server.port=80
## Only change this if you have a reverse proxy running.
## The game rely on 80 port for boot up command
server.port=80
########## Game specific setting ##########
## Chunithm
## This enables team function if you set team name here. Leave this blank to disable it.
game.chunithm.team-name=
## Logging
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=20MB