engine

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package engine coordinates logfile input with the reusable combat and XP models. It deliberately contains no terminal UI dependencies so another frontend can consume the same replay and live-tail behavior.

Index

Constants

This section is empty.

Variables

View Source
var ErrReplayCancelled = errors.New("replay cancelled")

Functions

func DispatchLiveLine added in v0.2.0

func DispatchLiveLine(line string, observers ...LiveLineObserver)

DispatchLiveLine forwards a genuinely new logfile line to optional live-only consumers after combat, XP, Sky, and connected-application processing have completed. Replay and catch-up paths deliberately do not call this helper.

func Follow

func Follow(logPath string, startOffset int64, done <-chan struct{}, onLine func(string, int64)) error

func FollowWithPoll

func FollowWithPoll(logPath string, startOffset int64, done <-chan struct{}, onLine func(string, int64), onPoll func(time.Time)) error

FollowWithPoll follows complete lines and invokes onPoll while waiting at EOF. The callbacks run serially, allowing a caller to maintain mutable parser state without a second synchronization path.

func ProcessLine

func ProcessLine(line string, tracker *combat.FightTracker, xpSession *xp.Session, idleTimeout time.Duration)

func ProcessRecord

func ProcessRecord(record eqlog.Record, tracker *combat.FightTracker, xpSession *xp.Session, idleTimeout time.Duration)

func Replay

func Replay(logPath string, idleTimeout, back time.Duration, since time.Time, historyLimit int) (*combat.FightTracker, *xp.Session, error)

func ReplayCutoff

func ReplayCutoff(logPath string, back time.Duration, since time.Time) (time.Time, error)

func ReplayCutoffWithCancel

func ReplayCutoffWithCancel(logPath string, back time.Duration, since time.Time, cancel <-chan struct{}) (time.Time, error)

func ReplayWithProgress

func ReplayWithProgress(logPath string, idleTimeout, back time.Duration, since time.Time, historyLimit int, maxBytes int64, onProgress func(ReplayProgress), cancel <-chan struct{}) (*combat.FightTracker, *xp.Session, error)

Types

type LiveLineObserver added in v0.2.0

type LiveLineObserver interface {
	ObserveLiveLine(string)
}

type ReplayLandmarks added in v0.2.4

type ReplayLandmarks struct {
	LastLevelUp           time.Time
	LastZoneChange        time.Time
	LastZoneLevelPercent  float64
	LastZoneProgressKnown bool
}

func FindReplayLandmarks added in v0.2.4

func FindReplayLandmarks(logPath string, maxBytes int64) (ReplayLandmarks, error)

FindReplayLandmarks returns the most recent points from which the GUI can rebuild an XP session. maxBytes keeps the scan on the same logfile snapshot that will subsequently be replayed.

type ReplayProgress

type ReplayProgress struct {
	Bytes int64
	Total int64
	Lines int
}

Jump to

Keyboard shortcuts

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