using System.Buffers.Binary;
namespace AcDream.Core.Net.Messages;
///
/// Retail PlayScriptID (0xF754): play the supplied PhysicsScript DID directly
/// on the addressed object. This packet never performs a typed-table lookup.
/// Named-retail handler: SmartBox::HandlePlayScriptID 0x00452020.
///
public readonly record struct PlayPhysicsScript(uint Guid, uint ScriptDid)
{
public const uint Opcode = 0xF754u;
public const int WireSize = 12;
public static PlayPhysicsScript? TryParse(ReadOnlySpan body)
{
if (body.Length != WireSize
|| BinaryPrimitives.ReadUInt32LittleEndian(body) != Opcode)
return null;
return new PlayPhysicsScript(
BinaryPrimitives.ReadUInt32LittleEndian(body[4..]),
BinaryPrimitives.ReadUInt32LittleEndian(body[8..]));
}
}