mirror of https://github.com/hykilpikonna/AquaDX
Merge branch 'master' into tc21/skip-to-music
commit
abe1d3ad29
|
@ -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" />
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
using Manager.MaiStudio;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace AquaMai.Cheat
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Unlock tickets that are typically locked unless a specific event is open.
|
||||||
|
*/
|
||||||
|
public class TicketUnlock
|
||||||
|
{
|
||||||
|
// For any ticket, return the event ID 1 to unlock it
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(TicketData), "get_ticketEvent")]
|
||||||
|
public static bool get_ticketEvent(ref StringID __result)
|
||||||
|
{
|
||||||
|
var id = new Manager.MaiStudio.Serialize.StringID
|
||||||
|
{
|
||||||
|
id = 1,
|
||||||
|
str = "無期限常時解放"
|
||||||
|
};
|
||||||
|
|
||||||
|
var sid = new StringID();
|
||||||
|
sid.Init(id);
|
||||||
|
|
||||||
|
__result = sid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modify the maxTicketNum to 0
|
||||||
|
// this is because TicketManager.GetTicketData adds the ticket to the list if either
|
||||||
|
// the player owns at least one ticket or the maxTicketNum = 0
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(TicketData), "get_maxCount")]
|
||||||
|
public static bool get_maxCount(ref int __result)
|
||||||
|
{
|
||||||
|
__result = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Process;
|
||||||
|
using Util;
|
||||||
|
|
||||||
|
namespace AquaMai.Fix
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fix character selection crashing because get map color returns null
|
||||||
|
*/
|
||||||
|
public class FixCharaCrash
|
||||||
|
{
|
||||||
|
// Check if the return is null. If it is, make up a color
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(CharacterSelectProces), "GetMapColorData")]
|
||||||
|
public static void GetMapColorData(ref CharacterSelectProces __instance, ref CharacterMapColorData __result)
|
||||||
|
{
|
||||||
|
if (__result != null) return;
|
||||||
|
|
||||||
|
// 1 is a color that definitely exists
|
||||||
|
if (MapMaster.GetSlotData(1) == null)
|
||||||
|
{
|
||||||
|
MapMaster.GetSlotData(1).Load();
|
||||||
|
}
|
||||||
|
__result = MapMaster.GetSlotData(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,23 +42,24 @@ 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));
|
||||||
|
|
||||||
|
|
||||||
if (AppConfig.UX.SkipToMusicSelection)
|
if (AppConfig.UX.SkipToMusicSelection)
|
||||||
{
|
{
|
||||||
MelonLogger.Msg($"> Patching {nameof(SkipToMusicSelection)}");
|
Patch(typeof(SkipToMusicSelection));
|
||||||
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SkipToMusicSelection));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixes that does not have side effects
|
||||||
|
// These don't need to be configurable
|
||||||
|
Patch(typeof(FixCharaCrash));
|
||||||
|
|
||||||
MelonLogger.Msg("Loaded!");
|
MelonLogger.Msg("Loaded!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue