source: binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs@ 252

Last change on this file since 252 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: 2.0 KB
RevLine 
[251]1using System;
2using System.Collections.Generic;
3using System.Runtime.Serialization;
4using System.Text.RegularExpressions;
5
6namespace AllocsFixes.PersistentData
7{
8 [Serializable]
9 public class Players
10 {
11 private Dictionary<string, Player> players = new Dictionary<string, Player> ();
12
13 public Player this [string steamId, bool create] {
14 get {
15 if (players.ContainsKey (steamId))
16 return players [steamId];
17 else {
18 if (create && steamId != null && steamId.Length == 17) {
19 Log.Out ("Created new player entry for ID: " + steamId);
20 Player p = new Player (steamId);
21 players.Add (steamId, p);
22 return p;
23 }
24 return null;
25 }
26 }
27 }
28
29 public List<string> SteamIDs {
30 get { return new List<string> (players.Keys); }
31 }
32
33 public int Count {
34 get { return players.Count; }
35 }
36
37// public Player GetPlayerByNameOrId (string _nameOrId, bool _ignoreColorCodes)
38// {
39// string sid = GetSteamID (_nameOrId, _ignoreColorCodes);
40// if (sid != null)
41// return this [sid];
42// else
43// return null;
44// }
45
46 public string GetSteamID (string _nameOrId, bool _ignoreColorCodes)
47 {
48 if (_nameOrId == null || _nameOrId.Length == 0)
49 return null;
50
51 long tempLong;
52 if (_nameOrId.Length == 17 && long.TryParse (_nameOrId, out tempLong)) {
53 return _nameOrId;
54 } else {
55 int entityId = -1;
56 if (int.TryParse (_nameOrId, out entityId)) {
57 foreach (KeyValuePair<string, Player> kvp in players) {
58 if (kvp.Value.IsOnline && kvp.Value.EntityID == entityId) {
59 return kvp.Key;
60 }
61 }
62 }
63
64 _nameOrId = _nameOrId.ToLower ();
65 foreach (KeyValuePair<string, Player> kvp in players) {
66 string name = kvp.Value.Name.ToLower ();
67 if (_ignoreColorCodes) {
68 name = Regex.Replace (name, "\\[[0-9a-fA-F]{6}\\]", "");
69 }
70 if (kvp.Value.IsOnline && name.Equals (_nameOrId)) {
71 return kvp.Key;
72 }
73 }
74 }
75 return null;
76 }
77 }
78}
79
Note: See TracBrowser for help on using the repository browser.