# frozen_string_literal: true module Steam module Protocol # Represents a Protobuf message. They have a protobuf header, and body. # Their emsg is masked with the PROTO_MASK flag class ProtobufMessage include Message # A Protobuf Message contains a steam id and a session id. It also uses # the PROTO_MASK on the EMsg. def initialize(header, body, emsg) super(header, body, emsg | PROTO_MASK) end # Returns the masked protobuf emsg def emsg @emsg & ~PROTO_MASK end # Get the steam_id associated with this message # # @return [Integer] def steam_id @header.proto.steamid end # # Get the steam_id associated with this message # # @return [Integer] def session_id @header.proto.client_sessionid end # The steam id associated with the message # # @param sid [String] the Steam id def steam_id=(sid) @header.proto.steamid = sid end # The session id associated with the message # # @param sid [String] the Session id def session_id=(sid) @header.proto.client_sessionid = sid end def proto? true end end end end