Skip to content

Commit

Permalink
[+] Log user ID on login
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Sep 10, 2024
1 parent 39dc6c5 commit b7c5d18
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions AquaMai/AquaMai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<Compile Include="Performance\ImproveLoadSpeed.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="Utils\LogUserId.cs" />
<Compile Include="UX\CustomPlaceName.cs" />
<Compile Include="UX\CustomVersionString.cs" />
<Compile Include="UX\DemoMaster.cs" />
Expand Down
4 changes: 4 additions & 0 deletions AquaMai/AquaMai.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ SkipVersionCheck=true
RemoveEncryption=true
ForceAsServer=true
ForceFreePlay=true

[Utils]
# Log user ID on login
LogUserId=false
4 changes: 4 additions & 0 deletions AquaMai/AquaMai.zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@ RemoveEncryption=true
# 如果要配置店内招募的话,应该要把这个关闭
ForceAsServer=true
ForceFreePlay=true

[Utils]
# 登录时将 UserID 输出到日志
LogUserId=false
6 changes: 6 additions & 0 deletions AquaMai/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Config
public CheatConfig Cheat { get; set; }
public PerformanceConfig Performance { get; set; }
public FixConfig Fix { get; set; }
public UtilsConfig Utils { get; set; }

public class CheatConfig
{
Expand Down Expand Up @@ -55,5 +56,10 @@ public class FixConfig
public bool ForceAsServer { get; set; } = true;
public bool ForceFreePlay { get; set; } = true;
}

public class UtilsConfig
{
public bool LogUserId { get; set; }
}
}
}
18 changes: 18 additions & 0 deletions AquaMai/Utils/LogUserId.cs
Original file line number Diff line number Diff line change
@@ -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<ulong, UserPreviewResponseVO>), typeof(Action<PacketStatus>))]
public static void Postfix(ulong userId)
{
MelonLogger.Msg($"UserLogin: {userId}");
}
}

0 comments on commit b7c5d18

Please sign in to comment.