Better Room Manager

A plugin by XertroV(Trusted developer)

Better Room Manager
Downloads 14,177
Updated 15 days ago
Released 2 years ago
Created 2 years ago
Numeric ID 312
Min. Openplanet 1.26.23
Featured
Signed
Game Trackmania

Better Room Manager

Better Room Manager is an alternate management UI for Club rooms that works for Creators, Admins, and Content Creators¹.

It currently supports:

  • creating and editing rooms
  • saving and loading presets of room configurations (excludes: room name, maps, and whether the room is passworded)
  • script options: add hidden options, modify existing, load defaults, and documentation links
  • adding known maps (in your Trackmania\Maps folder) -- search by name or browse by folder
  • adding random TMX maps within some constraints (length (seconds) and difficulty)
  • adding maps from TMX via IDs or Map Pack ID (will auto-upload maps to nadeo if required)
  • reorder maps or shuffle
  • toggle room active status
  • use club rooms with additional game modes

Launch it from the Plugins menu ("Better Room Manager")

[1]: Content Creators can only see active rooms. They can edit any active room and can create new rooms. They can also deactivate rooms, but this is behind a safety switch to avoid them locking themselves out of a room.

About

License: Public Domain

Authors: XertroV

Suggestions/feedback: @XertroV on Openplanet discord

Code/issues: https://github.com/XertroV/tm-better-room-manager

GL HF

For Devs: Exports Example Usage (v0.2.0+)

void SetNextRoom() {
    status = "Loading Map " + loadNextId + " / " + loadNextUid;
    auto builder = BRM::CreateRoomBuilder(clubId, roomId)
        .SetTimeLimit(1).SetChatTime(1).SetMaps({loadNextUid})
        .SetMode(BRM::GameMode::TimeAttack);
    auto resp = builder.SaveRoom();
    status += "\nSaved Room maps + time limit... Waiting 5s";
    log_trace('Room request returned: ' + Json::Write(resp));
    sleep(5000);
    int limit = -1;
    builder.SetTimeLimit(limit);
    status = "Adjusting room time limit to " + limit;
    builder.SaveRoom();
    status = "Room finalized, awaiting map change...";
    AwaitMapUidLoad();
    status = "Done";
    currState = GameState::Running;
    S_LastTmxID = loadNextId;
    return;
}

Exports (v0.2.0+)

Functions

CreateRoomBuilder -- IRoomSettingsBuilder@ CreateRoomBuilder(uint clubId, uint roomId)

Create an IRoomSettingsBuilder object for a given club and room

GameModeFromStr -- GameMode GameModeFromStr(const string &in modeStr)

Returns a BRM::GameMode based on the script path, e.g., "TrackMania/TM_Cup_Online.Script.txt"

GameModeToFullModeString -- const string GameModeToFullModeString(GameMode m)

Returns a scirpt path, e.g., "TrackMania/TM_Cup_Online.Script.txt", for a given BRM::GameMode

GetCurrentServerInfo -- ServerInfo@ GetCurrentServerInfo(CGameCtnApp@ app, bool waitForClubId = true)

Returns some basic info for the current server, including Club and Room IDs. Yields if waitForClubId=true otherwise might return null if club/room ID detection is still loading.

GetModeSettingType -- string GetModeSettingType(const string &in settingName)

Get the setting type (integer, bool, text) for a given setting, e.g., S_TimeLimit

GetMyClubs -- const Json::Value@ GetMyClubs()

Returns a JSON Array of JSON Objects. The format is equivalent to under .clubList in the payload returned by https://webservices.openplanet.dev/live/clubs/clubs-mine There are some additional fields, like nameSafe, tagSafe, and isAdmin (dump the json object for everything)

GetRoomInfoFromAPI -- Json::Value@ GetRoomInfoFromAPI(uint clubId, uint roomId)

Get a room info from the API. https://webservices.openplanet.dev/live/clubs/room-by-id

IsInAServer -- bool IsInAServer(CGameCtnApp@ app)

Returns true if the client is connected to a server

JoinServer -- void JoinServer(uint clubId, uint roomId, const string &in password = "")

Join a server by getting the joinlink for a given club and room

Types/Classes

BRM::GameMode (enum)

  • Unknown
  • Cup
  • Knockout
  • Laps
  • Teams
  • TimeAttack
  • Rounds
  • RoyalTimeAttack
  • TMWTTeams
  • TMWTMatchmaking
  • TeamsMatchmaking
  • TimeAttackDaily
  • KnockoutDaily
  • COTDQualifications
  • CupClassic
  • ChampionSpring2022
  • MultiTeams
  • HeadToHead
  • Final42TMGL
  • XXX_LAST

BRM::IRoomSettingsBuilder (interface)

Functions

AddMaps -- IRoomSettingsBuilder@ AddMaps(const array<string> &in maps)

Add a map to the rooms map list

LoadCurrentSettingsAsync -- IRoomSettingsBuilder@ LoadCurrentSettingsAsync()

