source: binary-improvements/MapRendering/Web/API/GetStats.cs@ 246

Last change on this file since 246 was 245, checked in by alloc, 9 years ago

Fixes

File size: 917 bytes
RevLine 
[244]1using AllocsFixes.JSON;
2using AllocsFixes.PersistentData;
3using System;
4using System.Collections.Generic;
5using System.Net;
6
7namespace AllocsFixes.NetConnections.Servers.Web.API
8{
9 public class GetStats : WebAPI
10 {
11 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
12 {
13 JSONObject result = new JSONObject ();
14
15 JSONObject time = new JSONObject ();
16 time.Add ("days", new JSONNumber (GameUtils.WorldTimeToDays (GameManager.Instance.World.worldTime)));
17 time.Add ("hours", new JSONNumber (GameUtils.WorldTimeToHours (GameManager.Instance.World.worldTime)));
18 time.Add ("minutes", new JSONNumber (GameUtils.WorldTimeToMinutes (GameManager.Instance.World.worldTime)));
19 result.Add ("gametime", time);
20
[245]21 result.Add ("players", new JSONNumber (GameManager.Instance.World.Players.Count));
22
[244]23 WriteJSON (resp, result);
24 }
25 }
26}
27
Note: See TracBrowser for help on using the repository browser.