fix(physics): TS-23 - plumb real PK/PKLite/Impenetrable mover flags
Campaign P Slice P3 item 3. The wire parse (CreateObject's PublicWeenieDesc._bitfield), the decode (EntityCollisionFlagsExt. FromPwdBitfield), the per-GUID storage (ClientObjectTable. PublicWeenieBitfield), and the exemption logic (CollisionExemption. ShouldSkip) all already existed and were already correct -- every mover-flags call site just fed a GUID-prefix IsPlayer heuristic instead of the real per-entity PK/PKLite/Impenetrable state (retail OBJECTINFO::init 0x0050cf30 state |= 0x80/0x800/0x1000). Port: - EntityCollisionFlagsExt.ToMoverState translates the decoded PWD bit-space into the ObjectInfoState bit-space FindObjCollisions actually reads -- two different numberings that must not be confused. Deliberately does not translate IsPlayer (every call site already derives that correctly from its own GUID heuristic per #184 Slice 2b). - EntityCollisionFlagsExt.ResolveMoverPvpState is the one shared ClientObjectTable-backed lookup (guid -> ObjectInfoState), replacing what would otherwise have been three separate inline copies across GameWindow/LivePresentationComposition/RemoteTeleportController. - Threaded as a new optional moverPvpState parameter through RuntimeRemotePhysicsUpdater.Tick/TickHidden and RuntimeOrdinaryPhysicsUpdater.TryBegin (default None preserves every pre-P3 caller unchanged), and as PlayerMovementController.OwnPvpFlags for the local player's own two resolve call sites. - TS-23 section 12b: PlayerWeenie.JumpStaminaCost's pk parameter now reads the real PlayerKillerStatus(0x86)/LastPkAttackTimestamp(0x91) pair against retail's 20-second recency window (pkStatus in {4, 0x40} && (timestamp + 20.0) >= now), replacing the P1 hardcoded false. RuntimeMovementSkillState/Snapshot and LiveSessionEventRouter.RecomputePvpStatus push both the PWD bitfield and the PlayerKillerStatus pair reactively, riding the SAME ClientObject event triggers RecomputeBurden already uses. - A conformance test caught a genuine precision bug in the first PK-timer clock choice: DateTimeOffset.UtcNow's Unix-epoch seconds (~1.7 billion) loses ~128 seconds of precision in a 32-bit float, silently swallowing the entire 20-second window. Switched to Environment.TickCount64 (small, monotonic magnitude) -- also the more retail-plausible basis, since LastPkAttackTimestamp is itself a wire PropertyFloat and retail's Timer::cur_time is almost certainly a process/session-relative counter for the same precision reason, not an absolute epoch. Non-PK invariant (the acceptance criterion): an entity with no ClientObjectTable row, or a row whose PublicWeenieBitfield is null or 0, resolves to ObjectInfoState.None -- a no-op OR into moverFlags, bit-identical to every pre-P3 caller's hardcoded value. A dedicated test drives two real ClientObjectTable rows through CollisionExemption.ShouldSkip and confirms PK-vs-PK collides while PK-vs-non-PK and non-PK-vs-non-PK both stay exempt (walk through). Register: TS-23 retired (both the collision-flags and PK-timer halves); the stale "M2 combat must land TS-23" phase-gate note removed. dotnet build + dotnet test (Core.Tests 4008/2 skip, Runtime.Tests 425/0, App.Tests 3968/3 skip, complete solution build) all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8b5425498c
commit
bb7b899bfe
17 changed files with 702 additions and 53 deletions
|
|
@ -482,7 +482,14 @@ internal sealed class LivePresentationCompositionPhase
|
|||
var ordinaryPhysicsUpdater = new LiveEntityOrdinaryPhysicsUpdater(
|
||||
d.EntityObjects.Physics,
|
||||
d.MotionBindings.GetSetupCylinder,
|
||||
d.MotionBindings.GetSetupMoverShape);
|
||||
d.MotionBindings.GetSetupMoverShape,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): the ordinary
|
||||
// mover's own PK/PKLite/Impenetrable bits — same
|
||||
// ClientObjectTable-backed lookup GameWindow's remote
|
||||
// updater uses.
|
||||
guid => AcDream.Core.Physics.EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
d.EntityObjects.Objects,
|
||||
guid));
|
||||
var animationScheduler = new LiveEntityAnimationScheduler(
|
||||
liveEntities,
|
||||
d.PlayerIdentity,
|
||||
|
|
@ -572,7 +579,11 @@ internal sealed class LivePresentationCompositionPhase
|
|||
d.WorldOrigin.CellLocalForSeed,
|
||||
remoteShadowPlacement.Sync,
|
||||
remoteTeleportPresentation.Complete,
|
||||
remoteTeleportPresentation.Begin),
|
||||
remoteTeleportPresentation.Begin,
|
||||
getMoverPvpState: guid =>
|
||||
EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
d.EntityObjects.Objects,
|
||||
guid)),
|
||||
static value => value.Dispose());
|
||||
bindings.BindProjectionPoseReady(
|
||||
equippedLease.Resource,
|
||||
|
|
|
|||
|
|
@ -21,13 +21,17 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
private readonly Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
_getSetupMoverShape;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
|
||||
public LiveEntityOrdinaryPhysicsUpdater(
|
||||
RuntimePhysicsState physics,
|
||||
Func<uint, WorldEntity, (float Radius, float Height)> getSetupCylinder,
|
||||
Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
getSetupMoverShape)
|
||||
getSetupMoverShape,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): see RemotePhysicsUpdater's
|
||||
// identical parameter.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_runtime = new RuntimeOrdinaryPhysicsUpdater(
|
||||
physics ?? throw new ArgumentNullException(nameof(physics)));
|
||||
|
|
@ -35,6 +39,7 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
?? throw new ArgumentNullException(nameof(getSetupCylinder));
|
||||
_getSetupMoverShape = getSetupMoverShape
|
||||
?? throw new ArgumentNullException(nameof(getSetupMoverShape));
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
}
|
||||
|
||||
public bool Tick(
|
||||
|
|
@ -82,7 +87,8 @@ internal sealed class LiveEntityOrdinaryPhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight))
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(record.ServerGuid)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ internal sealed class RemotePhysicsUpdater
|
|||
private readonly Func<uint, WorldEntity,
|
||||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
_getSetupMoverShape;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
private readonly Action<uint, LiveEntityAnimationState, RemoteMotion, Vector3>
|
||||
_applyServerControlledVelocityCycle;
|
||||
private readonly List<LiveEntityRecord> _spatialRemoteSnapshot = new();
|
||||
|
|
@ -33,7 +34,14 @@ internal sealed class RemotePhysicsUpdater
|
|||
(ImmutableArray<FlatCollisionSphere> Spheres, float Scale, float StepUpHeight, float StepDownHeight)>
|
||||
getSetupMoverShape,
|
||||
Action<uint, LiveEntityAnimationState, RemoteMotion, Vector3>
|
||||
applyServerControlledVelocityCycle)
|
||||
applyServerControlledVelocityCycle,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): resolves a remote's own
|
||||
// PK/PKLite/Impenetrable ObjectInfoState bits by server guid
|
||||
// (ClientObjectTable.PublicWeenieBitfield → EntityCollisionFlagsExt.
|
||||
// FromPwdBitfield → ToMoverState). Default (null) always returns
|
||||
// None — bit-identical to the pre-P3 behavior for every caller that
|
||||
// doesn't supply one.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_runtime = new RuntimeRemotePhysicsUpdater(
|
||||
physics ?? throw new ArgumentNullException(nameof(physics)));
|
||||
|
|
@ -41,6 +49,7 @@ internal sealed class RemotePhysicsUpdater
|
|||
?? throw new ArgumentNullException(nameof(getSetupCylinder));
|
||||
_getSetupMoverShape = getSetupMoverShape
|
||||
?? throw new ArgumentNullException(nameof(getSetupMoverShape));
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
_applyServerControlledVelocityCycle =
|
||||
applyServerControlledVelocityCycle
|
||||
?? throw new ArgumentNullException(
|
||||
|
|
@ -235,7 +244,8 @@ internal sealed class RemotePhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight);
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(ownerRecord.ServerGuid));
|
||||
}
|
||||
|
||||
public bool TickHidden(
|
||||
|
|
@ -289,7 +299,8 @@ internal sealed class RemotePhysicsUpdater
|
|||
sphereList: shape.Spheres,
|
||||
sphereScale: shape.Scale,
|
||||
stepUpHeight: shape.StepUpHeight,
|
||||
stepDownHeight: shape.StepDownHeight);
|
||||
stepDownHeight: shape.StepDownHeight,
|
||||
moverPvpState: _getMoverPvpState(ownerRecord.ServerGuid));
|
||||
}
|
||||
|
||||
public void SyncRemoteShadowToBody(
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
private readonly Action<uint, ushort, bool> _completeAuthoritativePlacement;
|
||||
private readonly Action<uint, ushort> _beginAuthoritativePlacement;
|
||||
private readonly PlacementResolver _resolvePlacement;
|
||||
private readonly Func<uint, ObjectInfoState> _getMoverPvpState;
|
||||
private readonly Dictionary<RuntimeEntityKey, PendingPlacement> _pending = new();
|
||||
|
||||
internal RemoteTeleportController(
|
||||
|
|
@ -43,7 +44,10 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
Action<WorldEntity, PhysicsBody, uint> syncResolvedShadow,
|
||||
Action<uint, ushort, bool> completeAuthoritativePlacement,
|
||||
Action<uint, ushort> beginAuthoritativePlacement,
|
||||
PlacementResolver? resolvePlacement = null)
|
||||
PlacementResolver? resolvePlacement = null,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): see
|
||||
// RemotePhysicsUpdater's identical parameter.
|
||||
Func<uint, ObjectInfoState>? getMoverPvpState = null)
|
||||
{
|
||||
_physics = physics ?? throw new ArgumentNullException(nameof(physics));
|
||||
_liveEntities = liveEntities ?? throw new ArgumentNullException(nameof(liveEntities));
|
||||
|
|
@ -58,6 +62,7 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
_beginAuthoritativePlacement = beginAuthoritativePlacement
|
||||
?? throw new ArgumentNullException(nameof(beginAuthoritativePlacement));
|
||||
_resolvePlacement = resolvePlacement ?? ResolvePlacement;
|
||||
_getMoverPvpState = getMoverPvpState ?? (static _ => ObjectInfoState.None);
|
||||
_liveEntities.ProjectionVisibilityChanged += OnProjectionVisibilityChanged;
|
||||
}
|
||||
|
||||
|
|
@ -286,9 +291,12 @@ internal sealed class RemoteTeleportController : IDisposable
|
|||
request.RequestedCellId,
|
||||
radius,
|
||||
height,
|
||||
IsPlayerGuid(request.Entity.ServerGuid)
|
||||
// TS-23: moverPvpState is a no-op OR (None) for every non-PK
|
||||
// remote.
|
||||
(IsPlayerGuid(request.Entity.ServerGuid)
|
||||
? ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide
|
||||
: ObjectInfoState.EdgeSlide,
|
||||
: ObjectInfoState.EdgeSlide)
|
||||
| _getMoverPvpState(request.Entity.ServerGuid),
|
||||
request.Entity.Id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,18 @@ public sealed class GameWindow :
|
|||
private AcDream.Core.Physics.PhysicsDataCache _physicsDataCache =>
|
||||
_runtimeEntityObjects.Physics.DataCache;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): resolves a mover's own
|
||||
/// PK/PKLite/Impenetrable <see cref="AcDream.Core.Physics.ObjectInfoState"/>
|
||||
/// bits from its <c>ClientObjectTable</c> row — the same table CreateObject
|
||||
/// already populates <c>PublicWeenieBitfield</c> on (per-GUID, including
|
||||
/// every remote's own row, not just collision targets).
|
||||
/// </summary>
|
||||
private AcDream.Core.Physics.ObjectInfoState GetMoverPvpState(uint serverGuid) =>
|
||||
AcDream.Core.Physics.EntityCollisionFlagsExt.ResolveMoverPvpState(
|
||||
_runtimeEntityObjects.Objects,
|
||||
serverGuid);
|
||||
|
||||
// #184 Slice 2a: the per-remote dead-reckoning tick, extracted out of the
|
||||
// >10k-line TickAnimations (Code Structure Rule 1). Reusable setup/motion
|
||||
// policy is supplied through the once-bound live motion runtime, while the
|
||||
|
|
@ -653,7 +665,8 @@ public sealed class GameWindow :
|
|||
_runtimeEntityObjects.Physics,
|
||||
_liveEntityMotionBindings.GetSetupCylinder,
|
||||
_liveEntityMotionBindings.GetSetupMoverShape,
|
||||
AcDream.App.Physics.RemoteServerControlledVelocityCycle.Apply);
|
||||
AcDream.App.Physics.RemoteServerControlledVelocityCycle.Apply,
|
||||
GetMoverPvpState);
|
||||
_remoteInboundMotion = new AcDream.App.Physics.RemoteInboundMotionDispatcher(
|
||||
(movement, cellId, update) =>
|
||||
_liveEntityMotionBindings.RouteServerMoveTo(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using AcDream.Core.Items;
|
||||
|
||||
namespace AcDream.Core.Physics;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -72,4 +74,46 @@ public static class EntityCollisionFlagsExt
|
|||
if ((bitfield & 0x2000000u) != 0) flags |= EntityCollisionFlags.IsPKLite;
|
||||
return flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): translate the decoded
|
||||
/// per-entity <see cref="EntityCollisionFlags"/> (the PWD-bitfield
|
||||
/// bit-space) into the <see cref="ObjectInfoState"/> bits
|
||||
/// <c>CollisionExemption.ShouldSkip</c> and the moverFlags argument to
|
||||
/// <c>PhysicsEngine.ResolveWithTransition</c> actually consume — a
|
||||
/// DIFFERENT bit-space (retail <c>OBJECTINFO::init</c> 0x0050cf30
|
||||
/// `state |= 0x80/0x800/0x1000`, acclient.h:6190-6194) that must not be
|
||||
/// confused with the PWD wire numbering. <see cref="EntityCollisionFlags.IsPlayer"/>
|
||||
/// is deliberately NOT translated here — every existing mover-flags call
|
||||
/// site already derives <see cref="ObjectInfoState.IsPlayer"/> from its
|
||||
/// own GUID-prefix heuristic (correct per #184 Slice 2b) and this helper
|
||||
/// only fills the gap that heuristic cannot: PK/PKLite/Impenetrable.
|
||||
/// </summary>
|
||||
public static ObjectInfoState ToMoverState(this EntityCollisionFlags flags)
|
||||
{
|
||||
var state = ObjectInfoState.None;
|
||||
if ((flags & EntityCollisionFlags.IsPK) != 0) state |= ObjectInfoState.IsPK;
|
||||
if ((flags & EntityCollisionFlags.IsPKLite) != 0) state |= ObjectInfoState.IsPKLite;
|
||||
if ((flags & EntityCollisionFlags.IsImpenetrable) != 0) state |= ObjectInfoState.IsImpenetrable;
|
||||
return state;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): the one shared
|
||||
/// <c>ClientObjectTable</c>-backed mover-flags lookup every physics
|
||||
/// call site (local player world-entry, remote DR sweep + teleport,
|
||||
/// ordinary movers) uses — was inlined three times (App
|
||||
/// <c>GameWindow</c>/<c>LivePresentationComposition</c>/
|
||||
/// <c>RemoteTeleportController</c>) before being consolidated here.
|
||||
/// An entity with no row, or a row with no wire bitfield yet, resolves
|
||||
/// to <see cref="ObjectInfoState.None"/> — a no-op OR into moverFlags,
|
||||
/// bit-identical to every pre-P3 caller.
|
||||
/// </summary>
|
||||
public static ObjectInfoState ResolveMoverPvpState(this ClientObjectTable objects, uint serverGuid)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(objects);
|
||||
return objects.Get(serverGuid)?.PublicWeenieBitfield is { } bitfield
|
||||
? FromPwdBitfield(bitfield).ToMoverState()
|
||||
: ObjectInfoState.None;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ public static class MovementSystem
|
|||
/// campaign plan's shorthand had the operands swapped (see pseudocode
|
||||
/// doc §6). The <c>pk!=0</c> branch is entirely dropped by BN; ACE's
|
||||
/// <c>(power+1.0)*100.0</c> is the tiebreaker. <paramref name="pk"/> is
|
||||
/// hardcoded <c>false</c> at every P1 call site pending TS-23
|
||||
/// (PlayerKillerStatus parsing, Campaign P Slice P3) — ported here for
|
||||
/// signature completeness only.
|
||||
/// the real <c>PlayerKillerStatus</c>/<c>LastPkAttackTimestamp</c>
|
||||
/// 20-second-window predicate as of TS-23 (Campaign P Slice P3,
|
||||
/// 2026-07-30) — see <see cref="PlayerWeenie.JumpStaminaCost"/>.
|
||||
/// </summary>
|
||||
public static int JumpStaminaCost(float power, float burden, bool pk)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,6 +44,20 @@ public sealed class PlayerWeenie : IWeenieObject
|
|||
private int _jumpSkill;
|
||||
private float _burden;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b (Campaign P Slice P3, 2026-07-30): raw
|
||||
/// <c>PropertyInt.PlayerKillerStatus</c> (0x86). <c>null</c> = never
|
||||
/// pushed (matches every pre-P3 caller — no PK-timer bump, today's
|
||||
/// behavior unchanged).
|
||||
/// </summary>
|
||||
private int? _playerKillerStatus;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b: raw <c>PropertyFloat.LastPkAttackTimestamp</c> (0x91).
|
||||
/// <c>null</c> = never pushed / property absent.
|
||||
/// </summary>
|
||||
private float? _lastPkAttackTimestamp;
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>AttributeCache::InqAttribute2nd(ATTR2ND_STAMINA=4)</c>'s
|
||||
/// current-stamina reading, consulted by <c>InqRunRate</c>/
|
||||
|
|
@ -84,6 +98,23 @@ public sealed class PlayerWeenie : IWeenieObject
|
|||
/// </summary>
|
||||
public void SetStamina(uint? currentStamina) => _currentStamina = currentStamina;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b (Campaign P Slice P3, 2026-07-30): pushes the raw
|
||||
/// <c>PropertyInt.PlayerKillerStatus</c> (0x86) / <c>PropertyFloat.
|
||||
/// LastPkAttackTimestamp</c> (0x91) pair <c>CACQualities::
|
||||
/// JumpStaminaCost</c> (0x00591b90) reads for its 20-second PK-timer
|
||||
/// jump-stamina-cost bump. Both <c>null</c> restores "never pushed" (no
|
||||
/// bump, matching every pre-P3 caller). The 20-second recency window
|
||||
/// itself is evaluated fresh at <see cref="JumpStaminaCost"/> call time
|
||||
/// against a live clock, not cached here — the window's EXPIRY has no
|
||||
/// wire event to re-push on.
|
||||
/// </summary>
|
||||
public void SetPlayerKillerStatus(int? playerKillerStatus, float? lastPkAttackTimestamp)
|
||||
{
|
||||
_playerKillerStatus = playerKillerStatus;
|
||||
_lastPkAttackTimestamp = lastPkAttackTimestamp;
|
||||
}
|
||||
|
||||
public bool InqRunRate(out float rate)
|
||||
{
|
||||
int effectiveSkill = _currentStamina == 0 ? 0 : _runSkill;
|
||||
|
|
@ -121,12 +152,49 @@ public sealed class PlayerWeenie : IWeenieObject
|
|||
/// unconditionally (once burden is knowable, which it always is for the
|
||||
/// local player) — retail's own function never exercises the "can't
|
||||
/// afford" false path; see the pseudocode doc §4/§7. TS-5 retired: this
|
||||
/// was previously a zero-cost stub. <c>pk</c> is hardcoded <c>false</c>
|
||||
/// pending TS-23 (PlayerKillerStatus parsing, Campaign P Slice P3).
|
||||
/// was previously a zero-cost stub.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TS-23 §12b (2026-07-30): <c>pk</c> is retail's own formula —
|
||||
/// <c>PlayerKillerStatus</c> (0x86) in {4 (PK), 0x40 (PKLite)} AND
|
||||
/// <c>(LastPkAttackTimestamp + 20.0) >= Timer::cur_time</c>. Both
|
||||
/// <see cref="_playerKillerStatus"/> defaulting to <c>8</c> (retail's own
|
||||
/// <c>InqInt</c> default) and an absent timestamp evaluate to
|
||||
/// <c>pk = false</c> — bit-identical to the pre-P3 hardcoded value for
|
||||
/// every non-PK/PKLite character, which is every ACE default-created
|
||||
/// character (the invariant this port must not break).
|
||||
/// <para>
|
||||
/// "Now" uses <see cref="Environment.TickCount64"/> (process-uptime
|
||||
/// milliseconds), NOT an absolute wall-clock epoch. A first attempt
|
||||
/// used <see cref="DateTimeOffset.UtcNow"/>'s Unix-epoch seconds and a
|
||||
/// conformance test caught the bug it produces: <c>LastPkAttackTimestamp</c>
|
||||
/// is a wire <c>PropertyFloat</c> (32-bit, ~7 significant decimal
|
||||
/// digits) — at a ~1.7-billion-second Unix epoch magnitude, float
|
||||
/// precision only resolves to roughly ±128 seconds, so a 20-second
|
||||
/// recency window is entirely swallowed by rounding error (a `now − 30s`
|
||||
/// timestamp computed the SAME cost as `now`). Retail's own
|
||||
/// <c>Timer::cur_time</c> almost certainly is NOT an absolute epoch for
|
||||
/// exactly this reason — a small process/session-relative counter is
|
||||
/// the only magnitude a 32-bit float can hold with sub-second precision
|
||||
/// for a meaningful session length. This is a documented, evidence-based
|
||||
/// clock CHOICE (a precision bug the test caught, not a guess dressed up
|
||||
/// as fact) — the exact retail epoch/basis was not independently
|
||||
/// confirmed (ACE does not model either property server-side, so this
|
||||
/// branch is inert against every local-ACE test scenario regardless of
|
||||
/// the clock's exact basis; flagged for cdb confirmation if a real PK
|
||||
/// server is ever tested against).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public bool JumpStaminaCost(float extent, out int cost)
|
||||
{
|
||||
cost = MovementSystem.JumpStaminaCost(extent, _burden, pk: false);
|
||||
bool pk = false;
|
||||
int pkStatus = _playerKillerStatus ?? 8; // retail InqInt default when the property is absent
|
||||
if ((pkStatus == 4 || pkStatus == 0x40) && _lastPkAttackTimestamp is { } ts)
|
||||
{
|
||||
float now = Environment.TickCount64 / 1000f;
|
||||
pk = (ts + 20.0f) >= now;
|
||||
}
|
||||
cost = MovementSystem.JumpStaminaCost(extent, _burden, pk);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,21 @@ public sealed class PlayerMovementController
|
|||
/// </summary>
|
||||
public float StepDownHeight { get; set; } = 0.4f;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): the local player's own
|
||||
/// PK/PKLite/Impenetrable <see cref="ObjectInfoState"/> bits, decoded
|
||||
/// from <c>PublicWeenieDesc._bitfield</c> (retail <c>OBJECTINFO::init</c>
|
||||
/// 0x0050cf30 `state |= w->vtable->IsPK()/IsPKLite()/IsImpenetrable()
|
||||
/// ? 0x800/0x1000/0x80`). Set at world-entry and refreshed reactively
|
||||
/// whenever the player's own <c>ClientObject.PublicWeenieBitfield</c>
|
||||
/// changes (same trigger set as <see cref="StepUpHeight"/>'s
|
||||
/// server-skill pushes). Default <see cref="ObjectInfoState.None"/>
|
||||
/// (no PK/PKLite/Impenetrable) is bit-identical to every pre-P3 caller's
|
||||
/// hardcoded <c>IsPlayer | EdgeSlide</c> — the non-PK invariant this
|
||||
/// port must not break.
|
||||
/// </summary>
|
||||
public ObjectInfoState OwnPvpFlags { get; set; } = ObjectInfoState.None;
|
||||
|
||||
/// <summary>
|
||||
/// TS-46 (2026-07-30): the player's own Setup ≤2-sphere list (dat
|
||||
/// <c>CSphere</c> Origin+Radius), verbatim per retail
|
||||
|
|
@ -930,6 +945,22 @@ public sealed class PlayerMovementController
|
|||
_weenie.SetStamina(currentStamina < 0 ? null : (uint)currentStamina);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b (Campaign P Slice P3, 2026-07-30): pushes the raw
|
||||
/// <c>PlayerKillerStatus</c>/<c>LastPkAttackTimestamp</c> pair into
|
||||
/// <see cref="PlayerWeenie.JumpStaminaCost"/>'s PK-timer bump. A
|
||||
/// negative <paramref name="playerKillerStatus"/> restores "never
|
||||
/// pushed" (matches <see cref="SetCharacterStamina"/>'s own sentinel
|
||||
/// convention); <paramref name="lastPkAttackTimestamp"/> is <c>null</c>
|
||||
/// when the property is absent.
|
||||
/// </summary>
|
||||
public void SetCharacterPkStatus(int playerKillerStatus, float? lastPkAttackTimestamp)
|
||||
{
|
||||
_weenie.SetPlayerKillerStatus(
|
||||
playerKillerStatus < 0 ? null : playerKillerStatus,
|
||||
lastPkAttackTimestamp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// R3-W2 (r3-port-plan.md §4): the player's <see cref="MotionInterpreter"/>
|
||||
/// — GameWindow binds the player sequencer's MotionDone seam to it so the
|
||||
|
|
@ -1418,7 +1449,10 @@ public sealed class PlayerMovementController
|
|||
stepDownHeight: StepDownHeight,
|
||||
isOnGround: previousOnWalkable,
|
||||
body: _body,
|
||||
moverFlags: ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide,
|
||||
// TS-23: OwnPvpFlags is None for every non-PK character
|
||||
// (the default), so this OR is a no-op for the common
|
||||
// case and bit-identical to the pre-P3 hardcoded value.
|
||||
moverFlags: ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide | OwnPvpFlags,
|
||||
movingEntityId: LocalEntityId,
|
||||
// TS-46: the player's own Setup sphere list, scaled by
|
||||
// ObjectScale. Empty falls back to the 0.48/1.835
|
||||
|
|
@ -1859,12 +1893,15 @@ public sealed class PlayerMovementController
|
|||
// under the same flag profile as retail player movement.
|
||||
//
|
||||
// Commit C 2026-04-29 — local player is always IsPlayer.
|
||||
// The PK/PKLite/Impenetrable bits come from PlayerDescription's
|
||||
// PlayerKillerStatus property; not yet parsed (non-PK pair → walks
|
||||
// through other non-PK players, which is retail's default for
|
||||
// ACE's character creation defaults too).
|
||||
// TS-23 (2026-07-30): OwnPvpFlags carries the real
|
||||
// PK/PKLite/Impenetrable bits, decoded from the player's own
|
||||
// PublicWeenieDesc._bitfield (default None — a no-op OR for
|
||||
// every non-PK character, bit-identical to the pre-P3 value;
|
||||
// non-PK pair still walks through other non-PK players,
|
||||
// retail's default for ACE's character creation defaults).
|
||||
moverFlags: AcDream.Core.Physics.ObjectInfoState.IsPlayer
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide,
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide
|
||||
| OwnPvpFlags,
|
||||
// Fix #42: skip self in FindObjCollisions. Wired by GameWindow
|
||||
// when the local player entity spawns (or stays 0 in tests, in
|
||||
// which case there's no registered ShadowEntry to collide with
|
||||
|
|
|
|||
|
|
@ -138,6 +138,9 @@ public sealed class RuntimeCharacterState : IDisposable
|
|||
&& MovementSkills.JumpSkill == -1
|
||||
&& MovementSkills.Burden == 0f
|
||||
&& MovementSkills.CurrentStamina == -1
|
||||
&& MovementSkills.OwnPwdBitfield == 0u
|
||||
&& MovementSkills.PlayerKillerStatus == -1
|
||||
&& MovementSkills.LastPkAttackTimestamp is null
|
||||
&& _runSkillBase == -1
|
||||
&& _jumpSkillBase == -1);
|
||||
}
|
||||
|
|
@ -552,19 +555,32 @@ public readonly record struct RuntimeMovementSkillSnapshot(
|
|||
// ratio (0.0 unencumbered) and current stamina (-1 = unknown/don't-gate,
|
||||
// matching RunSkill/JumpSkill's own sentinel convention).
|
||||
float Burden = 0f,
|
||||
int CurrentStamina = -1)
|
||||
int CurrentStamina = -1,
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): the local player's own
|
||||
// PublicWeenieDesc._bitfield (0 = never pushed / no PK-relevant bits —
|
||||
// a no-op OR, matching every pre-P3 caller) and the raw
|
||||
// PlayerKillerStatus/LastPkAttackTimestamp pair §12b's PK-timer
|
||||
// jump-cost bump reads (-1 / null = never pushed).
|
||||
uint OwnPwdBitfield = 0u,
|
||||
int PlayerKillerStatus = -1,
|
||||
float? LastPkAttackTimestamp = null)
|
||||
{
|
||||
public bool IsComplete => RunSkill >= 0 && JumpSkill >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Server-authoritative run/jump/burden/stamina values retained
|
||||
/// Server-authoritative run/jump/burden/stamina/PK-status values retained
|
||||
/// independently of any graphical movement controller. App applies this
|
||||
/// borrowed state whenever its presentation/physics controller exists or is
|
||||
/// rebuilt. Campaign P Slice P1 (2026-07-30) extended this beyond run/jump
|
||||
/// skill to the full stat-coupled-movement input set (burden, current
|
||||
/// stamina) — see the pseudocode doc §9. RunSkill/JumpSkill arrive here
|
||||
/// ALREADY vitae/enchantment-adjusted by
|
||||
/// stamina) — see the pseudocode doc §9. Campaign P Slice P3 (2026-07-30)
|
||||
/// further added the player's own PWD bitfield (PK/PKLite/Impenetrable
|
||||
/// collision-exemption bits) and the PlayerKillerStatus/
|
||||
/// LastPkAttackTimestamp pair (the PK-timer jump-cost bump) — the SAME
|
||||
/// reactive push seam, since both ride the player's own ClientObject
|
||||
/// property-update stream. RunSkill/JumpSkill arrive here ALREADY
|
||||
/// vitae/enchantment-adjusted by
|
||||
/// <see cref="RuntimeCharacterState.RecomputeMovementSkills"/>.
|
||||
/// </summary>
|
||||
public sealed class RuntimeMovementSkillState
|
||||
|
|
@ -573,16 +589,34 @@ public sealed class RuntimeMovementSkillState
|
|||
private int _jumpSkill = -1;
|
||||
private float _burden;
|
||||
private int _currentStamina = -1;
|
||||
private uint _ownPwdBitfield;
|
||||
private int _playerKillerStatus = -1;
|
||||
private float _lastPkAttackTimestamp;
|
||||
private bool _hasLastPkAttackTimestamp;
|
||||
private long _revision;
|
||||
|
||||
public int RunSkill => Volatile.Read(ref _runSkill);
|
||||
public int JumpSkill => Volatile.Read(ref _jumpSkill);
|
||||
public float Burden => Volatile.Read(ref _burden);
|
||||
public int CurrentStamina => Volatile.Read(ref _currentStamina);
|
||||
public uint OwnPwdBitfield => Volatile.Read(ref _ownPwdBitfield);
|
||||
public int PlayerKillerStatus => Volatile.Read(ref _playerKillerStatus);
|
||||
public float? LastPkAttackTimestamp =>
|
||||
Volatile.Read(ref _hasLastPkAttackTimestamp)
|
||||
? Volatile.Read(ref _lastPkAttackTimestamp)
|
||||
: null;
|
||||
public bool IsComplete => _runSkill >= 0 && _jumpSkill >= 0;
|
||||
public long Revision => Interlocked.Read(ref _revision);
|
||||
public RuntimeMovementSkillSnapshot Snapshot =>
|
||||
new(_runSkill, _jumpSkill, Revision, _burden, _currentStamina);
|
||||
new(
|
||||
_runSkill,
|
||||
_jumpSkill,
|
||||
Revision,
|
||||
_burden,
|
||||
_currentStamina,
|
||||
OwnPwdBitfield,
|
||||
PlayerKillerStatus,
|
||||
LastPkAttackTimestamp);
|
||||
|
||||
public void Update(int runSkill, int jumpSkill)
|
||||
{
|
||||
|
|
@ -626,12 +660,62 @@ public sealed class RuntimeMovementSkillState
|
|||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): pushes the local player's own
|
||||
/// raw <c>PublicWeenieDesc._bitfield</c> — the PWD wire bit-space
|
||||
/// <see cref="AcDream.Core.Physics.EntityCollisionFlagsExt.FromPwdBitfield"/>
|
||||
/// decodes. Fires on the SAME <c>ClientObject</c> add/update events
|
||||
/// <see cref="UpdateBurden"/> already reacts to (the player's own
|
||||
/// PublicWeenieBitfield lives on the same row).
|
||||
/// </summary>
|
||||
public void UpdateOwnPwdBitfield(uint bitfield)
|
||||
{
|
||||
if (OwnPwdBitfield == bitfield) return;
|
||||
Volatile.Write(ref _ownPwdBitfield, bitfield);
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b: pushes the raw <c>PlayerKillerStatus</c>
|
||||
/// (<c>PropertyInt</c> 0x86) / <c>LastPkAttackTimestamp</c>
|
||||
/// (<c>PropertyFloat</c> 0x91) pair feeding
|
||||
/// <c>CACQualities::JumpStaminaCost</c>'s 20-second PK-timer bump. A
|
||||
/// negative <paramref name="playerKillerStatus"/> restores "never
|
||||
/// pushed" (matches <see cref="UpdateStamina"/>'s own sentinel
|
||||
/// convention); <paramref name="lastPkAttackTimestamp"/> is <c>null</c>
|
||||
/// when the property is absent.
|
||||
/// </summary>
|
||||
public void UpdatePlayerKillerStatus(int playerKillerStatus, float? lastPkAttackTimestamp)
|
||||
{
|
||||
bool changed = false;
|
||||
if (PlayerKillerStatus != playerKillerStatus)
|
||||
{
|
||||
Volatile.Write(ref _playerKillerStatus, playerKillerStatus);
|
||||
changed = true;
|
||||
}
|
||||
bool hasTimestamp = lastPkAttackTimestamp.HasValue;
|
||||
float timestamp = lastPkAttackTimestamp ?? 0f;
|
||||
if (Volatile.Read(ref _hasLastPkAttackTimestamp) != hasTimestamp
|
||||
|| (hasTimestamp && Volatile.Read(ref _lastPkAttackTimestamp) != timestamp))
|
||||
{
|
||||
Volatile.Write(ref _lastPkAttackTimestamp, timestamp);
|
||||
Volatile.Write(ref _hasLastPkAttackTimestamp, hasTimestamp);
|
||||
changed = true;
|
||||
}
|
||||
if (changed)
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
|
||||
public void ResetSession()
|
||||
{
|
||||
Volatile.Write(ref _runSkill, -1);
|
||||
Volatile.Write(ref _jumpSkill, -1);
|
||||
Volatile.Write(ref _burden, 0f);
|
||||
Volatile.Write(ref _currentStamina, -1);
|
||||
Volatile.Write(ref _ownPwdBitfield, 0u);
|
||||
Volatile.Write(ref _playerKillerStatus, -1);
|
||||
Volatile.Write(ref _lastPkAttackTimestamp, 0f);
|
||||
Volatile.Write(ref _hasLastPkAttackTimestamp, false);
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.Runtime.Gameplay;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -23,6 +25,17 @@ public static class RuntimeMovementSkillProjection
|
|||
// seam run/jump skill already used — see the pseudocode doc §9.
|
||||
controller.SetCharacterBurden(snapshot.Burden);
|
||||
controller.SetCharacterStamina(snapshot.CurrentStamina);
|
||||
// TS-23 (Campaign P Slice P3, 2026-07-30): the player's own
|
||||
// PK/PKLite/Impenetrable collision-exemption bits and the
|
||||
// PlayerKillerStatus/LastPkAttackTimestamp pair the jump-cost
|
||||
// PK-timer bump reads — see EntityCollisionFlagsExt.ToMoverState
|
||||
// and PlayerWeenie.JumpStaminaCost.
|
||||
controller.OwnPvpFlags =
|
||||
EntityCollisionFlagsExt.FromPwdBitfield(snapshot.OwnPwdBitfield)
|
||||
.ToMoverState();
|
||||
controller.SetCharacterPkStatus(
|
||||
snapshot.PlayerKillerStatus,
|
||||
snapshot.LastPkAttackTimestamp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ internal sealed class RuntimeOrdinaryPhysicsUpdater
|
|||
sphereList = default,
|
||||
float sphereScale = 1f,
|
||||
float stepUpHeight = 0.4f,
|
||||
float stepDownHeight = 0.4f)
|
||||
float stepDownHeight = 0.4f,
|
||||
// TS-23 (2026-07-30): see RuntimeRemotePhysicsUpdater.Tick's
|
||||
// identical parameter.
|
||||
ObjectInfoState moverPvpState = ObjectInfoState.None)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(record);
|
||||
ArgumentNullException.ThrowIfNull(rootFrame);
|
||||
|
|
@ -142,9 +145,12 @@ internal sealed class RuntimeOrdinaryPhysicsUpdater
|
|||
stepDownHeight: stepDownHeight, // TS-46: Setup-derived, was a 0.4f literal
|
||||
isOnGround: previousOnWalkable,
|
||||
body: body,
|
||||
moverFlags: IsPlayerGuid(record.ServerGuid)
|
||||
// TS-23: moverPvpState is a no-op OR (None) for every
|
||||
// non-PK ordinary mover.
|
||||
moverFlags: (IsPlayerGuid(record.ServerGuid)
|
||||
? ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide
|
||||
: ObjectInfoState.EdgeSlide,
|
||||
: ObjectInfoState.EdgeSlide)
|
||||
| moverPvpState,
|
||||
movingEntityId: movingEntityId,
|
||||
// TS-46: the Setup's own sphere list, scaled by ObjScale.
|
||||
// Empty falls back to the radius/height reconstruction above.
|
||||
|
|
|
|||
|
|
@ -83,7 +83,14 @@ internal sealed class RuntimeRemotePhysicsUpdater
|
|||
sphereList = default,
|
||||
float sphereScale = 1f,
|
||||
float stepUpHeight = 0.4f,
|
||||
float stepDownHeight = 0.4f)
|
||||
float stepDownHeight = 0.4f,
|
||||
// TS-23 (2026-07-30): the remote's own PK/PKLite/Impenetrable
|
||||
// ObjectInfoState bits (LiveEntityMotionRuntimeController's
|
||||
// ClientObjectTable-backed lookup, translated via
|
||||
// EntityCollisionFlagsExt.ToMoverState). Default None is a no-op OR
|
||||
// for every non-PK remote — bit-identical to the pre-P3 value.
|
||||
AcDream.Core.Physics.ObjectInfoState moverPvpState =
|
||||
AcDream.Core.Physics.ObjectInfoState.None)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(record);
|
||||
ArgumentNullException.ThrowIfNull(rm);
|
||||
|
|
@ -382,15 +389,17 @@ internal sealed class RuntimeRemotePhysicsUpdater
|
|||
// non-PK player pair). Without IsPlayer the mover would de-overlap
|
||||
// two players — MORE solid than retail (you can stand inside another
|
||||
// non-PK player in AC). Players still COLLIDE with monsters (target
|
||||
// not IsPlayer → no exemption) + terrain + walls. PK/PKLite/
|
||||
// Impenetrable are NOT plumbed onto the remote mover yet, so a PK
|
||||
// pair walks through where retail collides — the SAME M1.5 gap the
|
||||
// local player carries (see TS-23; PlayerDescription PK status
|
||||
// unparsed).
|
||||
moverFlags: IsPlayerGuid(serverGuid)
|
||||
// not IsPlayer → no exemption) + terrain + walls. TS-23
|
||||
// (2026-07-30): moverPvpState carries the remote's real
|
||||
// PK/PKLite/Impenetrable bits (default None — a no-op OR
|
||||
// for every non-PK remote, bit-identical to the pre-P3
|
||||
// value); a PK-vs-PK pair now collides exactly like
|
||||
// retail instead of always walking through.
|
||||
moverFlags: (IsPlayerGuid(serverGuid)
|
||||
? AcDream.Core.Physics.ObjectInfoState.IsPlayer
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide
|
||||
: AcDream.Core.Physics.ObjectInfoState.EdgeSlide,
|
||||
: AcDream.Core.Physics.ObjectInfoState.EdgeSlide)
|
||||
| moverPvpState,
|
||||
// Fix #42 (2026-05-05): skip the moving remote's
|
||||
// own ShadowEntry. _animatedEntities is keyed by
|
||||
// entity.Id so kv.Key matches the EntityId the
|
||||
|
|
@ -629,12 +638,14 @@ internal sealed class RuntimeRemotePhysicsUpdater
|
|||
System.Func<RuntimeRemotePhysicsSnapshot, bool>?
|
||||
acknowledgeProjection = null,
|
||||
System.Func<bool>? externalOwnerValid = null,
|
||||
// TS-46 (2026-07-30): see the visible Tick's identical parameters.
|
||||
// TS-46/TS-23 (2026-07-30): see the visible Tick's identical parameters.
|
||||
System.Collections.Immutable.ImmutableArray<AcDream.Core.Physics.FlatCollisionSphere>
|
||||
sphereList = default,
|
||||
float sphereScale = 1f,
|
||||
float stepUpHeight = 0.4f,
|
||||
float stepDownHeight = 0.4f)
|
||||
float stepDownHeight = 0.4f,
|
||||
AcDream.Core.Physics.ObjectInfoState moverPvpState =
|
||||
AcDream.Core.Physics.ObjectInfoState.None)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(record);
|
||||
ArgumentNullException.ThrowIfNull(rm);
|
||||
|
|
@ -709,10 +720,13 @@ internal sealed class RuntimeRemotePhysicsUpdater
|
|||
stepDownHeight: stepDownHeight, // TS-46: Setup-derived, was a 0.4f literal
|
||||
isOnGround: previousOnWalkable,
|
||||
body: rm.Body,
|
||||
moverFlags: IsPlayerGuid(record.ServerGuid)
|
||||
// TS-23: moverPvpState is a no-op OR (None) for every
|
||||
// non-PK remote.
|
||||
moverFlags: (IsPlayerGuid(record.ServerGuid)
|
||||
? AcDream.Core.Physics.ObjectInfoState.IsPlayer
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide
|
||||
: AcDream.Core.Physics.ObjectInfoState.EdgeSlide,
|
||||
: AcDream.Core.Physics.ObjectInfoState.EdgeSlide)
|
||||
| moverPvpState,
|
||||
movingEntityId: localEntityId,
|
||||
// TS-46: the Setup's own sphere list, scaled by ObjScale.
|
||||
// Empty falls back to the radius/height reconstruction above.
|
||||
|
|
|
|||
|
|
@ -193,31 +193,34 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
|||
// the SAME event set IndicatorBarController.UpdateBurden already
|
||||
// reacts to (Strength + augmentation property 0xE6 +
|
||||
// EncumbranceVal property 5, falling back to SumCarriedBurden).
|
||||
// See the pseudocode doc §9.
|
||||
// See the pseudocode doc §9. Campaign P Slice P3 (2026-07-30)
|
||||
// rides the SAME triggers for the player's own PWD bitfield
|
||||
// (PK/PKLite/Impenetrable) and PlayerKillerStatus/
|
||||
// LastPkAttackTimestamp — all live on the SAME ClientObject row.
|
||||
SubscribeToRecompute<ClientObject>(
|
||||
h => inventory.Objects.ObjectAdded += h,
|
||||
h => inventory.Objects.ObjectAdded -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
SubscribeToRecompute<ClientObject>(
|
||||
h => inventory.Objects.ObjectUpdated += h,
|
||||
h => inventory.Objects.ObjectUpdated -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
SubscribeToRecompute<ClientObject>(
|
||||
h => inventory.Objects.ObjectRemoved += h,
|
||||
h => inventory.Objects.ObjectRemoved -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
SubscribeToRecompute<ClientObjectMove>(
|
||||
h => inventory.Objects.ObjectMoved += h,
|
||||
h => inventory.Objects.ObjectMoved -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
SubscribeToRecompute<uint>(
|
||||
h => inventory.Objects.ContainerContentsReplaced += h,
|
||||
h => inventory.Objects.ContainerContentsReplaced -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
SubscribeParameterless(
|
||||
h => inventory.Objects.Cleared += h,
|
||||
h => inventory.Objects.Cleared -= h,
|
||||
() => RecomputeBurden(inventory, character));
|
||||
() => { RecomputeBurden(inventory, character); RecomputePvpStatus(inventory, character); });
|
||||
Subscribe<LocalPlayerState.AttributeKind>(
|
||||
h => character.Character.LocalPlayer.AttributeChanged += h,
|
||||
h => character.Character.LocalPlayer.AttributeChanged -= h,
|
||||
|
|
@ -381,6 +384,40 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
|||
character.OnMovementStatsUpdated?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): pushes the local player's
|
||||
/// own <c>PublicWeenieDesc._bitfield</c> (PK/PKLite/Impenetrable
|
||||
/// collision-exemption bits, already parsed at CreateObject time — see
|
||||
/// <c>CreateObject.cs</c>'s <c>objectDescriptionFlags</c> read) and the
|
||||
/// raw <c>PlayerKillerStatus</c>(0x86)/<c>LastPkAttackTimestamp</c>(0x91)
|
||||
/// pair (retail <c>CACQualities::JumpStaminaCost</c>'s PK-timer bump)
|
||||
/// into <see cref="RuntimeMovementSkillState"/>. Rides the SAME
|
||||
/// ClientObject add/update/move/clear events <see cref="RecomputeBurden"/>
|
||||
/// already reacts to — both live on the player's own row.
|
||||
/// </summary>
|
||||
private static void RecomputePvpStatus(
|
||||
LiveInventorySessionBindings inventory,
|
||||
LiveCharacterSessionBindings character)
|
||||
{
|
||||
uint player = inventory.PlayerGuid();
|
||||
ClientObject? playerObject = inventory.Objects.Get(player);
|
||||
uint bitfield = playerObject?.PublicWeenieBitfield ?? 0u;
|
||||
int pkStatus = playerObject?.Properties.Ints.TryGetValue(
|
||||
(uint)PropertyInt.PlayerKillerStatus, out int wirePkStatus) == true
|
||||
? wirePkStatus
|
||||
: -1;
|
||||
float? lastPkAttackTimestamp =
|
||||
playerObject?.Properties.Floats.TryGetValue(
|
||||
(uint)PropertyFloat.LastPkAttackTimestamp, out double wireTimestamp) == true
|
||||
? (float)wireTimestamp
|
||||
: null;
|
||||
character.Character.MovementSkills.UpdateOwnPwdBitfield(bitfield);
|
||||
character.Character.MovementSkills.UpdatePlayerKillerStatus(
|
||||
pkStatus,
|
||||
lastPkAttackTimestamp);
|
||||
character.OnMovementStatsUpdated?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Campaign P Slice P1 (2026-07-30): pushes current-stamina vital
|
||||
/// changes into <see cref="RuntimeMovementSkillState"/> — feeds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue