Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Net;
|
---|
3 | using AllocsFixes.JSON;
|
---|
4 | using AllocsFixes.PersistentData;
|
---|
5 |
|
---|
6 | namespace 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, showIconName, showIconName));
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | WriteJSON (_resp, AllInventoriesResult);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.