From b7c5d18df105e9dc452ea9163b5a7bbacd28c16d Mon Sep 17 00:00:00 2001 From: Clansty Date: Wed, 11 Sep 2024 00:56:15 +0800 Subject: [PATCH] [+] Log user ID on login --- AquaMai/AquaMai.csproj | 1 + AquaMai/AquaMai.toml | 4 ++++ AquaMai/AquaMai.zh.toml | 4 ++++ AquaMai/Config.cs | 6 ++++++ AquaMai/Utils/LogUserId.cs | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+) create mode 100644 AquaMai/Utils/LogUserId.cs diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj index aecd3838..6e17f172 100644 --- a/AquaMai/AquaMai.csproj +++ b/AquaMai/AquaMai.csproj @@ -302,6 +302,7 @@ + diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index aa756d4d..2b64e367 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -69,3 +69,7 @@ SkipVersionCheck=true RemoveEncryption=true ForceAsServer=true ForceFreePlay=true + +[Utils] +# Log user ID on login +LogUserId=false diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml index b744b626..99ed18c2 100644 --- a/AquaMai/AquaMai.zh.toml +++ b/AquaMai/AquaMai.zh.toml @@ -85,3 +85,7 @@ RemoveEncryption=true # 如果要配置店内招募的话,应该要把这个关闭 ForceAsServer=true ForceFreePlay=true + +[Utils] +# 登录时将 UserID 输出到日志 +LogUserId=false diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index 00b4b561..790c57a2 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -10,6 +10,7 @@ namespace AquaMai public CheatConfig Cheat { get; set; } public PerformanceConfig Performance { get; set; } public FixConfig Fix { get; set; } + public UtilsConfig Utils { get; set; } public class CheatConfig { @@ -55,5 +56,10 @@ namespace AquaMai public bool ForceAsServer { get; set; } = true; public bool ForceFreePlay { get; set; } = true; } + + public class UtilsConfig + { + public bool LogUserId { get; set; } + } } } diff --git a/AquaMai/Utils/LogUserId.cs b/AquaMai/Utils/LogUserId.cs new file mode 100644 index 00000000..ef0ddf13 --- /dev/null +++ b/AquaMai/Utils/LogUserId.cs @@ -0,0 +1,18 @@ +using System; +using HarmonyLib; +using MelonLoader; +using Net.Packet; +using Net.Packet.Mai2; +using Net.VO.Mai2; + +namespace AquaMai.Utils; + +public class LogUserId +{ + [HarmonyPostfix] + [HarmonyPatch(typeof(PacketGetUserPreview), MethodType.Constructor, typeof(ulong), typeof(string), typeof(Action), typeof(Action))] + public static void Postfix(ulong userId) + { + MelonLogger.Msg($"UserLogin: {userId}"); + } +}