|
Last change
on this file since 454 was 454, checked in by alloc, 2 years ago |
|
24_29_43
Switched over to vanilla Web infrastructure
|
|
File size:
1.0 KB
|
| Rev | Line | |
|---|
| [251] | 1 | using AllocsFixes.JSON;
|
|---|
| 2 | using AllocsFixes.LiveData;
|
|---|
| [454] | 3 | using Webserver;
|
|---|
| 4 | using Webserver.WebAPI;
|
|---|
| [251] | 5 |
|
|---|
| [454] | 6 | namespace AllocsFixes.WebAPIs {
|
|---|
| 7 | public class GetStats : AbsWebAPI {
|
|---|
| 8 | public override void HandleRequest (RequestContext _context) {
|
|---|
| [251] | 9 | JSONObject result = new JSONObject ();
|
|---|
| 10 |
|
|---|
| 11 | JSONObject time = new JSONObject ();
|
|---|
| 12 | time.Add ("days", new JSONNumber (GameUtils.WorldTimeToDays (GameManager.Instance.World.worldTime)));
|
|---|
| 13 | time.Add ("hours", new JSONNumber (GameUtils.WorldTimeToHours (GameManager.Instance.World.worldTime)));
|
|---|
| 14 | time.Add ("minutes", new JSONNumber (GameUtils.WorldTimeToMinutes (GameManager.Instance.World.worldTime)));
|
|---|
| 15 | result.Add ("gametime", time);
|
|---|
| 16 |
|
|---|
| 17 | result.Add ("players", new JSONNumber (GameManager.Instance.World.Players.Count));
|
|---|
| [313] | 18 | result.Add ("hostiles", new JSONNumber (Hostiles.Instance.GetCount ()));
|
|---|
| 19 | result.Add ("animals", new JSONNumber (Animals.Instance.GetCount ()));
|
|---|
| [251] | 20 |
|
|---|
| [454] | 21 | LegacyApiHelper.WriteJSON (_context.Response, result);
|
|---|
| [251] | 22 | }
|
|---|
| [279] | 23 |
|
|---|
| 24 | public override int DefaultPermissionLevel () {
|
|---|
| 25 | return 2000;
|
|---|
| 26 | }
|
|---|
| [251] | 27 | }
|
|---|
| [325] | 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.