Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions config/template/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ game:
# Specific runs settings
pindleskin:
skipOnImmunities: [ ] # Allowed values: cold, fire, light, poison
palace:
openChests: true
focusOnElitePacks: false
stony_tomb:
openChests: true
focusOnElitePacks: false
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ type CharacterCfg struct {
Andariel struct {
ClearRoom bool `yaml:"clearRoom"`
}
Palace struct {
OpenChests bool `yaml:"openChests"`
FocusOnElitePacks bool `yaml:"focusOnElitePacks"`
} `yaml:"palace"`
StonyTomb struct {
OpenChests bool `yaml:"openChests"`
FocusOnElitePacks bool `yaml:"focusOnElitePacks"`
Expand Down
2 changes: 2 additions & 0 deletions internal/config/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
TristramRun Run = "tristram"
LowerKurastRun Run = "lower_kurast"
LowerKurastChestRun Run = "lower_kurast_chest"
PalaceRun Run = "palace"
StonyTombRun Run = "stony_tomb"
PitRun Run = "pit"
ArachnidLairRun Run = "arachnid_lair"
Expand Down Expand Up @@ -48,6 +49,7 @@ var AvailableRuns = map[Run]interface{}{
TristramRun: nil,
LowerKurastRun: nil,
LowerKurastChestRun: nil,
PalaceRun: nil,
StonyTombRun: nil,
PitRun: nil,
ArachnidLairRun: nil,
Expand Down
93 changes: 93 additions & 0 deletions internal/run/palace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
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/config"
"github.com/hectorgimenez/koolo/internal/context"
)

type Palace struct {
ctx *context.Status
}

func NewPalace() *Palace {
return &Palace{
ctx: context.Get(),
}
}

func (a Palace) Name() string {
return string(config.PalaceRun)
}

func (a Palace) Run() error {
openChests := a.ctx.CharacterCfg.Game.AncientTunnels.OpenChests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the configs you added :)

onlyElites := a.ctx.CharacterCfg.Game.AncientTunnels.FocusOnElitePacks
filter := data.MonsterAnyFilter()

if onlyElites {
filter = data.MonsterEliteFilter()
}

err := action.WayPoint(area.PalaceCellarLevel1)
if err != nil {
return err
}

// Open a TP if we're the leader
action.OpenTPIfLeader()

// Buff before we start
action.Buff()

err = action.MoveToArea(area.HaremLevel2)
if err != nil {
return err
}

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

action.Buff()

err = action.MoveToArea(area.PalaceCellarLevel1)
if err != nil {
return err
}

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

action.Buff()

err = action.MoveToArea(area.PalaceCellarLevel2)
if err != nil {
return err
}

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

action.Buff()

err = action.MoveToArea(area.PalaceCellarLevel3)
if err != nil {
return err
}

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

// Return to town
if err = action.ReturnTown(); err != nil {
return err
}

return nil
}
2 changes: 2 additions & 0 deletions internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func BuildRuns(cfg *config.CharacterCfg) (runs []Run) {
runs = append(runs, NewMausoleum())
case config.PitRun:
runs = append(runs, NewPit())
case config.PalaceRun:
runs = append(runs, NewPalace())
case config.StonyTombRun:
runs = append(runs, NewStonyTomb())
case config.ArachnidLairRun:
Expand Down
2 changes: 2 additions & 0 deletions internal/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,8 @@ func (s *HttpServer) characterSettings(w http.ResponseWriter, r *http.Request) {
cfg.Game.Pindleskin.SkipOnImmunities = append(cfg.Game.Pindleskin.SkipOnImmunities, stat.Resist(i))
}

cfg.Game.Palace.OpenChests = r.Form.Has("gamePalaceOpenChests")
cfg.Game.Palace.FocusOnElitePacks = r.Form.Has("gamePalaceFocusOnElitePacks")
cfg.Game.StonyTomb.OpenChests = r.Form.Has("gameStonytombOpenChests")
cfg.Game.StonyTomb.FocusOnElitePacks = r.Form.Has("gameStonytombFocusOnElitePacks")
cfg.Game.AncientTunnels.OpenChests = r.Form.Has("gameAncientTunnelsOpenChests")
Expand Down
7 changes: 7 additions & 0 deletions internal/server/templates/run_settings_components.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
</fieldset>
{{ end }}

{{ define "palace" }}
<fieldset>
<label><input type="checkbox" name="gamePalaceOpenChests" {{ if .Config.Game.Palace.OpenChests }}checked{{ end }}> Open chests</label>
<label><input type="checkbox" name="gamePalaceFocusOnElitePacks" {{ if .Config.Game.Palace.FocusOnElitePacks }}checked{{ end }}> Focus on elite packs</label>
</fieldset>
{{ end }}

{{ define "stony_tomb" }}
<fieldset>
<label><input type="checkbox" name="gameStonytombOpenChests" {{ if .Config.Game.StonyTomb.OpenChests }}checked{{ end }}> Open chests</label>
Expand Down