events

package
v0.0.0-...-19ad383 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(n string, ge *Event) error

Add takes a premade event and registers it to our event configuration

func EventType

func EventType(s string, srv ifaces.IGameServer) int

EventType - Given string and its source Server{}, determine the event type that was provided. Returns a -1 if none was found.

func Initialize

func Initialize()

Initialize handles event initialization and should be run before the server starts

Types

type Event

type Event struct {
	FString string

	Capture *regexp.Regexp
	Handler EventHandler
	// contains filtered or unexported fields
}

Event describes logged output that the ifaces.Server has output that can be acted upon in some fashion

func GetFromString

func GetFromString(in string) *Event

GetFromString returns a reference to a game event given a matching string

func New

func New(n, re string, h EventHandler) (*Event, error)

New makes, registers, and returns a game event using the Regex that is used to detect it. Panic if the Regexp that was provided matches the Regexp of a previously registered Event. Returns the index of the registered event

func (*Event) Loglevel

func (e *Event) Loglevel() int

Loglevel returns an events loglevel

func (*Event) Name

func (e *Event) Name() string

Name returns the name of the Event

func (*Event) SetLoglevel

func (e *Event) SetLoglevel(l int)

SetLoglevel sets an events loglevel

func (*Event) UUID

func (e *Event) UUID() string

UUID returns an events UUID

type EventHandler

type EventHandler func(ifaces.IGameServer, *Event, string, chan string)

EventHandler is a function that parses a logfile and performs an action

Jump to

Keyboard shortcuts

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