1
0
mirror of synced 2024-11-24 06:20:12 +01:00

Tweak SDVX to match other frontends, add note statistics, fix a few things here and there across all games.

This commit is contained in:
Jennifer Taylor 2022-10-08 18:24:15 +00:00
parent 21fb210439
commit c4d5a6032a
19 changed files with 214 additions and 166 deletions

View File

@ -114,7 +114,7 @@ class DDRFrontend(FrontendBase):
def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]: def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]:
formatted_score = super().format_score(userid, score) 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['lamp'] = score.data.get_int('halo')
formatted_score['halo'] = { formatted_score['halo'] = {
DDRBase.HALO_NONE: None, DDRBase.HALO_NONE: None,
@ -146,7 +146,7 @@ class DDRFrontend(FrontendBase):
def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]:
formatted_attempt = super().format_attempt(userid, attempt) 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'] = { formatted_attempt['halo'] = {
DDRBase.HALO_NONE: None, DDRBase.HALO_NONE: None,
DDRBase.HALO_GOOD_FULL_COMBO: "GOOD FULL COMBO", DDRBase.HALO_GOOD_FULL_COMBO: "GOOD FULL COMBO",

View File

@ -109,7 +109,6 @@ class JubeatFrontend(FrontendBase):
JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT",
JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT",
}.get(score.data.get_int('medal'), 'NO PLAY') }.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['clear_cnt'] = score.data.get_int('clear_count', 0)
formatted_score['stats'] = score.data.get_dict('stats') formatted_score['stats'] = score.data.get_dict('stats')
return formatted_score return formatted_score
@ -129,7 +128,6 @@ class JubeatFrontend(FrontendBase):
JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT",
JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT",
}.get(attempt.data.get_int('medal'), 'NO PLAY') }.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') formatted_attempt['stats'] = attempt.data.get_dict('stats')
return formatted_attempt return formatted_attempt

View File

@ -35,7 +35,7 @@ class SoundVoltexFrontend(FrontendBase):
formatted_score = super().format_score(userid, score) formatted_score = super().format_score(userid, score)
formatted_score['combo'] = score.data.get_int('combo', -1) formatted_score['combo'] = score.data.get_int('combo', -1)
formatted_score['grade'] = { formatted_score['grade'] = {
SoundVoltexBase.GRADE_NO_PLAY: 'No Play', SoundVoltexBase.GRADE_NO_PLAY: '-',
SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_D: 'D',
SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_C: 'C',
SoundVoltexBase.GRADE_B: 'B', SoundVoltexBase.GRADE_B: 'B',
@ -48,21 +48,22 @@ class SoundVoltexFrontend(FrontendBase):
SoundVoltexBase.GRADE_S: 'S', SoundVoltexBase.GRADE_S: 'S',
}.get(score.data.get_int('grade'), 'No Play') }.get(score.data.get_int('grade'), 'No Play')
formatted_score['clear_type'] = { formatted_score['clear_type'] = {
SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY',
SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED',
SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED',
SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED',
SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN',
SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN',
}.get(score.data.get_int('clear_type'), 'Failed') }.get(score.data.get_int('clear_type'), 'FAILED')
formatted_score['medal'] = score.data.get_int('clear_type') formatted_score['medal'] = score.data.get_int('clear_type')
formatted_score['stats'] = score.data.get_dict('stats')
return formatted_score return formatted_score
def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]:
formatted_attempt = super().format_attempt(userid, attempt) formatted_attempt = super().format_attempt(userid, attempt)
formatted_attempt['combo'] = attempt.data.get_int('combo', -1) formatted_attempt['combo'] = attempt.data.get_int('combo', -1)
formatted_attempt['grade'] = { formatted_attempt['grade'] = {
SoundVoltexBase.GRADE_NO_PLAY: 'No Play', SoundVoltexBase.GRADE_NO_PLAY: '-',
SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_D: 'D',
SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_C: 'C',
SoundVoltexBase.GRADE_B: 'B', SoundVoltexBase.GRADE_B: 'B',
@ -75,14 +76,15 @@ class SoundVoltexFrontend(FrontendBase):
SoundVoltexBase.GRADE_S: 'S', SoundVoltexBase.GRADE_S: 'S',
}.get(attempt.data.get_int('grade'), 'No Play') }.get(attempt.data.get_int('grade'), 'No Play')
formatted_attempt['clear_type'] = { formatted_attempt['clear_type'] = {
SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY',
SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED',
SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED',
SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED',
SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN',
SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN',
}.get(attempt.data.get_int('clear_type'), 'Failed') }.get(attempt.data.get_int('clear_type'), 'FAILED')
formatted_attempt['medal'] = attempt.data.get_int('clear_type') formatted_attempt['medal'] = attempt.data.get_int('clear_type')
formatted_attempt['stats'] = attempt.data.get_dict('stats')
return formatted_attempt return formatted_attempt
def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]: def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]:

