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