source: binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs@ 384

Last change on this file since 384 was 383, checked in by alloc, 2 years ago

Fixed a bunch of warnings

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