forked from Cookies_Github_mirror/AquaDX
[+] CardMaker 1.39 support (#79)
This commit is contained in:
@@ -57,9 +57,9 @@ public class GetGameConnectHandler implements BaseHandler {
|
||||
String port = ALLNET_PORT.equals("") ? SERVER_PORT : ALLNET_PORT;
|
||||
|
||||
List<GameConnect> gameConnectList = new ArrayList<>();
|
||||
GameConnect chuni = new GameConnect(0, 1, "http://" + addr + ":" + port + "/ChusanServlet/");
|
||||
GameConnect mai = new GameConnect(1, 1, "http://" + addr + ":" + port + "/Maimai2Servlet/");
|
||||
GameConnect ongeki = new GameConnect(2, 1, "http://" + addr + ":" + port + "/OngekiServlet/");
|
||||
GameConnect chuni = new GameConnect(0, 1, "http://" + addr + ":" + port + "/g/chu3/" + version + "/");
|
||||
GameConnect mai = new GameConnect(1, 1, "http://" + addr + ":" + port + "/g/mai2/");
|
||||
GameConnect ongeki = new GameConnect(2, 1, "http://" + addr + ":" + port + "/g/ongeki/");
|
||||
gameConnectList.add(chuni);
|
||||
gameConnectList.add(mai);
|
||||
gameConnectList.add(ongeki);
|
||||
|
||||
@@ -38,10 +38,10 @@ public class GetGameSettingHandler implements BaseHandler {
|
||||
LocalDateTime rebootEndTime = LocalDateTime.now().minusHours(2);
|
||||
|
||||
GameSetting gameSetting = new GameSetting(
|
||||
"1.0.0",
|
||||
"1.35.0",
|
||||
"1.32.0",
|
||||
"1.30.0",
|
||||
"1.32.0",
|
||||
"1.45.0",
|
||||
false,
|
||||
10,
|
||||
rebootStartTime.format(formatter),
|
||||
|
||||
@@ -97,7 +97,7 @@ class ChusanServletController(
|
||||
|
||||
val noopEndpoint = endpointList.popAll("UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi",
|
||||
"UpsertClientSettingApi", "UpsertClientTestmodeApi", "CreateTokenApi", "RemoveTokenApi", "UpsertClientUploadApi",
|
||||
"MatchingServer/Ping", "PrinterLoginApi", "PrinterLogoutApi")
|
||||
"MatchingServer/Ping", "PrinterLoginApi", "PrinterLogoutApi", "Ping")
|
||||
|
||||
val members = this::class.declaredMemberProperties
|
||||
val handlers: Map<String, BaseHandler> = endpointList.associateWith { api ->
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CMGetUserPreviewHandler implements BaseHandler {
|
||||
resultMap.put("userName", user.getUserName());
|
||||
resultMap.put("level", user.getLevel());
|
||||
resultMap.put("medal", user.getMedal());
|
||||
resultMap.put("lastDataVersion", "2.00.00"); //Hardcode due to outdated
|
||||
resultMap.put("lastDataVersion", user.getLastDataVersion());
|
||||
resultMap.put("isLogin", false);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
@@ -155,7 +155,7 @@ class Maimai2ServletController(
|
||||
"userId" to userId,
|
||||
"userName" to it.userName,
|
||||
"rating" to it.playerRating,
|
||||
"lastDataVersion" to "1.20.00",
|
||||
"lastDataVersion" to it.lastDataVersion,
|
||||
"isLogin" to false,
|
||||
"isExistSellingCard" to false
|
||||
)
|
||||
|
||||
@@ -15,17 +15,20 @@ import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2UpsertUserPrintHandler")
|
||||
@AllArgsConstructor
|
||||
public class UpsertUserPrintHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserPrintHandler.class);
|
||||
@@ -35,6 +38,21 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
private final Mai2UserPrintDetailRepo userPrintDetailRepository;
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
private long expirationTime;
|
||||
|
||||
public UpsertUserPrintHandler(BasicMapper mapper,
|
||||
@Value("${game.cardmaker.card.expiration:15}") long expirationTime,
|
||||
Mai2UserCardRepo userCardRepository,
|
||||
Mai2UserPrintDetailRepo userPrintDetailRepository,
|
||||
Mai2UserDataRepo userDataRepository
|
||||
) {
|
||||
this.mapper = mapper;
|
||||
this.expirationTime = expirationTime;
|
||||
this.userCardRepository = userCardRepository;
|
||||
this.userPrintDetailRepository = userPrintDetailRepository;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
@@ -54,12 +72,19 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
Mai2UserPrintDetail userPrintDetail = upsertUserPrint.getUserPrintDetail();
|
||||
Mai2UserCard newUserCard = userPrintDetail.getUserCard();
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||
String currentDateTime = LocalDateTime.now().format(formatter);
|
||||
String expirationDateTime = LocalDateTime.now().plusDays(expirationTime).format(formatter);
|
||||
String randomSerialId =
|
||||
String.format("%010d", ThreadLocalRandom.current().nextLong(0L, 9999999999L)) +
|
||||
String.format("%010d", ThreadLocalRandom.current().nextLong(0L, 9999999999L));
|
||||
|
||||
newUserCard.setUser(userData);
|
||||
userPrintDetail.setUser(userData);
|
||||
|
||||
newUserCard.setStartDate("2019-01-01 00:00:00.000000");
|
||||
newUserCard.setEndDate("2029-01-01 00:00:00.000000");
|
||||
userPrintDetail.setSerialId("FAKECARDIMAG12345678");
|
||||
newUserCard.setStartDate(currentDateTime);
|
||||
newUserCard.setEndDate(expirationDateTime);
|
||||
userPrintDetail.setSerialId(randomSerialId);
|
||||
|
||||
Optional<Mai2UserCard> userCardOptional = userCardRepository.findByUserAndCardId(newUserCard.getUser(), newUserCard.getCardId());
|
||||
if (userCardOptional.isPresent()) {
|
||||
@@ -73,9 +98,9 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("returnCode", 1);
|
||||
resultMap.put("orderId", 0);
|
||||
resultMap.put("serialId", "FAKECARDIMAG12345678");
|
||||
resultMap.put("startDate", "2019-01-01 00:00:00.000000");
|
||||
resultMap.put("endDate", "2029-01-01 00:00:00.000000");
|
||||
resultMap.put("serialId", randomSerialId);
|
||||
resultMap.put("startDate", currentDateTime);
|
||||
resultMap.put("endDate", expirationDateTime);
|
||||
|
||||
return mapper.write(resultMap);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ class Mai2GameCharge : BaseEntity() {
|
||||
@Table(name = "maimai2_game_selling_card")
|
||||
class Mai2GameSellingCard : BaseEntity() {
|
||||
var cardId = 0L
|
||||
var startDate: LocalDateTime? = null
|
||||
var endDate: LocalDateTime? = null
|
||||
var noticeStartDate: LocalDateTime? = null
|
||||
var noticeEndDate: LocalDateTime? = null
|
||||
var startDate: String? = null
|
||||
var endDate: String? = null
|
||||
var noticeStartDate: String? = null
|
||||
var noticeEndDate: String? = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user