OsuRoom

Represents a multiplayer lobby in osu! Automatically does ratelimiting by not sending more than a message every 2 seconds.

All slot indices are 0 based.

class OsuRoom {
bool timerIsStart;
bool timerRunning;
bool inProgress;
}

Members

Functions

abortMatch
bool abortMatch()

Aborts a running match

abortTimer
void abortTimer()

Aborts any running countdown

addRef
void addRef(string player)

Adds a player as referee (can manage the room with !mp commands), also useful to allow room control to another bot.

addRefs
void addRefs(string[] players)

Adds players to referees.

bancho
BanchoBot bancho()

Returns the BanchoBot instance used with this room.

channel
string channel()

Returns the channel name as on IRC

clearhost
void clearhost()

Makes nobody host (make it system/bog managed)

close
void close()

Closes the room and calls processClosed.

host
void host(string player)

Gives host to a player

invite
void invite(string player)

Invites a player to the room

isOpen
bool isOpen()
kick
void kick(string player)

Kicks a player from the room

locked
void locked(bool locked)

Property to lock slots (disallow changing slots & joining)

map
void map(string id)

Changes the map to a beatmap ID (b/ url)

mapAndMode
void mapAndMode(string id, GameMode mode)

Changes the map to a beatmap ID (b/ url) with gamemode

mods
void mods(Mod[] mods)

Changes the mods in this lobby (pass FreeMod first if you want FreeMod)

move
void move(string player, int slot)

Moves a player to another slot

mpid
string mpid()

Returns the game ID as usable in osu://mp/ID urls

password
void password(string pw)

Sets the match password (password will be visible to existing players)

processClosed
void processClosed()

Processes a room closed event

processFinishPlaying
void processFinishPlaying(string player, long score, bool pass)

Processes a user finish playing event & updates the state

processHost
void processHost(string user)

Processes a user host event & updates the state

processJoin
void processJoin(string user, ubyte slot, Team team)

Processes a user join event & updates the state

processLeave
void processLeave(string user)

Processes a user leave event & updates the state

processMatchFinish
void processMatchFinish()

Processes a match end event & updates the state

processMove
void processMove(string user, ubyte slot)

Processes a user move event & updates the state

processSize
void processSize(ubyte numSlots)

Processes a room size change event & updates the state

processTeam
void processTeam(string user, Team team)

Processes a user team switch event & updates the state

ratelimit
void ratelimit(bool put)

Manually wait until you can send a message again.

removeRef
void removeRef(string player)

Removes a player from referees.

removeRefs
void removeRefs(string[] players)

Removes players from referees.

room
string room()

Returns the room ID as usable in the mp history URL or IRC joinable via #mp_ID

sendMessage
void sendMessage(in char[] message)

Sends a message with a 2 second ratelimit

set
void set(TeamMode teammode, ScoreMode scoremode, ubyte size)

Sets up teammode, scoremode & lobby size

setTeam
void setTeam(string user, Team team)

Changes a user's team

setTimer
void setTimer(Duration d)

Sets a timer using !mp timer

settings
Settings settings()

Returns the current mp settings

size
void size(ubyte slots)

Changes the slot limit of this lobby

start
void start(Duration after = Duration.zero)

Starts a match after a specified amount of seconds. If after is <= 0 the game will be started immediately. The timeout can be canceled using abortTimer.

waitForJoin
string waitForJoin(Duration timeout)

Waits for a player to join the room & return the username

waitForTimer
void waitForTimer(Duration timeout)

Waits for an existing timer/countdown to finish (wont start one)

Structs

Settings
struct Settings

Returned by !mp settings

Variables

onBeatmapChanged
Event!BeatmapInfo onBeatmapChanged;

Host changed map

onBeatmapPending
Event!() onBeatmapPending;

Host is changing beatmap

onClosed
Event!() onClosed;

The room has been closed

onCountdownAborted
Event!() onCountdownAborted;

A countdown was aborted

onCountdownFinished
Event!() onCountdownFinished;

A timer finished

onMatchAborted
Event!() onMatchAborted;

The match was started but now aborted

onMatchEnd
Event!() onMatchEnd;

Match has ended (all players finished)

onMatchStart
Event!() onMatchStart;

Match has started

onMessage
Event!Message onMessage;

A message by anyone has been sent

onPlayerFinished
Event!(string, long, bool) onPlayerFinished;

A user finished playing. username + score + passed

onPlayersReady
Event!() onPlayersReady;

emitted when all players are ready

onUserHost
Event!string onUserHost;

username as argument

onUserJoin
Event!(string, ubyte, Team) onUserJoin;

username + slot (0 based) + team as argument

onUserLeave
Event!string onUserLeave;

username as argument

onUserMove
Event!(string, ubyte) onUserMove;

username + slot (0 based) as argument

onUserTeamChange
Event!(string, Team) onUserTeamChange;

username & team as argument

slots
Settings.Player[16] slots;

Automatically managed state of player slots, empty slots are Player.init

Meta