Last change
on this file since 389 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
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using AllocsFixes.JSON;
|
---|
3 | using AllocsFixes.PersistentData;
|
---|
4 |
|
---|
5 | namespace AllocsFixes.NetConnections.Servers.Web.API {
|
---|
6 | public class GetPlayerInventories : AbsWebAPI {
|
---|
7 | public override void HandleRequest (RequestContext _context) {
|
---|
8 | GetPlayerInventory.GetInventoryArguments (_context.Request, out bool showIconColor, out bool showIconName);
|
---|
9 |
|
---|
10 | JSONArray AllInventoriesResult = new JSONArray ();
|
---|
11 |
|
---|
12 | foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) {
|
---|
13 | Player p = kvp.Value;
|
---|
14 |
|
---|
15 | if (p == null) {
|
---|
16 | continue;
|
---|
17 | }
|
---|
18 |
|
---|
19 | if (p.IsOnline) {
|
---|
20 | AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (kvp.Key.CombinedString, p, showIconColor, showIconName));
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | WebUtils.WriteJson (_context.Response, AllInventoriesResult);
|
---|
25 | }
|
---|
26 | }
|
---|
27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.