Changeset 369 for binary-improvements/MapRendering/Web/API/GetPlayerList.cs
- Timestamp:
- Nov 9, 2021, 6:28:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/GetPlayerList.cs
r351 r369 6 6 using AllocsFixes.JSON; 7 7 using AllocsFixes.PersistentData; 8 using UnityEngine.Profiling;9 8 10 9 namespace AllocsFixes.NetConnections.Servers.Web.API { … … 14 13 15 14 #if ENABLE_PROFILER 16 private static readonly CustomSampler jsonSerializeSampler =CustomSampler.Create ("JSON_Build");15 private static readonly UnityEngine.Profiling.CustomSampler jsonSerializeSampler = UnityEngine.Profiling.CustomSampler.Create ("JSON_Build"); 17 16 #endif 18 17 … … 20 19 int _permissionLevel) { 21 20 AdminTools admTools = GameManager.Instance.adminTools; 22 _user = _user ?? new WebConnection ("", IPAddress.None, 0L);21 PlatformUserIdentifierAbs userId = _user?.UserId; 23 22 24 23 bool bViewAll = WebConnection.CanViewAllPlayers (_permissionLevel); … … 47 46 #endif 48 47 49 foreach (KeyValuePair< string, Player> kvp in playersList.Dict) {48 foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in playersList.Dict) { 50 49 Player p = kvp.Value; 51 50 52 ulong player_steam_ID; 53 if (!ulong.TryParse (kvp.Key, out player_steam_ID)) { 54 player_steam_ID = 0L; 55 } 56 57 if (player_steam_ID == _user.SteamID || bViewAll) { 51 if (bViewAll || p.PlatformId.Equals (userId)) { 58 52 JSONObject pos = new JSONObject (); 59 53 pos.Add ("x", new JSONNumber (p.LastPosition.x)); … … 62 56 63 57 JSONObject pJson = new JSONObject (); 64 pJson.Add ("steamid", new JSONString (kvp.Key ));58 pJson.Add ("steamid", new JSONString (kvp.Key.CombinedString)); 65 59 pJson.Add ("entityid", new JSONNumber (p.EntityID)); 66 60 pJson.Add ("ip", new JSONString (p.IP)); … … 74 68 pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1)); 75 69 76 JSONBoolean banned; 77 if (admTools != null) { 78 banned = new JSONBoolean (admTools.IsBanned (kvp.Key)); 79 } else { 80 banned = new JSONBoolean (false); 81 } 70 JSONBoolean banned = admTools != null ? new JSONBoolean (admTools.IsBanned (kvp.Key, out _, out _)) : new JSONBoolean (false); 82 71 83 72 pJson.Add ("banned", banned);
Note:
See TracChangeset
for help on using the changeset viewer.