Skip to content

Commit

Permalink
Bump SongCore dependency, replace obsolete references
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Dec 29, 2024
1 parent dac3ab7 commit f58befe
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion MultiplayerCore/Beatmaps/Abstractions/MpBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;
using MultiplayerCore.Beatmaps.Serializable;
using UnityEngine;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps.Abstractions
{
Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/Beatmaps/BeatSaverBeatmapLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using MultiplayerCore.Beatmaps.Abstractions;
using UnityEngine;
using static BeatSaverSharp.Models.BeatmapDifficulty;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps
{
Expand Down
9 changes: 5 additions & 4 deletions MultiplayerCore/Beatmaps/LocalBeatmapLevel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MultiplayerCore.Beatmaps.Abstractions;
using MultiplayerCore.Beatmaps.Serializable;
using UnityEngine;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps
{
Expand All @@ -28,7 +29,7 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> Requ
get
{
Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> reqs = new();
var difficulties = SongCore.Collections.RetrieveExtraSongData(LevelHash)?._difficulties;
var difficulties = SongCore.Collections.GetCustomLevelSongData(LevelID)?._difficulties; // TODO: Check if we need to call levelIDsForHash
if (difficulties == null)
return new();
foreach (var difficulty in difficulties)
Expand All @@ -46,7 +47,7 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, DifficultyColor
get
{
Dictionary<string, Dictionary<BeatmapDifficulty, DifficultyColors>> colors = new();
var difficulties = SongCore.Collections.RetrieveExtraSongData(LevelHash)?._difficulties;
var difficulties = SongCore.Collections.GetCustomLevelSongData(LevelID)?._difficulties;
if (difficulties == null)
return new();
foreach (var difficulty in difficulties)
Expand All @@ -60,7 +61,7 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, DifficultyColor
}
}

public override Contributor[] Contributors => SongCore.Collections.RetrieveExtraSongData(LevelHash)?.contributors ?? new Contributor[0];
public override Contributor[] Contributors => SongCore.Collections.GetCustomLevelSongData(LevelID)?.contributors ?? new Contributor[0];

private readonly BeatmapLevel _localBeatmapLevel;

Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/Beatmaps/NetworkBeatmapLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using MultiplayerCore.Beatmaps.Packets;
using MultiplayerCore.Beatmaps.Serializable;
using UnityEngine;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps
{
Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/Beatmaps/Packets/MpBeatmapPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using MultiplayerCore.Beatmaps.Abstractions;
using MultiplayerCore.Beatmaps.Serializable;
using MultiplayerCore.Networking.Abstractions;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps.Packets
{
Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/Beatmaps/Serializable/DifficultyColors.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using LiteNetLib.Utils;
using static SongCore.Data.ExtraSongData;
using static SongCore.Data.SongData;

namespace MultiplayerCore.Beatmaps.Serializable
{
Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/MultiplayerCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BeatSaber.ViewSystem">
<Reference Include="BeatSaber.ViewSystem" Publicize="true">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
Expand Down
6 changes: 3 additions & 3 deletions MultiplayerCore/Objects/MpEntitlementChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ private void HandleSetIsEntitledToLevel(string userId, string levelId, Entitleme

if (!string.IsNullOrWhiteSpace(levelHash) && SongCore.Collections.songWithHashPresent(levelHash))
{
ExtraSongData? extraSongData = SongCore.Collections.RetrieveExtraSongData(levelHash);
if (extraSongData == null)
SongData? SongData = SongCore.Collections.GetCustomLevelSongData(levelId);
if (SongData == null)
return Task.FromResult(EntitlementsStatus.Ok);

// Note: If there is even just one diff in the beatmap that requires a mod, this will flag the whole map, possible check selected difficulty?
string[] requirements = extraSongData._difficulties
string[] requirements = SongData._difficulties
.Aggregate(Array.Empty<string>(), (a, n) => a.Concat(n.additionalDifficultyData?._requirements ?? Array.Empty<string>()).ToArray())
.Distinct().ToArray();

Expand Down
6 changes: 3 additions & 3 deletions MultiplayerCore/Objects/MpLevelLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ internal void UnloadLevelIfRequirementsNotMet()
if (levelHash == null)
return;

var extraSongData = SongCore.Collections.RetrieveExtraSongData(levelHash);
if (extraSongData == null)
var SongData = SongCore.Collections.GetCustomLevelSongData(levelId);
if (SongData == null)
return;

var difficulty = _gameplaySetupData.beatmapKey.difficulty;
var characteristicName = _gameplaySetupData.beatmapKey.beatmapCharacteristic.serializedName;

var difficultyData = extraSongData._difficulties.FirstOrDefault(x =>
var difficultyData = SongData._difficulties.FirstOrDefault(x =>
x._difficulty == difficulty && x._beatmapCharacteristicName == characteristicName);
if (difficultyData == null)
return;
Expand Down
2 changes: 1 addition & 1 deletion MultiplayerCore/UI/MpColorsUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ internal void AcceptColors(DifficultyColors colors)
);
}

internal void AcceptColors(ExtraSongData.MapColor? leftColor, ExtraSongData.MapColor? rightColor, ExtraSongData.MapColor? envLeftColor, ExtraSongData.MapColor? envLeftBoostColor, ExtraSongData.MapColor? envRightColor, ExtraSongData.MapColor? envRightBoostColor, ExtraSongData.MapColor? obstacleColor)
internal void AcceptColors(SongData.MapColor? leftColor, SongData.MapColor? rightColor, SongData.MapColor? envLeftColor, SongData.MapColor? envLeftBoostColor, SongData.MapColor? envRightColor, SongData.MapColor? envRightBoostColor, SongData.MapColor? obstacleColor)
{
Parse();

Expand Down
8 changes: 4 additions & 4 deletions MultiplayerCore/UI/MpRequirementsUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ private void SetRequirementsFromLevel(BeatmapLevel level, in BeatmapKey key)
var levelHash = Utilities.HashForLevelID(key.levelId);
if (!string.IsNullOrEmpty(levelHash))
{
var extraSongData = SongCore.Collections.RetrieveExtraSongData(levelHash!);
if (extraSongData != null)
var SongData = SongCore.Collections.GetCustomLevelSongData(key.levelId);
if (SongData != null)
{
var diffData = SongCore.Collections.RetrieveDifficultyData(level, key);
var diffData = SongCore.Collections.GetCustomLevelSongDifficultyData(key);
if (diffData != null && diffData.additionalDifficultyData != null && diffData.additionalDifficultyData._requirements != null)
{
foreach (var req in diffData.additionalDifficultyData._requirements)
Expand All @@ -169,7 +169,7 @@ private void SetRequirementsFromLevel(BeatmapLevel level, in BeatmapKey key)
}
}

foreach (var contributor in extraSongData.contributors)
foreach (var contributor in SongData.contributors)
{
var cell = GetCellInfo();
cell.Text = $"<size=75%>{contributor._name}";
Expand Down
4 changes: 2 additions & 2 deletions MultiplayerCore/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"author": "Goobwabber",
"version": "1.5.4",
"description": "Adds custom songs to Beat Saber Multiplayer.",
"gameVersion": "1.38.0",
"gameVersion": "1.40.0",
"dependsOn": {
"BSIPA": "^4.3.3",
"SongCore": "^3.14.0",
"SongCore": "^3.15.2",
"BeatSaverSharp": "^3.4.5",
"SiraUtil": "^3.1.12",
"BeatSaberMarkupLanguage": "^1.12.0",
Expand Down

0 comments on commit f58befe

Please sign in to comment.