Update and restore unintentionally-changed formatting

pull/9/head
Tianyi Cao 2024-02-07 20:04:15 -08:00
parent fcee4d13da
commit cc1a91e5cd
1 changed files with 11 additions and 7 deletions

View File

@ -9,16 +9,18 @@ namespace AquaMai.Fix
/**
* Fix character selection crashing due to missing character data
*/
public class FixCharaCrash {
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;
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) {
if (MapMaster.GetSlotData(1) == null)
{
MapMaster.GetSlotData(1).Load();
}
__result = MapMaster.GetSlotData(1);
@ -26,8 +28,10 @@ namespace AquaMai.Fix
[HarmonyPrefix]
[HarmonyPatch(typeof(Monitor.CommonMonitor), "SetCharacterSlot", new Type[] { typeof(MessageCharactorInfomationData) })]
public static bool SetCharacterSlot(ref MessageCharactorInfomationData data, Dictionary<int, CharacterSlotData> ____characterSlotData) {
if (!____characterSlotData.ContainsKey(data.MapKey)) {
public static bool SetCharacterSlot(ref MessageCharactorInfomationData data, Dictionary<int, CharacterSlotData> ____characterSlotData)
{
if (!____characterSlotData.ContainsKey(data.MapKey))
{
Console.Log($"Could not get CharacterSlotData for character [Index={data.Index}, MapKey={data.MapKey}], ignoring...");
return false;
}