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

Last change on this file since 364 was 349, checked in by alloc, 6 years ago

Refs #156 - Code typo

File size: 887 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) {
10
11 bool showIconColor, showIconName;
12 GetPlayerInventory.GetInventoryArguments (_req, out showIconColor, out showIconName);
13
[325]14 JSONArray AllInventoriesResult = new JSONArray ();
[321]15
[332]16 foreach (KeyValuePair<string, Player> kvp in PersistentContainer.Instance.Players.Dict) {
17 Player p = kvp.Value;
[325]18
[321]19 if (p == null) {
20 continue;
21 }
[325]22
23 if (p.IsOnline) {
[349]24 AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key, p, showIconColor, showIconName));
[325]25 }
[321]26 }
27
[348]28 WriteJSON (_resp, AllInventoriesResult);
[321]29 }
30 }
[325]31}
Note: See TracBrowser for help on using the repository browser.