Skip to content

Commit df2f5c0

Browse files
committed
limit roleId to 16mil to fix the floating point precision bug
1 parent e7551ea commit df2f5c0

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

PatchUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static void LoadMultiplayerData()
7171

7272
var steamId = SteamFriendPrcMgr.Instance.GetMyInfo()._SteamID.m_SteamID;
7373

74-
var roleId = steamId.GetHashCode() ^ customData.charactorName.GetHashCode();
74+
var roleId = (steamId.GetHashCode() ^ customData.charactorName.GetHashCode()) % 16000000;
7575

7676
var role = new CustomData.RoleInfo()
7777
{

UILobbyMainWndCtrl_Patch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public static bool Start(UILobbyMainWndCtrl __instance)
2929

3030
__instance.GetType().GetMethod("InitRoomListSort", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(__instance, new object[] { });
3131

32+
__instance.mRoomInput.bUseClipboard = true;
33+
3234
return false;
3335
}
3436

UIMLoginControl_Patch.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public class UIMLoginControl_Patch
99
[HarmonyPatch("EnterLobby")]
1010
public static bool EnterLobby(UIMLoginControl __instance)
1111
{
12-
Traverse.Create<GameClientLobby>().Property("role").SetValue(MLPlayerInfo.Instance.GetRoleInfo(__instance.rc.GetSelectedIndex()).mRoleInfo);
12+
var role = MLPlayerInfo.Instance.GetRoleInfo(__instance.rc.GetSelectedIndex()).mRoleInfo;
13+
Traverse.Create<GameClientLobby>().Property("role").SetValue(role);
1314
PeSceneCtrl.Instance.GotoLobbyScene();
1415

1516
return false;

UIPlayerBuildCtrl_Patch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static bool CreatePlayer(UIPlayerBuildCtrl __instance)
3333

3434
var steamId = SteamFriendPrcMgr.Instance.GetMyInfo()._SteamID.m_SteamID;
3535

36-
var roleId = steamId.GetHashCode() ^ name.GetHashCode();
36+
var roleId = (steamId.GetHashCode() ^ name.GetHashCode()) % 16000000;
3737

3838
var role = new CustomData.RoleInfo()
3939
{

0 commit comments

Comments
 (0)