Adjust resource migration filter

This commit is contained in:
Crypto137 2026-03-25 18:42:06 +03:00
parent 346965116f
commit 74e39fb00a
2 changed files with 24 additions and 4 deletions

View file

@ -1,7 +1,9 @@
using Gazillion;
using MHServerEmu.Core.Memory;
using MHServerEmu.Core.Serialization;
using MHServerEmu.DatabaseAccess.Models;
using MHServerEmu.Games.Entities;
using MHServerEmu.Games.Entities.Avatars;
using MHServerEmu.Games.GameData;
using MHServerEmu.Games.GameData.Prototypes;
using MHServerEmu.Games.Properties;
@ -54,7 +56,25 @@ namespace MHServerEmu.Games.Network
{
List<(ulong, ulong)> propertyList = migrationData.GetOrCreatePropertyList(entity.DatabaseUniqueId);
propertyList.Clear();
entity.Properties.GetPropertiesForMigration(propertyList);
// HACK: Ugly property hack, remove this when we figure out an efficient way to migrate runtime-only conditions.
PropertyEnum propertyToIgnore = PropertyEnum.Invalid;
if (entity is Avatar)
{
switch ((AvatarPrototypeId)entity.PrototypeDataRef)
{
case AvatarPrototypeId.AntMan:
propertyToIgnore = PropertyEnum.SecondaryResource
break;
case AvatarPrototypeId.HumanTorch:
propertyToIgnore = PropertyEnum.Endurance;
break;
}
}
entity.Properties.GetPropertiesForMigration(propertyList, propertyToIgnore);
}
private static void RestoreProperties(MigrationData migrationData, Entity entity)

View file

@ -844,7 +844,7 @@ namespace MHServerEmu.Games.Properties
return success;
}
public void GetPropertiesForMigration(List<(ulong, ulong)> propertyList)
public void GetPropertiesForMigration(List<(ulong, ulong)> propertyList, PropertyEnum propertyToIgnore = PropertyEnum.Invalid)
{
PropertyEnum prevProperty = PropertyEnum.Invalid;
PropertyInfoPrototype propInfoProto = null;
@ -860,9 +860,9 @@ namespace MHServerEmu.Games.Properties
prevProperty = propertyEnum;
}
// HACK: Do not migrate mana because we don't migrate conditions, which can cause some heroes to get stuck in bad state (e.g. Human Torch).
// HACK: Do not migrate some properties because we don't migrate conditions, which can cause some heroes to get stuck in bad state (e.g. Human Torch, Ant-Man).
// This can be removed if we ever start migrating runtime-only conditions.
if (propertyEnum == PropertyEnum.Endurance)
if (propertyEnum == propertyToIgnore)
continue;
// Migrate properties that are not saved to the database, but are supposed to be replicated for transfer