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
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) {
[446]22 AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (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.