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

Last change on this file since 454 was 454, checked in by alloc, 16 months ago

24_29_43
Switched over to vanilla Web infrastructure

File size: 829 bytes
Line 
1using System.Collections.Generic;
2using AllocsFixes.JSON;
3using AllocsFixes.PersistentData;
4using Webserver;
5using Webserver.WebAPI;
6
7namespace AllocsFixes.WebAPIs {
8 public class GetPlayerInventories : AbsWebAPI {
9 public override void HandleRequest (RequestContext _context) {
10 GetPlayerInventory.GetInventoryArguments (_context, 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 LegacyApiHelper.WriteJSON (_context.Response, AllInventoriesResult);
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.