source: binary-improvements/MapRendering/Web/API/GetHostileLocation.cs@ 267

Last change on this file since 267 was 251, checked in by peter.souza, 9 years ago

Enemies (zombies and hostile animal entities) are now shown on the map as Hostiles and require permission level 'webapi.gethostilelocation' for web viewers to see.

Animals (non-hostile entities) are now shown on the map as Animals and require permission level 'webapi.getanimalslocation' for web viewers to see.

Permission level for 'webapi.viewallclaims' is now required for a viewer to see all claims, otherwise the permission level for 'webapi.getlandclaims' will only show viewer-owned claims. A viewer requires both 'webapi.getlandclaims' and 'webapi.viewallclaims' to be set for all claims to show (you can't just set 'webapi.viewallclaims').
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317405&viewfull=1#post317405

Permission level for 'webapi.viewallplayers' is now required for a viewer to see all players, otherwise the permission level for 'webapi.getplayerslocation' will only show the player for the currently-authenticated viewer. A viewer requires both 'webapi.getplayerslocation' and 'webapi.viewallplayers' to be set for all players to show (you can't just set 'webapi.viewallplayers').
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317405&viewfull=1#post317405

Banned players are now hidden from the web map.
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=320702&viewfull=1#post320702

Items using 'CustomIcon' and 'CustomIconTint' are now supported (although the exact tinting may not be perfectly the same as the game).
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317117&viewfull=1#post317117
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317679&viewfull=1#post317679

Map marker icons for players, hostiles, and animals have been updated.

File size: 1.4 KB
RevLine 
[251]1using AllocsFixes.JSON;
2using AllocsFixes.LiveData;
3using System;
4using System.Collections.Generic;
5using System.Net;
6
7namespace AllocsFixes.NetConnections.Servers.Web.API
8{
9 class GetHostileLocation : WebAPI
10 {
11 public override void HandleRequest(HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
12 {
13 JSONArray hostilesJsResult = new JSONArray();
14
15 foreach (EntityEnemy entity in Hostiles.List)
16 {
17 Vector3i position = new Vector3i(entity.GetPosition());
18
19 JSONObject jsonPOS = new JSONObject();
20 jsonPOS.Add("x", new JSONNumber(position.x));
21 jsonPOS.Add("y", new JSONNumber(position.y));
22 jsonPOS.Add("z", new JSONNumber(position.z));
23
24 JSONObject pJson = new JSONObject();
25 pJson.Add("id", new JSONNumber(entity.entityId));
26
27 if (!string.IsNullOrEmpty(entity.EntityName))
28 pJson.Add("name", new JSONString(entity.EntityName));
29 else
30 pJson.Add("name", new JSONString("enemy class #" + entity.entityClass.ToString()));
31
32 pJson.Add("position", jsonPOS);
33
34 hostilesJsResult.Add(pJson);
35 }
36
37 WriteJSON(resp, hostilesJsResult);
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.