Changeset 233 for binary-improvements/7dtd-server-fixes/src/PersistentData
- Timestamp:
- Apr 30, 2015, 1:55:16 AM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/PersistentData
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r230 r233 20 20 private int 21 21 lastPositionX, lastPositionY, lastPositionZ; 22 [OptionalField] 23 private uint experience; 22 24 [NonSerialized] 23 25 private ClientInfo … … 94 96 } 95 97 98 public uint Experience { 99 get { 100 return experience; 101 } 102 } 103 104 public float Level { 105 get { 106 float perc = (float)experience / 600000; 107 perc = Mathf.Sqrt (perc); 108 return Mathf.Clamp ((perc * 60) + 1, 1, 60); 109 } 110 } 111 96 112 public void SetOffline () 97 113 { … … 121 137 } 122 138 139 public void Update (PlayerDataFile _pdf) { 140 experience = _pdf.experience; 141 inventory.Update (_pdf); 142 } 143 123 144 public Player (string steamId) 124 145 { -
binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
r202 r233 11 11 private Dictionary<string, Player> players = new Dictionary<string, Player> (); 12 12 13 public Player this [string steamId ] {13 public Player this [string steamId, bool create] { 14 14 get { 15 15 if (players.ContainsKey (steamId)) 16 16 return players [steamId]; 17 17 else { 18 if ( steamId != null && steamId.Length == 17) {18 if (create && steamId != null && steamId.Length == 17) { 19 19 Log.Out ("Created new player entry for ID: " + steamId); 20 20 Player p = new Player (steamId); … … 35 35 } 36 36 37 public Player GetPlayerByClientId (int _clientid) 38 { 39 foreach (Player p in players.Values) { 40 if (p.ClientInfo != null && p.ClientInfo.clientId == _clientid) { 41 return p; 42 } 43 } 44 return null; 45 } 46 47 public Player GetPlayerByNameOrId (string _nameOrId, bool _ignoreColorCodes) 48 { 49 string sid = GetSteamID (_nameOrId, _ignoreColorCodes); 50 if (sid != null) 51 return this [sid]; 52 else 53 return null; 54 } 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 // } 55 45 56 46 public string GetSteamID (string _nameOrId, bool _ignoreColorCodes)
Note:
See TracChangeset
for help on using the changeset viewer.