Documentation
¶
Index ¶
- Constants
- func BanchoString(s string) []byte
- type Packet
- func ChannelJoin(channel string) 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 P89() 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 UserPrivileges(privileges uint32) Packet
- type UserDataFullInfo
- type UserDataInfo
Constants ¶
const ( ModeStandard = iota ModeTaiko ModeCTB ModeMania )
Game modes
const ( PacketUserID = 5 PacketUserDataFull = 11 PacketChannelJoin = 64 PacketChannelTitle = 65 PacketUserPrivileges = 71 PacketFriendList = 72 PacketChoProtocol = 75 PacketUserData = 83 Packet89 = 89 // No-one has no idea of what packet 89 is. PacketSilenceClient = 92 PacketOnlinePlayers = 96 )
Here we have all the known and reverse engeneered packet IDs.
const ( ColourNormal = 0 ColourSupporter = 4 ColourMod = 6 ColourAdmin = 16 )
These are the various colours an user can have in the osu! chat.
const ( StatusIdle = iota StatusAfk StatusPlaying StatusEditing StatusModding StatusMultiplayer StatusWatching StatusUnknown StatusTesting StatusSubmitting StatusPaused StatusLobby StatusMultiplaying StatusOsuDirect )
User actions
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 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 P89 ¶
func P89() Packet
P89 returns a Packet89. No-one has no idea of what packet 89 is, thus the generic name.
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 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_title.go
- friend_list.go
- game_modes.go
- int_array.go
- make_packet.go
- null_packet.go
- online_players.go
- packet.go
- packet_89.go
- packet_ids.go
- silence_client.go
- string_packet.go
- string_string_short.go
- user_data.go
- user_data_full.go
- user_privileges.go
- userid.go