[+] Add cheat config

pull/7/head
Azalea 2024-02-07 05:16:07 -05:00
parent de12ec6548
commit ccb3f7ef34
5 changed files with 37 additions and 11 deletions

View File

@ -263,7 +263,9 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Cheat\TicketUnlock.cs" />
<Compile Include="Config.cs" /> <Compile Include="Config.cs" />
<Compile Include="Fix\FixCharaCrash.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="UX\SinglePlayer.cs" /> <Compile Include="UX\SinglePlayer.cs" />

View File

@ -1,4 +1,10 @@
# ===================================
# Cheat: You control the buttons you press
[Cheat]
# Unlock normally event-only tickets
TicketUnlock=true
# =================================== # ===================================
# UX: User Experience Improvements # UX: User Experience Improvements
[UX] [UX]

View File

@ -6,6 +6,12 @@ namespace AquaMai
public class Config public class Config
{ {
public UXConfig UX { get; set; } public UXConfig UX { get; set; }
public CheatConfig Cheat { get; set; }
public class CheatConfig
{
public bool TicketUnlock { get; set; }
}
public class UXConfig public class UXConfig
{ {

View File

@ -1,4 +1,7 @@
using AquaMai.UX; using System;
using AquaMai.Cheat;
using AquaMai.Fix;
using AquaMai.UX;
using MelonLoader; using MelonLoader;
using Tomlet; using Tomlet;
@ -18,6 +21,12 @@ namespace AquaMai
{ {
public static Config AppConfig { get; private set; } public static Config AppConfig { get; private set; }
private void Patch(Type type)
{
MelonLogger.Msg($"> Patching {type}");
HarmonyLib.Harmony.CreateAndPatchAll(type);
}
public override void OnInitializeMelon() public override void OnInitializeMelon()
{ {
MelonLogger.Msg("Loading mod settings..."); MelonLogger.Msg("Loading mod settings...");
@ -33,16 +42,17 @@ namespace AquaMai
AppConfig = TomletMain.To<Config>(System.IO.File.ReadAllText("AquaMai.toml")); AppConfig = TomletMain.To<Config>(System.IO.File.ReadAllText("AquaMai.toml"));
if (AppConfig.UX.SkipWarningScreen) if (AppConfig.UX.SkipWarningScreen)
{ Patch(typeof(SkipWarningScreen));
MelonLogger.Msg("> Patching SkipWarningScreen");
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SkipWarningScreen));
}
if (AppConfig.UX.SinglePlayer) if (AppConfig.UX.SinglePlayer)
{ Patch(typeof(SinglePlayer));
MelonLogger.Msg("> Patching SinglePlayer");
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SinglePlayer)); if (AppConfig.Cheat.TicketUnlock)
} Patch(typeof(TicketUnlock));
// Fixes that does not have side effects
// These don't need to be configurable
Patch(typeof(FixCharaCrash));
MelonLogger.Msg("Loaded!"); MelonLogger.Msg("Loaded!");
} }

View File

@ -2,10 +2,12 @@ using System;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace AquaMai { namespace AquaMai.UX
{
// Hides the 2p (right hand side) UI. // Hides the 2p (right hand side) UI.
// Note: this is not my original work. I simply interpreted the code and rewrote it as a mod. // Note: this is not my original work. I simply interpreted the code and rewrote it as a mod.
public class SinglePlayer { public class SinglePlayer
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })] [HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })]
public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right) public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right)