private void GetPlayerColor(bool shouldSort = true) { playerColor = ""; switch (PlayerListConfig.displayNameColorMode.Value) { case DisplayNameColorMode.TrustAndFriends: playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser)); break; case DisplayNameColorMode.None: break; case DisplayNameColorMode.TrustOnly: // ty bono for this (https://github.com/ddakebono/) spoofFriend = true; playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser)); break; case DisplayNameColorMode.FriendsOnly: if (APIUser.IsFriendsWith(apiUser.id)) { playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser)); } break; } if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.NameColor) && shouldSort) { EntrySortManager.SortPlayer(playerLeftPairEntry); } }
public override void OnConfigChanged() { GetPlayerColor(false); if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.Distance)) { EntrySortManager.SortPlayer(playerLeftPairEntry); } }
public static void OnStaticConfigChanged() { updateDelegate = null; if (PlayerListConfig.pingToggle.Value) { updateDelegate += AddPing; } if (PlayerListConfig.fpsToggle.Value) { updateDelegate += AddFps; } if (PlayerListConfig.platformToggle.Value) { updateDelegate += AddPlatform; } if (PlayerListConfig.perfToggle.Value) { updateDelegate += AddPerf; } if (PlayerListConfig.distanceToggle.Value) { updateDelegate += AddDistance; } if (PlayerListConfig.photonIdToggle.Value) { updateDelegate += AddPhotonId; } if (PlayerListConfig.ownedObjectsToggle.Value) { if (VRCUtils.AreRiskyFunctionsAllowed) { updateDelegate += AddOwnedObjects; } else { updateDelegate += AddOwnedObjectsSafe; } } if (PlayerListConfig.displayNameToggle.Value) { updateDelegate += AddDisplayName; } if (PlayerListConfig.distanceToggle.Value && EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.Distance) || PlayerListConfig.pingToggle.Value && EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.Ping)) { updateDelegate += (PlayerNet playerNet, PlayerEntry entry, ref StringBuilder tempString) => EntrySortManager.SortPlayer(entry.playerLeftPairEntry); } if (PlayerListConfig.condensedText.Value) { separator = "|"; } else { separator = " | "; } EntryManager.RefreshPlayerEntries(); }
private void GetPlayerColor() { playerColor = ""; switch (PlayerListConfig.displayNameColorMode.Value) { case DisplayNameColorMode.None: case DisplayNameColorMode.FriendsOnly: break; case DisplayNameColorMode.TrustAndFriends: case DisplayNameColorMode.TrustOnly: playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(APIUser.CurrentUser)); break; } if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.NameColor) && playerLeftPairEntry != null) { EntrySortManager.SortPlayer(playerLeftPairEntry); } }
public static void EntryInit() { UiManager.OnQuickMenuOpened += new Action(() => { foreach (PlayerLeftPairEntry entry in EntryManager.playerLeftPairsEntries) { entry.playerEntry.GetPlayerColor(false); } EntrySortManager.SortAllPlayers(); EntryManager.RefreshPlayerEntries(); }); PlayerListConfig.OnConfigChanged += OnStaticConfigChanged; NetworkEvents.OnFriended += OnFriended; NetworkEvents.OnUnfriended += OnUnfriended; NetworkEvents.OnSetupFlagsReceived += OnSetupFlagsReceived; VRCUtils.OnEmmWorldCheckCompleted += (allowed) => OnStaticConfigChanged(); PlayerListMod.Instance.HarmonyInstance.Patch(typeof(PhotonView).GetMethods().First(mb => mb.Name.StartsWith("Method_FamOrAssem_set_Void_Int32_")), new HarmonyMethod(typeof(PlayerEntry).GetMethod(nameof(OnOwnerShipTransferred), BindingFlags.NonPublic | BindingFlags.Static))); PlayerListMod.Instance.HarmonyInstance.Patch(typeof(APIUser).GetMethod("IsFriendsWith"), new HarmonyMethod(typeof(PlayerEntry).GetMethod(nameof(OnIsFriend), BindingFlags.NonPublic | BindingFlags.Static))); }
public override void OnAvatarInstantiated(VRCAvatarManager manager, ApiAvatar avatar, GameObject gameObject) { apiUser = player.prop_APIUser_0; userId = apiUser.id; if (manager.field_Private_VRCPlayer_0.prop_Player_0.prop_APIUser_0?.id != userId) { return; } perf = manager.prop_AvatarPerformanceStats_0.field_Private_ArrayOf_PerformanceRating_0[(int)AvatarPerformanceCategory.Overall]; perfString = "<color=#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, perf)) + ">" + PlayerUtils.ParsePerformanceText(perf) + "</color>"; if (player.prop_PlayerNet_0 != null) { UpdateEntry(player.prop_PlayerNet_0, this, true); } if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.AvatarPerf)) { EntrySortManager.SortPlayer(playerLeftPairEntry); } }