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

Last change on this file since 446 was 446, checked in by alloc, 17 months ago

24_27_41

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