forked from Cookies_Github_mirror/AquaDX
[DIVA] Rival support and configurable border.
This commit is contained in:
@@ -101,6 +101,13 @@ public class ApiDivaPlayerDataController {
|
||||
return playerProfileService.save(profile);
|
||||
}
|
||||
|
||||
@PutMapping("rival")
|
||||
public PlayerProfile updateRival(@RequestBody Map<String, Object> request) {
|
||||
PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow();
|
||||
profile.setRivalPdId((Integer) request.get("rivalPdId"));
|
||||
return playerProfileService.save(profile);
|
||||
}
|
||||
|
||||
@PutMapping("playerInfo/se")
|
||||
public PlayerProfile updateSe(@RequestBody Map<String, Object> request) {
|
||||
PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow();
|
||||
@@ -116,7 +123,7 @@ public class ApiDivaPlayerDataController {
|
||||
PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow();
|
||||
profile.setShowInterimRanking((Boolean) request.get("showInterimRanking"));
|
||||
profile.setShowClearStatus((Boolean) request.get("showClearStatus"));
|
||||
profile.setShowClearBorder((Boolean) request.get("showClearBorder"));
|
||||
// profile.setShowClearBorder((Boolean) request.get("showClearBorder"));
|
||||
profile.setShowRgoSetting((Boolean) request.get("showRgoSetting"));
|
||||
return playerProfileService.save(profile);
|
||||
}
|
||||
@@ -180,4 +187,6 @@ public class ApiDivaPlayerDataController {
|
||||
Page<PlayerCustomize> customizes = playerCustomizeRepository.findByPdId_PdId(pdId, PageRequest.of(page, size));
|
||||
return new ReducedPageResponse<>(customizes.getContent(), customizes.getPageable().getPageNumber(), customizes.getTotalPages(), customizes.getTotalElements());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.util.Optional;
|
||||
public interface PlayerPvRecordRepository extends JpaRepository<PlayerPvRecord, Long> {
|
||||
Optional<PlayerPvRecord> findByPdIdAndPvIdAndEditionAndDifficulty(PlayerProfile profile, int pvId, Edition edition, Difficulty difficulty);
|
||||
|
||||
Optional<PlayerPvRecord> findByPdId_PdIdAndPvIdAndEditionAndDifficulty(int pdId, int pvId, Edition edition, Difficulty difficulty);
|
||||
|
||||
@Query("SELECT COUNT(t1.id) as ranking from DivaPlayerPvRecord as t1 " +
|
||||
"where t1.maxScore >= (" +
|
||||
"SELECT maxScore from DivaPlayerPvRecord where pvId = :pvId and pdId = :pdId and edition = :edition and difficulty = :difficulty" +
|
||||
|
||||
@@ -53,12 +53,31 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
} else {
|
||||
int diff = request.getDifficulty();
|
||||
Difficulty difficulty = Difficulty.fromValue(diff);
|
||||
Optional<PlayerPvRecord> edition0optional = pvRecordRepository.findByPdIdAndPvIdAndEditionAndDifficulty(profile, pvId, Edition.ORIGINAL, difficulty);
|
||||
PlayerPvRecord edition0 = edition0optional.orElseGet(() -> new PlayerPvRecord(pvId, Edition.ORIGINAL));
|
||||
PlayerPvRecord edition1 = pvRecordRepository.findByPdIdAndPvIdAndEditionAndDifficulty(profile, pvId, Edition.EXTRA, difficulty).orElseGet(() -> new PlayerPvRecord(pvId, Edition.EXTRA));
|
||||
|
||||
// Myself
|
||||
PlayerPvRecord edition0 = pvRecordRepository.findByPdIdAndPvIdAndEditionAndDifficulty(profile, pvId, Edition.ORIGINAL, difficulty)
|
||||
.orElseGet(() -> new PlayerPvRecord(pvId, Edition.ORIGINAL));
|
||||
|
||||
PlayerPvRecord edition1 = pvRecordRepository.findByPdIdAndPvIdAndEditionAndDifficulty(profile, pvId, Edition.EXTRA, difficulty)
|
||||
.orElseGet(() -> new PlayerPvRecord(pvId, Edition.EXTRA));
|
||||
|
||||
// Rival
|
||||
PlayerPvRecord rivalEdition0;
|
||||
PlayerPvRecord rivalEdition1;
|
||||
if(profile.getRivalPdId() != -1) {
|
||||
rivalEdition0 = pvRecordRepository.findByPdId_PdIdAndPvIdAndEditionAndDifficulty(profile.getRivalPdId(), pvId, Edition.ORIGINAL, difficulty)
|
||||
.orElseGet(() -> new PlayerPvRecord(pvId, Edition.ORIGINAL));
|
||||
|
||||
rivalEdition1 = pvRecordRepository.findByPdId_PdIdAndPvIdAndEditionAndDifficulty(profile.getRivalPdId(), pvId, Edition.EXTRA, difficulty)
|
||||
.orElseGet(() -> new PlayerPvRecord(pvId, Edition.EXTRA));
|
||||
} else {
|
||||
rivalEdition0 = new PlayerPvRecord(pvId, Edition.ORIGINAL);
|
||||
rivalEdition1 = new PlayerPvRecord(pvId, Edition.EXTRA);
|
||||
}
|
||||
|
||||
PlayerPvCustomize customize = pvCustomizeRepository.findByPdIdAndPvId(profile, pvId).orElseGet(() -> new PlayerPvCustomize(profile, pvId));
|
||||
|
||||
String str = getString(edition0, customize) + "," + getString(edition1, customize);
|
||||
String str = getString(edition0, customize, rivalEdition0, profile.getRivalPdId()) + "," + getString(edition1, customize, rivalEdition1, profile.getRivalPdId());
|
||||
// logger.info(str);
|
||||
pd.append(URIEncoder.encode(str)).append(",");
|
||||
}
|
||||
@@ -82,7 +101,7 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
}
|
||||
|
||||
|
||||
private String getString(PlayerPvRecord record, PlayerPvCustomize customize) {
|
||||
private String getString(PlayerPvRecord record, PlayerPvCustomize customize, PlayerPvRecord rivalRecord, int rivalId) {
|
||||
return
|
||||
"" + record.getPvId() + "," +
|
||||
record.getEdition().getValue() + "," +
|
||||
@@ -98,9 +117,9 @@ public class GetPvPdHandler extends BaseHandler {
|
||||
customize.getSlideSe() + "," +
|
||||
customize.getChainSlideSe() + "," +
|
||||
customize.getSliderTouchSe() + "," +
|
||||
"15," +
|
||||
"0," +
|
||||
"0," +
|
||||
rivalId + "," +
|
||||
rivalRecord.getMaxScore() + "," +
|
||||
rivalRecord.getMaxAttain() + "," +
|
||||
"-1,-1," +
|
||||
pvRecordRepository.rankByPvIdAndPdIdAndEditionAndDifficulty(record.getPvId(), record.getPdId(), record.getEdition(), record.getDifficulty()) + "," +
|
||||
record.getRgoPurchased() + "," +
|
||||
|
||||
@@ -75,6 +75,10 @@ public class StartHandler extends BaseHandler {
|
||||
|
||||
Map<String, String> contestResult = getContestResult(profile);
|
||||
|
||||
int border = profile.isShowGreatBorder() ? 1 : 0;
|
||||
border = border | ((profile.isShowExcellentBorder() ? 1 : 0) << 1);
|
||||
border = border | ((profile.isShowRivalBorder() ? 1 : 0) << 2);
|
||||
|
||||
StartResponse response = new StartResponse(
|
||||
request.getCmd(),
|
||||
request.getReq_id(),
|
||||
@@ -127,7 +131,7 @@ public class StartHandler extends BaseHandler {
|
||||
null,
|
||||
// getDummyString("-1", 40),
|
||||
// getDummyString("-1", 40),
|
||||
profile.isShowClearBorder(),
|
||||
String.valueOf(border),
|
||||
profile.isShowInterimRanking(),
|
||||
profile.isShowClearStatus(),
|
||||
countClearStatus(profile),
|
||||
|
||||
@@ -69,7 +69,7 @@ public class StartResponse extends BaseResponse {
|
||||
private String my_lst_3; // Unused
|
||||
private String my_lst_4; // Unused
|
||||
|
||||
private boolean dsp_clr_brdr;
|
||||
private String dsp_clr_brdr;
|
||||
private boolean dsp_intrm_rnk;
|
||||
private boolean dsp_clr_sts;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class StartResponse extends BaseResponse {
|
||||
private String p_std_ie_have = ALL_NOT_HAVE;
|
||||
private String p_std_se_have = ALL_NOT_HAVE;
|
||||
|
||||
public StartResponse(String cmd, String req_id, String stat, int pd_id, Result start_result, int accept_idx, int start_idx, String player_name, int hp_vol, boolean btn_se_vol, int btn_se_vol2, int sldr_se_vol2, SortMode sort_kind, int lv_num, int lv_pnt, String lv_str, int lv_efct_id, int lv_plt_id, String mdl_eqp_ary, String c_itm_eqp_ary, String ms_itm_flg_ary, LocalDateTime mdl_eqp_tm, String mdl_have, String cstmz_itm_have, boolean use_pv_mdl_eqp, boolean use_mdl_pri, boolean use_pv_skn_eqp, boolean use_pv_btn_se_eqp, boolean use_pv_sld_se_eqp, boolean use_pv_chn_sld_se_eqp, boolean use_pv_sldr_tch_se_eqp, int vcld_pts, int nxt_pv_id, Difficulty nxt_dffclty, Edition nxt_edtn, String cv_cid, String cv_sc, String cv_rr, String cv_bv, String cv_bf, int cnp_cid, int cnp_val, ContestBorder cnp_rr, String cnp_sp, String my_lst_0, String my_lst_1, String my_lst_2, String my_lst_3, String my_lst_4, boolean dsp_clr_brdr, boolean dsp_intrm_rnk, boolean dsp_clr_sts, String clr_sts, boolean rgo_sts, String my_qst_id, String my_qst_sts, String my_qst_prgrs, String my_qst_et, String p_std_ie_have, String p_std_se_have) {
|
||||
public StartResponse(String cmd, String req_id, String stat, int pd_id, Result start_result, int accept_idx, int start_idx, String player_name, int hp_vol, boolean btn_se_vol, int btn_se_vol2, int sldr_se_vol2, SortMode sort_kind, int lv_num, int lv_pnt, String lv_str, int lv_efct_id, int lv_plt_id, String mdl_eqp_ary, String c_itm_eqp_ary, String ms_itm_flg_ary, LocalDateTime mdl_eqp_tm, String mdl_have, String cstmz_itm_have, boolean use_pv_mdl_eqp, boolean use_mdl_pri, boolean use_pv_skn_eqp, boolean use_pv_btn_se_eqp, boolean use_pv_sld_se_eqp, boolean use_pv_chn_sld_se_eqp, boolean use_pv_sldr_tch_se_eqp, int vcld_pts, int nxt_pv_id, Difficulty nxt_dffclty, Edition nxt_edtn, String cv_cid, String cv_sc, String cv_rr, String cv_bv, String cv_bf, int cnp_cid, int cnp_val, ContestBorder cnp_rr, String cnp_sp, String my_lst_0, String my_lst_1, String my_lst_2, String my_lst_3, String my_lst_4, String dsp_clr_brdr, boolean dsp_intrm_rnk, boolean dsp_clr_sts, String clr_sts, boolean rgo_sts, String my_qst_id, String my_qst_sts, String my_qst_prgrs, String my_qst_et, String p_std_ie_have, String p_std_se_have) {
|
||||
super(cmd, req_id, stat);
|
||||
this.pd_id = pd_id;
|
||||
this.start_result = start_result;
|
||||
|
||||
@@ -119,7 +119,11 @@ public class PlayerProfile implements Serializable {
|
||||
|
||||
private boolean showClearStatus = true;
|
||||
|
||||
private boolean showClearBorder = true;
|
||||
private boolean showGreatBorder = true;
|
||||
|
||||
private boolean showExcellentBorder = true;
|
||||
|
||||
private boolean showRivalBorder = true;
|
||||
|
||||
private boolean showRgoSetting = true;
|
||||
|
||||
@@ -151,6 +155,8 @@ public class PlayerProfile implements Serializable {
|
||||
|
||||
private String myList2 = getDummyString("-1", 40);
|
||||
|
||||
private int rivalPdId = -1;
|
||||
|
||||
public PlayerProfile(int pdId, String playerName) {
|
||||
this.pdId = pdId;
|
||||
this.playerName = playerName;
|
||||
|
||||
Reference in New Issue
Block a user