Documentation
¶
Index ¶
- Constants
- func BanchoString(s string) []byte
- type Packet
- func ChannelJoin(channel string) Packet
- func ChannelListingComplete() Packet
- func ChannelTitle(channelName, channelDescription string, users uint16) Packet
- func ChoProtocol(protocolVersion uint32) Packet
- func FriendList(friends []int32) Packet
- func IntArray(packetID uint16, values []int32) Packet
- func MakePacket(t uint16, dataLen uint32, data interface{}) Packet
- func NewPacket(content []byte) Packet
- func NullPacket(packetID uint16) Packet
- func OnlinePlayers(players []int32) Packet
- func SilenceClient(time uint32) Packet
- func StringPacket(packetID uint16, s string) Packet
- func StringStringShort(packetID uint16, s1, s2 string, i uint16) Packet
- func UserData(u UserDataInfo) Packet
- func UserDataFull(u UserDataFullInfo) Packet
- func UserID(userID int32) Packet
- func UserPresence(userID int32) Packet
- func UserPrivileges(privileges uint32) Packet
- type UserDataFullInfo
- type UserDataInfo
Constants ¶
const ( ModeStandard = iota ModeTaiko ModeCTB ModeMania )
Game modes
const ( ColourNormal = 0 ColourSupporter = 4 ColourMod = 6 ColourAdmin = 16 )
These are the various colours an user can have in the osu! chat.
const ( PrivilegeNormal = 1 PrivilegeGMT = 2 PrivilegeSupporter = 4 PrivilegeGMTSupporter = PrivilegeSupporter | PrivilegeGMT )
User ranks
const ( LoginFailed = -1 LoginNeedUpdate = -2 // Locks the client LoginBanned = -4 // LoginError is to be used in case of maintainance LoginError = -5 LoginNeedSupporter = -6 )
These are the various error codes that can happen on login.
Variables ¶
This section is empty.
Functions ¶
func BanchoString ¶
BanchoString creates a string in the clusterfuck that is bancho.
Types ¶
type Packet ¶
type Packet struct {
Content []byte
}
Packet is a packet that must arrive at a user's client.
func ChannelJoin ¶
ChannelJoin returns a packet of successful joining of a channel.
func ChannelListingComplete ¶
func ChannelListingComplete() Packet
ChannelListingComplete tells bancho we finished outputting all the channels.
func ChannelTitle ¶
ChannelTitle returns a packet with the name, description and number of users in a channel.
func ChoProtocol ¶
ChoProtocol returns a packet with the current protocol version (which must be passed as an argument).
func FriendList ¶
FriendList returns an int array of friend user IDs (passed as argument).
func MakePacket ¶
MakePacket generates a new Packet with t being the type of packet and data being the actual data to write.
func NullPacket ¶
NullPacket can be used to send packets with no data in them (well, a uint32(0) actually)
func OnlinePlayers ¶
OnlinePlayers returns a packet with an array containing all the online users. User must be in it.
func SilenceClient ¶
SilenceClient makes a packet telling the client how much time the user has to be silence. time is the number of seconds until the end of the silence.
func StringPacket ¶
StringPacket returns a packet yielding a string.
func StringStringShort ¶
StringStringShort AKA Class20
func UserData ¶
func UserData(u UserDataInfo) Packet
UserData returns a packet containing the data of an user.
func UserDataFull ¶
func UserDataFull(u UserDataFullInfo) Packet
UserDataFull returns a packet containing the [extended] data of an user.
func UserID ¶
UserID returns a packet containing the UserID. This is used on login to tell the client everything went smoothly.
In case you wish to do other stuff on login, for instance locking the client, then use one of the constants beginning with `Login`.
func UserPresence ¶
UserPresence returns a packets which contains an user that has come online.
func UserPrivileges ¶
UserPrivileges returns a packet with the privileges of the user. Privileges can be picked using the related constants.
type UserDataFullInfo ¶
type UserDataFullInfo struct {
ID int32
// Action is afk, modding, playing, listening...
Action byte
ActionText string
ActionMapMD5 string
Mods int32
GameMode byte
// Nobody knows the fuck this is.
// ripple bancho v1 says this should be "\x00\x00\x00\x01", although justm3's
// custom-bancho says it should be just 0 (so "\x00\x00\x00\x00").
UnknownInt int32
Score uint64
// Accuracy is divided by 100 when sent to osu!. This is because 0.1337 = 13.37% on the osu! client.
Accuracy float32
Playcount uint32
// Used for level
TotalScore uint64
Rank uint32
PP uint16
}
UserDataFullInfo is a struct containing all the user data you'll ever need.
type UserDataInfo ¶
type UserDataInfo struct {
ID int32
PlayerName string
UTCOffset byte
Country byte
Colour byte
Longitude float32
Latitude float32
Rank uint32
}
UserDataInfo is a struct containing user data that can be passed to UserData() for making an user data packet. User data user data user data.
Source Files
¶
- bancho_protocol.go
- bancho_string.go
- channel_join.go
- channel_listing_complete.go
- channel_title.go
- friend_list.go
- game_modes.go
- int_array.go
- make_packet.go
- null_packet.go
- online_players.go
- packet.go
- silence_client.go
- string_packet.go
- string_string_short.go
- user_data.go
- user_data_full.go
- user_presence.go
- user_privileges.go
- userid.go