Changeset 443 for binary-improvements/7dtd-server-fixes/src
- Timestamp:
- Jun 10, 2023, 5:47:43 PM (17 months ago)
- Location:
- binary-improvements/7dtd-server-fixes/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/API.cs
r371 r443 23 23 24 24 public void SavePlayerData (ClientInfo _cInfo, PlayerDataFile _playerDataFile) { 25 PersistentContainer.Instance.Players [_cInfo.InternalId, true].Update (_ playerDataFile);25 PersistentContainer.Instance.Players [_cInfo.InternalId, true].Update (_cInfo, _playerDataFile); 26 26 } 27 27 -
binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
r369 r443 141 141 } 142 142 143 public void Update ( PlayerDataFile _pdf) {144 UpdateProgression (_ pdf);143 public void Update (ClientInfo _clientInfo, PlayerDataFile _pdf) { 144 UpdateProgression (_clientInfo, _pdf); 145 145 inventory.Update (_pdf); 146 146 } 147 147 148 private void UpdateProgression ( PlayerDataFile _pdf) {148 private void UpdateProgression (ClientInfo _clientInfo, PlayerDataFile _pdf) { 149 149 if (_pdf.progressionData.Length <= 0) { 150 150 return; 151 151 } 152 152 153 using (PooledBinaryReader pbr = MemoryPools.poolBinaryReader.AllocSync (false)) { 154 pbr.SetBaseStream (_pdf.progressionData); 155 long posBefore = pbr.BaseStream.Position; 156 pbr.BaseStream.Position = 0; 157 Progression p = Progression.Read (pbr, null); 158 pbr.BaseStream.Position = posBefore; 159 expToNextLevel = (uint) p.ExpToNextLevel; 160 level = p.Level; 153 if (!GameManager.Instance.World.Entities.dict.TryGetValue (_clientInfo.entityId, out Entity entity)) { 154 return; 161 155 } 156 157 if (entity is not EntityPlayer ep) { 158 return; 159 } 160 161 expToNextLevel = (uint)ep.Progression.ExpToNextLevel; 162 level = ep.Progression.Level; 162 163 } 163 164
Note:
See TracChangeset
for help on using the changeset viewer.