Files
SVSimLoader/SVSimLoader/Patches/ExaminationPatches.cs
2024-09-08 10:32:52 -04:00

40 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cute;
using HarmonyLib;
using LitJson;
using Wizard;
namespace SVSimLoader.Patches;
[HarmonyPatch]
public static class ExaminationPatches
{
[HarmonyPatch(typeof(NetworkTask), nameof(NetworkTask.SetResponseData))]
[HarmonyPrefix]
public static bool SetResponseData(JsonData data, NetworkTask __instance)
{
Plugin.Log.LogInfo($"Post to {__instance.Url} returned: {data.ToJson()}");
return true;
}
[HarmonyPatch(typeof(NetworkTask), "CreateBody")]
[HarmonyPrefix]
public static bool CreateBody(NetworkTask __instance, bool encrypt)
{
string body = JsonMapper.ToJson(__instance.Params);
Plugin.Log.LogInfo($"Post to {__instance.Url} with encryption {encrypt} and with body: {body}");
return true;
}
[HarmonyPatch(typeof(CardMaster), MethodType.Constructor, typeof(List<CardCSVData>))]
[HarmonyPostfix]
public static void ExamineCardMaster(List<CardCSVData> cardList)
{
if (SvSimConfig.DumpCardDB)
{
FileLog.Log(JsonMapper.ToJson(cardList));
}
}
}