Skip to content

Commit

Permalink
fix (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
promiseofcake authored Sep 5, 2024
1 parent 33711b8 commit 2cc0ea8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.5
require (
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/lmittmann/tint v1.0.5
github.com/promiseofcake/artifactsmmo-go-client v1.7.0
github.com/promiseofcake/artifactsmmo-go-client v1.7.1
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/promiseofcake/artifactsmmo-go-client v1.7.0 h1:h7sceXRlPdf7AqdijxIEY7frcoRycvSBGum9SbIVDCI=
github.com/promiseofcake/artifactsmmo-go-client v1.7.0/go.mod h1:UPeTbBmAMzjX0EtFMxF4KVPdHrejptIwHASP4NxkjxI=
github.com/promiseofcake/artifactsmmo-go-client v1.7.1 h1:lQEJJqRrbK2ebj/OHLXqVUg9iY7UiQ5ydraNhO37stY=
github.com/promiseofcake/artifactsmmo-go-client v1.7.1/go.mod h1:UPeTbBmAMzjX0EtFMxF4KVPdHrejptIwHASP4NxkjxI=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
11 changes: 7 additions & 4 deletions internal/engine/refine.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ func Refine(ctx context.Context, r *actions.Runner, character string) error {
}

// min level current level - 10
minLevel := int(math.Max(0, float64(refineLevel-10)))
// TODO make overridable
//minLevel := int(math.Max(0, float64(refineLevel-10)))

// allow all items to be refined
minLevel := 0

// get items that match
items, iErr := r.GetItems(ctx, minLevel, refineLevel, skillType, res.Code)
Expand All @@ -121,10 +125,9 @@ func Refine(ctx context.Context, r *actions.Runner, character string) error {
return NoItemsToRefine
}

// given the first item in the list (we should sort it)
// determine how much we want to withdraw.
// sort list with higher level items first
slices.SortFunc(refinable, func(a, b *models.Item) int {
return cmp.Compare(a.Level, b.Level)
return cmp.Compare(b.Level, a.Level)
})

// look over all the resources we have in the bank
Expand Down

0 comments on commit 2cc0ea8

Please sign in to comment.