packets

package
v0.0.0-...-34f5af7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Packets used by multiple server types.

* Packet constants and structures. All functions return 0 on success, * negative int on db error, and a positive int for any other errors.

Packets specific to the patch and data servers.

Index

Constants

View Source
const (
	LobbyListType        = 0x83
	BlockListType        = 0x07
	FullCharacterType    = 0xE7
	FullCharacterEndType = 0x95
)
View Source
const (
	PCHeaderSize = 0x04
	BBHeaderSize = 0x08
)
View Source
const (
	BBLoginErrorNone = iota
	BBLoginErrorUnknown
	BBLoginErrorPassword
	BBLoginErrorPassword2 // Same as password
	BBLoginErrorMaintenance
	BBLoginErrorUserInUse
	BBLoginErrorBanned
	BBLoginErrorBanned2 // Same as banned
	BBLoginErrorUnregistered
	BBLoginErrorExpiredSub
	BBLoginErrorLocked
	BBLoginErrorPatch
	BBLoginErrorDisconnect
)
View Source
const (
	DisconnectType = 0x05
	RedirectType   = 0x19
	MenuSelectType = 0x10
)

Packet types common to multiple servers.

View Source
const (
	LoginWelcomeType            = 0x03
	LoginType                   = 0x93
	LoginSecurityType           = 0xE6
	LoginClientMessageType      = 0x1A
	LoginOptionsRequestType     = 0xE0
	LoginOptionsType            = 0xE2
	LoginCharSelectType         = 0xE3
	LoginCharAckType            = 0xE4
	LoginCharPreviewType        = 0xE5
	LoginChecksumType           = 0x01E8
	LoginChecksumAckType        = 0x02E8
	LoginGuildcardReqType       = 0x03E8
	LoginGuildcardHeaderType    = 0x01DC
	LoginGuildcardChunkType     = 0x02DC
	LoginGuildcardChunkReqType  = 0x03DC
	LoginParameterHeaderType    = 0x01EB
	LoginParameterChunkType     = 0x02EB
	LoginParameterChunkReqType  = 0x03EB
	LoginParameterHeaderReqType = 0x04EB
	LoginSetFlagType            = 0xEC
	LoginTimestampType          = 0xB1
	LoginShipListType           = 0xA0
	LoginScrollMessageType      = 0xEE
)

Packet types for packets sent to and from the login and character servers.

View Source
const (
	PatchWelcomeType        = 0x02
	PatchHandshakeType      = 0x04
	PatchMessageType        = 0x13
	PatchRedirectType       = 0x14
	PatchDataAckType        = 0x0B
	PatchDirAboveType       = 0x0A
	PatchChangeDirType      = 0x09
	PatchCheckFileType      = 0x0C
	PatchFileListDoneType   = 0x0D
	PatchFileStatusType     = 0x0F
	PatchClientListDoneType = 0x10
	PatchUpdateFilesType    = 0x11
	PatchFileHeaderType     = 0x06
	PatchFileChunkType      = 0x07
	PatchFileCompleteType   = 0x08
	PatchUpdateCompleteType = 0x12
)

Packet types handled by the patch and data servers.

Variables

This section is empty.

Functions

This section is empty.

Types

type BBHeader

type BBHeader struct {
	Size  uint16
	Type  uint16
	Flags uint32
}

Packet header for every packet sent between the server and BlueBurst clients.

type BBLoginError

type BBLoginError uint32

Error codes used by the 0xE6 security/auth response packet.

type BankItem

type BankItem struct {
	Data      [12]byte
	ItemID    uint32
	MagData   [4]byte
	BankCount uint32
}

type Block

type Block struct {
	Unknown   uint16
	BlockID   uint32
	Padding   uint16
	BlockName [36]byte
}

Info about the available block servers.

type BlockList

type BlockList struct {
	Header   BBHeader
	Padding  [10]byte
	ShipName [32]byte
	Unknown  uint32
	Blocks   []Block
}

List containing the available blocks on a ship.

type ChangeDir

type ChangeDir struct {
	Header  PCHeader
	Dirname [64]byte
}

Instruct the client to chdir into Dirname (one level below).

type CharacterAck

type CharacterAck struct {
	Header BBHeader
	Slot   uint32
	Flag   uint32
}

Acknowledge a character selection from the client or indicate an error.

type CharacterPreview

type CharacterPreview struct {
	Experience     uint32
	Level          uint32
	GuildcardStr   [16]byte
	Unknown        [2]uint32
	NameColor      uint32
	Model          byte
	Padding        [15]byte
	NameColorChksm uint32
	SectionID      byte
	Class          byte
	V2Flags        byte
	Version        byte
	V1Flags        uint32
	Costume        uint16
	Skin           uint16
	Face           uint16
	Head           uint16
	Hair           uint16
	HairRed        uint16
	HairGreen      uint16
	HairBlue       uint16
	PropX          float32
	PropY          float32
	// In reality this is [16]uint16 but []uint8 is more convenient to work with.
	Name     [32]uint8
	Playtime uint32
}

CharacterSummary is the common intermediate representation of a Character as it gets passed around various servers and/or stored.

type CharacterSelection

type CharacterSelection struct {
	Header    BBHeader
	Slot      uint32
	Selecting uint32
}

type CharacterSummary

type CharacterSummary struct {
	Header    BBHeader
	Slot      uint32
	Character CharacterPreview
}

Sent to the client for the selection menu and received for updating a character.

type CheckFile

type CheckFile struct {
	Header   PCHeader
	PatchID  uint32
	Filename [32]byte
}

Request a check on a file in the client's working directory.

type ChecksumAck

type ChecksumAck struct {
	Header BBHeader
	Ack    uint32
}

Sent in response to 0x01E8 to acknowledge a checksum (really it's just ignored).

type ClientConfig

type ClientConfig struct {
	// The rest of this holds various portions of client state to represent
	// the client's progression through the login process.
	Magic        uint32 // Must be set to 0x48615467
	CharSelected uint8  // Has a character been selected?
	SlotNum      uint8  // Slot number of selected Character
	Flags        uint16
	Ports        [4]uint16
	Unused       [4]uint32
	Unused2      [2]uint32
}

type FileChunk

type FileChunk struct {
	Header   PCHeader
	Chunk    uint32
	Checksum uint32
	Size     uint32
	Data     []byte
}

Chunk of data from a file.

type FileHeader

type FileHeader struct {
	Header   PCHeader
	Padding  uint32
	FileSize uint32
	Filename [48]byte
}

File header for a series of file chunks.

type FileStatus

type FileStatus struct {
	Header   PCHeader
	PatchID  uint32
	Checksum uint32
	FileSize uint32
}

Response to CheckFile from the client with the properties of a file.

type FullCharacter

type FullCharacter struct {
	Header                BBHeader
	NumInventoryItems     uint8
	HPMaterials           uint8 // TODO: Is this total HP materials consumed (i.e. for the limit)?
	TPMaterials           uint8 // TODO: Is this total HP materials consumed (i.e. for the limit)?
	Language              uint8
	Inventory             [30]InventorySlot
	ATP                   uint16
	MST                   uint16
	EVP                   uint16
	HP                    uint16
	DFP                   uint16
	ATA                   uint16
	LCK                   uint16
	Unknown               [30]byte
	Level                 uint16
	Unknown2              uint16
	Experience            uint32
	Meseta                uint32
	GuildcardStr          [10]byte
	Unknown3              [10]uint8
	NameColorBlue         uint8
	NameColorGreen        uint8
	NameColorRed          uint8
	NameColorTransparency uint8
	SkinID                uint16
	Unknown4              [18]byte
	SectionID             uint8
	Class                 uint8
	SkinFlag              uint8
	Unknown5              [5]byte
	Costume               uint16
	Skin                  uint16
	Face                  uint16
	Head                  uint16
	Hair                  uint16
	HairColorRed          uint16
	HairColorBlue         uint16
	HairColorGreen        uint16
	ProportionX           uint32
	ProportionY           uint32
	Name                  [24]byte
	PlayTime              uint32
	Unknown6              [4]byte
	KeyConfig             [232]uint8
	Techniques            [20]uint8
	Unknown7              [16]uint8
	Options               [4]uint8
	Reserved4             uint32
	QuestData             [512]uint8
	Reserved5             uint32
	BankUse               uint32
	BankMeseta            uint32
	BankInventory         [200]BankItem
	Guildcard             uint32
	Name2                 [24]uint8
	Unknown9              [56]byte
	GuildcardText         [176]uint8
	Reserved1             uint8
	Reserved2             uint8
	SectionID2            uint8
	Class2                uint8
	Unknown10             [4]uint8
	SymbolChats           [1248]uint8
	Shortcuts             [2624]uint8
	AutoReply             [344]uint8
	GCBoard               [172]uint8
	Unknown12             [200]uint8
	ChallengeData         [320]uint8
	TechConfig            [40]uint8
	Unknown13             [40]uint8
	QuestData2            [92]uint8
	Unknown14             [276]uint8
	KeyConfigGlobal       [364]uint8
	JoystickConfigGlobal  [56]uint8
	Guildcard2            uint32
	TeamID                uint32
	TeamInformation       [8]uint8
	PrivilegeLevel        uint16
	Reserved3             uint16
	TeamName              [28]uint8
	Unknown15             uint32
	TeamFlag              [2048]uint8
	TeamRewards           [8]uint8
}

FullCharacter is the full dataset for one character.

type GuildcardChunk

type GuildcardChunk struct {
	Header  BBHeader
	Unknown uint32
	Chunk   uint32
	Data    []uint8
}

type GuildcardChunkRequest

type GuildcardChunkRequest struct {
	Header         BBHeader
	Unknown        uint32
	ChunkRequested uint32
	Continue       uint32
}

Received from the client to request a guildcard data chunk.

type GuildcardHeader

type GuildcardHeader struct {
	Header   BBHeader
	Unknown  uint32
	Length   uint16
	Padding  uint16
	Checksum uint32
}

Chunk header with info about the guildcard data we're about to send.

type InventoryItem

type InventoryItem struct {
	Data    [12]byte
	ItemID  uint32
	MagData uint32
}

type InventorySlot

type InventorySlot struct {
	InUse   uint8 // 0x01 for in use, 0xFF is unused
	Unknown [3]byte
	Flags   uint32
	Item    InventoryItem
}

type LobbyList

type LobbyList struct {
	Header  BBHeader
	Lobbies []LobbyListEntry
}

LobbyList is the list of available lobbies in a block.

type LobbyListEntry

type LobbyListEntry struct {
	MenuID  uint32 // Always 0x01 0x00 0x1A 0x00
	LobbyID uint32
	Padding uint32
}

type Login

type Login struct {
	Header        BBHeader
	Unknown       [8]byte
	ClientVersion uint16
	Slot          uint32
	Phase         LoginPhase
	Unknown4      uint8 // It's not clear yet if this field is part of/related to the Phase field but it can take either 0 or e value on different clients
	TeamID        uint32
	Username      [16]byte
	Padding       [32]byte
	Password      [16]byte
	Unknown3      [40]byte
	HardwareInfo  [8]byte
	Security      [40]byte
	Padding2      uint32
}

Login Packet (0x93) sent to both the login and character servers.

type LoginClientMessage

type LoginClientMessage struct {
	Header   BBHeader
	Language uint32
	Message  []byte
}

Message in a large text box, usually sent right before a disconnect.

type LoginPhase

type LoginPhase uint8

LoginPhase is an identifier set by the client to distinguish the "phases" it passes though with the Character server. The client disconnects and then reconnects between each phase.

const (
	// Initialize represents the first connection with the Character server. The
	// client expects to authenticate, download the parameter files, and get the
	// previews of the account's characters.
	Initialize LoginPhase = iota
	// CharacterSelect is the second connection with the Character server and
	// all the client seems to do is to set a flag indicating that the user is
	// choosing a character.
	CharacterSelect
	// CharacterCreate is an optional connection with the Character server and indicates
	// that the user has either created a new character or recreated an existing one.
	CharacterCreate
	// CharacterUpdate is another optional connection with the Character server and
	// only appears when the user selects the Dressing Room during character selection.
	CharacterUpdate
	// ShipSelection is the final connection with the Character server. The client expects
	// to receive the ship list and the IP address of the selected Ship server.
	ShipSelection
)
type MenuSelection struct {
	Header  BBHeader
	Unknown uint16
	MenuID  uint16
	ItemID  uint32
}

MenuSelection is a client packet indicating a player's selection from one of the various menus, such as the ship or block list.

type Options

type Options struct {
	Header BBHeader
	// Based on the key config structure from sylverant and newserv. KeyConfig
	// and JoystickConfig are saved in the database.
	//
	// Note: This packet is shortened by dropping 4 bytes from TeamFlag in order
	// to align it with tethealla. Sylverant and Newserv do not do this and this
	// may not actually be right.
	PlayerKeyConfig struct {
		Unknown            [0x114]uint8
		KeyConfig          [0x16C]uint8
		JoystickConfig     [0x38]uint8
		Guildcard          uint32
		TeamID             uint32
		TeamInfo           [2]uint32
		TeamPrivilegeLevel uint16
		Reserved           uint16
		Teamname           [0x10]uint16
		TeamFlag           [0x7FC]uint8
		TeamRewards        [2]uint32
	}
}

Options packet containing keyboard and joystick config, team options, etc.

type PCHeader

type PCHeader struct {
	Size uint16
	Type uint16
}

Blueburst, PC, and Gamecube clients all use a 4 byte header to communicate with the patch server instead of the 8 byte one used by Blueburst for the other servers.

type ParameterChunk

type ParameterChunk struct {
	Header BBHeader
	Chunk  uint32
	Data   []byte
}

type ParameterHeader

type ParameterHeader struct {
	Header  BBHeader
	Entries []byte
}

Parameter header containing details about the param files we're about to send.

type PatchRedirect

type PatchRedirect struct {
	Header  PCHeader
	IPAddr  [4]uint8
	Port    uint16
	Padding uint16
}

Redirect packet for patch to send character server IP.

type PatchWelcome

type PatchWelcome struct {
	Header       PCHeader
	Copyright    [44]byte
	Padding      [20]byte
	ServerVector [4]byte
	ClientVector [4]byte
}

Welcome packet with encryption vectors sent to the client upon initial connection.

type PatchWelcomeMessage

type PatchWelcomeMessage struct {
	Header  PCHeader
	Message []byte
}

Packet containing the patch server welcome message.

type Redirect

type Redirect struct {
	Header  BBHeader
	IPAddr  [4]uint8
	Port    uint16
	Padding uint16
}

The address of the next server; in this case, the character server.

type ScrollMessagePacket

type ScrollMessagePacket struct {
	Header  BBHeader
	Padding [2]uint32
	Message []byte
}

Scroll message the client should display on the ship select screen.

type Security

type Security struct {
	Header       BBHeader
	ErrorCode    uint32
	PlayerTag    uint32
	Guildcard    uint32
	TeamID       uint32
	Config       ClientConfig
	Capabilities uint32
}

Security packet (0xE6) sent to the client to indicate the state of client login.

type SetFlag

type SetFlag struct {
	Header BBHeader
	Flag   uint32
}

Used by the client to indicate whether a character should be recreated or updated.

type ShipList

type ShipList struct {
	Header      BBHeader
	Padding     uint16
	Unknown     uint16 // Always 0x20
	Unknown2    uint32 // Always 0xFFFFFFF4
	Unknown3    uint16 // Always 0x04
	ServerName  [32]byte
	Padding2    uint32
	ShipEntries []ShipListEntry
}

The list of menu items to display to the client.

type ShipListEntry

type ShipListEntry struct {
	MenuID   uint16
	ShipID   uint32
	Padding  uint16
	ShipName [36]byte
}

type StartFileUpdate

type StartFileUpdate struct {
	Header    PCHeader
	TotalSize uint32
	NumFiles  uint32
}

Size and number of files that need to be updated.

type Timestamp

type Timestamp struct {
	Header    BBHeader
	Timestamp [28]byte
}

Indicate the server's current time.

type Welcome

type Welcome struct {
	Header       BBHeader
	Copyright    [96]byte
	ServerVector [48]byte
	ClientVector [48]byte
}

Welcome packet with encryption vectors sent to the client upon initial connection.

Jump to

Keyboard shortcuts

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