block

package
v0.0.0-...-4e28f1d Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BadPassword = 0xfffffdda
View Source
const CouldNotEnterLobby = 0xfffffe09
View Source
const DoesntExist = 0x00000001
View Source
const GeneralError = 0xffffffff
View Source
const MAX_BLOCK_DATA_SIZE = 1024
View Source
const Ok = 0
View Source
const PlayerNameExists = 0xfffffefc
View Source
const RoomFull = 0xfffffe09
View Source
const ServiceUnavailableError = 0xffffff12
View Source
const VerificationError = 0xffffff10

Variables

This section is empty.

Functions

func GetBytes

func GetBytes(b PieceInternal) []byte

Types

type AccountPlayerInternal

type AccountPlayerInternal struct {
	Position      byte
	Id            uint32
	Name          [32]byte
	Unknown       [16]byte
	TimePlayed    uint32
	Division      byte
	Points        uint32
	Category      uint16
	MatchesPlayed uint16
}

type AccountPlayers

type AccountPlayers struct {
	Players [3]*Player
}

type AccountPlayersInternal

type AccountPlayersInternal struct {
	Zero                   uint32
	AccountPlayersInternal [3]AccountPlayerInternal
}

type AccountingInit

type AccountingInit struct {
}

type AccountingInitInternal

type AccountingInitInternal struct {
	Unknown [16]byte
}

type Authentication

type Authentication struct {
	Key          string
	PasswordHash []byte
	Password     string
	Unknown      []byte
	RosterHash   []byte
}

func NewAuthentication

func NewAuthentication(b *Block) Authentication

func (Authentication) GetPasswordHash

func (info Authentication) GetPasswordHash() []byte

type AuthenticationInternal

type AuthenticationInternal struct {
	Data [80]byte
}

type Block

type Block struct {
	Header *Header
	Body   Body
}

func GetBlocks

func GetBlocks(query uint16, data interface{}) []*Block

func GetBlocksFromPieces

func GetBlocksFromPieces(query uint16, pieces []Piece) []*Block

func NewBlock

func NewBlock(query uint16, body Body) *Block

func ReadBlock

func ReadBlock(data []byte) (*Block, error)

func (*Block) GetBytes

func (b *Block) GetBytes() []byte

func (*Block) Sign

func (b *Block) Sign(sequence uint32)

func (*Block) String

func (b *Block) String() string

type Body

type Body interface {
	GetBytes() []byte
}

type Byte

type Byte struct {
	Value byte
}

func NewByte

func NewByte(b *Block) Byte

type ByteInternal

type ByteInternal struct {
	Value byte
}

type ChatMessage

type ChatMessage struct {
	Place      byte // lobby = 0, or room = 1
	Channel    byte // 1 = to lobby, 2, 3 = private, 4 = group, 5 = playing, 7 = in-game, 8 = room, 9 = team
	PlayerId   uint32
	PlayerName string
	Message    string
}

func NewChatMessage

func NewChatMessage(b *Block, playerName string) *ChatMessage

type ChatMessageInternal

type ChatMessageInternal struct {
	Place      byte
	Channel    byte
	Unknown1   [4]byte
	PlayerId   uint32
	PlayerName [48]byte
	Message    [48]byte
}

type CreateRoom

type CreateRoom struct {
	Name        string
	HasPassword byte
	Password    string
}

func NewCreateRoom

func NewCreateRoom(b *Block) CreateRoom

type CreateRoomInternal

type CreateRoomInternal struct {
	Name        [64]byte
	HasPassword byte
	Password    [16]byte
}

type GenericBody

type GenericBody struct {
	Data []byte
}

func (GenericBody) GetBytes

func (body GenericBody) GetBytes() []byte

type GroupInfo

type GroupInfo struct {
	Time time.Time
}

type GroupInfoInternal

type GroupInfoInternal struct {
	Unknown0 [36]byte
	Time     [19]byte
	Unknown1 [20]byte
}
type Header struct {
	Query    uint16
	Size     uint16
	Sequence uint32
	Hash     [16]byte // Sixserver says this is the md5 of Data
}

type JoinLobby

type JoinLobby struct {
	LobbyId byte
	Ip1     string
	Port1   uint16
	Ip2     string
	Port2   uint16
}

func NewJoinLobby

func NewJoinLobby(b *Block) JoinLobby

type JoinLobbyInternal

type JoinLobbyInternal struct {
	LobbyId byte
	Ip1     [16]byte
	Port1   uint16
	Ip2     [16]byte
	Port2   uint16
	// contains filtered or unexported fields
}

type JoinRoomRequest

type JoinRoomRequest struct {
	Id       uint32
	Password string
}

func NewJoinRoomRequest

func NewJoinRoomRequest(b *Block) JoinRoomRequest

type JoinRoomResponse

type JoinRoomResponse struct {
	Code     uint32
	Position byte
}

