Last change
on this file since 388 was 387, checked in by alloc, 2 years ago |
Big refactoring in Web to pass around a Context instead of a bunch of individual arguments all the time
|
File size:
836 bytes
|
Rev | Line | |
---|
[332] | 1 | using System.Collections.Generic;
|
---|
[321] | 2 | using AllocsFixes.JSON;
|
---|
| 3 | using AllocsFixes.PersistentData;
|
---|
| 4 |
|
---|
| 5 | namespace AllocsFixes.NetConnections.Servers.Web.API {
|
---|
[387] | 6 | public class GetPlayerInventories : AbsWebAPI {
|
---|
| 7 | public override void HandleRequest (RequestContext _context) {
|
---|
| 8 | GetPlayerInventory.GetInventoryArguments (_context.Request, out bool showIconColor, out bool showIconName);
|
---|
[348] | 9 |
|
---|
[325] | 10 | JSONArray AllInventoriesResult = new JSONArray ();
|
---|
[321] | 11 |
|
---|
[369] | 12 | foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) {
|
---|
[332] | 13 | Player p = kvp.Value;
|
---|
[325] | 14 |
|
---|
[321] | 15 | if (p == null) {
|
---|
| 16 | continue;
|
---|
| 17 | }
|
---|
[325] | 18 |
|
---|
| 19 | if (p.IsOnline) {
|
---|
[369] | 20 | AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key.CombinedString, p, showIconColor, showIconName));
|
---|
[325] | 21 | }
|
---|
[321] | 22 | }
|
---|
| 23 |
|
---|
[387] | 24 | WebUtils.WriteJson (_context.Response, AllInventoriesResult);
|
---|
[321] | 25 | }
|
---|
| 26 | }
|
---|
[325] | 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.