opengsq.responses.trackmania_nations package

Submodules

opengsq.responses.trackmania_nations.server_info module

opengsq.responses.trackmania_nations.server_info.strip_formatting(text: str) → str

Removes TrackMania formatting codes ($fff, $o, $l[…], …) from a string.

class opengsq.responses.trackmania_nations.server_info.Player(name: str, ladder_ranking: int)

Bases: object

A player connected to the server.

name: str

Nickname, including TrackMania formatting codes.

ladder_ranking: int

Ladder ranking (-1 = not ranked, 0 = unknown).

class opengsq.responses.trackmania_nations.server_info.Challenge(name: str, gold_time: int, copper_price: int, environment: str)

Bases: object

A challenge (map) of the server playlist.

name: str

Challenge name. The server truncates it to 15 characters.

gold_time: int

Gold medal time in milliseconds.

copper_price: int

Copper price (display cost) of the challenge.

environment: str

Environment (collection) of the challenge, e.g. Stadium.

class opengsq.responses.trackmania_nations.server_info.ServerInfo(name: str, map: str, players: int, max_players: int, game_mode: str, password_protected: bool = False, version: str | None = None, environment: str = 'Unknown', comment: str = '', server_login: str = '', pc_guid: str = '', time_limit: int = 0, nb_laps: int = 0, spectator_slots: int = 0, build_number: int = 0, private_server: bool = False, ladder_server: bool = False, status_flags: int = 0, challenge_crc: int = 0, public_ip: str = '', local_ip: str = '', spectators: int = 0, max_spectators: int = 0, spectator_password_protected: bool = False, ladder_mode: int = 0, game_mode_id: int = 0, points_limit: int = 0, pack_mask: str = '', nb_challenges: int = 0, challenges: list[~opengsq.responses.trackmania_nations.server_info.Challenge] = <factory>, player_list: list[~opengsq.responses.trackmania_nations.server_info.Player] = <factory>, server_address: str = '', server_port: int = 0, raw_data: str | None = None)

Bases: object

Trackmania Nations/United Forever Server Information

name: str

Name of the server, including TrackMania formatting codes.

map: str

Current challenge (truncated to 15 characters by the server).

players: int

Current number of players on the server.

max_players: int

Maximum number of players the server can hold.

game_mode: str

Current game mode (TimeAttack, Rounds, Team, Laps, Stunts or Cup).

password_protected: bool = False

Whether joining as player requires a password.

version: str | None = None

Not part of the query response, always None.

environment: str = 'Unknown'

Environment of the current challenge, e.g. Stadium.

comment: str = ''

Server comment.

server_login: str = ''

Login of the server host. In LAN mode this is the computer name.

pc_guid: str = ''

Deprecated alias of server_login.

time_limit: int = 0

Time limit in milliseconds (TimeAttack and Stunts).

nb_laps: int = 0

Number of laps (Laps mode).

spectator_slots: int = 0

Deprecated alias of max_spectators.

build_number: int = 0

Not part of the query response, always 0.

private_server: bool = False

Deprecated alias of password_protected.

ladder_server: bool = False

Whether the ladder mode is active (ladder_mode != 0).

status_flags: int = 0

Not part of the query response, always 0.

challenge_crc: int = 0

Not part of the query response, always 0.

public_ip: str = ''

Not part of the query response, always empty.

local_ip: str = ''

Deprecated alias of server_address.

spectators: int = 0

Current number of spectators.

max_spectators: int = 0

Maximum number of spectators.

spectator_password_protected: bool = False

Whether joining as spectator requires a password.

ladder_mode: int = 0

Ladder mode (0 = inactive, 1 = forced).

game_mode_id: int = 0

Internal game mode id (1 TimeAttack, 3 Rounds, 6 Team, 7 Laps, 8 Stunts, 9 Cup).

points_limit: int = 0

Points limit (Rounds, Team and Cup).

pack_mask: str = ''

Pack mask of the server, e.g. Stadium for Nations servers.

nb_challenges: int = 0

Number of challenges in the playlist (capped at 255 by the server).

challenges: list[Challenge]

Current challenge followed by the next ones (at most 20).

player_list: list[Player]

Players connected to the server.

server_address: str = ''

IP address the server announces for itself.

server_port: int = 0

Port the server announces for itself.

raw_data: str | None = None

Decompressed server info payload as hex string.

property plain_name: str

Server name without TrackMania formatting codes.

to_dict() → dict

