Changeset 443 for binary-improvements/7dtd-server-fixes
- Timestamp:
- Jun 10, 2023, 5:47:43 PM (18 months ago)
- Location:
- binary-improvements/7dtd-server-fixes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r420 r443 11 11 <RootNamespace>AllocsFixes</RootNamespace> 12 12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 13 <LangVersion>9</LangVersion> 13 14 </PropertyGroup> 14 15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> -
binary-improvements/7dtd-server-fixes/ModInfo.xml
r442 r443 5 5 <Description value="Common functions" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="2 5" />7 <Version value="26" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
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.