diff --git a/bemani/frontend/jubeat/endpoints.py b/bemani/frontend/jubeat/endpoints.py index d152d96..5dbf261 100644 --- a/bemani/frontend/jubeat/endpoints.py +++ b/bemani/frontend/jubeat/endpoints.py @@ -3,7 +3,7 @@ import re from typing import Any, Dict from flask import Blueprint, request, Response, url_for, abort -from bemani.common import ID, GameConstants +from bemani.common import ID, GameConstants, VersionConstants from bemani.data import UserID from bemani.frontend.app import loginrequired, jsonify, render_react from bemani.frontend.jubeat.jubeat import JubeatFrontend @@ -183,16 +183,22 @@ def viewtopscores(musicid: int) -> Response: name = None artist = None genre = None - difficulties = [0, 0, 0] + category = 0 + difficulties = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for version in versions: - for chart in [0, 1, 2]: + for chart in [0, 1, 2, 3, 4, 5]: details = g.data.local.music.get_song(GameConstants.JUBEAT, version, musicid, chart) if details is not None: name = details.name artist = details.artist genre = details.genre - difficulties[chart] = details.data.get_int('difficulty', 13) + if category < version: + category = version; + if difficulties[chart] == 0.0: + difficulties[chart] = details.data.get_float('difficulty', 13) + if difficulties[chart] >= 13.0: + difficulties[chart] = float(details.data.get_int('difficulty', 13)) if name is None: # Not a real song! @@ -208,6 +214,7 @@ def viewtopscores(musicid: int) -> Response: 'artist': artist, 'genre': genre, 'difficulties': difficulties, + 'new_rating': category >= VersionConstants.JUBEAT_FESTO, 'players': top_scores['players'], 'topscores': top_scores['topscores'], }, diff --git a/bemani/frontend/jubeat/jubeat.py b/bemani/frontend/jubeat/jubeat.py index 601962e..a1d8907 100644 --- a/bemani/frontend/jubeat/jubeat.py +++ b/bemani/frontend/jubeat/jubeat.py @@ -15,6 +15,9 @@ class JubeatFrontend(FrontendBase): JubeatBase.CHART_TYPE_BASIC, JubeatBase.CHART_TYPE_ADVANCED, JubeatBase.CHART_TYPE_EXTREME, + JubeatBase.CHART_TYPE_HARD_BASIC, + JubeatBase.CHART_TYPE_HARD_ADVANCED, + JubeatBase.CHART_TYPE_HARD_EXTREME, ] valid_rival_types: List[str] = ['rival'] @@ -42,6 +45,9 @@ class JubeatFrontend(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', -1) + formatted_score['music_rate'] = score.data.get_int('music_rate', -1) + if formatted_score['music_rate'] >= 0: + formatted_score['music_rate'] /= 10 formatted_score['medal'] = score.data.get_int('medal') formatted_score['status'] = { JubeatBase.PLAY_MEDAL_FAILED: "FAILED", @@ -57,6 +63,9 @@ class JubeatFrontend(FrontendBase): 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['music_rate'] = attempt.data.get_int('music_rate', -1) + if formatted_attempt['music_rate'] >= 0: + formatted_attempt['music_rate'] /= 10 formatted_attempt['status'] = { JubeatBase.PLAY_MEDAL_FAILED: "FAILED", JubeatBase.PLAY_MEDAL_CLEARED: "CLEARED", @@ -73,8 +82,10 @@ class JubeatFrontend(FrontendBase): return formatted_profile def format_song(self, song: Song) -> Dict[str, Any]: - difficulties = [0, 0, 0] - difficulties[song.chart] = song.data.get_int('difficulty', 13) + difficulties = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] + difficulties[song.chart] = song.data.get_float('difficulty', 13) + if difficulties[song.chart] == 13.0: + difficulties[song.chart] = float(song.data.get_int('difficulty', 13)) formatted_song = super().format_song(song) formatted_song['bpm_min'] = song.data.get_int('bpm_min', 120) @@ -99,6 +110,8 @@ class JubeatFrontend(FrontendBase): def merge_song(self, existing: Dict[str, Any], new: Song) -> Dict[str, Any]: new_song = super().merge_song(existing, new) - if existing['difficulties'][new.chart] == 0: - new_song['difficulties'][new.chart] = new.data.get_int('difficulty', 13) + if existing['difficulties'][new.chart] == 0.0: + new_song['difficulties'][new.chart] = new.data.get_float('difficulty', 13) + if new_song['difficulties'][new.chart] == 13.0: + new_song['difficulties'][new.chart] = float(new.data.get_int('difficulty', 13)) return new_song diff --git a/bemani/frontend/static/controllers/jubeat/records.react.js b/bemani/frontend/static/controllers/jubeat/records.react.js index 29d2cdb..e3c3f16 100644 --- a/bemani/frontend/static/controllers/jubeat/records.react.js +++ b/bemani/frontend/static/controllers/jubeat/records.react.js @@ -1,7 +1,7 @@ /*** @jsx React.DOM */ var valid_sorts = ['series', 'name', 'popularity']; -var valid_charts = ['Basic', 'Advanced', 'Extreme']; +var valid_charts = ['Basic', 'Advanced', 'Extreme', 'Hard Mode Basic', 'Hard Mode Advanced', 'Hard Mode Extreme']; var valid_mixes = Object.keys(window.versions).map(function(mix) { return (parseInt(mix) - 1).toString(); }); @@ -120,10 +120,16 @@ var network_records = React.createClass({ }, renderDifficulty: function(songid, chart) { - if (this.state.songs[songid].difficulties[chart] == 0) { + var diff = this.state.songs[songid].difficulties[chart]; + var new_rating = ( + this.state.songs[songid].difficulties[3] > 0 || + this.state.songs[songid].difficulties[4] > 0 || + this.state.songs[songid].difficulties[5] > 0 + ); + if (this.state.songs[songid].difficulties[chart] < 1) { return --; } else { - return {this.state.songs[songid].difficulties[chart]}★; + return {diff >= 9 && new_rating ? diff.toFixed(1) : diff.toFixed(0)}★; } }, @@ -208,6 +214,9 @@ var network_records = React.createClass({ Basic Advanced Extreme + Hard Mode Basic + Hard Mode Advanced + Hard Mode Extreme ); } else { @@ -234,7 +243,7 @@ var network_records = React.createClass({ {this.renderDifficulty(songid, 2)} - + 0 ? "" : "nochart"}> - + 0 ? "" : "nochart"}> - + 0 ? "" : "nochart"}> + 0 ? "" : "nochart"}> + + + 0 ? "" : "nochart"}> + + + 0 ? "" : "nochart"}> + + ); } @@ -418,6 +451,9 @@ var network_records = React.createClass({ Basic Advanced Extreme + Hard Mode Basic + Hard Mode Advanced + Hard Mode Extreme @@ -451,7 +487,7 @@ var network_records = React.createClass({ { showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } - + 0 ? "" : "nochart"}> - + 0 ? "" : "nochart"}> - + 0 ? "" : "nochart"}> + 0 ? "" : "nochart"}> + + + 0 ? "" : "nochart"}> + + + 0 ? "" : "nochart"}> + + ); }.bind(this))} - + { this.state.offset > 0 ? {score.points} Combo {score.combo < 0 ? '-' : score.combo} + Music Rate + {score.music_rate < 0 ? '-' : score.music_rate}
{score.status} @@ -80,6 +88,12 @@ var network_scores = React.createClass({ return null; } + var diff = window.songs[attempt.songid].difficulties[attempt.chart]; + var new_rating = ( + window.songs[attempt.songid].difficulties[3] > 0 || + window.songs[attempt.songid].difficulties[4] > 0 || + window.songs[attempt.songid].difficulties[5] > 0 + ); return ( { window.shownames ? { @@ -107,7 +121,7 @@ var network_scores = React.createClass({ }
- {window.songs[attempt.songid].difficulties[attempt.chart]}★ + {diff >= 9 && new_rating ? diff.toFixed(1) : diff.toFixed(0)}★
{ this.renderScore(attempt) } diff --git a/bemani/frontend/static/controllers/jubeat/topscores.react.js b/bemani/frontend/static/controllers/jubeat/topscores.react.js index d07a245..0927e05 100644 --- a/bemani/frontend/static/controllers/jubeat/topscores.react.js +++ b/bemani/frontend/static/controllers/jubeat/topscores.react.js @@ -1,12 +1,14 @@ /*** @jsx React.DOM */ -var valid_charts = ['Basic', 'Advanced', 'Extreme']; +var valid_charts = window.new_rating ? + ['Basic', 'Advanced', 'Extreme', 'Hard Mode Basic', 'Hard Mode Advanced', 'Hard Mode Extreme'] : + ['Basic', 'Advanced', 'Extreme']; var pagenav = new History(valid_charts); var top_scores = React.createClass({ sortTopScores: function(topscores) { - var newscores = [[], [], [], []]; + var newscores = [[], [], [], [], [], []]; topscores.map(function(score) { newscores[score.chart].push(score); }.bind(this)); @@ -50,6 +52,12 @@ var top_scores = React.createClass({ return 1; case 'Extreme': return 2; + case 'Hard Mode Basic': + return 3; + case 'Hard Mode Advanced': + return 4; + case 'Hard Mode Extreme': + return 5; default: return null; } @@ -57,13 +65,14 @@ var top_scores = React.createClass({ render: function() { var chart = this.convertChart(this.state.chart); + var diff = window.difficulties[chart]; return (
{window.name}
{window.artist}
-
{window.difficulties[chart]}★
+
{diff >= 9 && window.new_rating ? diff.toFixed(1) : diff.toFixed(0)}★
{valid_charts.map(function(chart) {