mirvpgl

package module
v0.0.0-...-f4455d1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 12 Imported by: 0

README

hlae-server-kit-go

This is a personal fork from FlowingSPDG/HLAE-Server-GO.

HLAE Server Kit with Go implementation

About

HLAE mirv_pgl command server implementation with Go.
This package helps you to handle mirv_pgl command and their data.

mirv_pgl

mirv_pgl supports to remote-control CS:GO client by using WebSocket.
you can handle client's camera information(position,rotation,fov,time) and game-events, and you can send commands like RCON.

Official NodeJS code : https://github.com/advancedfx/advancedfx/blob/master/misc/mirv_pgl_test/server.js

Usage

see examples.

  • 1,Launch HLAE Server by go run main.go.
  • 2,Launch CSGO with HLAE.
  • 3,type following commands below:
mirv_pgl url "ws://localhost:65535/";
mirv_pgl start;
mirv_pgl datastart;

once CS:GO client succeed to connect HLAE Server, you can send commands by typing window.

Documentation

Index

Constants

View Source
const (
	KEYTYPE_STRING int32 = iota + 1
	KEYTYPE_FLOAT32
	KEYTYPE_INT32
	KEYTYPE_INT16
	KEYTYPE_INT8
	KEYTYPE_BOOLEAN
	KEYTYPE_BIGUINT64
	KEYTYPE_UNKNOWN
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CamData

type CamData struct {
	Time float32
	XPos float32
	YPos float32
	ZPos float32
	XRot float32
	YRot float32
	ZRot float32
	Fov  float32
}

CamData Camera data

type Coordinates

type Coordinates struct {
	X float32
	Y float32
	Z float32
}

Coordinates include float32 X/Y/Z Pos coordinates.

type Enrichment

type Enrichment interface {
	Unserialize(r io.Reader) error
	GetMap() map[string]interface{}
	SetEnrichment([]string)
	GetEnrichment() []string
}

type Enrichments

type Enrichments map[string]map[string]Enrichment

type EntityNumEnrichment

type EntityNumEnrichment struct {
	Origin   Coordinates
	Angles   Coordinates
	KeyValue string
	// contains filtered or unexported fields
}

EntityNumEnrichment containns Entity's Origin/Angles.

func (*EntityNumEnrichment) GetEnrichment

func (e *EntityNumEnrichment) GetEnrichment() []string

func (*EntityNumEnrichment) GetMap

func (e *EntityNumEnrichment) GetMap() map[string]interface{}

GetMap EntityNum Enrichment

func (*EntityNumEnrichment) SetEnrichment

func (e *EntityNumEnrichment) SetEnrichment(en []string)

func (*EntityNumEnrichment) Unserialize

func (e *EntityNumEnrichment) Unserialize(r io.Reader) error

GetMap EntityNum Enrichment

type EventKey

type EventKey struct {
	Name string
	Type int32
}

EventKey key-value struct with dynamic typing

type GameEventData

type GameEventData struct {
	Name       string
	ClientTime float32
	Keys       map[string]string // Even value is float32 or int etc. convert to string
}

GameEventData Game event keys and time

type GameEventDescription

type GameEventDescription struct {
	EventID   int32
	EventName string
	Keys      []EventKey // KeyName->Key type
	// contains filtered or unexported fields
}

GameEventDescription include Event ID, Name, Keys etc.

func (*GameEventDescription) Unserialize

func (e *GameEventDescription) Unserialize(r io.Reader) (*GameEventData, error)

Unserialize parse EventDescription

type HLAEServer

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

HLAEServer Main struct

func New

func New(args HLAEServerArguments) (srv *HLAEServer, err error)

New Get new instance of HLAEServer

func (*HLAEServer) BroadcastRCON

func (h *HLAEServer) BroadcastRCON(cmd string) error

BroadcastRCON broadcast command

func (*HLAEServer) RegisterCamHandler

func (h *HLAEServer) RegisterCamHandler(handler func(*CamData))

RegisterCamHandler to handle each requests

func (*HLAEServer) RegisterEventHandler

func (h *HLAEServer) RegisterEventHandler(handler func(*GameEventData))

RegisterEventHandler to handle each requests

func (*HLAEServer) RegisterHandler

func (h *HLAEServer) RegisterHandler(handler func(HLAEServerCommand))

RegisterHandler to handle each requests

func (*HLAEServer) RegisterLevelInitHandler

func (h *HLAEServer) RegisterLevelInitHandler(handler func(string))

func (*HLAEServer) SendRCON

func (h *HLAEServer) SendRCON(k int, cmd string) error

SendRCON Send RCON to specific client

func (*HLAEServer) ServeHTTP

func (h *HLAEServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interfaces

func (*HLAEServer) TransBegin

func (h *HLAEServer) TransBegin() error

TransBegin Start transaction

func (*HLAEServer) TransEnd

func (h *HLAEServer) TransEnd() error

TransEnd End transaction

type HLAEServerArguments

type HLAEServerArguments struct {
	Logger *zap.Logger
}

type HLAEServerCommand

type HLAEServerCommand string

HLAEServerCommand server command types

const (
	ServerCommandHello         HLAEServerCommand = "hello"
	ServerCommandDataStop      HLAEServerCommand = "dataStop"
	ServerCommandDataStart     HLAEServerCommand = "dataStart"
	ServerCommandLevelInit     HLAEServerCommand = "levelInit"
	ServerCommandLevelShutdown HLAEServerCommand = "levelShutdown"
	ServerCommandCam           HLAEServerCommand = "cam"
	ServerCommandGameEvent     HLAEServerCommand = "gameEvent"
)

type HLAESession

type HLAESession struct {
	*melody.Session
}

HLAESession wraps some session-related functions and is also a melody.Session wrapper

func (HLAESession) SetUUID

func (s HLAESession) SetUUID(uuid uuid.UUID)

SetUUID set a new unified id for this session

func (HLAESession) UUID

func (s HLAESession) UUID() uuid.UUID

UUID returns unified id for this session

func (HLAESession) UUIDAsLogField

func (s HLAESession) UUIDAsLogField() zap.Field

UUIDAsLogField creates a zap.Field representing session uuid

type UserIDEnrichment

type UserIDEnrichment struct {
	XUID      *big.Int
	EyeOrigin Coordinates
	EyeAngles Coordinates
	KeyValue  string
	// contains filtered or unexported fields
}

UserIDEnrichment contains User informations with XUID/Eyeorigins(Coordinates)/EyeAngles(Coordinates)

func (*UserIDEnrichment) GetEnrichment

func (u *UserIDEnrichment) GetEnrichment() []string

func (*UserIDEnrichment) GetMap

func (u *UserIDEnrichment) GetMap() map[string]interface{}

GetMap UserID Enrichment to map

func (*UserIDEnrichment) SetEnrichment

func (u *UserIDEnrichment) SetEnrichment(en []string)

func (*UserIDEnrichment) Unserialize

func (u *UserIDEnrichment) Unserialize(r io.Reader) error

Unserialize Unserialize into u

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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