mirror of https://github.com/hykilpikonna/AquaDX
[DIVA] Rival support and configurable border.
parent
38120a3aa9
commit
5fa287ffb6
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
PRAGMA foreign_keys = 0;
|
||||
|
||||
CREATE TABLE diva_player_profile_new (
|
||||
id INTEGER,
|
||||
button_se INTEGER NOT NULL,
|
||||
button_se_on BOOLEAN NOT NULL,
|
||||
button_se_volume INTEGER NOT NULL,
|
||||
chain_slide_se INTEGER NOT NULL,
|
||||
common_customize_items VARCHAR (255),
|
||||
common_module VARCHAR (255),
|
||||
common_module_set_time DATETIME,
|
||||
common_skin INTEGER NOT NULL,
|
||||
contest_now_playing_enable BOOLEAN NOT NULL,
|
||||
contest_now_playing_id INTEGER NOT NULL,
|
||||
contest_now_playing_result_rank VARCHAR (255),
|
||||
contest_now_playing_specifier VARCHAR (255),
|
||||
contest_now_playing_value INTEGER NOT NULL,
|
||||
headphone_volume INTEGER NOT NULL,
|
||||
level INTEGER NOT NULL,
|
||||
level_exp INTEGER NOT NULL,
|
||||
level_title VARCHAR (255),
|
||||
module_select_item_flag VARCHAR (255),
|
||||
my_list0 VARCHAR (255),
|
||||
my_list1 VARCHAR (255),
|
||||
my_list2 VARCHAR (255),
|
||||
next_difficulty VARCHAR (255),
|
||||
next_edition VARCHAR (255),
|
||||
next_pv_id INTEGER NOT NULL,
|
||||
password VARCHAR (255),
|
||||
password_status VARCHAR (255),
|
||||
pd_id INTEGER UNIQUE
|
||||
REFERENCES sega_card (ext_id) ON DELETE CASCADE,
|
||||
plate_effect_id INTEGER NOT NULL,
|
||||
plate_id INTEGER NOT NULL,
|
||||
player_name VARCHAR (255),
|
||||
prefer_common_module BOOLEAN NOT NULL,
|
||||
prefer_per_pv_module BOOLEAN NOT NULL,
|
||||
show_great_border BOOLEAN NOT NULL,
|
||||
show_clear_status BOOLEAN NOT NULL,
|
||||
show_interim_ranking BOOLEAN NOT NULL,
|
||||
show_rgo_setting BOOLEAN NOT NULL,
|
||||
slide_se INTEGER NOT NULL,
|
||||
slider_se_volume INTEGER NOT NULL,
|
||||
slider_touch_se INTEGER NOT NULL,
|
||||
sort_mode VARCHAR (255),
|
||||
use_per_pv_button_se BOOLEAN NOT NULL,
|
||||
use_per_pv_chain_slider_se BOOLEAN NOT NULL,
|
||||
use_per_pv_skin BOOLEAN NOT NULL,
|
||||
use_per_pv_slider_se BOOLEAN NOT NULL,
|
||||
use_per_pv_touch_slider_se BOOLEAN NOT NULL,
|
||||
vocaloid_points INTEGER NOT NULL,
|
||||
show_excellent_border BOOLEAN NOT NULL,
|
||||
show_rival_border BOOLEAN NOT NULL,
|
||||
rival_pd_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (
|
||||
id
|
||||
)
|
||||
);
|
||||
|
||||
INSERT INTO diva_player_profile_new (
|
||||
id,
|
||||
button_se,
|
||||
button_se_on,
|
||||
button_se_volume,
|
||||
chain_slide_se,
|
||||
common_customize_items,
|
||||
common_module,
|
||||
common_module_set_time,
|
||||
common_skin,
|
||||
contest_now_playing_enable,
|
||||
contest_now_playing_id,
|
||||
contest_now_playing_result_rank,
|
||||
contest_now_playing_specifier,
|
||||
contest_now_playing_value,
|
||||
headphone_volume,
|
||||
level,
|
||||
level_exp,
|
||||
level_title,
|
||||
module_select_item_flag,
|
||||
my_list0,
|
||||
my_list1,
|
||||
my_list2,
|
||||
next_difficulty,
|
||||
next_edition,
|
||||
next_pv_id,
|
||||
password,
|
||||
password_status,
|
||||
pd_id,
|
||||
plate_effect_id,
|
||||
plate_id,
|
||||
player_name,
|
||||
prefer_common_module,
|
||||
prefer_per_pv_module,
|
||||
show_great_border,
|
||||
show_clear_status,
|
||||
show_interim_ranking,
|
||||
show_rgo_setting,
|
||||
slide_se,
|
||||
slider_se_volume,
|
||||
slider_touch_se,
|
||||
sort_mode,
|
||||
use_per_pv_button_se,
|
||||
use_per_pv_chain_slider_se,
|
||||
use_per_pv_skin,
|
||||
use_per_pv_slider_se,
|
||||
use_per_pv_touch_slider_se,
|
||||
vocaloid_points,
|
||||
show_excellent_border,
|
||||
show_rival_border,
|
||||
rival_pd_id
|
||||
)
|
||||
SELECT id,
|
||||
button_se,
|
||||
button_se_on,
|
||||
button_se_volume,
|
||||
chain_slide_se,
|
||||
common_customize_items,
|
||||
common_module,
|
||||
common_module_set_time,
|
||||
common_skin,
|
||||
contest_now_playing_enable,
|
||||
contest_now_playing_id,
|
||||
contest_now_playing_result_rank,
|
||||
contest_now_playing_specifier,
|
||||
contest_now_playing_value,
|
||||
headphone_volume,
|
||||
level,
|
||||
level_exp,
|
||||
level_title,
|
||||
module_select_item_flag,
|
||||
my_list0,
|
||||
my_list1,
|
||||
my_list2,
|
||||
next_difficulty,
|
||||
next_edition,
|
||||
next_pv_id,
|
||||
password,
|
||||
password_status,
|
||||
pd_id,
|
||||
plate_effect_id,
|
||||
plate_id,
|
||||
player_name,
|
||||
prefer_common_module,
|
||||
prefer_per_pv_module,
|
||||
show_clear_border,
|
||||
show_clear_status,
|
||||
show_interim_ranking,
|
||||
show_rgo_setting,
|
||||
slide_se,
|
||||
slider_se_volume,
|
||||
slider_touch_se,
|
||||
sort_mode,
|
||||
use_per_pv_button_se,
|
||||
use_per_pv_chain_slider_se,
|
||||
use_per_pv_skin,
|
||||
use_per_pv_slider_se,
|
||||
use_per_pv_touch_slider_se,
|
||||
vocaloid_points,
|
||||
1,
|
||||
1,
|
||||
-1
|
||||
FROM diva_player_profile;
|
||||
|
||||
ALTER TABLE diva_player_profile RENAME TO bak_diva_player_profile;
|
||||
ALTER TABLE diva_player_profile_new RENAME TO diva_player_profile;
|
||||
|
||||
PRAGMA foreign_keys = 1;
|
|
@ -0,0 +1 @@
|
|||
executeInTransaction=false
|
Loading…
Reference in New Issue