65 lines
1.6 KiB
C#
Raw Normal View History

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