From 1bb33597841f6c4548811fa50d3e0e1bc1472b18 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Mon, 4 Nov 2019 17:20:44 +0300 Subject: [PATCH] Use stars on song select for score level --- public/src/js/controller.js | 4 ++-- public/src/js/importsongs.js | 4 ++-- public/src/js/parseosu.js | 5 +++-- public/src/js/parsetja.js | 5 +++-- public/src/js/songselect.js | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/public/src/js/controller.js b/public/src/js/controller.js index 3b0852e..6020d2a 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -12,9 +12,9 @@ class Controller{ } if(selectedSong.type === "tja"){ - this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.offset) + this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.stars, selectedSong.offset) }else{ - this.parsedSongData = new ParseOsu(songData, selectedSong.difficulty, selectedSong.offset) + this.parsedSongData = new ParseOsu(songData, selectedSong.difficulty, selectedSong.stars, selectedSong.offset) } this.offset = this.parsedSongData.soundOffset diff --git a/public/src/js/importsongs.js b/public/src/js/importsongs.js index 288cece..a0b059c 100644 --- a/public/src/js/importsongs.js +++ b/public/src/js/importsongs.js @@ -199,7 +199,7 @@ var reader = new FileReader() var promise = pageEvents.load(reader).then(event => { var data = event.target.result.replace(/\0/g, "").split("\n") - var tja = new ParseTja(data, "oni", 0, true) + var tja = new ParseTja(data, "oni", 0, 0, true) var songObj = { id: index + 1, type: "tja", @@ -283,7 +283,7 @@ var reader = new FileReader() var promise = pageEvents.load(reader).then(event => { var data = event.target.result.replace(/\0/g, "").split("\n") - var osu = new ParseOsu(data, "oni", 0, true); + var osu = new ParseOsu(data, "oni", 0, 0, true); var dir = file.webkitRelativePath.toLowerCase() dir = dir.slice(0, dir.lastIndexOf("/") + 1) var songObj = { diff --git a/public/src/js/parseosu.js b/public/src/js/parseosu.js index b4447b2..0ef70eb 100644 --- a/public/src/js/parseosu.js +++ b/public/src/js/parseosu.js @@ -1,5 +1,5 @@ class ParseOsu{ - constructor(fileContent, difficulty, offset, metaOnly){ + constructor(fileContent, difficulty, stars, offset, metaOnly){ this.osu = { OFFSET: 0, MSPERBEAT: 1, @@ -53,6 +53,7 @@ class ParseOsu{ this.editor = this.parseEditor() this.difficulty = this.parseDifficulty() this._difficulty = difficulty; + this.stars = stars if(!metaOnly){ this.timingPoints = this.parseTiming() this.circles = this.parseCircles() @@ -356,7 +357,7 @@ class ParseOsu{ } } this.scoremode = 2; - var autoscore = new AutoScore(this._difficulty, parseInt(this.difficulty.overallDifficulty) * 2, 2, circles); + var autoscore = new AutoScore(this._difficulty, this.stars, 2, circles); this.scoreinit = autoscore.ScoreInit; this.scorediff = autoscore.ScoreDiff; return circles diff --git a/public/src/js/parsetja.js b/public/src/js/parsetja.js index 9071ad9..6979c81 100644 --- a/public/src/js/parsetja.js +++ b/public/src/js/parsetja.js @@ -1,5 +1,5 @@ class ParseTja{ - constructor(file, difficulty, offset, metaOnly){ + constructor(file, difficulty, stars, offset, metaOnly){ this.data = [] for(let line of file){ line = line.replace(/\/\/.*/, "").trim() @@ -8,6 +8,7 @@ } } this.difficulty = difficulty + this.stars = stars this.offset = (offset || 0) * -1000 this.soundOffset = 0 this.noteTypes = { @@ -454,7 +455,7 @@ this.scoremode = meta.scoremode || 1; } else { this.scoremode = meta.scoremode || 2; - var autoscore = new AutoScore(this.difficulty, meta.level, this.scoremode, circles); + var autoscore = new AutoScore(this.difficulty, this.stars, this.scoremode, circles); this.scoreinit = autoscore.ScoreInit; this.scorediff = autoscore.ScoreDiff; } diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index f50dbc1..d02c07f 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -687,7 +687,8 @@ class SongSelect{ "category": selectedSong.category, "type": selectedSong.type, "offset": selectedSong.offset, - "songSkin": selectedSong.songSkin + "songSkin": selectedSong.songSkin, + "stars": selectedSong.stars[difficulty] }, autoplay, multiplayer, touch) } toOptions(moveBy){