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
RevLine 
[332]1using System.Collections.Generic;
[321]2using AllocsFixes.JSON;
3using AllocsFixes.PersistentData;
[454]4using Webserver;
5using Webserver.WebAPI;
[321]6
[454]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);
[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) {
[446]22 AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (p, showIconColor, showIconName));
[325]23 }
[321]24 }
25
[454]26 LegacyApiHelper.WriteJSON (_context.Response, AllInventoriesResult);
[321]27 }
28 }
[325]29}
Note: See TracBrowser for help on using the repository browser.