type JoinRoomResponseInternal

type JoinRoomResponseInternal struct {
	Code     uint32
	Position byte
}
type Link struct {
	Ip1   string
	Port1 uint16
	Ip2   string
	Port2 uint16
}

type Lobbies

type Lobbies struct {
	Lobbies []*Lobby
}

type LobbiesInternal

type LobbiesInternal struct {
	NumLobbies      uint16
	LobbiesInternal []LobbyInternal
}

type Lobby

type Lobby struct {
	Type       byte
	Name       string
	NumClients uint16
	Rooms      *types.IdMap
}

func (*Lobby) RemoveRoom

func (l *Lobby) RemoveRoom(roomId uint32)

type LobbyInternal

type LobbyInternal struct {
	Type       byte
	Name       [32]byte
	NumClients uint16
}

type MessageToGroup

type MessageToGroup struct {
	// contains filtered or unexported fields
}

type News

type News struct {
	Time  time.Time
	Title string
	Text  string
}

type NewsInternal

type NewsInternal struct {
	Header [6]byte
	Time   [19]byte
	Title  [64]byte
	Text   [935]byte
}

type Piece

type Piece interface {
	// contains filtered or unexported methods
}

func GetPieces

func GetPieces(data reflect.Value) []Piece

type PieceInternal

type PieceInternal interface {
}

type Pieces

type Pieces struct {
	// contains filtered or unexported fields
}

type Player

type Player struct {
	Id       uint32
	Category uint16
	Points   uint32

	MatchPoints   uint32
	MatchesPlayed uint16
	Victories     uint16
	Defeats       uint16
	Draws         uint16

	WinningStreak  uint16
	BestStreak     uint16
	Disconnections uint16
	Division       byte

	Teams         [5]uint16
	GoalsScored   uint32
	GoalsReceived uint32
	TimePlayed    uint32
	LastLogin     uint32
	Position      uint32
	OldCategory   uint32
	OldPoints     uint32

	Name     string
	Comment  string
	Lang     uint16
	Settings []byte
	LoggedIn bool
	Admin    int

	RoomId     uint32
	GameStatus byte

	GroupId     uint32
	GroupName   string
	GroupStatus byte

	RoomData *PlayerRoomData

	Link *Link
}

func NewPlayer

func NewPlayer(name string) *Player

func (*Player) ResetRoomData

func (info *Player) ResetRoomData()

type PlayerCreate

type PlayerCreate struct {
	Position byte
	Name     string
}

func NewPlayerCreate

func NewPlayerCreate(b *Block) PlayerCreate

type PlayerCreateInternal

type PlayerCreateInternal struct {
	// contains filtered or unexported fields
}

type PlayerExtended

type PlayerExtended struct {
	*Player
}

type PlayerExtendedInternal

type PlayerExtendedInternal struct {
	Zero           uint32
	Id             uint32
	Name           [48]byte
	GroupId        uint32
	GroupName      [48]byte
	GroupStatus    byte
	Division       byte
	Points         uint32
	Category       uint16
	MatchesPlayed  uint16
	Victories      uint16
	Defeats        uint16
	Draws          uint16
	WinningStreak  uint16
	BestStreak     uint16
	Disconnections uint16
	GoalsScored    uint32
	GoalsReceived  uint32
	Comment        [256]byte
	Position       uint32
	// uint16's could have to do with medals
	Unknown2  [12]byte
	Lang      uint16
	LastTeams [5]uint16
}

type PlayerExtraSettings

type PlayerExtraSettings struct {
	PlayerId  uint32
	GroupName string
}

type PlayerExtraSettingsInternal

type PlayerExtraSettingsInternal struct {
	Unknown0  uint32
	PlayerId  uint32
	Unknown1  [37]byte
	GroupName [48]byte
	Unknown2  [3]byte
}

type PlayerFriends

type PlayerFriends struct {
}

type PlayerFriendsInternal

type PlayerFriendsInternal struct {
}

type PlayerIdResponse

type PlayerIdResponse struct {
}

type PlayerIdResponseInternal

type PlayerIdResponseInternal struct {
	Unknown1 [8]byte
	Code     uint16
	Unknown2 [4]byte
}

type PlayerInternal

type PlayerInternal struct {
	Id            uint32
	Name          [48]byte
	GroupId       uint32
	GroupName     [48]byte
	GroupStatus   byte
	Division      byte
	RoomId        uint32 // Not clear whether this could be the room id, we will fill it with ff's
	Points        uint32
	Category      uint16
	MatchesPlayed uint16
	Victories     uint16
	Defeats       uint16
	Draws         uint16
	Lang          uint16
	GameStatus    byte // 0 = idle, 1 = competition
}
type PlayerLink struct {
	Player *Player
}

type PlayerLinkInternal

type PlayerLinkInternal struct {
	Unknown1 uint32
	Ip1      [16]byte
	Port1    uint16
	Ip2      [16]byte
	Port2    uint16
	PlayerId uint32
}

