- Timestamp:
- Sep 4, 2018, 2:33:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r325 r326 174 174 175 175 public void SetOffline () { 176 if (clientInfo != null) { 177 Log.Out ("Player set to offline: " + steamId); 178 lastOnline = DateTime.Now; 179 try { 180 Vector3i lastPos = new Vector3i (Entity.GetPosition ()); 181 lastPositionX = lastPos.x; 182 lastPositionY = lastPos.y; 183 lastPositionZ = lastPos.z; 184 totalPlayTime += (long) (Time.timeSinceLevelLoad - Entity.CreationTimeSinceLevelLoad); 185 } catch (NullReferenceException) { 186 Log.Out ("Entity not available. Something seems to be wrong here..."); 187 } 188 189 clientInfo = null; 190 } 176 if (clientInfo == null) { 177 return; 178 } 179 180 Log.Out ("Player set to offline: " + steamId); 181 lastOnline = DateTime.Now; 182 try { 183 Vector3i lastPos = new Vector3i (Entity.GetPosition ()); 184 lastPositionX = lastPos.x; 185 lastPositionY = lastPos.y; 186 lastPositionZ = lastPos.z; 187 totalPlayTime += (long) (Time.timeSinceLevelLoad - Entity.CreationTimeSinceLevelLoad); 188 } catch (NullReferenceException) { 189 Log.Out ("Entity not available. Something seems to be wrong here..."); 190 } 191 192 clientInfo = null; 191 193 } 192 194 … … 206 208 207 209 private void UpdateProgression (PlayerDataFile _pdf) { 208 if (_pdf.progressionData.Length > 0) { 209 using (PooledBinaryReader pbr = MemoryPools.poolBinaryReader.AllocSync (false)) { 210 pbr.SetBaseStream (_pdf.progressionData); 211 Progression p = Progression.Read (pbr, null); 212 expToNextLevel = (uint) p.ExpToNextLevel; 213 level = p.Level; 214 } 210 if (_pdf.progressionData.Length <= 0) { 211 return; 212 } 213 214 using (PooledBinaryReader pbr = MemoryPools.poolBinaryReader.AllocSync (false)) { 215 pbr.SetBaseStream (_pdf.progressionData); 216 Progression p = Progression.Read (pbr, null); 217 expToNextLevel = (uint) p.ExpToNextLevel; 218 level = p.Level; 215 219 } 216 220 }
Note:
See TracChangeset
for help on using the changeset viewer.