From c4d5a6032ace68bb126f82620a440071f43528e6 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sat, 8 Oct 2022 18:24:15 +0000 Subject: [PATCH] Tweak SDVX to match other frontends, add note statistics, fix a few things here and there across all games. --- bemani/frontend/ddr/ddr.py | 4 +- bemani/frontend/jubeat/jubeat.py | 2 - bemani/frontend/sdvx/sdvx.py | 34 +-- .../static/controllers/ddr/records.react.js | 2 +- .../static/controllers/ddr/scores.react.js | 2 +- .../static/controllers/ddr/topscores.react.js | 2 +- .../controllers/jubeat/records.react.js | 4 +- .../static/controllers/jubeat/scores.react.js | 2 +- .../controllers/jubeat/topscores.react.js | 4 +- .../controllers/museca/topscores.react.js | 2 +- .../controllers/popn/topscores.react.js | 2 +- .../controllers/reflec/records.react.js | 4 +- .../static/controllers/reflec/scores.react.js | 4 +- .../controllers/reflec/topscores.react.js | 4 +- .../controllers/sdvx/allplayers.react.js | 2 +- .../static/controllers/sdvx/player.react.js | 6 +- .../static/controllers/sdvx/records.react.js | 244 +++++++++--------- .../static/controllers/sdvx/scores.react.js | 26 +- .../controllers/sdvx/topscores.react.js | 30 ++- 19 files changed, 214 insertions(+), 166 deletions(-) diff --git a/bemani/frontend/ddr/ddr.py b/bemani/frontend/ddr/ddr.py index a7dc161..cde6576 100644 --- a/bemani/frontend/ddr/ddr.py +++ b/bemani/frontend/ddr/ddr.py @@ -114,7 +114,7 @@ class DDRFrontend(FrontendBase): def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]: formatted_score = super().format_score(userid, score) - formatted_score['combo'] = score.data.get_int('combo') + formatted_score['combo'] = score.data.get_int('combo', -1) formatted_score['lamp'] = score.data.get_int('halo') formatted_score['halo'] = { DDRBase.HALO_NONE: None, @@ -146,7 +146,7 @@ class DDRFrontend(FrontendBase): def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: formatted_attempt = super().format_attempt(userid, attempt) - formatted_attempt['combo'] = attempt.data.get_int('combo') + formatted_attempt['combo'] = attempt.data.get_int('combo', -1) formatted_attempt['halo'] = { DDRBase.HALO_NONE: None, DDRBase.HALO_GOOD_FULL_COMBO: "GOOD FULL COMBO", diff --git a/bemani/frontend/jubeat/jubeat.py b/bemani/frontend/jubeat/jubeat.py index 22e1f2f..3af48a1 100644 --- a/bemani/frontend/jubeat/jubeat.py +++ b/bemani/frontend/jubeat/jubeat.py @@ -109,7 +109,6 @@ class JubeatFrontend(FrontendBase): JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", }.get(score.data.get_int('medal'), 'NO PLAY') - formatted_score['music_rate'] = score.data.get_int('music_rate', 0) / 10 formatted_score['clear_cnt'] = score.data.get_int('clear_count', 0) formatted_score['stats'] = score.data.get_dict('stats') return formatted_score @@ -129,7 +128,6 @@ class JubeatFrontend(FrontendBase): JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", }.get(attempt.data.get_int('medal'), 'NO PLAY') - formatted_attempt['music_rate'] = attempt.data.get_int('music_rate', 0) / 10 formatted_attempt['stats'] = attempt.data.get_dict('stats') return formatted_attempt diff --git a/bemani/frontend/sdvx/sdvx.py b/bemani/frontend/sdvx/sdvx.py index 087875c..1c6ab24 100644 --- a/bemani/frontend/sdvx/sdvx.py +++ b/bemani/frontend/sdvx/sdvx.py @@ -35,7 +35,7 @@ class SoundVoltexFrontend(FrontendBase): formatted_score = super().format_score(userid, score) formatted_score['combo'] = score.data.get_int('combo', -1) formatted_score['grade'] = { - SoundVoltexBase.GRADE_NO_PLAY: 'No Play', + SoundVoltexBase.GRADE_NO_PLAY: '-', SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_B: 'B', @@ -48,21 +48,22 @@ class SoundVoltexFrontend(FrontendBase): SoundVoltexBase.GRADE_S: 'S', }.get(score.data.get_int('grade'), 'No Play') formatted_score['clear_type'] = { - SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', - SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', - SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', - SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', - SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', - SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', - }.get(score.data.get_int('clear_type'), 'Failed') + SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY', + SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED', + SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED', + SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED', + SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN', + SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN', + }.get(score.data.get_int('clear_type'), 'FAILED') formatted_score['medal'] = score.data.get_int('clear_type') + formatted_score['stats'] = score.data.get_dict('stats') return formatted_score def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: formatted_attempt = super().format_attempt(userid, attempt) formatted_attempt['combo'] = attempt.data.get_int('combo', -1) formatted_attempt['grade'] = { - SoundVoltexBase.GRADE_NO_PLAY: 'No Play', + SoundVoltexBase.GRADE_NO_PLAY: '-', SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_B: 'B', @@ -75,14 +76,15 @@ class SoundVoltexFrontend(FrontendBase): SoundVoltexBase.GRADE_S: 'S', }.get(attempt.data.get_int('grade'), 'No Play') formatted_attempt['clear_type'] = { - SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', - SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', - SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', - SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', - SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', - SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', - }.get(attempt.data.get_int('clear_type'), 'Failed') + SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY', + SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED', + SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED', + SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED', + SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN', + SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN', + }.get(attempt.data.get_int('clear_type'), 'FAILED') formatted_attempt['medal'] = attempt.data.get_int('clear_type') + formatted_attempt['stats'] = attempt.data.get_dict('stats') return formatted_attempt def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]: diff --git a/bemani/frontend/static/controllers/ddr/records.react.js b/bemani/frontend/static/controllers/ddr/records.react.js index 176bcc2..db733e1 100644 --- a/bemani/frontend/static/controllers/ddr/records.react.js +++ b/bemani/frontend/static/controllers/ddr/records.react.js @@ -32,7 +32,7 @@ var HighScore = React.createClass({ {this.props.score.rank} {this.props.score.points} - { this.props.score.combo > 0 ? + { this.props.score.combo >= 0 ?
Combo {this.props.score.combo} diff --git a/bemani/frontend/static/controllers/ddr/scores.react.js b/bemani/frontend/static/controllers/ddr/scores.react.js index 306abbf..9bd6854 100644 --- a/bemani/frontend/static/controllers/ddr/scores.react.js +++ b/bemani/frontend/static/controllers/ddr/scores.react.js @@ -64,7 +64,7 @@ var network_scores = React.createClass({ {score.rank} {score.points}
- { score.combo > 0 ? + { score.combo >= 0 ?
Combo {score.combo} diff --git a/bemani/frontend/static/controllers/ddr/topscores.react.js b/bemani/frontend/static/controllers/ddr/topscores.react.js index b37eb75..99d1622 100644 --- a/bemani/frontend/static/controllers/ddr/topscores.react.js +++ b/bemani/frontend/static/controllers/ddr/topscores.react.js @@ -196,7 +196,7 @@ var top_scores = React.createClass({ return a.combo - b.combo; }, reverse: true, - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, }, { name: 'Halo', diff --git a/bemani/frontend/static/controllers/jubeat/records.react.js b/bemani/frontend/static/controllers/jubeat/records.react.js index 095b45e..bb0ea36 100644 --- a/bemani/frontend/static/controllers/jubeat/records.react.js +++ b/bemani/frontend/static/controllers/jubeat/records.react.js @@ -41,9 +41,9 @@ var HighScore = React.createClass({ Combo {this.props.score.combo < 0 ? '-' : this.props.score.combo}
- {this.props.score.music_rate > 0 ?
+ {this.props.score.music_rate >= 0 ?
Music Rate - {this.props.score.music_rate <= 0 ? '-' : this.props.score.music_rate}% + {this.props.score.music_rate}%
: null} {has_stats ?
{this.props.score.stats.perfect} diff --git a/bemani/frontend/static/controllers/jubeat/scores.react.js b/bemani/frontend/static/controllers/jubeat/scores.react.js index 5fa7bfd..35576ea 100644 --- a/bemani/frontend/static/controllers/jubeat/scores.react.js +++ b/bemani/frontend/static/controllers/jubeat/scores.react.js @@ -66,7 +66,7 @@ var network_scores = React.createClass({ {score.points} Combo {score.combo < 0 ? '-' : score.combo} - {score.music_rate > 0 ? + {score.music_rate >= 0 ? Music Rate {score.music_rate <= 0 ? '-' : score.music_rate}% : null} diff --git a/bemani/frontend/static/controllers/jubeat/topscores.react.js b/bemani/frontend/static/controllers/jubeat/topscores.react.js index 4ec7fc9..34d6504 100644 --- a/bemani/frontend/static/controllers/jubeat/topscores.react.js +++ b/bemani/frontend/static/controllers/jubeat/topscores.react.js @@ -122,7 +122,7 @@ var top_scores = React.createClass({ }, { name: 'Combo', - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, sort: function(a, b) { return a.combo - b.combo; }, @@ -130,7 +130,7 @@ var top_scores = React.createClass({ }, { name: 'Music Rate', - render: function(topscore) { return topscore.music_rate > 0 ? topscore.music_rate + "%" : ''; }, + render: function(topscore) { return topscore.music_rate >= 0 ? topscore.music_rate + "%" : '-'; }, sort: function(a, b) { return a.music_rate - b.music_rate; }, diff --git a/bemani/frontend/static/controllers/museca/topscores.react.js b/bemani/frontend/static/controllers/museca/topscores.react.js index 2211e68..0dbc34f 100644 --- a/bemani/frontend/static/controllers/museca/topscores.react.js +++ b/bemani/frontend/static/controllers/museca/topscores.react.js @@ -124,7 +124,7 @@ var top_scores = React.createClass({ }, { name: 'Combo', - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, sort: function(a, b) { return a.combo - b.combo; }, diff --git a/bemani/frontend/static/controllers/popn/topscores.react.js b/bemani/frontend/static/controllers/popn/topscores.react.js index 93c12b9..e8a904d 100644 --- a/bemani/frontend/static/controllers/popn/topscores.react.js +++ b/bemani/frontend/static/controllers/popn/topscores.react.js @@ -118,7 +118,7 @@ var top_scores = React.createClass({ }, { name: 'Combo', - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, sort: function(a, b) { return a.combo - b.combo; }, diff --git a/bemani/frontend/static/controllers/reflec/records.react.js b/bemani/frontend/static/controllers/reflec/records.react.js index 216d480..d9acc99 100644 --- a/bemani/frontend/static/controllers/reflec/records.react.js +++ b/bemani/frontend/static/controllers/reflec/records.react.js @@ -57,9 +57,9 @@ var HighScore = React.createClass({ {this.props.score.points} M {this.props.score.miss_count < 0 ? '-' : this.props.score.miss_count} - {this.props.score.combo > 0 ? + {this.props.score.combo >= 0 ? Combo - {this.props.score.combo < 0 ? '-' : this.props.score.combo} + {this.props.score.combo} : null}
diff --git a/bemani/frontend/static/controllers/reflec/scores.react.js b/bemani/frontend/static/controllers/reflec/scores.react.js index a136e62..d0dd355 100644 --- a/bemani/frontend/static/controllers/reflec/scores.react.js +++ b/bemani/frontend/static/controllers/reflec/scores.react.js @@ -76,9 +76,9 @@ var network_scores = React.createClass({ {score.points} M {score.miss_count < 0 ? '-' : score.miss_count} - {score.combo > 0 ? + {score.combo >= 0 ? Combo - {score.combo < 0 ? '-' : score.combo} + {score.combo} : null}
diff --git a/bemani/frontend/static/controllers/reflec/topscores.react.js b/bemani/frontend/static/controllers/reflec/topscores.react.js index 0b7f7e3..a6c9017 100644 --- a/bemani/frontend/static/controllers/reflec/topscores.react.js +++ b/bemani/frontend/static/controllers/reflec/topscores.react.js @@ -151,7 +151,7 @@ var top_scores = React.createClass({ }, { name: 'Combo', - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, sort: function(a, b) { return a.combo - b.combo; }, @@ -159,7 +159,7 @@ var top_scores = React.createClass({ }, { name: 'Miss Count', - render: function(topscore) { return topscore.miss_count; }, + render: function(topscore) { return topscore.miss_count >= 0 ? topscore.miss_count : '-'; }, sort: function(a, b) { return a.miss_count - b.miss_count; }, diff --git a/bemani/frontend/static/controllers/sdvx/allplayers.react.js b/bemani/frontend/static/controllers/sdvx/allplayers.react.js index 0af5d3c..07dc8e8 100644 --- a/bemani/frontend/static/controllers/sdvx/allplayers.react.js +++ b/bemani/frontend/static/controllers/sdvx/allplayers.react.js @@ -57,7 +57,7 @@ var all_players = React.createClass({ }.bind(this), }, { - name: 'Play Count', + name: 'Total Rounds', render: function(userid) { var player = this.state.players[userid]; return player.plays; diff --git a/bemani/frontend/static/controllers/sdvx/player.react.js b/bemani/frontend/static/controllers/sdvx/player.react.js index 3cb5867..59e3164 100644 --- a/bemani/frontend/static/controllers/sdvx/player.react.js +++ b/bemani/frontend/static/controllers/sdvx/player.react.js @@ -59,13 +59,13 @@ var profile_view = React.createClass({
{player.extid} - + - + - + {player.plays}回
diff --git a/bemani/frontend/static/controllers/sdvx/records.react.js b/bemani/frontend/static/controllers/sdvx/records.react.js index 2b01975..d173315 100644 --- a/bemani/frontend/static/controllers/sdvx/records.react.js +++ b/bemani/frontend/static/controllers/sdvx/records.react.js @@ -22,18 +22,28 @@ var HighScore = React.createClass({ if (!this.props.score) { return null; } + has_stats = ( + this.props.score.stats.critical > 0 || + this.props.score.stats.near > 0 || + this.props.score.stats.error > 0 + ); return (
+ {this.props.score.grade} Score {this.props.score.points} - {this.props.score.grade} -
-
Combo {this.props.score.combo < 0 ? '-' : this.props.score.combo}
+ {has_stats ?
+ {this.props.score.stats.critical} + / + {this.props.score.stats.near} + / + {this.props.score.stats.error} +
: null}
{this.props.score.clear_type}
@@ -201,8 +211,10 @@ var network_records = React.createClass({ if (paginate && curpage != this.state.subtab) { return null; } return ( - - { this.state.versions[(-songid) - 1] } + + { + !paginate ? this.state.versions[(-songid) - 1] : "Song / Artist / Difficulties" + } Novice Advanced Exhaust @@ -432,118 +444,120 @@ var network_records = React.createClass({ renderBySongIDList: function(songids, showplays) { return ( - - - - - - - - - - - - - {songids.map(function(songid, index) { - if (index < this.state.offset || index >= this.state.offset + this.state.limit) { - return null; - } - - var records = this.state.records[songid]; - if (!records) { - records = {}; - } - - var plays = this.getPlays(records); - var difficulties = this.state.songs[songid].difficulties; - return ( - - - - - - - - - ); - }.bind(this))} - - - - + + + + + + + + ); + }.bind(this))} + + + + + + +
SongNoviceAdvancedExhaustInfiniteMaximum
- -
- {this.renderDifficulty(songid, 0)} - / - {this.renderDifficulty(songid, 1)} - / - {this.renderDifficulty(songid, 2)} - / - {this.renderDifficulty(songid, 3)} - / - {this.renderDifficulty(songid, 4)} -
- { showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } -
0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - -
- { this.state.offset > 0 ? - : null +
+ + + + + + + + + + + + + {songids.map(function(songid, index) { + if (index < this.state.offset || index >= this.state.offset + this.state.limit) { + return null; } - { (this.state.offset + this.state.limit) < songids.length ? - = songids.length) { return } - this.setState({offset: page}); - }.bind(this)}/> : - null + + var records = this.state.records[songid]; + if (!records) { + records = {}; } - - - -
Song / Artist / DifficultiesNoviceAdvancedExhaustInfiniteMaximum
+ + var plays = this.getPlays(records); + var difficulties = this.state.songs[songid].difficulties; + return ( +
+ +
+ {this.renderDifficulty(songid, 0)} + / + {this.renderDifficulty(songid, 1)} + / + {this.renderDifficulty(songid, 2)} + / + {this.renderDifficulty(songid, 3)} + / + {this.renderDifficulty(songid, 4)} +
+ { showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } +
0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + +
+ { this.state.offset > 0 ? + : null + } + { (this.state.offset + this.state.limit) < songids.length ? + = songids.length) { return } + this.setState({offset: page}); + }.bind(this)}/> : + null + } +
+
); }, diff --git a/bemani/frontend/static/controllers/sdvx/scores.react.js b/bemani/frontend/static/controllers/sdvx/scores.react.js index 18e3be0..93e21c7 100644 --- a/bemani/frontend/static/controllers/sdvx/scores.react.js +++ b/bemani/frontend/static/controllers/sdvx/scores.react.js @@ -49,17 +49,29 @@ var network_scores = React.createClass({ }, renderScore: function(score) { + has_stats = ( + score.stats.critical > 0 || + score.stats.near > 0 || + score.stats.error > 0 + ); return (
+ {score.grade} Score {score.points} - {score.grade} -
-
- Combo - {score.combo < 0 ? '-' : score.combo} + {score.combo >= 0 ? + Combo + {score.combo} + : null}
+ {has_stats ?
+ {score.stats.critical} + / + {score.stats.near} + / + {score.stats.error} +
: null}
{score.clear_type}
@@ -75,8 +87,8 @@ var network_scores = React.createClass({ { window.shownames ? Name : null } Timestamp - Song - Chart + Song / Artist + Difficulty Score diff --git a/bemani/frontend/static/controllers/sdvx/topscores.react.js b/bemani/frontend/static/controllers/sdvx/topscores.react.js index 4650686..c9e60ea 100644 --- a/bemani/frontend/static/controllers/sdvx/topscores.react.js +++ b/bemani/frontend/static/controllers/sdvx/topscores.react.js @@ -87,7 +87,7 @@ var top_scores = React.createClass({ }.bind(this))}
- {topscore.grade}; }, }, { name: 'Clear Type', @@ -123,7 +123,29 @@ var top_scores = React.createClass({ }, { name: 'Combo', - render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, + render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; }, + sort: function(a, b) { + return a.combo - b.combo; + }, + reverse: true, + }, + { + name: 'Judgement Stats', + render: function(topscore) { + console.log(topscore); + has_stats = ( + topscore.stats.critical > 0 || + topscore.stats.near > 0 || + topscore.stats.error > 0 + ); + return has_stats ?
+ {topscore.stats.critical} + / + {topscore.stats.near} + / + {topscore.stats.error} +
: null; + } }, ]} defaultsort='Score'