koolo

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

Bot will be in charge of running the run loop: create games, traveling, killing bosses, repairing, picking...

func NewBot

func NewBot(
	logger *slog.Logger,
	hm *health.Manager,
	ab *action.Builder,
	container container.Container,
	supervisorName string,
) *Bot

func (*Bot) Run

func (b *Bot) Run(ctx context.Context, firstRun bool, runs []run.Run) (err error)

func (*Bot) TogglePause

func (b *Bot) TogglePause()

type CompanionSupervisor

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

func NewCompanionSupervisor

func NewCompanionSupervisor(name string, bot *Bot, runFactory *run.Factory, statsHandler *StatsHandler, c container.Container) (*CompanionSupervisor, error)

func (CompanionSupervisor) GetData added in v0.4.0

func (s CompanionSupervisor) GetData() game.Data

func (CompanionSupervisor) Name added in v0.4.0

func (s CompanionSupervisor) Name() string

func (CompanionSupervisor) SetWindowPosition added in v0.4.0

func (s CompanionSupervisor) SetWindowPosition(x, y int)

func (*CompanionSupervisor) Start

func (s *CompanionSupervisor) Start() error

Start will return error if it can not be started, otherwise will always return nil

func (CompanionSupervisor) Stats added in v0.4.0

func (s CompanionSupervisor) Stats() Stats

func (CompanionSupervisor) Stop

func (s CompanionSupervisor) Stop()

func (CompanionSupervisor) TogglePause

func (s CompanionSupervisor) TogglePause()

type GameStats added in v0.4.0

type GameStats struct {
	StartedAt  time.Time
	FinishedAt time.Time
	Reason     event.FinishReason
	Runs       []RunStats
}

type RunStats added in v0.4.0

type RunStats struct {
	Name        string
	Reason      event.FinishReason
	StartedAt   time.Time
	Items       []data.Item
	FinishedAt  time.Time
	UsedPotions []event.UsedPotionEvent
}

type SinglePlayerSupervisor

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

func NewSinglePlayerSupervisor

func NewSinglePlayerSupervisor(name string, bot *Bot, runFactory *run.Factory, statsHandler *StatsHandler, c container.Container) (*SinglePlayerSupervisor, error)

func (SinglePlayerSupervisor) GetData added in v0.4.0

func (s SinglePlayerSupervisor) GetData() game.Data

func (SinglePlayerSupervisor) Name added in v0.4.0

func (s SinglePlayerSupervisor) Name() string

func (SinglePlayerSupervisor) SetWindowPosition added in v0.4.0

func (s SinglePlayerSupervisor) SetWindowPosition(x, y int)

func (*SinglePlayerSupervisor) Start

func (s *SinglePlayerSupervisor) Start() error

Start will return error if it can not be started, otherwise will always return nil

func (SinglePlayerSupervisor) Stats added in v0.4.0

func (s SinglePlayerSupervisor) Stats() Stats

func (SinglePlayerSupervisor) Stop

func (s SinglePlayerSupervisor) Stop()

func (SinglePlayerSupervisor) TogglePause

func (s SinglePlayerSupervisor) TogglePause()

type Stats added in v0.4.0

type Stats struct {
	StartedAt        time.Time
	SupervisorStatus SupervisorStatus
	Details          string
	Games            []GameStats
}

func (Stats) TotalChickens added in v0.4.0

func (s Stats) TotalChickens() int

func (Stats) TotalDeaths added in v0.4.0

func (s Stats) TotalDeaths() int

func (Stats) TotalErrors added in v0.4.0

func (s Stats) TotalErrors() int

func (Stats) TotalGames added in v0.4.0

func (s Stats) TotalGames() int

type StatsHandler added in v0.4.0

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

func NewStatsHandler added in v0.4.0

func NewStatsHandler(name string, logger *slog.Logger) *StatsHandler

func (*StatsHandler) Handle added in v0.4.0

func (h *StatsHandler) Handle(_ context.Context, e event.Event) error

func (*StatsHandler) Stats added in v0.4.0

func (h *StatsHandler) Stats() Stats

type Supervisor

type Supervisor interface {
	Start() error
	Name() string
	Stop()
	Stats() Stats
	TogglePause()
	SetWindowPosition(x, y int)
	GetData() game.Data
}

type SupervisorManager added in v0.4.0

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

func NewSupervisorManager added in v0.4.0

func NewSupervisorManager(logger *slog.Logger, eventListener *event.Listener) *SupervisorManager

func (*SupervisorManager) AvailableSupervisors added in v0.4.0

func (mng *SupervisorManager) AvailableSupervisors() []string

func (*SupervisorManager) GetData added in v0.4.0

func (mng *SupervisorManager) GetData(characterName string) game.Data

func (*SupervisorManager) Start added in v0.4.0

func (mng *SupervisorManager) Start(supervisorName string) error

func (*SupervisorManager) Status added in v0.4.0

func (mng *SupervisorManager) Status(characterName string) Stats

func (*SupervisorManager) Stop added in v0.4.0

func (mng *SupervisorManager) Stop(supervisor string)

func (*SupervisorManager) StopAll added in v0.4.0

func (mng *SupervisorManager) StopAll()

func (*SupervisorManager) TogglePause added in v0.4.0

func (mng *SupervisorManager) TogglePause(supervisor string)

type SupervisorStatus added in v0.4.0

type SupervisorStatus string
const (
	NotStarted SupervisorStatus = "Not Started"
	Starting   SupervisorStatus = "Starting"
	InGame     SupervisorStatus = "In game"
	Paused     SupervisorStatus = "Paused"
	Crashed    SupervisorStatus = "Crashed"
)

Directories

Path Synopsis
remote

Jump to

Keyboard shortcuts

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