1
0
mirror of synced 2024-11-12 01:00:46 +01:00

Fix a few inconsistencies with Pop'n Music, perform similar nomenclature tweaks, display note stats on score pages.

This commit is contained in:
Jennifer Taylor 2022-10-08 17:22:37 +00:00
parent b3acc54a2a
commit 0af53a5163
13 changed files with 209 additions and 150 deletions

View File

@ -45,10 +45,10 @@ class MusecaFrontend(FrontendBase):
MusecaBase.GRADE_PERFECT: 'Perfect (傑)',
}.get(score.data.get_int('grade'), 'No Play')
formatted_score['clear_type'] = {
MusecaBase.CLEAR_TYPE_FAILED: 'Failed',
MusecaBase.CLEAR_TYPE_CLEARED: 'Cleared',
MusecaBase.CLEAR_TYPE_FULL_COMBO: 'Full Combo',
}.get(score.data.get_int('clear_type'), 'Failed')
MusecaBase.CLEAR_TYPE_FAILED: 'FAILED',
MusecaBase.CLEAR_TYPE_CLEARED: 'CLEARED',
MusecaBase.CLEAR_TYPE_FULL_COMBO: 'FULL COMBO',
}.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
@ -68,10 +68,10 @@ class MusecaFrontend(FrontendBase):
MusecaBase.GRADE_PERFECT: 'Perfect (傑)',
}.get(attempt.data.get_int('grade'), 'No Play')
formatted_attempt['clear_type'] = {
MusecaBase.CLEAR_TYPE_FAILED: 'Failed',
MusecaBase.CLEAR_TYPE_CLEARED: 'Cleared',
MusecaBase.CLEAR_TYPE_FULL_COMBO: 'Full Combo',
}.get(attempt.data.get_int('clear_type'), 'Failed')
MusecaBase.CLEAR_TYPE_FAILED: 'FAILED',
MusecaBase.CLEAR_TYPE_CLEARED: 'CLEARED',
MusecaBase.CLEAR_TYPE_FULL_COMBO: 'FULL COMBO',
}.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

View File

