Persist behavior progress in entity snapshots
This commit is contained in:
parent
6bcf6444b9
commit
3c4fe6fd10
7 changed files with 137 additions and 5 deletions
|
|
@ -440,10 +440,26 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
.Select(group => new AetheriaWeaponGroupSnapshot { EquipmentIndices = group })
|
||||
.ToArray(),
|
||||
StatGrids = ToEntityStatGrids(entity.StatGrids),
|
||||
ActiveConsumables = ToActiveConsumables(entity.ActiveConsumables)
|
||||
ActiveConsumables = ToActiveConsumables(entity.ActiveConsumables),
|
||||
BehaviorProgress = ToBehaviorProgress(entity.BehaviorProgress)
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaBehaviorProgressSnapshot[] ToBehaviorProgress(
|
||||
IReadOnlyList<AetheriaRuntimeBehaviorProgressCommit>? progress)
|
||||
{
|
||||
return (progress ?? Array.Empty<AetheriaRuntimeBehaviorProgressCommit>())
|
||||
.Select(entry => new AetheriaBehaviorProgressSnapshot
|
||||
{
|
||||
OwnerKind = entry.OwnerKind ?? "",
|
||||
OwnerIndex = entry.OwnerIndex,
|
||||
BehaviorIndex = entry.BehaviorIndex,
|
||||
BehaviorKind = entry.BehaviorKind ?? "",
|
||||
Progress = entry.Progress
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static AetheriaActiveConsumableSnapshot[] ToActiveConsumables(
|
||||
IReadOnlyList<AetheriaRuntimeActiveConsumableCommit>? consumables)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -482,6 +482,9 @@ public sealed class AetheriaEntitySnapshot
|
|||
|
||||
[Key(20)]
|
||||
public AetheriaActiveConsumableSnapshot[] ActiveConsumables { get; set; } = [];
|
||||
|
||||
[Key(21)]
|
||||
public AetheriaBehaviorProgressSnapshot[] BehaviorProgress { get; set; } = [];
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -534,6 +537,25 @@ public sealed class AetheriaActiveConsumableSnapshot
|
|||
public double Duration { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaBehaviorProgressSnapshot
|
||||
{
|
||||
[Key(0)]
|
||||
public string OwnerKind { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public int OwnerIndex { get; set; } = -1;
|
||||
|
||||
[Key(2)]
|
||||
public int BehaviorIndex { get; set; } = -1;
|
||||
|
||||
[Key(3)]
|
||||
public string BehaviorKind { get; set; } = "";
|
||||
|
||||
[Key(4)]
|
||||
public double Progress { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaActionBarBinding
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue