aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_combine.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/act_combine.go')
-rw-r--r--internal/game/act_combine.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/game/act_combine.go b/internal/game/act_combine.go
index 26d85c6..bc9b6de 100644
--- a/internal/game/act_combine.go
+++ b/internal/game/act_combine.go
@@ -100,7 +100,12 @@ func (g *Game) advanceCombine(sess *net.Session, p *player.Player) {
return
}
- consumeIngredients(craft, p.HasItem, p.RemoveItem)
+ // Byproducts must be collected BEFORE consumption: the resolver maps
+ // each ingredient entry to the alternative actually being consumed
+ // (bucket vs jug of water), which requires the items still present.
+ byproducts := g.collectByproducts(p, item)
+
+ consumeIngredients(craft, p.CountItem, p.RemoveItem)
outputQty := craft.OutputQty
if outputQty <= 0 {
@@ -129,6 +134,14 @@ func (g *Game) advanceCombine(sess *net.Session, p *player.Player) {
p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: item.ID, Quantity: outputQty})
}
+ // Return the empty containers (and any other byproducts) alongside
+ // the output; without this, combine crafts silently discarded them.
+ for _, bp := range byproducts {
+ if slot := p.FirstFreeSlot(); slot >= 0 {
+ p.SetInvSlot(slot, &player.InventorySlot{ItemID: bp, Quantity: 1})
+ }
+ }
+
g.saveCharacter(p)
if d.Remaining > 0 {