type PlayerParticipateResponse

type PlayerParticipateResponse struct {
	Code          uint32
	Selection     byte
	Participation byte
}

type PlayerParticipateResponseInternal

type PlayerParticipateResponseInternal struct {
	Code          uint32
	Selection     byte
	Participation byte
}

type PlayerRoomData

type PlayerRoomData struct {
	Team          byte
	Spectator     byte
	Participation byte
}

type PlayerSelected

type PlayerSelected struct {
	Position byte
	Lang     byte
	Unknown  byte
}

func NewPlayerSelected

func NewPlayerSelected(b *Block) PlayerSelected

type PlayerSettings

type PlayerSettings struct {
	Settings []byte
}

type PlayerSettingsHeader

type PlayerSettingsHeader struct {
	PlayerId uint32
}

type PlayerSettingsHeaderInternal

type PlayerSettingsHeaderInternal struct {
	Zero     uint32
	PlayerId uint32
}

type PlayerSettingsInternal

type PlayerSettingsInternal struct {
	Settings [1300]byte
}

type RankUrl

type RankUrl struct {
	Rtype int
	Url   string
}

type RankUrlInternal

type RankUrlInternal struct {
	Rtype   byte
	Unknown byte
	Url     [128]byte
}

type RankUrlsHeader

type RankUrlsHeader struct {
}

type RankUrlsInternal

type RankUrlsInternal struct {
	Unknown [8]byte
}

type Room

type Room struct {
	Id          uint32
	Type        byte
	Phase       byte
	Name        string
	Time        byte
	Players     []*Player
	Teams       [2]RoomTeam
	HasPassword byte
	Password    string
	MatchType   byte
	ChatLevel   byte
}

func GetRoomsSlice

func GetRoomsSlice(rooms *types.IdMap) []*Room

func (*Room) AddPlayer

func (info *Room) AddPlayer(player *Player) byte

func (*Room) GetNumPlayers

func (info *Room) GetNumPlayers() int

func (*Room) HasPlayers

func (info *Room) HasPlayers() bool

func (*Room) RemovePlayer

func (info *Room) RemovePlayer(player *Player) error

func (Room) ToggleParticipation

func (info Room) ToggleParticipation(playerId uint32) (byte, error)

type RoomInternal

type RoomInternal struct {
	Id          uint32
	Type        byte
	Phase       byte
	Name        [64]byte
	Time        byte
	Players     [4]RoomPlayerInternal
	RoomTeams   [2]RoomTeam
	Unknown1    byte
	HasPassword byte
	MatchType   byte
	ChatLevel   byte
	Unknown2    byte
	Unknown3    byte
}

type RoomParticipation

type RoomParticipation Room

func NewRoomParticipation

func NewRoomParticipation(room *Room) *RoomParticipation

type RoomParticipationInternal

type RoomParticipationInternal struct {
	Players [4]RoomPlayerParticipationInternal
}

type RoomPlayerInternal

type RoomPlayerInternal struct {
	Id            uint32
	Owner         byte
	Unknown       byte
	Team          byte
	Spectator     byte
	Position      byte
	Participation byte
}

type RoomPlayerLinkInternal

type RoomPlayerLinkInternal struct {
	Unknown1  [32]byte
	Ip1       [16]byte
	Port1     uint16
	Ip2       [16]byte
	Port2     uint16
	PlayerId  uint32
	Position1 byte // Why two positions? idk
	Position2 byte
	Color     byte
}
type RoomPlayerLinks Room
func NewRoomPlayerLinks(room *Room) *RoomPlayerLinks

type RoomPlayerLinksInternal

type RoomPlayerLinksInternal struct {
	Internals []RoomPlayerLinkInternal
}

type RoomPlayerParticipationInternal

type RoomPlayerParticipationInternal struct {
	Id            uint32
	Position      byte
	Participation byte
}

type RoomTeam

type RoomTeam struct {
	Id          uint16
	GoalsByPart [5]byte
}

type Server

type Server struct {
	Stype      int
	Name       string
	Ip         string
	Port       int
	NumClients int
}

type ServerInternal

type ServerInternal struct {
	Unknown1   [7]byte
	Stype      byte
	Name       [32]byte
	Ip         [15]byte
	Port       uint16
	NumClients uint16
	Unknown2   [2]byte
}

type ServerTime

type ServerTime struct {
	Time time.Time
}

type ServerTimeInternal

type ServerTimeInternal struct {
	Time uint32
}

type Uint32

type Uint32 struct {
	Value uint32
}

func NewUint32

func NewUint32(b *Block) *Uint32

type Uint32Internal

type Uint32Internal struct {
	Value uint32
}

type Void

type Void struct {
}

type VoidInternal

type VoidInternal struct {
}

Jump to

Keyboard shortcuts

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