mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
34 lines
888 B
C#
34 lines
888 B
C#
using HarmonyLib;
|
|
using NewHorizons.External;
|
|
using QSB;
|
|
using QSB.Patches;
|
|
using QSB.SaveSync;
|
|
using QSB.Utility;
|
|
|
|
namespace QSBNH.Patches;
|
|
|
|
/// <summary>
|
|
/// pretends to be a new profile when in multiplayer so NH saves its data to a new place
|
|
/// </summary>
|
|
public class NewHorizonsDataPatches : QSBPatch
|
|
{
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnModStart;
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(NewHorizonsData), nameof(NewHorizonsData.GetProfileName))]
|
|
public static bool NewHorizonsData_GetProfileName(out string __result)
|
|
{
|
|
if (QSBCore.IsInMultiplayer)
|
|
{
|
|
__result = QSBStandaloneProfileManager.SharedInstance?.currentProfile?.profileName + "_mult";
|
|
DebugLog.DebugWrite($"using fake multiplayer profile {__result} for NH");
|
|
}
|
|
else
|
|
{
|
|
__result = QSBStandaloneProfileManager.SharedInstance?.currentProfile?.profileName;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|