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 Endugu + Drifter Cavern run #385

Merged
merged 1 commit into from
Aug 2, 2024
Merged
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 @@ -58,6 +58,9 @@ game:
ancient_tunnels:
openChests: true
focusOnElitePacks: false
drifter_cavern:
openChests: true
focusOnElitePacks: false
pit:
# default - Outer Cloister -> Monastery Gates -> Tamoe Highland
moveThroughBlackMarsh: false # Use Black Marsh -> Tamoe Highland route
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ type CharacterCfg struct {
OpenChests bool `yaml:"openChests"`
FocusOnElitePacks bool `yaml:"focusOnElitePacks"`
} `yaml:"ancient_tunnels"`
DrifterCavern struct {
OpenChests bool `yaml:"openChests"`
FocusOnElitePacks bool `yaml:"focusOnElitePacks"`
} `yaml:"drifter_cavern"`
Mephisto struct {
KillCouncilMembers bool `yaml:"killCouncilMembers"`
OpenChests bool `yaml:"openChests"`
Expand Down
4 changes: 4 additions & 0 deletions internal/config/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const (
QuestsRun Run = "quests"
TerrorZoneRun Run = "terror_zone"
ThreshsocketRun Run = "threshsocket"
DrifterCavernRun Run = "drifter_cavern"
EnduguRun Run = "endugu"
)

var AvailableRuns = map[Run]interface{}{
Expand Down Expand Up @@ -54,4 +56,6 @@ var AvailableRuns = map[Run]interface{}{
QuestsRun: nil,
TerrorZoneRun: nil,
ThreshsocketRun: nil,
DrifterCavernRun: nil,
EnduguRun: nil,
}
37 changes: 37 additions & 0 deletions internal/run/drifter_cavern.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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"
)

type DrifterCavern struct {
baseRun
}

func (a DrifterCavern) Name() string {
return string(config.DrifterCavernRun)
}

func (a DrifterCavern) BuildActions() (actions []action.Action) {
openChests := a.CharacterCfg.Game.DrifterCavern.OpenChests
onlyElites := a.CharacterCfg.Game.DrifterCavern.FocusOnElitePacks
filter := data.MonsterAnyFilter()

if onlyElites {
filter = data.MonsterEliteFilter()
}

actions = []action.Action{
a.builder.WayPoint(area.GlacialTrail),
a.builder.MoveToArea(area.DrifterCavern),
}

/*actions = append(actions,
a.builder.OpenTPIfLeader(),
)*/

return append(actions, a.builder.ClearArea(openChests, filter))
}
58 changes: 58 additions & 0 deletions internal/run/endugu.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package run

import (
"github.com/hectorgimenez/d2go/pkg/data"
"github.com/hectorgimenez/d2go/pkg/data/area"
"github.com/hectorgimenez/d2go/pkg/data/object"
"github.com/hectorgimenez/koolo/internal/action"
"github.com/hectorgimenez/koolo/internal/action/step"
"github.com/hectorgimenez/koolo/internal/config"
"github.com/hectorgimenez/koolo/internal/game"
"time"
)

type Endugu struct {
baseRun
}

func (e Endugu) Name() string {
return string(config.EnduguRun)
}

func (e Endugu) BuildActions() []action.Action {
return []action.Action{
e.builder.WayPoint(area.FlayerJungle),
e.builder.MoveToArea(area.FlayerDungeonLevel1),
e.builder.MoveToArea(area.FlayerDungeonLevel2),
e.builder.MoveToArea(area.FlayerDungeonLevel3),
e.moveToKhalimChest(),
e.builder.ClearAreaAroundPlayer(15, data.MonsterEliteFilter()),
action.NewStepChain(func(d game.Data) []step.Step {
return []step.Step{step.Wait(3 * time.Second)}
}),
e.openKhalimChest(),
e.builder.ItemPickup(false, 10),
}
}

func (e Endugu) moveToKhalimChest() action.Action {
return action.NewStepChain(func(d game.Data) []step.Step {
for _, o := range d.Objects {
if o.Name == object.KhalimChest2 {
return []step.Step{step.MoveTo(o.Position, step.StopAtDistance(10))}
}
}
return nil
})
}

func (e Endugu) openKhalimChest() action.Action {
return e.builder.InteractObject(object.KhalimChest2, func(d game.Data) bool {
for _, obj := range d.Objects {
if obj.Name == object.KhalimChest2 && !obj.Selectable {
return true
}
}
return false
})
}
4 changes: 4 additions & 0 deletions internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (f *Factory) BuildRuns() (runs []Run) {
runs = append(runs, Cows{baseRun})
case config.ThreshsocketRun:
runs = append(runs, Threshsocket{baseRun})
case config.DrifterCavernRun:
runs = append(runs, DrifterCavern{baseRun})
case config.EnduguRun:
runs = append(runs, Endugu{baseRun})
}
}

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 @@ -573,6 +573,8 @@ func (s *HttpServer) characterSettings(w http.ResponseWriter, r *http.Request) {
cfg.Game.StonyTomb.FocusOnElitePacks = r.Form.Has("gameStonytombFocusOnElitePacks")
cfg.Game.AncientTunnels.OpenChests = r.Form.Has("gameAncientTunnelsOpenChests")
cfg.Game.AncientTunnels.FocusOnElitePacks = r.Form.Has("gameAncientTunnelsFocusOnElitePacks")
cfg.Game.DrifterCavern.OpenChests = r.Form.Has("gameDrifterCavernOpenChests")
cfg.Game.DrifterCavern.FocusOnElitePacks = r.Form.Has("gameDrifterCavernFocusOnElitePacks")
cfg.Game.Mephisto.KillCouncilMembers = r.Form.Has("gameMephistoKillCouncilMembers")
cfg.Game.Mephisto.OpenChests = r.Form.Has("gameMephistoOpenChests")
cfg.Game.Tristram.ClearPortal = r.Form.Has("gameTristramClearPortal")
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 @@ -51,6 +51,13 @@
</fieldset>
{{ end }}

{{ define "drifter_cavern" }}
<fieldset>
<label><input type="checkbox" name="gameDrifterCavernOpenChests" {{ if .Config.Game.DrifterCavern.OpenChests }}checked{{ end }}> Open chests</label>
<label><input type="checkbox" name="gameDrifterCavernFocusOnElitePacks" {{ if .Config.Game.DrifterCavern.FocusOnElitePacks }}checked{{ end }}> Focus on elite packs</label>
</fieldset>
{{ end }}

{{ define "mephisto" }}
<fieldset>
<label><input type="checkbox" name="gameMephistoKillCouncilMembers" {{ if .Config.Game.Mephisto.KillCouncilMembers }}checked{{ end }}> Kill council members</label>
Expand Down