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

Add option to skip pames and prubys when rerolling charms #605

Merged
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
5 changes: 5 additions & 0 deletions internal/action/cube_recipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ func hasItemsForGrandCharmReroll(ctx *context.Status, items []data.Item) ([]data
grandCharm = itm
}
} else if isPerfectGem(itm) && len(perfectGems) < 3 {
// Skip perfect amethysts and rubies if configured
if (ctx.CharacterCfg.CubeRecipes.SkipPerfectAmethysts && itm.Name == "PerfectAmethyst") ||
(ctx.CharacterCfg.CubeRecipes.SkipPerfectRubies && itm.Name == "PerfectRuby") {
continue
}
perfectGems = append(perfectGems, itm)
}

Expand Down
6 changes: 4 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ type CharacterCfg struct {
Items []item.Name `yaml:"items"`
} `yaml:"gambling"`
CubeRecipes struct {
Enabled bool `yaml:"enabled"`
EnabledRecipes []string `yaml:"enabledRecipes"`
Enabled bool `yaml:"enabled"`
EnabledRecipes []string `yaml:"enabledRecipes"`
SkipPerfectAmethysts bool `yaml:"skipPerfectAmethysts"`
SkipPerfectRubies bool `yaml:"skipPerfectRubies"`
} `yaml:"cubing"`
BackToTown struct {
NoHpPotions bool `yaml:"noHpPotions"`
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 @@ -958,6 +958,8 @@ func (s *HttpServer) characterSettings(w http.ResponseWriter, r *http.Request) {
cfg.CubeRecipes.Enabled = r.Form.Has("enableCubeRecipes")
enabledRecipes := r.Form["enabledRecipes"]
cfg.CubeRecipes.EnabledRecipes = enabledRecipes
cfg.CubeRecipes.SkipPerfectAmethysts = r.Form.Has("skipPerfectAmethysts")
cfg.CubeRecipes.SkipPerfectRubies = r.Form.Has("skipPerfectRubies")
// Companion

// Companion config
Expand Down
8 changes: 8 additions & 0 deletions internal/server/templates/character_settings.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@
<input type="checkbox" style="padding-right: 30px" name="enableCubeRecipes" {{ if .Config.CubeRecipes.Enabled }}checked{{ end }}/>
Enable the bot to automatically cube item recipes.
</label><br>
<label>
<input type="checkbox" name="skipPerfectAmethysts" {{ if .Config.CubeRecipes.SkipPerfectAmethysts }}checked{{ end }}/>
Don't use Perfect Amethysts when rolling charms
</label><br>
<label>
<input type="checkbox" name="skipPerfectRubies" {{ if .Config.CubeRecipes.SkipPerfectRubies }}checked{{ end }}/>
Don't use Perfect Rubies when rolling charms
</label><br>

<div class="recipe-grid">
{{ range $index, $recipe := .RecipeList }}
Expand Down