mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-14 23:17:28 +08:00
[diva] Ignore pvId -1 request
This commit is contained in:
@@ -3,7 +3,6 @@ package icu.samnyan.aqua.sega.diva.handler.ingame;
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvCustomizeRepository;
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository;
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException;
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty;
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition;
|
||||
@@ -20,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
@@ -42,7 +42,7 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
|
||||
public String handle(GetPvPdRequest request) {
|
||||
|
||||
PlayerProfile profile = profileRepository.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
|
||||
Optional<PlayerProfile> profileO = profileRepository.findByPdId(request.getPd_id());
|
||||
StringBuilder pd = new StringBuilder();
|
||||
|
||||
for (int pvId :
|
||||
@@ -50,6 +50,10 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
if (pvId == -1) {
|
||||
pd.append("***").append(",");
|
||||
} else {
|
||||
if (profileO.isEmpty()) {
|
||||
pd.append("***").append(",");
|
||||
} else {
|
||||
var profile = profileO.get();
|
||||
int diff = request.getDifficulty();
|
||||
Difficulty difficulty = Difficulty.fromValue(diff);
|
||||
|
||||
@@ -63,7 +67,7 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
// Rival
|
||||
PlayerPvRecord rivalEdition0;
|
||||
PlayerPvRecord rivalEdition1;
|
||||
if(profile.getRivalPdId() != -1) {
|
||||
if (profile.getRivalPdId() != -1) {
|
||||
rivalEdition0 = pvRecordRepository.findByPdId_PdIdAndPvIdAndEditionAndDifficulty(profile.getRivalPdId(), pvId, Edition.ORIGINAL, difficulty)
|
||||
.orElseGet(() -> new PlayerPvRecord(pvId, Edition.ORIGINAL));
|
||||
|
||||
@@ -81,6 +85,7 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
pd.append(URIEncoder.encode(str)).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
pd.deleteCharAt(pd.length() - 1);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user