source:
binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs@
390
| Last change on this file since 390 was 387, checked in by , 3 years ago | |
|---|---|
| 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)