| Line | |
|---|
| 1 | using System.Collections.Generic;
|
|---|
| 2 | using AllocsFixes.JSON;
|
|---|
| 3 | using AllocsFixes.PersistentData;
|
|---|
| 4 | using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
|
|---|
| 5 | using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
|
|---|
| 6 |
|
|---|
| 7 | namespace AllocsFixes.NetConnections.Servers.Web.API {
|
|---|
| 8 | public class GetPlayerInventories : WebAPI {
|
|---|
| 9 | public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
|
|---|
| 10 | int _permissionLevel) {
|
|---|
| 11 | GetPlayerInventory.GetInventoryArguments (_req, out bool showIconColor, out bool showIconName);
|
|---|
| 12 |
|
|---|
| 13 | JSONArray AllInventoriesResult = new JSONArray ();
|
|---|
| 14 |
|
|---|
| 15 | foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) {
|
|---|
| 16 | Player p = kvp.Value;
|
|---|
| 17 |
|
|---|
| 18 | if (p == null) {
|
|---|
| 19 | continue;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | if (p.IsOnline) {
|
|---|
| 23 | AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key.CombinedString, p, showIconColor, showIconName));
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | WriteJSON (_resp, AllInventoriesResult);
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.