private void SetStarInfo(string levelID) { var multiplier = this._gameStatus.modifierMultiplier; if (multiplier != 1 && !PPCounterUtil.AllowedPositiveModifiers(levelID)) { this._songRawPP = 0; } else { this._songRawPP = (float)this._songDataUtil.GetPP(this._currentCustomBeatmapLevel, this._currentBeatmapDifficulty, this._currentBeatmapCharacteristics); } this.SetCustomLabel(this._currentCustomBeatmapLevel, this._currentBeatmapDifficulty, this._currentBeatmapCharacteristics); this._currentStarSong = this._songDataUtil.GetBeatStarSong(this._currentCustomBeatmapLevel); this._currentStarSongDiff = this._songDataUtil.GetBeatStarSongDiffculityStats(this._currentCustomBeatmapLevel, this._currentBeatmapDifficulty, this._currentBeatmapCharacteristics); if (this._statusManager.StatusJSON["beatmap"] == null) { this._statusManager.StatusJSON["beatmap"] = new JSONObject(); } var beatmapJson = this._statusManager.StatusJSON["beatmap"].AsObject; if (this._currentStarSong != null && this._currentStarSongDiff != null) { beatmapJson["pp"] = new JSONNumber(PPCounterUtil.CalculatePP(this._songRawPP, multiplier * 0.95f, PPCounterUtil.AllowedPositiveModifiers(levelID))); beatmapJson["star"] = new JSONNumber(this._currentStarSongDiff.Star); beatmapJson["downloadCount"] = new JSONNumber(this._currentStarSong.DownloadCount); beatmapJson["upVotes"] = new JSONNumber(this._currentStarSong.Upvotes); beatmapJson["downVotes"] = new JSONNumber(this._currentStarSong.Downvotes); beatmapJson["rating"] = new JSONNumber(this._currentStarSong.Rating); } }
private void SendPP(float relativeScore) { if (this.statusManager.StatusJSON["performance"] == null) { this.statusManager.StatusJSON["performance"] = new JSONObject(); } var jsonObject = this.statusManager.StatusJSON["performance"].AsObject; jsonObject["current_pp"] = new JSONNumber(PPCounterUtil.CalculatePP(this.songRawPP, relativeScore)); this.statusManager.EmitStatusUpdate(ChangedProperty.Performance, BeatSaberEvent.ScoreChanged); }
private void Setup() { Plugin.Log.Debug($"Setup start."); if (this.pauseController != null) { this.pauseController.didResumeEvent += OnGameResume; } if (ScoreDataBase.Instance.Init) { this.relativeScoreAndImmediateRankCounter.relativeScoreOrImmediateRankDidChangeEvent += this.RelativeScoreAndImmediateRankCounter_relativeScoreOrImmediateRankDidChangeEvent; } var beatmapLevel = CurrentData.difficultyBeatmap.level; this._currentBeatmapDifficulty = CurrentData.difficultyBeatmap.difficulty; var levelID = beatmapLevel.levelID; this._currentCustomBeatmapLevel = Loader.GetLevelByHash(levelID.Split('_').Last()); this.songRawPP = ScoreDataBase.Instance.Init ? PPCounterUtil.GetPP(_currentCustomBeatmapLevel, _currentBeatmapDifficulty) : 0; if (_currentCustomBeatmapLevel != null) { HMMainThreadDispatcher.instance.Enqueue(this.SetCustomLabel(_currentCustomBeatmapLevel, _currentBeatmapDifficulty)); } this._currentStarSong = SongDataCoreUtil.GetBeatStarSong(_currentCustomBeatmapLevel); this._currentStarSongDiff = SongDataCoreUtil.GetBeatStarSongDiffculityStats(_currentCustomBeatmapLevel, _currentBeatmapDifficulty); if (this.statusManager.StatusJSON["beatmap"] == null) { this.statusManager.StatusJSON["beatmap"] = new JSONObject(); } var beatmapJson = this.statusManager.StatusJSON["beatmap"].AsObject; if (this._currentStarSong != null && this._currentStarSongDiff != null) { var multiplier = this.statusManager.GameStatus.songSpeedMultiplier; if (ScoreDataBase.Instance.Init) { if (multiplier == 1 || !PPCounterUtil.AllowedPositiveModifiers(levelID)) { beatmapJson["pp"] = new JSONNumber(this.songRawPP * 1.12); } else { beatmapJson["pp"] = new JSONNumber(PPCounterUtil.CalculatePP(this.songRawPP, multiplier)); } } beatmapJson["star"] = new JSONNumber(this._currentStarSongDiff.star); beatmapJson["downloadCount"] = new JSONNumber(this._currentStarSong.downloadCount); beatmapJson["upVotes"] = new JSONNumber(this._currentStarSong.upVotes); beatmapJson["downVotes"] = new JSONNumber(this._currentStarSong.downVotes); beatmapJson["rating"] = new JSONNumber(this._currentStarSong.rating); } HMMainThreadDispatcher.instance.Enqueue(this.SongStartWait(this._currentStarSong != null && this._currentStarSongDiff != null)); }
private void SendPP(float relativeScore) { if (this._songRawPP == 0) { return; } if (this._statusManager.StatusJSON["performance"] == null) { this._statusManager.StatusJSON["performance"] = new JSONObject(); } var jsonObject = this._statusManager.StatusJSON["performance"].AsObject; jsonObject["current_pp"].AsFloat = PPCounterUtil.CalculatePP(this._songRawPP, relativeScore, PPCounterUtil.AllowedPositiveModifiers(this._levelID)); this._statusManager.EmitStatusUpdate(ChangedProperty.Performance, BeatSaberEvent.ScoreChanged); }