event

package
v0.4.0-beta7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinishedOK          FinishReason = "ok"
	FinishedDied        FinishReason = "death"
	FinishedChicken     FinishReason = "chicken"
	FinishedMercChicken FinishReason = "merc chicken"
	FinishedError       FinishReason = "error"

	InteractionTypeEntrance InteractionType = "entrance"
	InteractionTypeNPC      InteractionType = "npc"
	InteractionTypeObject   InteractionType = "object"
)

Variables

This section is empty.

Functions

func Send added in v0.4.0

func Send(e Event)

Types

type BaseEvent added in v0.4.0

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

func Text

func Text(supervisor string, message string) BaseEvent

func WithScreenshot

func WithScreenshot(supervisor string, message string, img image.Image) BaseEvent

func (BaseEvent) Image added in v0.4.0

func (b BaseEvent) Image() image.Image

func (BaseEvent) Message added in v0.4.0

func (b BaseEvent) Message() string

func (BaseEvent) OccurredAt added in v0.4.0

func (b BaseEvent) OccurredAt() time.Time

func (BaseEvent) Supervisor added in v0.4.0

func (b BaseEvent) Supervisor() string

type CompanionLeaderAttackEvent added in v0.4.0

type CompanionLeaderAttackEvent struct {
	BaseEvent
	TargetUnitID data.UnitID
}

func CompanionLeaderAttack added in v0.4.0

func CompanionLeaderAttack(be BaseEvent, targetUnitID data.UnitID) CompanionLeaderAttackEvent

type CompanionRequestedTPEvent added in v0.4.0

type CompanionRequestedTPEvent struct {
	BaseEvent
}

func CompanionRequestedTP added in v0.4.0

func CompanionRequestedTP(be BaseEvent) CompanionRequestedTPEvent

type Event

type Event interface {
	Message() string
	Image() image.Image
	OccurredAt() time.Time
	Supervisor() string
}

type FinishReason added in v0.4.0

type FinishReason string

type GameCreatedEvent added in v0.4.0

type GameCreatedEvent struct {
	BaseEvent
	Name     string
	Password string
}

func GameCreated added in v0.4.0

func GameCreated(be BaseEvent, name string, password string) GameCreatedEvent

type GameFinishedEvent added in v0.4.0

type GameFinishedEvent struct {
	BaseEvent
	Reason FinishReason
}

func GameFinished added in v0.4.0

func GameFinished(be BaseEvent, reason FinishReason) GameFinishedEvent

type GamePausedEvent added in v0.4.0

type GamePausedEvent struct {
	BaseEvent
	Paused bool
}

func GamePaused added in v0.4.0

func GamePaused(be BaseEvent, paused bool) GamePausedEvent

type Handler

type Handler func(ctx context.Context, e Event) error

type InteractedToEvent added in v0.4.0

type InteractedToEvent struct {
	BaseEvent
	ID              int
	InteractionType InteractionType
}

func InteractedTo added in v0.4.0

func InteractedTo(be BaseEvent, id int, it InteractionType) InteractedToEvent

type InteractionType added in v0.4.0

type InteractionType string

type ItemStashedEvent added in v0.4.0

type ItemStashedEvent struct {
	BaseEvent
	Item data.Item
}

func ItemStashed added in v0.4.0

func ItemStashed(be BaseEvent, item data.Item) ItemStashedEvent

type Listener

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

func NewListener

func NewListener(logger *slog.Logger) *Listener

func (*Listener) Listen

func (l *Listener) Listen(ctx context.Context) error

func (*Listener) Register

func (l *Listener) Register(h Handler)

func (*Listener) WaitForEvent added in v0.4.0

func (l *Listener) WaitForEvent(ctx context.Context) Event

type RunFinishedEvent added in v0.4.0

type RunFinishedEvent struct {
	BaseEvent
	RunName string
	Reason  FinishReason
}

func RunFinished added in v0.4.0

func RunFinished(be BaseEvent, runName string, reason FinishReason) RunFinishedEvent

type RunStartedEvent added in v0.4.0

type RunStartedEvent struct {
	BaseEvent
	RunName string
}

func RunStarted added in v0.4.0

func RunStarted(be BaseEvent, runName string) RunStartedEvent

type UsedPotionEvent added in v0.4.0

type UsedPotionEvent struct {
	BaseEvent
	PotionType data.PotionType
	OnMerc     bool
}

func UsedPotion added in v0.4.0

func UsedPotion(be BaseEvent, pt data.PotionType, onMerc bool) UsedPotionEvent

Jump to

Keyboard shortcuts

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