- Timestamp:
- Jan 31, 2018, 2:52:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs
r277 r315 14 14 user = user ?? new WebConnection ("", "", 0L); 15 15 16 bool listOffline = false; 17 if (req.QueryString ["offline"] != null) { 18 bool.TryParse (req.QueryString ["offline"], out listOffline); 19 } 20 16 21 bool bViewAll = WebConnection.CanViewAllPlayers (permissionLevel); 17 22 … … 27 32 Player p = playersList [sid, false]; 28 33 29 ulong player_steam_ID = 0L; 30 if (!ulong.TryParse (sid, out player_steam_ID)) 31 player_steam_ID = 0L; 34 if (listOffline || p.IsOnline) { 35 ulong player_steam_ID = 0L; 36 if (!ulong.TryParse (sid, out player_steam_ID)) 37 player_steam_ID = 0L; 32 38 33 if ((player_steam_ID == user.SteamID) || bViewAll) {34 JSONObject pos = new JSONObject ();35 pos.Add("x", new JSONNumber (p.LastPosition.x));36 pos.Add("y", new JSONNumber (p.LastPosition.y));37 pos.Add("z", new JSONNumber (p.LastPosition.z));39 if ((player_steam_ID == user.SteamID) || bViewAll) { 40 JSONObject pos = new JSONObject (); 41 pos.Add("x", new JSONNumber (p.LastPosition.x)); 42 pos.Add("y", new JSONNumber (p.LastPosition.y)); 43 pos.Add("z", new JSONNumber (p.LastPosition.z)); 38 44 39 JSONObject pJson = new JSONObject ();40 pJson.Add("steamid", new JSONString (sid));41 pJson.Add("entityid", new JSONNumber (p.EntityID));42 pJson.Add("ip", new JSONString (p.IP));43 pJson.Add("name", new JSONString (p.Name));44 pJson.Add("online", new JSONBoolean (p.IsOnline));45 pJson.Add("position", pos);45 JSONObject pJson = new JSONObject (); 46 pJson.Add("steamid", new JSONString (sid)); 47 // pJson.Add("entityid", new JSONNumber (p.EntityID)); 48 // pJson.Add("ip", new JSONString (p.IP)); 49 pJson.Add("name", new JSONString (p.Name)); 50 pJson.Add("online", new JSONBoolean (p.IsOnline)); 51 pJson.Add("position", pos); 46 52 47 pJson.Add ("totalplaytime", new JSONNumber (p.TotalPlayTime));48 pJson.Add ("lastonline", new JSONString (p.LastOnline.ToString ("s")));49 pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1));53 // pJson.Add ("totalplaytime", new JSONNumber (p.TotalPlayTime)); 54 // pJson.Add ("lastonline", new JSONString (p.LastOnline.ToString ("s"))); 55 // pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1)); 50 56 51 playersJsResult.Add (pJson); 52 } 57 playersJsResult.Add (pJson); 58 } 59 } 53 60 } 54 61
Note:
See TracChangeset
for help on using the changeset viewer.