From 61bafac567383ca042840478c2c94dfbed3cebaa Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 4 Dec 2022 19:19:53 +0000 Subject: [PATCH] Add modification timestamp --- VpSharp/src/Entities/VirtualParadiseObject.cs | 7 +++++++ VpSharp/src/VirtualParadiseClient.Objects.cs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/VpSharp/src/Entities/VirtualParadiseObject.cs b/VpSharp/src/Entities/VirtualParadiseObject.cs index 89b8ec1..c07f418 100644 --- a/VpSharp/src/Entities/VirtualParadiseObject.cs +++ b/VpSharp/src/Entities/VirtualParadiseObject.cs @@ -37,6 +37,12 @@ public abstract class VirtualParadiseObject : IEquatable /// The location of this object. public Location Location { get; internal set; } + /// + /// Gets the modification timestamp of this object. + /// + /// The modification timestamp. + public DateTimeOffset ModificationTimestamp { get; internal set; } + /// /// Gets the owner of this object. /// @@ -232,6 +238,7 @@ public abstract class VirtualParadiseObject : IEquatable { ArgumentNullException.ThrowIfNull(virtualParadiseObject); Location = virtualParadiseObject.Location; + ModificationTimestamp = virtualParadiseObject.ModificationTimestamp; Owner = virtualParadiseObject.Owner; } diff --git a/VpSharp/src/VirtualParadiseClient.Objects.cs b/VpSharp/src/VirtualParadiseClient.Objects.cs index d0d985b..f6c4109 100644 --- a/VpSharp/src/VirtualParadiseClient.Objects.cs +++ b/VpSharp/src/VirtualParadiseClient.Objects.cs @@ -168,6 +168,7 @@ public sealed partial class VirtualParadiseClient { ObjectType type; int id; + int time; int owner; Quaternion rotation; Vector3d position; @@ -197,6 +198,8 @@ public sealed partial class VirtualParadiseClient var axis = new Vector3(rotX, rotY, rotZ); rotation = Quaternion.CreateFromAxisAngle(axis, angle); } + + time = vp_int(sender, IntegerAttribute.ObjectTime); } VirtualParadiseObject virtualParadiseObject = type switch @@ -211,6 +214,7 @@ public sealed partial class VirtualParadiseClient var location = new Location(CurrentWorld!, position, rotation); virtualParadiseObject.Location = location; + virtualParadiseObject.ModificationTimestamp = DateTimeOffset.FromUnixTimeSeconds(time); virtualParadiseObject.Owner = await GetUserAsync(owner).ConfigureAwait(false); return virtualParadiseObject; }