@ -39,39 +39,41 @@ class PopnMusicFrontend(FrontendBase):
formatted_score = super().format_score(userid, score)
formatted_score['combo'] = score.data.get_int('combo', -1)
formatted_score['medal'] = score.data.get_int('medal')
formatted_score['stats'] = score.data.get_dict('stats')
formatted_score['status'] = {
PopnMusicBase.PLAY_MEDAL_NO_PLAY: "No Play",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FAILED: "○ Failed",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FAILED: "◇ Failed",
PopnMusicBase.PLAY_MEDAL_STAR_FAILED: "☆ Failed",
PopnMusicBase.PLAY_MEDAL_EASY_CLEAR: "Easy Clear",
PopnMusicBase.PLAY_MEDAL_CIRCLE_CLEARED: "○ Cleared",
PopnMusicBase.PLAY_MEDAL_DIAMOND_CLEARED: "◇ Cleared",
PopnMusicBase.PLAY_MEDAL_STAR_CLEARED: "☆ Cleared",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FULL_COMBO: "○ Full Combo",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FULL_COMBO: "◇ Full Combo",
PopnMusicBase.PLAY_MEDAL_STAR_FULL_COMBO: "☆ Full Combo",
PopnMusicBase.PLAY_MEDAL_PERFECT: "Perfect",
}.get(score.data.get_int('medal'), 'No Play')
PopnMusicBase.PLAY_MEDAL_NO_PLAY: "NO PLAY",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FAILED: "○ FAILED",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FAILED: "◇ FAILED",
PopnMusicBase.PLAY_MEDAL_STAR_FAILED: "☆ FAILED",
PopnMusicBase.PLAY_MEDAL_EASY_CLEAR: "EASY CLEAR",
PopnMusicBase.PLAY_MEDAL_CIRCLE_CLEARED: "○ CLEARED",
PopnMusicBase.PLAY_MEDAL_DIAMOND_CLEARED: "◇ CLEARED",
PopnMusicBase.PLAY_MEDAL_STAR_CLEARED: "☆ CLEARED",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FULL_COMBO: "○ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FULL_COMBO: "◇ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_STAR_FULL_COMBO: "☆ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_PERFECT: "PERFECT",
}.get(score.data.get_int('medal'), 'NO PLAY')
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['medal'] = attempt.data.get_int('medal')
formatted_attempt['stats'] = attempt.data.get_dict('stats')
formatted_attempt['status'] = {
PopnMusicBase.PLAY_MEDAL_CIRCLE_FAILED: "○ Failed",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FAILED: "◇ Failed",
PopnMusicBase.PLAY_MEDAL_STAR_FAILED: "☆ Failed",
PopnMusicBase.PLAY_MEDAL_EASY_CLEAR: "Easy Clear",
PopnMusicBase.PLAY_MEDAL_CIRCLE_CLEARED: "○ Cleared",
PopnMusicBase.PLAY_MEDAL_DIAMOND_CLEARED: "◇ Cleared",
PopnMusicBase.PLAY_MEDAL_STAR_CLEARED: "☆ Cleared",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FULL_COMBO: "○ Full Combo",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FULL_COMBO: "◇ Full Combo",
PopnMusicBase.PLAY_MEDAL_STAR_FULL_COMBO: "☆ Full Combo",
PopnMusicBase.PLAY_MEDAL_PERFECT: "Perfect",
}.get(attempt.data.get_int('medal'), 'No Play')
PopnMusicBase.PLAY_MEDAL_CIRCLE_FAILED: "○ FAILED",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FAILED: "◇ FAILED",
PopnMusicBase.PLAY_MEDAL_STAR_FAILED: "☆ FAILED",
PopnMusicBase.PLAY_MEDAL_EASY_CLEAR: "EASY CLEAR",
PopnMusicBase.PLAY_MEDAL_CIRCLE_CLEARED: "○ CLEARED",
PopnMusicBase.PLAY_MEDAL_DIAMOND_CLEARED: "◇ CLEARED",
PopnMusicBase.PLAY_MEDAL_STAR_CLEARED: "☆ CLEARED",
PopnMusicBase.PLAY_MEDAL_CIRCLE_FULL_COMBO: "○ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_DIAMOND_FULL_COMBO: "◇ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_STAR_FULL_COMBO: "☆ FULL COMBO",
PopnMusicBase.PLAY_MEDAL_PERFECT: "PERFECT",
}.get(attempt.data.get_int('medal'), 'NO PLAY')
return formatted_attempt
def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]:

View File

@ -6,7 +6,6 @@ function makeGameSettingName(game_settings) {
var GameSettings = React.createClass({
getInitialState: function() {
console.log(this.props);
var valid_settings = this.props.game_settings.map(function(setting) {
return makeGameSettingName(setting);
});

View File

@ -166,7 +166,6 @@ var arcade_management = React.createClass({
Object.keys(response.users).map(function(userid) {
credits[userid] = '';
});
console.log('huh?');
this.setState({
users: response.users,
balances: response.balances,

View File

@ -47,13 +47,13 @@ var HighScore = React.createClass({
</div> : null}
{has_stats ? <div title="perfect / great / good / poor / miss">
{this.props.score.stats.perfect}
<span> / </span>
<span> / </span>
{this.props.score.stats.great}
<span> / </span>
<span> / </span>
{this.props.score.stats.good}
<span> / </span>
<span> / </span>
{this.props.score.stats.poor}
<span> / </span>
<span> / </span>
{this.props.score.stats.miss}
</div> : null}
<div>

View File

@ -52,7 +52,7 @@ var HighScore = React.createClass({
{this.props.score.stats.error}
</div> : null}
<div>
<span className="status">{this.props.score.clear_type.toUpperCase()}</span>
<span className="status">{this.props.score.clear_type}</span>
</div>
{ this.props.score.userid && window.shownames ?
<div><a href={Link.get('player', this.props.score.userid)}>{

View File

@ -80,7 +80,7 @@ var network_scores = React.createClass({
{score.stats.error}
</div> : null}
<div>
<span className="status">{score.clear_type.toUpperCase()}</span>
<span className="status">{score.clear_type}</span>
</div>
</div>
);

View File

@ -112,7 +112,7 @@ var top_scores = React.createClass({
},
{
name: 'Clear Type',
render: function(topscore) { return topscore.clear_type.toUpperCase(); },
render: function(topscore) { return topscore.clear_type; },
},
{
name: 'Score',

View File

@ -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;

View File

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

View File

@ -22,6 +22,12 @@ var HighScore = React.createClass({
if (!this.props.score) {
return null;
}
has_stats = (
this.props.score.stats.cool > 0 ||
this.props.score.stats.great > 0 ||
this.props.score.stats.good > 0 ||
this.props.score.stats.bad > 0
);
return (
<div className="score">
@ -31,6 +37,15 @@ var HighScore = React.createClass({
<span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span>
</div>
{has_stats ? <div title="cool / great / good / bad">
{this.props.score.stats.cool}
<span> / </span>
{this.props.score.stats.great}
<span> / </span>
{this.props.score.stats.good}
<span> / </span>
{this.props.score.stats.bad}
</div> : null}
<div>
<span className="status">{this.props.score.status}</span>
</div>
@ -198,8 +213,10 @@ var network_records = React.createClass({
if (paginate && curpage != this.state.subtab) { return null; }
return (
<tr key={((-songid) - 1).toString()}>
<td className="subheader">{ this.state.versions[(-songid) - 1] }</td>
<tr key={((-songid) - 1).toString()} className="header">
<td className="subheader">{
!paginate ? this.state.versions[(-songid) - 1] : "Song / Artist / Difficulties"
}</td>
<td className="subheader">Easy</td>
<td className="subheader">Normal</td>
<td className="subheader">Hyper</td>
@ -419,108 +436,110 @@ var network_records = React.createClass({
renderBySongIDList: function(songids, showplays) {
return (
<table className="list records">
<thead>
<tr>
<th className="subheader">Song</th>
<td className="subheader">Easy</td>
<td className="subheader">Normal</td>
<td className="subheader">Hyper</td>
<td className="subheader">EX</td>
</tr>
</thead>
<tbody>
{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 (
<tr key={songid.toString()}>
<td className="center">
<div>
<a href={Link.get('individual_score', songid)}>
<div className="songname">{ this.state.songs[songid].name }</div>
<div className="songartist">{ this.state.songs[songid].artist }</div>
<div className="songgenre">{ this.state.songs[songid].genre }</div>
</a>
</div>
<div className="songdifficulties">
{this.renderDifficulty(songid, 0)}
<span> / </span>
{this.renderDifficulty(songid, 1)}
<span> / </span>
{this.renderDifficulty(songid, 2)}
<span> / </span>
{this.renderDifficulty(songid, 3)}
</div>
{ showplays ? <div className="songplays">#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}</div> : null }
</td>
<td className={difficulties[0] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={0}
score={records[0]}
/>
</td>
<td className={difficulties[1] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={1}
score={records[1]}
/>
</td>
<td className={difficulties[2] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={2}
score={records[2]}
/>
</td>
<td className={difficulties[3] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={3}
score={records[3]}
/>
</td>
</tr>
);
}.bind(this))}
</tbody>
<tfoot>
<tr>
<td colSpan={5}>
{ this.state.offset > 0 ?
<Prev onClick={function(event) {
var page = this.state.offset - this.state.limit;
if (page < 0) { page = 0; }
this.setState({offset: page});
}.bind(this)}/> : null
<div className="section">
<table className="list records">
<thead>
<tr>
<th className="subheader">Song / Artist / Difficulties</th>
<th className="subheader">Easy</th>
<th className="subheader">Normal</th>
<th className="subheader">Hyper</th>
<th className="subheader">EX</th>
</tr>
</thead>
<tbody>
{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 ?
<Next style={ {float: 'right'} } onClick={function(event) {
var page = this.state.offset + this.state.limit;
if (page >= songids.length) { return }
this.setState({offset: page});
}.bind(this)}/> :
null
var records = this.state.records[songid];
if (!records) {
records = {};
}
</td>
</tr>
</tfoot>
</table>
var plays = this.getPlays(records);
var difficulties = this.state.songs[songid].difficulties;
return (
<tr key={songid.toString()}>
<td className="center">
<div>
<a href={Link.get('individual_score', songid)}>
<div className="songname">{ this.state.songs[songid].name }</div>
<div className="songartist">{ this.state.songs[songid].artist }</div>
<div className="songgenre">{ this.state.songs[songid].genre }</div>
</a>
</div>
<div className="songdifficulties">
{this.renderDifficulty(songid, 0)}
<span> / </span>
{this.renderDifficulty(songid, 1)}
<span> / </span>
{this.renderDifficulty(songid, 2)}
<span> / </span>
{this.renderDifficulty(songid, 3)}
</div>
{ showplays ? <div className="songplays">#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}</div> : null }
</td>
<td className={difficulties[0] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={0}
score={records[0]}
/>
</td>
<td className={difficulties[1] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={1}
score={records[1]}
/>
</td>
<td className={difficulties[2] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={2}
score={records[2]}
/>
</td>
<td className={difficulties[3] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={3}
score={records[3]}
/>
</td>
</tr>
);
}.bind(this))}
</tbody>
<tfoot>
<tr>
<td colSpan={5}>
{ this.state.offset > 0 ?
<Prev onClick={function(event) {
var page = this.state.offset - this.state.limit;
if (page < 0) { page = 0; }
this.setState({offset: page});
}.bind(this)}/> : null
}
{ (this.state.offset + this.state.limit) < songids.length ?
<Next style={ {float: 'right'} } onClick={function(event) {
var page = this.state.offset + this.state.limit;
if (page >= songids.length) { return }
this.setState({offset: page});
}.bind(this)}/> :
null
}
</td>
</tr>
</tfoot>
</table>
</div>
);
},

View File

@ -60,6 +60,13 @@ var network_scores = React.createClass({
},
renderScore: function(score) {
has_stats = (
score.stats.cool > 0 ||
score.stats.great > 0 ||
score.stats.good > 0 ||
score.stats.bad > 0
);
return (
<div className="score">
<div>
@ -68,6 +75,15 @@ var network_scores = React.createClass({
<span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span>
</div>
{has_stats ? <div title="cool / great / good / bad">
{score.stats.cool}
<span> / </span>
{score.stats.great}
<span> / </span>
{score.stats.good}
<span> / </span>
{score.stats.bad}
</div> : null}
<div>
<span className="status">{score.status}</span>
</div>
@ -83,8 +99,8 @@ var network_scores = React.createClass({
<tr>
{ window.shownames ? <th>Name</th> : null }
<th>Timestamp</th>
<th>Song</th>
<th>Chart</th>
<th>Song / Artist</th>
<th>Difficulty</th>
<th>Score</th>
</tr>
</thead>

View File

@ -119,6 +119,30 @@ var top_scores = React.createClass({
{
name: '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) {
has_stats = (
topscore.stats.cool > 0 ||
topscore.stats.great > 0 ||
topscore.stats.good > 0 ||
topscore.stats.bad > 0
);
return has_stats ? <div title="cool / great / good / bad">
{topscore.stats.cool}
<span> / </span>
{topscore.stats.great}
<span> / </span>
{topscore.stats.good}
<span> / </span>
{topscore.stats.bad}
</div> : null;
}
},
]}
defaultsort='Score'