Second attempt at fixing prestige issue #558

This commit is contained in:
Chomp
2025-08-19 12:04:15 +01:00
parent 22ab053cda
commit 7eb88646f2
2 changed files with 18 additions and 13 deletions
@@ -82,7 +82,18 @@ public class PlayerScavGenerator(
pmcDataClone
);
// Remove cached bot data after scav was generated
// Add additional items to player scav as loot
AddAdditionalLootToPlayerScavContainers(
scavData.Id.Value,
playerScavKarmaSettings.LootItemsToAddChancePercent,
scavData,
[EquipmentSlots.TacticalVest, EquipmentSlots.Pockets, EquipmentSlots.Backpack]
);
// No need for cache data, clear up
botInventoryContainerService.ClearCache(scavData.Id.Value);
// Remove cached bot loot cache now scav is generated
botLootCacheService.ClearCache();
// Add scav metadata
@@ -112,17 +123,6 @@ public class PlayerScavGenerator(
scavData.WishList = existingScavDataClone.WishList ?? new();
scavData.Encyclopedia = pmcDataClone.Encyclopedia ?? new();
// Add additional items to player scav as loot
AddAdditionalLootToPlayerScavContainers(
scavData.Id.Value,
playerScavKarmaSettings.LootItemsToAddChancePercent,
scavData,
[EquipmentSlots.TacticalVest, EquipmentSlots.Pockets, EquipmentSlots.Backpack]
);
// No need for cache data, clear up
botInventoryContainerService.ClearCache(scavData.Id.Value);
// Remove secure container
scavData = profileHelper.RemoveSecureContainer(scavData);
@@ -88,9 +88,14 @@ public class ProfileHelper(
/// <param name="clonedProfile">A clone of the full player profile</param>
protected void SanitizeProfileForClient(SptProfile clonedProfile)
{
if (clonedProfile.CharacterData?.PmcData?.TradersInfo?.Values is null)
{
return;
}
// Remove `loyaltyLevel` from `TradersInfo`, as otherwise it causes the client to not
// properly calculate the player's `loyaltyLevel`
foreach (var trader in clonedProfile.CharacterData?.PmcData?.TradersInfo?.Values!)
foreach (var trader in clonedProfile.CharacterData.PmcData.TradersInfo.Values)
{
trader.LoyaltyLevel = null;
}