This commit is contained in:
shoopea 2020-02-01 15:21:43 +08:00
parent 123479def5
commit 8c51bed9d2
2 changed files with 4 additions and 4 deletions

6
job.go
View File

@ -2007,9 +2007,9 @@ func jobCraftAll(j Job) {
muxObjItem.RUnlock() muxObjItem.RUnlock()
for _, i := range p2.Vault { for _, i := range p2.Vault {
if item, ok := itemsParts[i.ItemID64]; ok { if item, ok := itemParts[i.ItemID64]; ok {
totalParts[item] = i.Quantity totalParts[item] = i.Quantity
} else if item, ok := itemsRecipes[i.ItemID64]; ok { } else if item, ok := itemRecipes[i.ItemID64]; ok {
totalRecipes[item] = i.Quantity totalRecipes[item] = i.Quantity
} }
} }
@ -2018,7 +2018,7 @@ func jobCraftAll(j Job) {
recipes, _ := totalRecipes[k] recipes, _ := totalRecipes[k]
parts, _ := totalParts[k] parts, _ := totalParts[k]
if (recipes > 0 && parts > (i-1)) || (parts >= i) { if (recipes > 0 && parts > (i-1)) || (parts >= i) {
completeItems[k] = MinInt64(recipes*i, parts) / i completeItems[k] = float64(MinInt64(recipes*i, parts) / i)
maxItems = MaxInt64(maxItems, int64(completeItems[k])) maxItems = MaxInt64(maxItems, int64(completeItems[k]))
} }
} }

View File

@ -30,7 +30,7 @@ func MinInt64(a int64, b int64) int64 {
} }
} }
func MaxInt(a int64, b int64) int64 { func MaxInt64(a int64, b int64) int64 {
if a > b { if a > b {
return a return a
} else { } else {