opcode702.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. #include <optional>
  5. #include "../../../state/account/inventory/seen_state.h"
  6. #include "../web_service_envelope.h"
  7. namespace sunrise::middleware::web_service::messages::opcode702 {
  8. /** Web Service opcode of the character object B write-back. */
  9. inline constexpr std::uint16_t kOpcode = 702;
  10. /** The full 5360-byte character mirror packs into at most 4800 bytes. */
  11. inline constexpr std::size_t kPayloadSize = 4800;
  12. /** Value of the world-state field once the client has entered the world. */
  13. inline constexpr std::uint8_t kInWorld = 8;
  14. /** Supported fields from the character writeback. */
  15. struct Request {
  16. /**
  17. * Five-bit field at objB `+12068`, schema path `.0.11.1.0.0.4`. Measured 0 on the orbit
  18. * screen, 1 from the launch through the load, 8 after `activity:in_world`.
  19. */
  20. std::uint8_t worldState{};
  21. bool hasWorldState{};
  22. std::optional<state::account::inventory::CharacterNewItems> newItems;
  23. };
  24. /**
  25. * Reads the complete character writeback with optional groups and bounded zero padding.
  26. * @param message Parsed Web Service envelope.
  27. * @param request Receives only fields present in a valid body.
  28. * @return False for malformed or truncated fields.
  29. */
  30. [[nodiscard]] bool parse_request(const Message& message, Request& request) noexcept;
  31. } // namespace sunrise::middleware::web_service::messages::opcode702