Rev | Line | |
---|
[391] | 1 | using System.Collections.Generic;
|
---|
| 2 | using AllocsFixes.JSON;
|
---|
| 3 | using AllocsFixes.PersistentData;
|
---|
| 4 | using JetBrains.Annotations;
|
---|
| 5 |
|
---|
| 6 | namespace Webserver.WebAPI {
|
---|
| 7 | [UsedImplicitly]
|
---|
| 8 | public class GetPlayerInventories : AbsWebAPI {
|
---|
| 9 | public override void HandleRequest (RequestContext _context) {
|
---|
| 10 | GetPlayerInventory.GetInventoryArguments (_context.Request, out bool showIconColor, out bool showIconName);
|
---|
| 11 |
|
---|
| 12 | JsonArray allInventoriesResult = new JsonArray ();
|
---|
| 13 |
|
---|
| 14 | foreach ((PlatformUserIdentifierAbs userId, Player player) in PersistentContainer.Instance.Players.Dict) {
|
---|
| 15 | if (player == null) {
|
---|
| 16 | continue;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | if (player.IsOnline) {
|
---|
| 20 | allInventoriesResult.Add (GetPlayerInventory.DoPlayer (userId.CombinedString, player, showIconColor, showIconName));
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | WebUtils.WriteJson (_context.Response, allInventoriesResult);
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.