source: binary-improvements/MapRendering/Web/API/GetPlayerInventories.cs@ 425

Last change on this file since 425 was 369, checked in by alloc, 3 years ago

Preparations for A20 release
Changes usage of "SteamID" to "UserID" in console commands
Also changes a bunch of the WebAPI stuff to show / use UserIDs

File size: 893 bytes
RevLine 
[332]1using System.Collections.Generic;
[325]2using System.Net;
[321]3using AllocsFixes.JSON;
4using AllocsFixes.PersistentData;
5
6namespace AllocsFixes.NetConnections.Servers.Web.API {
7 public class GetPlayerInventories : WebAPI {
[348]8 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
9 int _permissionLevel) {
[369]10 GetPlayerInventory.GetInventoryArguments (_req, out bool showIconColor, out bool showIconName);
[348]11
[325]12 JSONArray AllInventoriesResult = new JSONArray ();
[321]13
[369]14 foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) {
[332]15 Player p = kvp.Value;
[325]16
[321]17 if (p == null) {
18 continue;
19 }
[325]20
21 if (p.IsOnline) {
[369]22 AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key.CombinedString, p, showIconColor, showIconName));
[325]23 }
[321]24 }
25
[348]26 WriteJSON (_resp, AllInventoriesResult);
[321]27 }
28 }
[325]29}
Note: See TracBrowser for help on using the repository browser.