hockevent

package
v0.0.0-...-b05498c Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DimensionName

func DimensionName(dimension int) string

func Serialize

func Serialize(event HockEvent) string

func ToDimensionId

func ToDimensionId(dimension string) int

Types

type FormRequestEvent

type FormRequestEvent struct {
	FormID int            `json:"formId"`
	Data   map[string]any `json:"jsonData"`
	To     string         `json:"to"`
}

func (FormRequestEvent) GetType

func (FormRequestEvent) GetType() Type

type FormResponseEvent

type FormResponseEvent struct {
	FormID   int    `json:"formId"`
	Response string `json:"response"`
	From     string `json:"from"`
}

func (FormResponseEvent) GetType

func (FormResponseEvent) GetType() Type

type HockClient

type HockClient interface {
	Send(toSend <-chan HockEvent)
	Recv() <-chan HockEvent
	Stop()
}

func Connect

func Connect(target string) (HockClient, error)

type HockEvent

type HockEvent interface {
	GetType() Type
}

func Deserialize

func Deserialize(data []byte) (HockEvent, error)

type LogEvent

type LogEvent struct {
	Category     int    `json:"category"`
	Bitset       int    `json:"bitset"`
	Rules        int    `json:"rules"`
	Area         int    `json:"area"`
	Unk0         int    `json:"unk0"`
	FunctionLine int    `json:"functionLine"`
	FunctionName string `json:"functionName"`
	Message      string `json:"message"`
}

func (LogEvent) GetType

func (LogEvent) GetType() Type

type MessageEvent

type MessageEvent struct {
	From         string      `json:"from"`
	To           string      `json:"to"`
	Message      string      `json:"message"`
	MsgType      MessageType `json:"msgType"`
	Translatable bool        `json:"translatable"`
}

func (MessageEvent) GetType

func (MessageEvent) GetType() Type

type MessageType

type MessageType int
const (
	MESSAGE_NORMAL  MessageType = 0
	MESSAGE_SYSTEM  MessageType = 1
	MESSAGE_ANOUNCE MessageType = 2
	MESSAGE_WHISPER MessageType = 3
	MESSAGE_JUKEBOX MessageType = 4
)

type PlayerDeathCountRequestEvent

type PlayerDeathCountRequestEvent struct{}

func (PlayerDeathCountRequestEvent) GetType

type PlayerDeathCountResponseEvent

type PlayerDeathCountResponseEvent struct {
	PlayerDeaths map[string]int `json:"playerDeaths"`
}

func (PlayerDeathCountResponseEvent) GetType

type PlayerDeathEvent

type PlayerDeathEvent struct {
	PlayerStatusEvent
	DeathReason string `json:"deathReason"`
}

func (PlayerDeathEvent) GetType

func (PlayerDeathEvent) GetType() Type

type PlayerDimensionChangeEvent

type PlayerDimensionChangeEvent struct {
	PlayerStatusEvent

	Dimension     int `json:"dimension"`
	FromDimension int `json:"fromDimension"`
}

func (PlayerDimensionChangeEvent) DimensionName

func (e PlayerDimensionChangeEvent) DimensionName() string

func (PlayerDimensionChangeEvent) FromDimensionName

func (e PlayerDimensionChangeEvent) FromDimensionName() string

func (PlayerDimensionChangeEvent) GetType

func (PlayerDimensionChangeEvent) GetType() Type

type PlayerJoinEvent

type PlayerJoinEvent struct {
	PlayerStatusEvent
}

func (PlayerJoinEvent) GetType

func (PlayerJoinEvent) GetType() Type

type PlayerLeftEvent

type PlayerLeftEvent struct {
	PlayerStatusEvent
}

func (PlayerLeftEvent) GetType

func (PlayerLeftEvent) GetType() Type

type PlayerListEvent

type PlayerListEvent struct {
	Players []string `json:"players"`
}

func (PlayerListEvent) GetType

func (PlayerListEvent) GetType() Type

type PlayerStatusEvent

type PlayerStatusEvent struct {
	Username string `json:"username"`
	Xuid     string `json:"xuid"`
}

func (PlayerStatusEvent) GetType

func (PlayerStatusEvent) GetType() Type

type PlayerUpdateEvent

type PlayerUpdateEvent struct {
	PlayerStatusEvent

	Pitch   float32 `json:"pitch"`
	Yaw     float32 `json:"yaw"`
	X       float32
	Y       float32
	Z       float32
	HeadYaw float32 `json:"headYaw"`
}

func (PlayerUpdateEvent) GetType

func (PlayerUpdateEvent) GetType() Type

type ScoreBoardEvent

type ScoreBoardEvent struct {
	Name           string            `json:"name"`
	Type           string            `json:"type"`
	Title          string            `json:"title"`
	To             string            `json:"to"`
	SortDescending bool              `json:"sortDescending"`
	Entries        []ScoreboardEntry `json:"entries"`
}

func (ScoreBoardEvent) GetType

func (ScoreBoardEvent) GetType() Type

type ScoreboardEntry

type ScoreboardEntry struct {
	EntryID   int64  `json:"entryId"`
	Type      uint8  `json:"type"`
	PID       uint64 `json:"pid"`
	Score     uint32 `json:"score"`
	ActorID   int64  `json:"actorId"`
	EntryName string `json:"entryName"`
}

type Type

type Type int
const (
	EventInvalid                  Type = -1
	EventMessage                  Type = 0
	EventPlayerJoin               Type = 1
	EventPlayerLeft               Type = 2
	EventPlayerDeath              Type = 3
	EventPlayerUpdate             Type = 4
	EventPlayerList               Type = 5
	EventPlayerDimensionChange    Type = 6
	EventLog                      Type = 7
	EventFormRequest              Type = 8
	EventFormResponse             Type = 9
	EventScoreboard               Type = 10
	EventPlayerDeathCountRequest  Type = 11
	EventPlayerDeathCountResponse Type = 12
)

Jump to

Keyboard shortcuts

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