Changeset 443 for binary-improvements/7dtd-server-fixes/src/PersistentData
- Timestamp:
- Jun 10, 2023, 5:47:43 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.