messages.impl module

Provides user message implementations.

class messages.impl.SayText2Impl[source]

Bases: UserMessageImpl

SayText2 implementation.

static read_bitbuffer(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (BitBufferRead) – The buffer to read.

Return type:

UserMessageData

static read_protobuf(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (ProtobufMessage) – The buffer to read.

Return type:

UserMessageData

static write_bitbuffer(buffer, data)[source]

Write data to the given buffer.

Parameters:
static write_protobuf(buffer, data)[source]

Write data to the given buffer.

Parameters:
  • buffer (ProtobufMessage) – The buffer to write to.

  • data (UserMessageData) – User message data that should be written to the buffer.

class messages.impl.ShowMenuImpl[source]

Bases: UserMessageImpl

ShowMenu implementation.

static read_bitbuffer(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (BitBufferRead) – The buffer to read.

Return type:

UserMessageData

static read_protobuf(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (ProtobufMessage) – The buffer to read.

Return type:

UserMessageData

static write_bitbuffer(buffer, data)[source]

Write data to the given buffer.

Parameters:
static write_protobuf(buffer, data)[source]

Write data to the given buffer.

Parameters:
  • buffer (ProtobufMessage) – The buffer to write to.

  • data (UserMessageData) – User message data that should be written to the buffer.

class messages.impl.UserMessageData(**kwargs)[source]

Bases: dict

A dict that keeps track whether it has been modified.

__init__(**kwargs)[source]
has_been_changed()[source]

Return whether the data has been changed.

Return type:

bool

class messages.impl.UserMessageImpl[source]

Bases: object

Base class for user message implementations.

classmethod read(buffer)[source]

A wrapper for read_protobuf() and read_bitbuffer().

Parameters:

buffer – The buffer to read.

Return type:

UserMessageData

classmethod write(buffer, data)[source]

A wrapper for write_protobuf() and write_bitbuffer().

Parameters:

buffer – The buffer to write.

Return type:

UserMessageData

static read_bitbuffer(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (BitBufferRead) – The buffer to read.

Return type:

UserMessageData

static read_protobuf(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (ProtobufMessage) – The buffer to read.

Return type:

UserMessageData

static write_bitbuffer(buffer, data)[source]

Write data to the given buffer.

Parameters:
static write_protobuf(buffer, data)[source]

Write data to the given buffer.

Parameters:
  • buffer (ProtobufMessage) – The buffer to write to.

  • data (UserMessageData) – User message data that should be written to the buffer.

class messages.impl.VGUIMenuImpl[source]

Bases: UserMessageImpl

VGUIMenu implementation.

static read_bitbuffer(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (BitBufferRead) – The buffer to read.

Return type:

UserMessageData

static read_protobuf(buffer)[source]

Read data from the given buffer.

Parameters:

buffer (ProtobufMessage) – The buffer to read.

Return type:

UserMessageData

static write_bitbuffer(buffer, data)[source]

Write data to the given buffer.

Parameters:
static write_protobuf(buffer, data)[source]

Write data to the given buffer.

Parameters:
  • buffer (ProtobufMessage) – The buffer to write to.

  • data (UserMessageData) – User message data that should be written to the buffer.

messages.impl.get_user_message_impl(msg_index)[source]

Return the user message implementation for the given message index.

Parameters:

msg_index (int) – The index of the user message.

Raises:

NotImplementedError – Raised if the given user message is not implemented.

Return type:

UserMessageImpl

messages.impl.implemented_usermessages = {4: <class 'messages.impl.SayText2Impl'>, 10: <class 'messages.impl.ShowMenuImpl'>, 13: <class 'messages.impl.VGUIMenuImpl'>}

A dictionary that contains all implemented user messages.