Skip to content

Commit 31052f1

Browse files
authored
Merge pull request #123 from Zingabopp/dev
bug fixes
2 parents 04ecf47 + ed35343 commit 31052f1

File tree

7 files changed

+24
-16
lines changed

7 files changed

+24
-16
lines changed

MultiplayerExtensions/HarmonyPatches/InstallerPatches.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,13 @@ internal static void Prefix(ref GameplayCoreInstaller __instance, ref IConnected
109109
else
110110
newModifiers = hostPlayer?.lastModifiers;
111111

112-
if (Plugin.Config.LagReducer && newModifiers != null)
113-
newModifiers = newModifiers.CopyWith(zenMode: true);
114-
115112
if (newModifiers == null)
116113
newModifiers = ____sceneSetupData.gameplayModifiers;
117114

118115
____sceneSetupData = new GameplayCoreSceneSetupData(
119116
____sceneSetupData.difficultyBeatmap,
120117
____sceneSetupData.previewBeatmapLevel,
121-
newModifiers.CopyWith(zenMode: true),
118+
newModifiers.CopyWith(zenMode: Plugin.Config.LagReducer),
122119
____sceneSetupData.playerSpecificSettings,
123120
____sceneSetupData.practiceSettings,
124121
____sceneSetupData.useTestNoteCutSoundEffects,

MultiplayerExtensions/MultiplayerExtensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<OutputType>Library</OutputType>
55
<AppDesignerFolder>Properties</AppDesignerFolder>
66
<AssemblyName>MultiplayerExtensions</AssemblyName>
7-
<AssemblyVersion>0.4.9</AssemblyVersion>
7+
<AssemblyVersion>0.5.0</AssemblyVersion>
88
<TargetFramework>net472</TargetFramework>
99
<DebugSymbols>true</DebugSymbols>
1010
<DebugType>portable</DebugType>

MultiplayerExtensions/OverrideClasses/GameStateControllerStub.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,19 @@ private void handleLevelFinished(MultiplayerLevelScenesTransitionSetupDataSO sce
185185
{
186186
if (resultsData.localPlayerResultData.levelCompletionResults == null)
187187
return;
188-
189-
string? hash = Utilities.Utils.LevelIdToHash(sceneSetupData.previewBeatmapLevel.levelID);
190-
188+
189+
string difficulty = sceneSetupData.beatmapDifficulty.ToString();
190+
string characteristic = sceneSetupData.beatmapCharacteristic.serializedName;
191+
int timePlayed = (int)Math.Floor(resultsData.localPlayerResultData.levelCompletionResults.endSongTime);
192+
bool pass = resultsData.localPlayerResultData.levelCompletionResults.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared;
193+
int cutNotes = resultsData.localPlayerResultData.levelCompletionResults.badCutsCount + resultsData.localPlayerResultData.levelCompletionResults.notGoodCount + resultsData.localPlayerResultData.levelCompletionResults.okCount + resultsData.localPlayerResultData.levelCompletionResults.goodCutsCount;
194+
int missedNotes = resultsData.localPlayerResultData.levelCompletionResults.missedCount;
195+
int score = resultsData.localPlayerResultData.levelCompletionResults.rawScore;
196+
double accuracy = score != 0 ? Math.Floor(100 *((double)ScoreModel.MaxRawScoreForNumberOfNotes(sceneSetupData.difficultyBeatmap.beatmapData.cuttableNotesType) / score))/100 : 0;
197+
string ? hash = Utilities.Utils.LevelIdToHash(sceneSetupData.previewBeatmapLevel.levelID);
191198
if (hash != null)
192-
_ = Statistics.PlayMap(hash, sceneSetupData.beatmapDifficulty.ToString(), sceneSetupData.beatmapCharacteristic.serializedName, (int)Math.Floor(resultsData.localPlayerResultData.levelCompletionResults.endSongTime), (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname);
199+
_ = Statistics.PlayMap(ExtendedPlayerManager.localPlatformID, (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname, hash, difficulty, characteristic, timePlayed, pass, cutNotes, missedNotes, score, accuracy);
200+
//_ = Statistics.PlayMap(hash, sceneSetupData.beatmapDifficulty.ToString(), sceneSetupData.beatmapCharacteristic.serializedName, (int)Math.Floor(resultsData.localPlayerResultData.levelCompletionResults.endSongTime), (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname);
193201
}
194202

195203
private bool starting;

MultiplayerExtensions/Sessions/SessionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Dispose()
3636
private void HandleConnected()
3737
{
3838
MPState.LocalPlayerIsHost = _sessionManager.localPlayer.isConnectionOwner;
39-
_ = Statistics.UseMaster(MPState.CurrentMasterServer.hostname, (int)ExtendedPlayerManager.localPlatform, ExtendedPlayerManager.localPlatformID, MPState.LocalPlayerIsHost);
39+
_ = Statistics.UseMaster(ExtendedPlayerManager.localPlatformID, (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname, MPState.LocalPlayerIsHost);
4040
}
4141

4242
private void HandlePlayerStateChanged(IConnectedPlayer player)

MultiplayerExtensions/Utilities/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class PluginConfig
1313
public virtual bool HostPick { get; set; } = true;
1414
public virtual string Color { get; set; } = "#08C0FF";
1515
public virtual int MaxPlayers { get; set; } = 10;
16+
public virtual bool ReportMasterServer { get; set; } = true;
1617

1718
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
1819
public virtual DebugConfig? DebugConfig { get; set; }

MultiplayerExtensions/Utilities/Statistics.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,18 @@ public static async Task<bool> AddUser(string userId, int platform)
6464
return await PerformWebRequest("POST", $"/adduser?userId={userId}&platform={platform}") != null;
6565
}
6666

67-
public static async Task<bool> PlayMap(string hash, string difficulty, string characteristic, int timePlayed, int platform, string hostname)
67+
public static async Task<bool> PlayMap(string? userId, int platform, string hostname, string hash, string difficulty, string characteristic, int timePlayed, bool pass, int cutNotes, int missedNotes, int score, double accuracy)
6868
{
69-
return await PerformWebRequest("POST", $"/playmap?hash={hash}&difficulty={difficulty}&characteristic={characteristic}&timePlayed={timePlayed}&platform={platform}&hostname={hostname}") != null;
69+
if (userId != null)
70+
return await PerformWebRequest("POST", $"/playmap?userId={userId}&platform={platform}&hostname={hostname}&hash={hash}&difficulty={difficulty}&characteristic={characteristic}&timePlayed={timePlayed}&pass={pass}&cutNotes={cutNotes}&missedNotes={missedNotes}&score={score}&accuracy={accuracy}") != null;
71+
return true;
7072
}
7173

72-
public static async Task<bool> UseMaster(string hostname, int platform, string? userId = null, bool host = false)
74+
public static async Task<bool> UseMaster(string? userId, int platform, string hostname, bool host = false)
7375
{
7476
if (userId != null)
75-
return await PerformWebRequest("POST", $"/usemaster?hostname={hostname}&userId={userId}&platform={platform}&host={host}") != null;
76-
return await PerformWebRequest("POST", $"/usemaster?hostname={hostname}&platform={platform}&host={host}") != null;
77+
return await PerformWebRequest("POST", $"/usemaster?userId={userId}&hostname={hostname}&platform={platform}&host={host}&disableNewMaster={!Plugin.Config.ReportMasterServer}") != null;
78+
return true;
7779
}
7880
}
7981
}

MultiplayerExtensions/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "MultiplayerExtensions",
44
"name": "MultiplayerExtensions",
55
"author": "Zingabopp and Goobwabber",
6-
"version": "0.4.9",
6+
"version": "0.5.0",
77
"description": "Expands the functionality of Beat Saber Multiplayer.",
88
"gameVersion": "1.16.1",
99
"dependsOn": {

0 commit comments

Comments
 (0)