feat(player): port retail augmentation stat chain

This commit is contained in:
Erik 2026-07-31 08:08:23 +02:00
parent 0cb60d98a0
commit 461a1fb7b4
22 changed files with 953 additions and 138 deletions

View file

@ -200,27 +200,27 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
SubscribeToRecompute<ClientObject>(
h => inventory.Objects.ObjectAdded += h,
h => inventory.Objects.ObjectAdded -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
SubscribeToRecompute<ClientObject>(
h => inventory.Objects.ObjectUpdated += h,
h => inventory.Objects.ObjectUpdated -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
SubscribeToRecompute<ClientObject>(
h => inventory.Objects.ObjectRemoved += h,
h => inventory.Objects.ObjectRemoved -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
SubscribeToRecompute<ClientObjectMove>(
h => inventory.Objects.ObjectMoved += h,
h => inventory.Objects.ObjectMoved -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
SubscribeToRecompute<uint>(
h => inventory.Objects.ContainerContentsReplaced += h,
h => inventory.Objects.ContainerContentsReplaced -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
SubscribeParameterless(
h => inventory.Objects.Cleared += h,
h => inventory.Objects.Cleared -= h,
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
() => RecomputePlayerQualities(inventory, character));
Subscribe<LocalPlayerState.AttributeKind>(
h => character.Character.LocalPlayer.AttributeChanged += h,
h => character.Character.LocalPlayer.AttributeChanged -= h,
@ -365,7 +365,8 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
/// </summary>
private static void RecomputeBurden(
LiveInventorySessionBindings inventory,
LiveCharacterSessionBindings character)
LiveCharacterSessionBindings character,
bool notify = true)
{
uint player = inventory.PlayerGuid();
ClientObject? playerObject = inventory.Objects.Get(player);
@ -381,6 +382,22 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
: inventory.Objects.SumCarriedBurden(player);
float load = EncumbranceSystem.Load(capacity, burden);
character.Character.MovementSkills.UpdateBurden(load);
if (notify)
character.OnMovementStatsUpdated?.Invoke();
}
private static void RecomputePlayerQualities(
LiveInventorySessionBindings inventory,
LiveCharacterSessionBindings character)
{
RecomputeBurden(inventory, character, notify: false);
RecomputePvpStatus(inventory, character, notify: false);
uint player = inventory.PlayerGuid();
PropertyBundle properties = inventory.Objects.Get(player)?.Properties
?? character.Character.LocalPlayer.Properties;
character.Character.UpdateMovementSkillAugmentations(
PlayerSkillMath.AugmentationBonuses.FromProperties(properties));
character.OnMovementStatsUpdated?.Invoke();
}
@ -397,7 +414,8 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
/// </summary>
private static void RecomputePvpStatus(
LiveInventorySessionBindings inventory,
LiveCharacterSessionBindings character)
LiveCharacterSessionBindings character,
bool notify = true)
{
uint player = inventory.PlayerGuid();
ClientObject? playerObject = inventory.Objects.Get(player);
@ -415,7 +433,8 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
character.Character.MovementSkills.UpdatePlayerKillerStatus(
pkStatus,
lastPkAttackTimestamp);
character.OnMovementStatsUpdated?.Invoke();
if (notify)
character.OnMovementStatsUpdated?.Invoke();
}
/// <summary>