Populate based on current room settings. This function may yield.

GetCurrentSettingsJson -- Json::Value@ GetCurrentSettingsJson()

Get the current raw settings json object (which is mutable). Call LoadCurrentSettingsAsync first to load current settings.

GoToNextMapAndThenSetTimeLimit -- IRoomSettingsBuilder@ GoToNextMapAndThenSetTimeLimit(const string &in mapUid, int limit = -1, int ct = 1)

This will yield! An easy 'go to next map' command for club rooms in TimeAttack mode. Duration is 5s + 2 http requests to nadeo.

GetModeSetting -- string GetModeSetting(const string &in key)

Gets a game mode setting's current value. Throws if it does not exist.

HasModeSetting -- bool HasModeSetting(const string &in key)

Whether a game mode setting exists (note: you probably want to call LoadCurrentSettingsAsync first)

SaveRoom -- Json::Value@ SaveRoom()

saves the room and returns the result; will yield internally

SaveRoomInCoro -- IRoomSettingsBuilder@ SaveRoomInCoro()

Save the room; returns immediately

SetChatTime -- IRoomSettingsBuilder@ SetChatTime(int ct)

Set the chat time (seconds)

SetLoadingScreenUrl -- IRoomSettingsBuilder@ SetLoadingScreenUrl(const string &in url)

Set the loading screen image URL

SetMaps -- IRoomSettingsBuilder@ SetMaps(const array<string> &in maps)

Set the rooms map list

SetMode -- IRoomSettingsBuilder@ SetMode(GameMode mode, bool withDefaultSettings = false)

Set the room game mode

SetModeSetting -- IRoomSettingsBuilder@ SetModeSetting(const string &in key, const string &in value)

Set a game mode setting (e.g., S_TimeLimit)

SetName -- IRoomSettingsBuilder@ SetName(const string &in name)

Set the room name

SetPlayerLimit -- IRoomSettingsBuilder@ SetPlayerLimit(uint limit)

Set the room player limit (1 - 100)

SetTimeLimit -- IRoomSettingsBuilder@ SetTimeLimit(int limit)

Set the time limit (seconds)

BRM::ServerInfo (class)

Properties

clubId -- int clubId
login -- string login
name -- string name
roomId -- int roomId

Changelog

0.3.0 - 15 days ago

  • Fix server names with formatting in quick menu.

  • Add a way to add maps directly by UID in room UI.

  • Add loading status messages when the room UI is disabled due to loading or operation.

  • Add Score Board Manager export: lets you create news-based leaderboards for use with Server-Game Scoreboard.

    • Create one with BRM::INewsScoreBoardManager@ BRM::CreateNewsScoreBoardManager(int clubId, const string &in serverName = "", bool autoCreateNews = false)
  • Add functionality to pre-cache maps so they're quicker to load in servers.

    • void BRM::PreCacheMap(const string &in url)
    • void BRM::PreCacheAsset(const string &in url)
    • void BRM::PreCacheMapByUid_Async(const string &in uid, const string &in name = "<Unk Name>")
      • Retrieves a map url from nadeo and precaches it. It's safe to call more than once with the same UID (does nothing 2nd+ time). Will yield while it gets the map URL.
  • BRM::IRoomSettingsBuilder additions:

    • Add BRM::GameMode GetMode()
    • Add int GetTimeLimit()
    • Add string[]@ GetMapUids()
    • Add BRM::IRoomSettingsBuilder@ DisableWarmups()
  • For full documentation of INewsScoreBoardManager (i.e., with explanatory comments) see BRM_Exports/Shared.as.

  • BRM::INewsScoreBoardManager

    • int NewsActivityId
    • string ServerName
    • string NewsName
    • BRM::INewsScoreBoardSection@ GetOrCreateSection(const string &in sectionName)
    • BRM::INewsScoreBoardSection@ GetSection(const string &in sectionName)
    • void DeleteAllSections()
    • void ClearAllEntries()
    • void EnsureNewsActivityCreatedAsync()
    • void UpdateNewsAsync()
    • void UpdateNewsInBg()
  • BRM::INewsScoreBoardSection

    • string SectionName
    • array<BRM::INewsScoreBoardEntry@> Entries
    • void AddEntry(int rank, const string &in name, int wrs = -1, int ats = -1, int golds = -1, int mapsPlayed = -1)
    • void ClearEntries()
    • string ToNewsString()
  • BRM::INewsScoreBoardEntry

    • int Rank
    • string Name
    • int WRs
    • int ATs
    • int Golds
    • int MapsPlayed
    • string ToNewsString()

0.2.10 - 3 months ago

  • Fix map UID blacklist alert

0.2.9 - 4 months ago

  • Add UID blacklist to Add Random Maps from TMX window (thanks risyn).
  • Add room map list export to json (thanks risyn).
  • Update tags list & fix some minor bugs.

View all changelogs