diff options
Diffstat (limited to 'internal/game/act_clean.go')
| -rw-r--r-- | internal/game/act_clean.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/game/act_clean.go b/internal/game/act_clean.go index 3525475..4efe293 100644 --- a/internal/game/act_clean.go +++ b/internal/game/act_clean.go @@ -56,7 +56,17 @@ func (g *Game) advanceClean(sess *net.Session, p *player.Player) { } craft := matchItem.FirstCraft() - consumeID := craft.Ingredients[0].Items[0] + // Resolve the exact alternative the availability check selected instead + // of assuming the first listed item: an ingredient-less or + // alternative-item cleaning recipe would otherwise panic or consume the + // wrong stack while still awarding XP. + plan := planIngredients(craft, p.CountItem) + if len(plan) == 0 { + sess.WriteLine("You've finished cleaning herbs.") + g.cancelBgAction(p) + return + } + consumeID := plan[0].id for i := 0; i < 28; i++ { slot := p.InvSlot(i) |
