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

feature: Blood Moor Run #639

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/template/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ game:
difficulty: hell # Allowed values: normal, nightmare, hell
randomizeRuns: true # Will randomize the order of the runs each game
# Just add the runs you want to do and they will be executed respecting the order, unless randomizeRuns is set to true
# Available runs: countess, andariel, ancient_tunnels, summoner, mephisto, council, eldritch, pindleskin, nihlathak,
# Available runs: blood_moor, countess, andariel, ancient_tunnels, summoner, mephisto, council, eldritch, pindleskin, nihlathak,
# tristram, lower_kurast, lower_kurast_chest, stony_tomb, pit, arachnid_lair, tal_rasha_tombs, baal, diablo, cows, terror_zone
# leveling: there is a "leveling" run, in combination with "sorceress or paladin" class will be able to start leveling character from level 1 (don't expect too much)
# terror_zone: will detect current TZ and clear it
runs: [ stony_tomb, pit, arachnid_lair ]

# Specific runs settings
blood_moor:
clearDenOfEvil: true
openChests: true
focusOnElitePacks: false
onlyClearDenOfEvil: true
pindleskin:
skipOnImmunities: [ ] # Allowed values: cold, fire, light, poison
stony_tomb:
Expand Down
6 changes: 6 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ type CharacterCfg struct {
Runs []Run `yaml:"runs"`
CreateLobbyGames bool `yaml:"createLobbyGames"`
PublicGameCounter int `yaml:"-"`
BloodMoor struct {
ClearDenOfEvil bool `yaml:"clearDenOfEvil"`
OpenChests bool `yaml:"openChests"`
FocusOnElitePacks bool `yaml:"focusOnElitePacks"`
OnlyClearDenOfEvil bool `yaml:"onlyClearDenOfEvil"`
} `yaml:"blood_moor"`
Pindleskin struct {
SkipOnImmunities []stat.Resist `yaml:"skipOnImmunities"`
} `yaml:"pindleskin"`
Expand Down
2 changes: 2 additions & 0 deletions internal/config/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
type Run string

const (
BloodMoorRun Run = "blood_moor"
CountessRun Run = "countess"
AndarielRun Run = "andariel"
AncientTunnelsRun Run = "ancient_tunnels"
Expand Down Expand Up @@ -34,6 +35,7 @@ const (
)

var AvailableRuns = map[Run]interface{}{
BloodMoorRun: nil,
CountessRun: nil,
AndarielRun: nil,
AncientTunnelsRun: nil,
Expand Down
78 changes: 78 additions & 0 deletions internal/run/blood_moor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package run

import (
"github.com/hectorgimenez/d2go/pkg/data"
"github.com/hectorgimenez/d2go/pkg/data/area"
"github.com/hectorgimenez/koolo/internal/action"
"github.com/hectorgimenez/koolo/internal/context"
"github.com/hectorgimenez/koolo/internal/config"
)

type BloodMoor struct {
ctx *context.Status
}

func NewBloodMoor() *BloodMoor {
return &BloodMoor{
ctx: context.Get(),
}
}

func (b BloodMoor) Name() string {
return string(config.BloodMoorRun)
}

func (b BloodMoor) Run() error {
// Get the monster filter based on configuration
monsterFilter := GetMonsterFilter(b)

// Shall we open chests?
openChests := b.ctx.CharacterCfg.Game.BloodMoor.OpenChests

// Less issues finding the waypoint than the town's exit
if err := action.WayPoint(area.ColdPlains); err != nil {
return err
}

// Buff before we start
action.Buff()

// Moving to the Blood Moor
if err := action.MoveToArea(area.BloodMoor); err != nil {
return err
}

// If we don't want to just do the Den of Evil, we clear the area
if !b.ctx.CharacterCfg.Game.BloodMoor.OnlyClearDenOfEvil {
if err := action.ClearCurrentLevel(openChests, monsterFilter); err != nil {
return err
}
}

// if we don't want to clear the den of evil, the run is over
if !b.ctx.CharacterCfg.Game.BloodMoor.ClearDenOfEvil {
return nil
}

// else, we go to the den of evil and clear it
if err := action.MoveToArea(area.DenOfEvil); err != nil {
return err
}

// Buff before we start
action.Buff()

if err := action.ClearCurrentLevel(openChests, monsterFilter); err != nil {
return err
}

return nil
}

func GetMonsterFilter(b BloodMoor) data.MonsterFilter {
if b.ctx.CharacterCfg.Game.BloodMoor.FocusOnElitePacks {
return data.MonsterEliteFilter()
} else {
return data.MonsterAnyFilter()
}
}
2 changes: 2 additions & 0 deletions internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func BuildRuns(cfg *config.CharacterCfg) (runs []Run) {

for _, run := range cfg.Game.Runs {
switch run {
case config.BloodMoorRun:
runs = append(runs, NewBloodMoor())
case config.CountessRun:
runs = append(runs, NewCountess())
case config.AndarielRun:
Expand Down
9 changes: 9 additions & 0 deletions internal/server/templates/run_settings_components.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,12 @@
{{ end }}
</fieldset>
{{ end }}

{{ define "blood_moor" }}
<fieldset>
<label><input type="checkbox" name="gameBloodMoorMoveThroughBlackMarsh" {{ if .Config.Game.BloodMoor.ClearDenOfEvil }}checked{{ end }}> Clear Den of Evil</label>
<label><input type="checkbox" name="gameBloodMoorOnlyClearLevel2" {{ if .Config.Game.BloodMoor.OnlyClearDenOfEvil }}checked{{ end }}> Only clear Den of Evil</label>
<label><input type="checkbox" name="gameBloodMoorOpenChests" {{ if .Config.Game.BloodMoor.OpenChests }}checked{{ end }}> Open chests</label>
<label><input type="checkbox" name="gameBloodMoorFocusOnElitePacks" {{ if .Config.Game.BloodMoor.FocusOnElitePacks }}checked{{ end }}> Focus on elite packs</label>
</fieldset>
{{ end }}