action

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCanBeSkipped = errors.New("error occurred, but this action is not critical and game can continue")
View Source
var ErrLogAndContinue = errors.New("error occurred, but marking action as completed")
View Source
var ErrNoMoreSteps = errors.New("action finished, no more steps remaining")
View Source
var ErrNoRecover = errors.New("unrecoverable error occurred, game can not continue")
View Source
var ErrWillBeRetried = errors.New("error occurred, but it will be retried")

Functions

func ResetBuffTime added in v0.5.0

func ResetBuffTime(supervisor string)

Types

type AbortReason added in v0.4.0

type AbortReason string
const (
	ReasonChicken AbortReason = "chicken occurred"
)

type Action

type Action interface {
	NextStep(d game.Data, container container.Container) error
	Skip()
	IsFinished() bool
}

type Builder

type Builder struct {
	container.Container
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(container container.Container, sm town.ShopManager, bm health.BeltManager, ch Character) *Builder

func (*Builder) Buff added in v0.3.0

func (b *Builder) Buff() *StepChainAction

func (*Builder) BuffIfRequired added in v0.3.0

func (b *Builder) BuffIfRequired(d game.Data) *StepChainAction

func (*Builder) BuyAtVendor added in v0.3.0

func (b *Builder) BuyAtVendor(vendor npc.ID, items ...VendorItemRequest) *Chain

func (*Builder) CheckKeyBindings added in v0.5.0

func (b *Builder) CheckKeyBindings(d game.Data) []skill.ID

func (*Builder) ChickenOnMonsters added in v0.4.0

func (b *Builder) ChickenOnMonsters(distance int, monsterIds []npc.ID) *Chain

func (*Builder) ClearArea

func (b *Builder) ClearArea(openChests bool, filter data.MonsterFilter) *Chain

func (*Builder) ClearAreaAroundPlayer

func (b *Builder) ClearAreaAroundPlayer(distance int, filter data.MonsterFilter) Action

func (*Builder) CubeAddItems added in v0.3.0

func (b *Builder) CubeAddItems(items ...data.Item) *Chain

func (*Builder) CubeRecipes added in v0.4.0

func (b *Builder) CubeRecipes() *Chain

func (*Builder) CubeTransmute added in v0.3.0

func (b *Builder) CubeTransmute() *Chain

func (*Builder) DiscoverWaypoint added in v0.2.0

func (b *Builder) DiscoverWaypoint() *Chain

func (*Builder) DropMouseItem added in v0.5.0

func (b *Builder) DropMouseItem() *Chain

func (*Builder) EachLoopHook added in v0.5.0

func (b *Builder) EachLoopHook(d game.Data) (actions []Action)

EachLoopHook is executed every loop iteration before the main actions are executed. If you return any actions here, they will be executed before the main actions. This is useful to execute actions that are high priority and should be executed before the main actions, since will interrupt the main actions. For example, buffing, healing, going back to town to buy pots, revive merc...

func (*Builder) EnsureSkillBindings added in v0.3.0

func (b *Builder) EnsureSkillBindings() *StepChainAction

func (*Builder) EnsureSkillPoints added in v0.2.0

func (b *Builder) EnsureSkillPoints() *StepChainAction

func (*Builder) EnsureStatPoints added in v0.2.0

func (b *Builder) EnsureStatPoints() *StepChainAction

func (*Builder) Gamble added in v0.3.0

func (b *Builder) Gamble() *Chain

func (*Builder) Heal

func (b *Builder) Heal() *Chain

func (*Builder) HireMerc added in v0.3.0

func (b *Builder) HireMerc() *Chain

func (*Builder) IdentifyAll

func (b *Builder) IdentifyAll(skipIdentify bool) *Chain

func (*Builder) InRunReturnTownRoutine added in v0.3.0

func (b *Builder) InRunReturnTownRoutine() []Action

func (*Builder) InteractNPC added in v0.3.0

func (b *Builder) InteractNPC(npc npc.ID, additionalSteps ...step.Step) *StepChainAction

func (*Builder) InteractNPCWithCheck added in v0.3.0

func (b *Builder) InteractNPCWithCheck(npc npc.ID, isCompletedFn func(d game.Data) bool, additionalSteps ...step.Step) *StepChainAction

func (*Builder) InteractObject added in v0.3.0

func (b *Builder) InteractObject(name object.Name, isCompletedFn func(game.Data) bool, additionalSteps ...step.Step) *StepChainAction

func (*Builder) InteractObjectByID added in v0.4.0

func (b *Builder) InteractObjectByID(id data.UnitID, isCompletedFn func(game.Data) bool, additionalSteps ...step.Step) *StepChainAction

func (*Builder) IsMonsterSealElite added in v0.4.0

func (b *Builder) IsMonsterSealElite(monster data.Monster) bool

func (*Builder) IsRebuffRequired added in v0.3.0

func (b *Builder) IsRebuffRequired(d game.Data) bool

func (*Builder) ItemPickup

func (b *Builder) ItemPickup(waitForDrop bool, maxDistance int) *Chain

func (*Builder) MoveTo added in v0.3.0

func (b *Builder) MoveTo(toFunc func(d game.Data) (data.Position, bool), opts ...step.MoveToStepOption) *Chain

func (*Builder) MoveToArea added in v0.3.0

func (b *Builder) MoveToArea(dst area.ID) *Chain

func (*Builder) MoveToCoords added in v0.3.0

func (b *Builder) MoveToCoords(to data.Position, opts ...step.MoveToStepOption) *Chain

func (*Builder) MoveToCoordsWithMinDistance added in v0.5.0

func (b *Builder) MoveToCoordsWithMinDistance(to data.Position, minDistance int, opts ...step.MoveToStepOption) *Chain

func (*Builder) NewGameHook added in v0.5.0

func (b *Builder) NewGameHook() []Action

NewGameHook is executed when a new game is created. Actions returned here will be executed when a new game is created before the main actions.

func (*Builder) OpenTPIfLeader added in v0.4.0

func (b *Builder) OpenTPIfLeader() *StepChainAction

func (*Builder) PostRunHook added in v0.5.0

func (b *Builder) PostRunHook(isLastRun bool) (actions []Action)

PostRunHook is executed after the main actions are executed. Actions returned here will be executed after the main actions for each run.

func (*Builder) PreRun added in v0.3.0

func (b *Builder) PreRun(firstRun bool) []Action

func (*Builder) PreRunHook added in v0.5.0

func (b *Builder) PreRunHook(firstRun bool) []Action

PreRunHook is executed before the main actions are executed. Actions returned here will be executed before the main actions for each run.

func (*Builder) RecoverCorpse

func (b *Builder) RecoverCorpse() *StepChainAction

func (*Builder) Repair

func (b *Builder) Repair() *Chain

func (*Builder) RepairRequired added in v0.5.0

func (b *Builder) RepairRequired() bool

func (*Builder) ResetStats added in v0.3.0

func (b *Builder) ResetStats() *Chain

func (*Builder) ReturnTown

func (b *Builder) ReturnTown() *Chain

func (*Builder) ReviveMerc

func (b *Builder) ReviveMerc() *Chain

func (*Builder) Stash

func (b *Builder) Stash(forceStash bool) *Chain

func (*Builder) SwitchStashTab added in v0.4.0

func (b *Builder) SwitchStashTab(tab int) *Chain

func (*Builder) SwitchToLegacyMode added in v0.5.0

func (b *Builder) SwitchToLegacyMode() *StepChainAction

func (*Builder) UpdateQuestLog added in v0.4.0

func (b *Builder) UpdateQuestLog() *StepChainAction

func (*Builder) UsePortalFrom added in v0.4.0

func (b *Builder) UsePortalFrom(owner string) *Chain

func (*Builder) UsePortalInTown added in v0.3.0

func (b *Builder) UsePortalInTown() *Chain

func (*Builder) UseSkillIfBind added in v0.4.0

func (b *Builder) UseSkillIfBind(id skill.ID) *Chain

func (*Builder) VendorRefill

func (b *Builder) VendorRefill(forceRefill, sellJunk bool) *Chain

func (*Builder) Wait added in v0.3.0

func (b *Builder) Wait(duration time.Duration) *StepChainAction

func (*Builder) WaitForAllMembersWhenLeveling added in v0.4.0

func (b *Builder) WaitForAllMembersWhenLeveling() *Chain

func (*Builder) WayPoint

func (b *Builder) WayPoint(a area.ID) *Chain

type Chain added in v0.2.0

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

func NewChain added in v0.2.0

func NewChain(builder func(d game.Data) []Action, opts ...Option) *Chain

func (*Chain) IsFinished added in v0.5.0

func (b *Chain) IsFinished() bool

func (*Chain) NextStep added in v0.2.0

func (a *Chain) NextStep(d game.Data, container container.Container) error

func (*Chain) Skip added in v0.2.0

func (b *Chain) Skip()

type Character

type Character interface {
	CheckKeyBindings(game.Data) []skill.ID
	BuffSkills(game.Data) []skill.ID
	PreCTABuffSkills(game.Data) []skill.ID
	KillCountess() Action
	KillAndariel() Action
	KillSummoner() Action
	KillDuriel() Action
	KillMephisto() Action
	KillPindle(skipOnImmunities []stat.Resist) Action
	KillNihlathak() Action
	KillCouncil() Action
	KillDiablo() Action
	KillIzual() Action
	KillBaal() Action
	KillMonsterSequence(
		monsterSelector func(d game.Data) (data.UnitID, bool),
		skipOnImmunities []stat.Resist,
		opts ...step.AttackOption,
	) Action
}

type CubeRecipe added in v0.4.0

type CubeRecipe struct {
	Name  string
	Items []string
}

type LevelingCharacter added in v0.2.0

type LevelingCharacter interface {
	Character
	// StatPoints Stats will be assigned in the order they are returned by this function.
	StatPoints(game.Data) map[stat.ID]int
	SkillPoints(game.Data) []skill.ID
	SkillsToBind(game.Data) (skill.ID, []skill.ID)
	ShouldResetSkills(game.Data) bool
	KillAncients() Action
}

type Option

type Option func(action *basicAction)

func AbortOtherActionsIfNil added in v0.4.0

func AbortOtherActionsIfNil(reason AbortReason) Option

func CanBeSkipped

func CanBeSkipped() Option

func IgnoreErrors added in v0.2.0

func IgnoreErrors() Option

IgnoreErrors will ignore the errors and mark the action as succeeded

func RepeatUntilNoSteps added in v0.3.0

func RepeatUntilNoSteps() Option

func Resettable

func Resettable() Option

type StepChainAction added in v0.3.0

type StepChainAction struct {
	Steps []step.Step
	// contains filtered or unexported fields
}

func NewStepChain added in v0.3.0

func NewStepChain(builder func(d game.Data) []step.Step, opts ...Option) *StepChainAction

func (*StepChainAction) IsFinished added in v0.5.0

func (b *StepChainAction) IsFinished() bool

func (*StepChainAction) NextStep added in v0.3.0

func (a *StepChainAction) NextStep(d game.Data, container container.Container) error

func (*StepChainAction) Skip added in v0.3.0

func (b *StepChainAction) Skip()

type VendorItemRequest added in v0.3.0

type VendorItemRequest struct {
	Item     item.Name
	Quantity int
	Tab      int // At this point I have no idea how to detect the Tab the Item is in the vendor (1-4)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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