Files
2026-11-23 03:28:32 +02:00

31 lines
1.0 KiB
C++

// Isolated 70334 MountSpecial request/PlaySound response helper.
#pragma once
#include "gateway/protocol.hpp"
#include <cstdint>
#include <span>
namespace gateway::mount_special_packet {
inline constexpr std::uint32_t RequestOpcode = 0x3D0154;
inline constexpr std::uint32_t SoundOpcode = 0x450212;
inline void validate_request(std::span<const std::uint8_t> body) {
Reader r(body);
const auto count = r.le(4);
(void)r.le(4); // SequenceVariation belongs to the client's local animation.
if (count > 16 || r.left() != count * 4)
throw Error("mount-special visual-kit extent");
for (std::uint64_t i = 0; i < count; ++i) (void)r.le(4);
r.end();
}
inline Bytes sound_response(std::uint32_t source_sound_kit, const Guid128& self) {
if (!source_sound_kit || !self.back())
throw Error("mount-special sound requires a kit and typed self GUID");
Bytes body;
le(body, source_sound_kit, 4);
append(body, pack_guid(self));
le(body, 0, 4); // BroadcastTextID; no invented speech/text.
return body;
}
}