quantum-space-buddies/EpicRerouter/ModSide/Patches.cs

67 lines
1.6 KiB
C#
Raw Normal View History

2022-02-07 05:38:14 +00:00
using HarmonyLib;
2022-02-07 22:23:16 +00:00
using UnityEngine;
2022-02-07 08:45:22 +00:00
using static EntitlementsManager;
2022-02-07 05:38:14 +00:00
2022-02-07 07:09:55 +00:00
namespace EpicRerouter.ModSide
2022-02-07 05:38:14 +00:00
{
[HarmonyPatch(typeof(EpicPlatformManager))]
public static class Patches
2022-02-07 06:05:24 +00:00
{
2022-02-07 22:23:16 +00:00
public static void Apply()
{
2022-02-07 22:23:16 +00:00
var harmony = new Harmony(typeof(Patches).FullName);
harmony.PatchAll(typeof(EntitlementsManagerPatches));
harmony.PatchAll(typeof(EpicPlatformManagerPatches));
}
2022-02-07 22:23:16 +00:00
[HarmonyPatch(typeof(EntitlementsManager))]
private static class EntitlementsManagerPatches
{
2022-02-07 22:23:16 +00:00
[HarmonyPrefix]
[HarmonyPatch(nameof(EntitlementsManager.InitializeOnAwake))]
private static bool InitializeOnAwake(EntitlementsManager __instance)
{
Object.Destroy(__instance);
return false;
}
2022-02-07 22:23:16 +00:00
[HarmonyPrefix]
[HarmonyPatch(nameof(EntitlementsManager.Start))]
private static bool Start() => false;
[HarmonyPrefix]
[HarmonyPatch(nameof(EntitlementsManager.OnDestroy))]
private static bool OnDestroy() => false;
[HarmonyPrefix]
[HarmonyPatch(nameof(EntitlementsManager.IsDlcOwned))]
private static bool IsDlcOwned(out AsyncOwnershipStatus __result)
{
__result = Interop.OwnershipStatus;
Interop.Log($"ownership status = {__result}");
return false;
}
}
2022-02-07 22:23:16 +00:00
[HarmonyPatch(typeof(EpicPlatformManager))]
private static class EpicPlatformManagerPatches
2022-02-07 08:45:22 +00:00
{
2022-02-07 22:23:16 +00:00
[HarmonyPrefix]
[HarmonyPatch("Awake")]
private static bool Awake(EpicPlatformManager __instance)
{
Object.Destroy(__instance);
return false;
}
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static bool Start() => false;
[HarmonyPrefix]
[HarmonyPatch("OnDestroy")]
private static bool OnDestroy() => false;
2022-02-07 06:05:24 +00:00
}
}
2022-02-07 05:38:14 +00:00
}