Rev | Line | |
---|
[244] | 1 | using AllocsFixes.JSON;
|
---|
| 2 | using AllocsFixes.PersistentData;
|
---|
| 3 | using System;
|
---|
| 4 | using System.Collections.Generic;
|
---|
| 5 | using System.Net;
|
---|
| 6 |
|
---|
| 7 | namespace 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.