From 7ff66e92770185c8bbae7f53e6e3c3a38abf1a49 Mon Sep 17 00:00:00 2001
From: Azalea <22280294+hykilpikonna@users.noreply.github.com>
Date: Sun, 28 Apr 2024 09:04:46 -0400
Subject: [PATCH] [+] AquaMai: Disable reboot
---
AquaMai/AquaMai.csproj | 1 +
AquaMai/Main.cs | 1 +
AquaMai/UX/DisableReboot.cs | 63 +++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+)
create mode 100644 AquaMai/UX/DisableReboot.cs
diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index 800ac623..a509da8a 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -270,6 +270,7 @@
+
diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs
index 6a35b971..59094e2d 100644
--- a/AquaMai/Main.cs
+++ b/AquaMai/Main.cs
@@ -79,6 +79,7 @@ namespace AquaMai
// These don't need to be configurable
Patch(typeof(FixCharaCrash));
Patch(typeof(CustomVersionString));
+ Patch(typeof(DisableReboot));
MelonLogger.Msg("Loaded!");
}
diff --git a/AquaMai/UX/DisableReboot.cs b/AquaMai/UX/DisableReboot.cs
new file mode 100644
index 00000000..6fcbc903
--- /dev/null
+++ b/AquaMai/UX/DisableReboot.cs
@@ -0,0 +1,63 @@
+using HarmonyLib;
+using Manager.Operation;
+
+namespace AquaMai.UX
+{
+ public class DisableReboot
+ {
+ // IsAutoRebootNeeded
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "IsAutoRebootNeeded")]
+ public static bool IsAutoRebootNeeded(ref bool __result)
+ {
+ __result = false;
+ return false;
+ }
+
+ // IsUnderServerMaintenance
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "IsUnderServerMaintenance")]
+ public static bool IsUnderServerMaintenance(ref bool __result)
+ {
+ __result = false;
+ return false;
+ }
+
+ // RemainingMinutes
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "RemainingMinutes")]
+ public static bool RemainingMinutes(ref int __result)
+ {
+ __result = 600;
+ return false;
+ }
+
+ // GetAutoRebootSec
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "GetAutoRebootSec")]
+ public static bool GetAutoRebootSec(ref int __result)
+ {
+ __result = 60 * 60 * 10;
+ return false;
+ }
+
+ // GetServerMaintenanceSec
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "GetServerMaintenanceSec")]
+ public static bool GetServerMaintenanceSec(ref int __result)
+ {
+ __result = 60 * 60 * 10;
+ return false;
+ }
+
+ // Execute
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "Execute")]
+ public static bool Execute(MaintenanceTimer __instance) => false;
+
+ // UpdateTimes
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(MaintenanceTimer), "UpdateTimes")]
+ public static bool UpdateTimes(MaintenanceTimer __instance) => false;
+ }
+}
\ No newline at end of file