Skip to content

Commit

Permalink
Release v1.10.0 (#35)
Browse files Browse the repository at this point in the history
Adds:
- Beat Saber v1.8.0 support
- BSIPA v4 support

Co-authored-by: Eris <[email protected]>
  • Loading branch information
ErisApps authored Apr 2, 2020
1 parent 902a904 commit 5012c14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
10 changes: 5 additions & 5 deletions BeatSaberHTTPStatus/BeatSaberHTTPStatusPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<Version>1.9.1</Version>
<BeatSaberVersion>1.6.0</BeatSaberVersion>
<Version>1.10.0</Version>
<BeatSaberVersion>1.8.0</BeatSaberVersion>
<GameDirPath>..\libs\beatsaber\</GameDirPath>
<SemVerVersion>$(Version)</SemVerVersion>
</PropertyGroup>
Expand Down Expand Up @@ -48,8 +48,8 @@
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MainAssembly">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\MainAssembly.dll</HintPath>
<Reference Include="Main">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\Main.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -106,7 +106,7 @@
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Plugin.cs" OutputFilename="$(IntermediateSourcePath)Plugin.cs" MatchExpression="$SEMVER_VERSION$" ReplacementText="$(SemVerVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Plugin.cs" OutputFilename="$(IntermediateSourcePath)Plugin.cs" MatchExpression="$BS_VERSION$" ReplacementText="$(BeatSaberVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Properties\AssemblyInfo.cs" OutputFilename="$(IntermediateSourcePath)Properties\AssemblyInfo.cs" MatchExpression="$VERSION$" ReplacementText="$(Version)" />
<Copy SourceFiles="manifest.json" DestinationFiles="$(IntermediateSourcePath)manifest.json" SkipUnchangedFiles="true"></Copy>
<Copy SourceFiles="manifest.json" DestinationFiles="$(IntermediateSourcePath)manifest.json" SkipUnchangedFiles="true" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)manifest.json" OutputFilename="$(IntermediateSourcePath)manifest.json" MatchExpression="$SEMVER_VERSION$" ReplacementText="$(SemVerVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)manifest.json" OutputFilename="$(IntermediateSourcePath)manifest.json" MatchExpression="$BS_VERSION$" ReplacementText="$(BeatSaberVersion)" />
</Target>
Expand Down
22 changes: 15 additions & 7 deletions BeatSaberHTTPStatus/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
// protected ScoreController._baseScore

namespace BeatSaberHTTPStatus {
public class Plugin : IBeatSaberPlugin {
[Plugin(RuntimeOptions.SingleStartInit)]
internal class Plugin {
private bool initialized;

private StatusManager statusManager = new StatusManager();
Expand Down Expand Up @@ -62,19 +63,26 @@ public string Version {

public static IPALogger log;

[Init]
public void Init(IPALogger logger) {
log = logger;
}

[OnStart]
public void OnApplicationStart() {
if (initialized) return;
initialized = true;

server = new HTTPServer(statusManager);
server.InitServer();

SceneManager.activeSceneChanged += OnActiveSceneChanged;
}

[OnExit]
public void OnApplicationQuit() {
SceneManager.activeSceneChanged -= OnActiveSceneChanged;

if (gamePause != null) {
gamePause.didPauseEvent -= OnGamePause;
gamePause.didResumeEvent -= OnGameResume;
Expand Down Expand Up @@ -206,7 +214,7 @@ public void OnActiveSceneChanged(Scene oldScene, Scene newScene) {
gameStatus.obstaclesCount = diff.beatmapData.obstaclesCount;
gameStatus.environmentName = level.environmentInfo.sceneInfo.sceneName;

gameStatus.maxScore = ScoreController.MaxModifiedScoreForMaxRawScore(ScoreController.MaxRawScoreForNumberOfNotes(diff.beatmapData.notesCount), gameplayModifiers, gameplayModifiersSO);
gameStatus.maxScore = gameplayModifiersSO.MaxModifiedScoreForMaxRawScore(ScoreModel.MaxRawScoreForNumberOfNotes(diff.beatmapData.notesCount), gameplayModifiers, gameplayModifiersSO);
gameStatus.maxRank = RankModel.MaxRankForGameplayModifiers(gameplayModifiers, gameplayModifiersSO).ToString();

try {
Expand Down Expand Up @@ -321,7 +329,7 @@ public void OnNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multipl
int afterScore = 0;
int cutDistanceScore = 0;

ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore);
ScoreModel.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore);

gameStatus.initialScore = score;
gameStatus.finalScore = -1;
Expand Down Expand Up @@ -371,8 +379,8 @@ public void OnNoteWasFullyCut(CutScoreBuffer acsb) {

SetNoteCutStatus(noteData, noteCutInfo, false);

// public ScoreController.RawScoreWithoutMultiplier(NoteCutInfo, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore)
ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore);
// public static ScoreModel.RawScoreWithoutMultiplier(NoteCutInfo, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore)
ScoreModel.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore);

int multiplier = (int) cutScoreBufferMultiplierField.GetValue(acsb);

Expand Down Expand Up @@ -437,8 +445,8 @@ public void OnScoreDidChange(int scoreBeforeMultiplier, int scoreAfterMultiplier

gameStatus.score = scoreAfterMultiplier;

int currentMaxScoreBeforeMultiplier = ScoreController.MaxRawScoreForNumberOfNotes(gameStatus.passedNotes);
gameStatus.currentMaxScore = ScoreController.MaxModifiedScoreForMaxRawScore(currentMaxScoreBeforeMultiplier, gameplayModifiers, gameplayModifiersSO);
int currentMaxScoreBeforeMultiplier = ScoreModel.MaxRawScoreForNumberOfNotes(gameStatus.passedNotes);
gameStatus.currentMaxScore = gameplayModifiersSO.MaxModifiedScoreForMaxRawScore(currentMaxScoreBeforeMultiplier, gameplayModifiers, gameplayModifiersSO);

RankModel.Rank rank = RankModel.GetRankForScore(scoreBeforeMultiplier, gameStatus.score, currentMaxScoreBeforeMultiplier, gameStatus.currentMaxScore);
gameStatus.rank = RankModel.GetRankName(rank);
Expand Down

0 comments on commit 5012c14

Please sign in to comment.