View File

@ -32,7 +32,7 @@ var HighScore = React.createClass({
<span className="grade">{this.props.score.rank}</span> <span className="grade">{this.props.score.rank}</span>
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
</div> </div>
{ this.props.score.combo > 0 ? { this.props.score.combo >= 0 ?
<div> <div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo}</span> <span className="score">{this.props.score.combo}</span>

View File

@ -64,7 +64,7 @@ var network_scores = React.createClass({
<span className="grade">{score.rank}</span> <span className="grade">{score.rank}</span>
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
</div> </div>
{ score.combo > 0 ? { score.combo >= 0 ?
<div> <div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo}</span> <span className="score">{score.combo}</span>

View File

@ -196,7 +196,7 @@ var top_scores = React.createClass({
return a.combo - b.combo; return a.combo - b.combo;
}, },
reverse: true, reverse: true,
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
}, },
{ {
name: 'Halo', name: 'Halo',

View File

@ -41,9 +41,9 @@ var HighScore = React.createClass({
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span>
</div> </div>
{this.props.score.music_rate > 0 ? <div> {this.props.score.music_rate >= 0 ? <div>
<span className="label">Music Rate</span> <span className="label">Music Rate</span>
<span className="score">{this.props.score.music_rate <= 0 ? '-' : this.props.score.music_rate}%</span> <span className="score">{this.props.score.music_rate}%</span>
</div> : null} </div> : null}
{has_stats ? <div title="perfect / great / good / poor / miss"> {has_stats ? <div title="perfect / great / good / poor / miss">
{this.props.score.stats.perfect} {this.props.score.stats.perfect}

View File

@ -66,7 +66,7 @@ var network_scores = React.createClass({
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span> <span className="score">{score.combo < 0 ? '-' : score.combo}</span>
{score.music_rate > 0 ? <span> {score.music_rate >= 0 ? <span>
<span className="label">Music Rate</span> <span className="label">Music Rate</span>
<span className="score">{score.music_rate <= 0 ? '-' : score.music_rate}%</span> <span className="score">{score.music_rate <= 0 ? '-' : score.music_rate}%</span>
</span> : null} </span> : null}

View File

@ -122,7 +122,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },
@ -130,7 +130,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Music Rate', 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) { sort: function(a, b) {
return a.music_rate - b.music_rate; return a.music_rate - b.music_rate;
}, },

View File

@ -124,7 +124,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },

View File

@ -118,7 +118,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },

View File

@ -57,9 +57,9 @@ var HighScore = React.createClass({
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
<span className="label">M</span> <span className="label">M</span>
<span className="score">{this.props.score.miss_count < 0 ? '-' : this.props.score.miss_count}</span> <span className="score">{this.props.score.miss_count < 0 ? '-' : this.props.score.miss_count}</span>
{this.props.score.combo > 0 ? <span> {this.props.score.combo >= 0 ? <span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo}</span>
</span> : null} </span> : null}
</div> </div>
<div> <div>

View File

@ -76,9 +76,9 @@ var network_scores = React.createClass({
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="label">M</span> <span className="label">M</span>
<span className="score">{score.miss_count < 0 ? '-' : score.miss_count}</span> <span className="score">{score.miss_count < 0 ? '-' : score.miss_count}</span>
{score.combo > 0 ? <span> {score.combo >= 0 ? <span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span> <span className="score">{score.combo}</span>
</span> : null} </span> : null}
</div> </div>
<div> <div>

View File

@ -151,7 +151,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },
@ -159,7 +159,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Miss Count', 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) { sort: function(a, b) {
return a.miss_count - b.miss_count; return a.miss_count - b.miss_count;
}, },

View File

@ -57,7 +57,7 @@ var all_players = React.createClass({
}.bind(this), }.bind(this),
}, },
{ {
name: 'Play Count', name: 'Total Rounds',
render: function(userid) { render: function(userid) {
var player = this.state.players[userid]; var player = this.state.players[userid];
return player.plays; return player.plays;

View File

@ -59,13 +59,13 @@ var profile_view = React.createClass({
</div> </div>
<div className="section"> <div className="section">
<LabelledSection label="User ID">{player.extid}</LabelledSection> <LabelledSection label="User ID">{player.extid}</LabelledSection>
<LabelledSection label="Register Time"> <LabelledSection label="Profile Created">
<Timestamp timestamp={player.first_play_time}/> <Timestamp timestamp={player.first_play_time}/>
</LabelledSection> </LabelledSection>
<LabelledSection label="Last Play Time"> <LabelledSection label="Last Played">
<Timestamp timestamp={player.last_play_time}/> <Timestamp timestamp={player.last_play_time}/>
</LabelledSection> </LabelledSection>
<LabelledSection label="Total Plays"> <LabelledSection label="Total Rounds">
{player.plays} {player.plays}
</LabelledSection> </LabelledSection>
</div> </div>

View File

@ -22,18 +22,28 @@ var HighScore = React.createClass({
if (!this.props.score) { if (!this.props.score) {
return null; return null;
} }
has_stats = (
this.props.score.stats.critical > 0 ||
this.props.score.stats.near > 0 ||
this.props.score.stats.error > 0
);
return ( return (
<div className="score"> <div className="score">
<div> <div>
<span className="grade">{this.props.score.grade}</span>
<span className="label">Score</span> <span className="label">Score</span>
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
<span className="status">{this.props.score.grade}</span>
</div>
<div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span>
</div> </div>
{has_stats ? <div title="critical / near / error">
{this.props.score.stats.critical}
<span> / </span>
{this.props.score.stats.near}
<span> / </span>
{this.props.score.stats.error}
</div> : null}
<div> <div>
<span className="status">{this.props.score.clear_type}</span> <span className="status">{this.props.score.clear_type}</span>
</div> </div>
@ -201,8 +211,10 @@ var network_records = React.createClass({
if (paginate && curpage != this.state.subtab) { return null; } if (paginate && curpage != this.state.subtab) { return null; }
return ( return (
<tr key={((-songid) - 1).toString()}> <tr key={((-songid) - 1).toString()} className="header">
<td className="subheader">{ this.state.versions[(-songid) - 1] }</td> <td className="subheader">{
!paginate ? this.state.versions[(-songid) - 1] : "Song / Artist / Difficulties"
}</td>
<td className="subheader">Novice</td> <td className="subheader">Novice</td>
<td className="subheader">Advanced</td> <td className="subheader">Advanced</td>
<td className="subheader">Exhaust</td> <td className="subheader">Exhaust</td>
@ -432,10 +444,11 @@ var network_records = React.createClass({
renderBySongIDList: function(songids, showplays) { renderBySongIDList: function(songids, showplays) {
return ( return (
<div className="section">
<table className="list records"> <table className="list records">
<thead> <thead>
<tr> <tr>
<th className="subheader">Song</th> <th className="subheader">Song / Artist / Difficulties</th>
<th className="subheader">Novice</th> <th className="subheader">Novice</th>
<th className="subheader">Advanced</th> <th className="subheader">Advanced</th>
<th className="subheader">Exhaust</th> <th className="subheader">Exhaust</th>
@ -544,6 +557,7 @@ var network_records = React.createClass({
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
</div>
); );
}, },

View File

@ -49,17 +49,29 @@ var network_scores = React.createClass({
}, },
renderScore: function(score) { renderScore: function(score) {
has_stats = (
score.stats.critical > 0 ||
score.stats.near > 0 ||
score.stats.error > 0
);
return ( return (
<div className="score"> <div className="score">
<div> <div>
<span className="grade">{score.grade}</span>
<span className="label">Score</span> <span className="label">Score</span>
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="status">{score.grade}</span> {score.combo >= 0 ? <span>
<div>
</div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span> <span className="score">{score.combo}</span>
</span> : null}
</div> </div>
{has_stats ? <div title="critical / near / error">
{score.stats.critical}
<span> / </span>
{score.stats.near}
<span> / </span>
{score.stats.error}
</div> : null}
<div> <div>
<span className="status">{score.clear_type}</span> <span className="status">{score.clear_type}</span>
</div> </div>
@ -75,8 +87,8 @@ var network_scores = React.createClass({
<tr> <tr>
{ window.shownames ? <th>Name</th> : null } { window.shownames ? <th>Name</th> : null }
<th>Timestamp</th> <th>Timestamp</th>
<th>Song</th> <th>Song / Artist</th>
<th>Chart</th> <th>Difficulty</th>
<th>Score</th> <th>Score</th>
</tr> </tr>
</thead> </thead>

View File

@ -107,7 +107,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Grade', name: 'Grade',
render: function(topscore) { return topscore.grade; }, render: function(topscore) { return <span className="grade">{topscore.grade}</span>; },
}, },
{ {
name: 'Clear Type', name: 'Clear Type',
@ -123,7 +123,29 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', 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 ? <div title="critical / near / error">
{topscore.stats.critical}
<span> / </span>
{topscore.stats.near}
<span> / </span>
{topscore.stats.error}
</div> : null;
}
}, },
]} ]}
defaultsort='Score' defaultsort='Score'