koolo icon indicating copy to clipboard operation
koolo copied to clipboard

Added Option for Countess run to clear ghosts

Open PhoxSillanpaa opened this issue 10 months ago • 3 comments

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.

PhoxSillanpaa avatar Feb 26 '25 17:02 PhoxSillanpaa

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 : https://github.com/hectorgimenez/koolo/blob/523a6a0a211435284da0f2a6a747dfce8b3c20e4/internal/run/diablo.go#L167

elb91 avatar Feb 27 '25 04:02 elb91

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 :

https://github.com/hectorgimenez/koolo/blob/523a6a0a211435284da0f2a6a747dfce8b3c20e4/internal/run/diablo.go#L167

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.

PhoxSillanpaa avatar Feb 27 '25 04:02 PhoxSillanpaa

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()
}

Wamlad avatar Feb 27 '25 20:02 Wamlad