Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Option for Countess run to clear ghosts #703

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PhoxSillanpaa
Copy link

This PR also adds actions/clear_targets.go. The purpose of this addition was to create a function that takes an argument of npc.ID and creates a list of monsters to kill as the bot moves through the rooms of a dungeon. It functions essentially identically to action.ClearCurrentLevel(), also accepting a boolean to toggle opening chests.

There is likely a more elegant solution to this.

@elobo91
Copy link
Contributor

elobo91 commented Feb 27, 2025

This PR also adds actions/clear_targets.go. The purpose of this addition was to create a function that takes an argument of npc.ID and creates a list of monsters to kill as the bot moves through the rooms of a dungeon. It functions essentially identically to action.ClearCurrentLevel(), also accepting a boolean to toggle opening chests.

There is likely a more elegant solution to this.

hi thanks for putting time on this . Why do we need a new clear action? Could create a local monster filter with npc ids you need . Can look how its done here :

func (d *Diablo) getMonsterFilter() data.MonsterFilter {

@PhoxSillanpaa
Copy link
Author

This PR also adds actions/clear_targets.go. The purpose of this addition was to create a function that takes an argument of npc.ID and creates a list of monsters to kill as the bot moves through the rooms of a dungeon. It functions essentially identically to action.ClearCurrentLevel(), also accepting a boolean to toggle opening chests.
There is likely a more elegant solution to this.

hi thanks for putting time on this . Why do we need a new clear action? Could create a local monster filter with npc ids you need . Can look how its done here :

func (d *Diablo) getMonsterFilter() data.MonsterFilter {

Thanks. That was the more elegant solution I was looking for. I totally understand how that works. Shame I just spent several hours doing basically what I did for this Countess Run to the Arcane Sanctuary run. But I should be able to rework it easy enough.

@Wamlad
Copy link

Wamlad commented Feb 27, 2025

Not sure how to add this in with your Ghosts filter sorry, but I've been testing the leveling scripts and added ClearThroughPath to the leveling countess run. I saw Elb mentioned it in Discord to you so hopefully this is helpful. I think the leveling runs will sometimes inherently be different from the main runs, but this could be worth adding here too if you can build it in with your ghosts filter.
It could be made configurable in the settings separately, but probably just part of your clearGhosts option. Only leveling chars would want to clear everything on the way anyway.

func (a Leveling) countessClearPath() error {
	// Travel to boss level
	err := action.WayPoint(area.BlackMarsh)
	if err != nil {
		return err
	}

	// Move to these areas directly
	action.MoveToArea(area.ForgottenTower)
	action.MoveToArea(area.TowerCellarLevel1)

	// Destination areas to clear towards
	areas := []area.ID{
		area.TowerCellarLevel2,
		area.TowerCellarLevel3,
		area.TowerCellarLevel4,
		area.TowerCellarLevel5, 
	}

	for _, ar := range areas {
		// Get ingame adjacent areas so we can read the exit coordinates, check it matches the next level from script
		adjacentLevels := a.ctx.Data.AdjacentLevels
		nextExitArea := adjacentLevels[0]
		for _, adj := range adjacentLevels {
			if adj.Area == ar {
				nextExitArea = adj
			}
		}
		// Get the exit coordinates (position) and clear towards it
		nextExitPosition := nextExitArea.Position
		action.ClearThroughPath(nextExitPosition, 15, data.MonsterAnyFilter())
		err = action.MoveToArea(ar) // MoveToArea still needed to click exit
		if err != nil {
			return err
		}

	}
	// Countess section from the boss script added, plus ClearThroughPath
	// Try to move around Countess area
	action.MoveTo(func() (data.Position, bool) {
		if areaData, ok := context.Get().GameReader.GetData().Areas[area.TowerCellarLevel5]; ok {
			for _, o := range areaData.Objects {
				if o.Name == object.GoodChest {
					action.ClearThroughPath(o.Position, 30, data.MonsterAnyFilter())
					return o.Position, true
				} // Countess Chest position from 1.13c fetch
			}
		}

		// Try to teleport over Countess in case we are not able to find the chest position, a bit more risky
		if countess, found := a.ctx.Data.Monsters.FindOne(npc.DarkStalker, data.MonsterTypeSuperUnique); found {
			action.ClearThroughPath(countess.Position, 30, data.MonsterAnyFilter())
			return countess.Position, true
		}

		return data.Position{}, false
	})

	// Kill Countess
	return a.ctx.Char.KillCountess()
}

Added in the Diablo code from Elb and borrowed code from Wamlad for ClearPathThrough.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants