Rev | Line | |
---|
[332] | 1 | using System.Collections.Generic;
|
---|
[325] | 2 | using System.Net;
|
---|
[321] | 3 | using AllocsFixes.JSON;
|
---|
| 4 | using AllocsFixes.PersistentData;
|
---|
| 5 |
|
---|
| 6 | namespace 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.