Convert to dictionary for JSON serialization, excluding raw_data.

Module contents

class opengsq.responses.trackmania_nations.Challenge(name: str, gold_time: int, copper_price: int, environment: str)

Bases: object

A challenge (map) of the server playlist.

name: str

Challenge name. The server truncates it to 15 characters.

gold_time: int

Gold medal time in milliseconds.

copper_price: int

Copper price (display cost) of the challenge.

environment: str

Environment (collection) of the challenge, e.g. Stadium.

class opengsq.responses.trackmania_nations.Player(name: str, ladder_ranking: int)

Bases: object

A player connected to the server.

name: str

Nickname, including TrackMania formatting codes.

ladder_ranking: int

Ladder ranking (-1 = not ranked, 0 = unknown).

class opengsq.responses.trackmania_nations.ServerInfo(name: str, map: str, players: int, max_players: int, game_mode: str, password_protected: bool = False, version: str | None = None, environment: str = 'Unknown', comment: str = '', server_login: str = '', pc_guid: str = '', time_limit: int = 0, nb_laps: int = 0, spectator_slots: int = 0, build_number: int = 0, private_server: bool = False, ladder_server: bool = False, status_flags: int = 0, challenge_crc: int = 0, public_ip: str = '', local_ip: str = '', spectators: int = 0, max_spectators: int = 0, spectator_password_protected: bool = False, ladder_mode: int = 0, game_mode_id: int = 0, points_limit: int = 0, pack_mask: str = '', nb_challenges: int = 0, challenges: list[~opengsq.responses.trackmania_nations.server_info.Challenge] = <factory>, player_list: list[~opengsq.responses.trackmania_nations.server_info.Player] = <factory>, server_address: str = '', server_port: int = 0, raw_data: str | None = None)

Bases: object

Trackmania Nations/United Forever Server Information

build_number: int = 0

Not part of the query response, always 0.

challenge_crc: int = 0

Not part of the query response, always 0.

comment: str = ''

Server comment.

environment: str = 'Unknown'

Environment of the current challenge, e.g. Stadium.

game_mode_id: int = 0

Internal game mode id (1 TimeAttack, 3 Rounds, 6 Team, 7 Laps, 8 Stunts, 9 Cup).

ladder_mode: int = 0

Ladder mode (0 = inactive, 1 = forced).

ladder_server: bool = False

Whether the ladder mode is active (ladder_mode != 0).

local_ip: str = ''

Deprecated alias of server_address.

max_spectators: int = 0

Maximum number of spectators.

nb_challenges: int = 0

Number of challenges in the playlist (capped at 255 by the server).

nb_laps: int = 0

Number of laps (Laps mode).

pack_mask: str = ''

Pack mask of the server, e.g. Stadium for Nations servers.

password_protected: bool = False

Whether joining as player requires a password.

pc_guid: str = ''

Deprecated alias of server_login.

property plain_name: str

Server name without TrackMania formatting codes.

points_limit: int = 0

Points limit (Rounds, Team and Cup).

private_server: bool = False

Deprecated alias of password_protected.

public_ip: str = ''

Not part of the query response, always empty.

raw_data: str | None = None

Decompressed server info payload as hex string.

server_address: str = ''

IP address the server announces for itself.

server_login: str = ''

Login of the server host. In LAN mode this is the computer name.

server_port: int = 0

Port the server announces for itself.

spectator_password_protected: bool = False

Whether joining as spectator requires a password.

spectator_slots: int = 0

Deprecated alias of max_spectators.

spectators: int = 0

Current number of spectators.

status_flags: int = 0

Not part of the query response, always 0.

time_limit: int = 0

Time limit in milliseconds (TimeAttack and Stunts).

to_dict() → dict

Convert to dictionary for JSON serialization, excluding raw_data.

version: str | None = None

Not part of the query response, always None.

name: str

Name of the server, including TrackMania formatting codes.

map: str

Current challenge (truncated to 15 characters by the server).

players: int

Current number of players on the server.

max_players: int

Maximum number of players the server can hold.

game_mode: str

Current game mode (TimeAttack, Rounds, Team, Laps, Stunts or Cup).

challenges: list[Challenge]

Current challenge followed by the next ones (at most 20).

player_list: list[Player]

Players connected to the server.

opengsq.responses.trackmania_nations.strip_formatting(text: str) → str

Removes TrackMania formatting codes ($fff, $o, $l[…], …) from a string.