packets

package
v0.1.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2016 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ModeStandard = iota
	ModeTaiko
	ModeCTB
	ModeMania
)

Game modes

View Source
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.

View Source
const (
	ColourNormal    = 0
	ColourSupporter = 4
	ColourMod       = 6
	ColourAdmin     = 16
)

These are the various colours an user can have in the osu! chat.

View Source
const (
	StatusIdle = iota
	StatusAfk
	StatusPlaying
	StatusEditing
	StatusModding
	StatusMultiplayer
	StatusWatching
	StatusUnknown
	StatusTesting
	StatusSubmitting
	StatusPaused
	StatusLobby
	StatusMultiplaying
	StatusOsuDirect
)

User actions

View Source
const (
	PrivilegeNormal       = 1
	PrivilegeGMT          = 2
	PrivilegeSupporter    = 4
	PrivilegeGMTSupporter = PrivilegeSupporter | PrivilegeGMT
)

User ranks

View Source
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

func BanchoString(s string) []byte

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

func ChannelJoin(channel string) Packet

ChannelJoin returns a packet of successful joining of a channel.

func ChannelTitle

func ChannelTitle(channelName, channelDescription string, users uint16) Packet

ChannelTitle returns a packet with the name, description and number of users in a channel.

func ChoProtocol

func ChoProtocol(protocolVersion uint32) Packet

ChoProtocol returns a packet with the current protocol version (which must be passed as an argument).

func FriendList

func FriendList(friends []int32) Packet

FriendList returns an int array of friend user IDs (passed as argument).

func IntArray

func IntArray(packetID uint16, values []int32) Packet

IntArray generates a int[] without many clusterfucks.

func MakePacket

func MakePacket(t uint16, dataLen uint32, data interface{}) Packet

MakePacket generates a new Packet with t being the type of packet and data being the actual data to write.

func NewPacket

func NewPacket(content []byte) Packet

NewPacket generate a new packet.

func NullPacket

func NullPacket(packetID uint16) Packet

NullPacket can be used to send packets with no data in them (well, a uint32(0) actually)

func OnlinePlayers

func OnlinePlayers(players []int32) Packet

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

func SilenceClient(time uint32) Packet

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

func StringPacket(packetID uint16, s string) Packet

StringPacket returns a packet yielding a string.

func StringStringShort

func StringStringShort(packetID uint16, s1, s2 string, i uint16) Packet

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

func UserID(userID int32) Packet

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

func UserPrivileges(privileges uint32) Packet

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.

Directories

Path Synopsis
Package uleb128 allows for marshaling/unmarshaling of uleb128 values.
Package uleb128 allows for marshaling/unmarshaling of uleb128 values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL