package field

import "github.com/Diarkis/diarkis/proto/go/field"

Index

Constants

const JoinCmd uint16 = 120

JoinCmd represents the command ID of the protocol's command ID.

[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const JoinVer uint8 = 1

JoinVer represents the ver of the protocol's command.

[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const SyncCmd uint16 = 121

SyncCmd represents the command ID of the protocol's command ID.

[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const SyncVer uint8 = 1

SyncVer represents the ver of the protocol's command.

[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.

Types

type Join

type Join struct {
	// Command version of the protocol
	Ver uint8
	// Command ID of the protocol
	Cmd uint16
	// unique ID to identify the custom filter
	FilterID uint8
	// message to send with sync request
	Message []byte
	// whether or not to use reliable UDP on UDP connection
	Reliable bool
	// number of synchronization
	SyncLimit uint16
	// current x-coordinate of the client
	X int64
	// current y-coordinate of the client
	Y int64
	// current z-coordinate of the client
	Z int64
}

Join represents the command protocol data structure.

func NewJoin

func NewJoin() *Join

NewJoin creates a new instance of Join struct.

func (*Join) GetCmd

func (proto *Join) GetCmd() uint16

func (*Join) GetVer

func (proto *Join) GetVer() uint8

func (*Join) Pack

func (proto *Join) Pack() []byte

Pack encodes Join struct to a byte array to be delivered over the command.

func (*Join) PackedSize

func (proto *Join) PackedSize() int

PackedSize returns the estimated packed size of the struct.

func (*Join) String

func (proto *Join) String() string

func (*Join) Unpack

func (proto *Join) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to Join struct.

type Sync

type Sync struct {
	// Command version of the protocol
	Ver uint8
	// Command ID of the protocol
	Cmd uint16
	// unique ID to identify the custom filter
	FilterID uint8
	// message to send with sync request
	Message []byte
	// whether or not to use reliable UDP on UDP connection
	Reliable bool
	// number of synchronization
	SyncLimit uint16
	// current x-coordinate of the client
	X int64
	// current y-coordinate of the client
	Y int64
	// current z-coordinate of the client
	Z int64
}

Sync represents the command protocol data structure.

func NewSync

func NewSync() *Sync

NewSync creates a new instance of Sync struct.

func (*Sync) GetCmd

func (proto *Sync) GetCmd() uint16

func (*Sync) GetVer

func (proto *Sync) GetVer() uint8

func (*Sync) Pack

func (proto *Sync) Pack() []byte

Pack encodes Sync struct to a byte array to be delivered over the command.

func (*Sync) PackedSize

func (proto *Sync) PackedSize() int

PackedSize returns the estimated packed size of the struct.

func (*Sync) String

func (proto *Sync) String() string

func (*Sync) Unpack

func (proto *Sync) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to Sync struct.