Ignore:
Timestamp:
Oct 28, 2015, 7:51:20 PM (9 years ago)
Author:
peter.souza
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs

    r244 r251  
    1111                public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
    1212                {
    13                         JSONArray playersJsResult = new JSONArray ();
     13            AdminTools admTools = null;
     14
     15            try { admTools = GameManager.Instance.adminTools; } catch { }
     16            try { user = user ?? new WebConnection ("", "", 0L); } catch { } // default user, cheap way to avoid 'null reference exception'
     17
     18            bool bViewAll = false; try { bViewAll = user.CanViewAllPlayers (permissionLevel); } catch { }
     19
     20            JSONArray playersJsResult = new JSONArray ();
    1421
    1522                        Players playersList = PersistentContainer.Instance.Players;
    1623
    1724                        foreach (string sid in playersList.SteamIDs) {
    18                                 Player p = playersList[sid, false];
     25                try {
     26                    if ((admTools != null) && (PetesUtils.ValidText (sid)))
     27                        if (admTools.IsBanned (sid))
     28                            continue;
     29                }
     30                catch { }
    1931
    20                                 JSONObject pos = new JSONObject();
    21                                 pos.Add("x", new JSONNumber(p.LastPosition.x));
    22                                 pos.Add("y", new JSONNumber(p.LastPosition.y));
    23                                 pos.Add("z", new JSONNumber(p.LastPosition.z));
     32                try
     33                {
     34                    Player p = playersList [sid, false];
    2435
    25                                 JSONObject pJson = new JSONObject();
    26                                 pJson.Add("steamid", new JSONString(sid));
    27                                 pJson.Add("ip", new JSONString(p.IP));
    28                                 pJson.Add("name", new JSONString(p.Name));
    29                                 pJson.Add("online", new JSONBoolean(p.IsOnline));
    30                                 pJson.Add("position", pos);
     36                    ulong player_steam_ID = 0L;
     37                    if (!ulong.TryParse (sid, out player_steam_ID))
     38                        player_steam_ID = 0L;
    3139
    32                                 playersJsResult.Add(pJson);
    33                         }
     40                    if ((player_steam_ID == user.SteamID) || bViewAll) {
     41                        JSONObject pos = new JSONObject ();
     42                        pos.Add("x", new JSONNumber (p.LastPosition.x));
     43                        pos.Add("y", new JSONNumber (p.LastPosition.y));
     44                        pos.Add("z", new JSONNumber (p.LastPosition.z));
    3445
    35                         WriteJSON(resp, playersJsResult);
     46                        JSONObject pJson = new JSONObject ();
     47                        pJson.Add("steamid", new JSONString (sid));
     48                        pJson.Add("ip", new JSONString (p.IP));
     49                        pJson.Add("name", new JSONString (p.Name));
     50                        pJson.Add("online", new JSONBoolean (p.IsOnline));
     51                        pJson.Add("position", pos);
     52
     53                        playersJsResult.Add (pJson);
     54                    }
     55                }
     56                catch { }
     57            }
     58
     59                        WriteJSON (resp, playersJsResult);
    3660                }
    3761        }
Note: See TracChangeset for help on using the changeset viewer.