diff options
| author | historia <[not public]> | 2026-10-05 17:31:50 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-05 17:31:50 -0400 |
| commit | 516fd29da423432ef6dfded21a984f1d15dcab1a (patch) | |
| tree | eb2dabe325a1335dedac28a93453df643ef986f2 /internal/game/cmd_get.go | |
| parent | e42952469dadfb3535633c66c881050ac128703c (diff) | |
| download | thehouseoficarus-516fd29da423432ef6dfded21a984f1d15dcab1a.tar.gz | |
fix: slop casino and economy fixes
Diffstat (limited to 'internal/game/cmd_get.go')
| -rw-r--r-- | internal/game/cmd_get.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/game/cmd_get.go b/internal/game/cmd_get.go index a806ffa..d4742a5 100644 --- a/internal/game/cmd_get.go +++ b/internal/game/cmd_get.go @@ -40,7 +40,7 @@ func (g *Game) doGet(sess *net.Session, input string) { itemID := matches[0].ID if itemID == "credits" { - g.pickupCredits(sess, p, itemID) + g.pickupCredits(sess, p, itemID, qty) return } @@ -162,7 +162,7 @@ func (g *Game) doGetAllNamed(sess *net.Session, input string) { itemID := matches[0].ID if itemID == "credits" { - g.pickupCredits(sess, p, itemID) + g.pickupCredits(sess, p, itemID, 0) return } @@ -391,7 +391,7 @@ func (g *Game) doGetAll(sess *net.Session) { } } -func (g *Game) pickupCredits(sess *net.Session, p *player.Player, itemID string) { +func (g *Game) pickupCredits(sess *net.Session, p *player.Player, itemID string, want int) { // The balance cap is a hard limit: credits the purse cannot absorb must // stay on the ground instead of being removed and then clamped away by // grantCredits. Only the headroom below the cap is taken. @@ -400,7 +400,13 @@ func (g *Game) pickupCredits(sess *net.Session, p *player.Player, itemID string) sess.WriteLine(g.colorize(sess, "currency_pickup", "Your purse can't hold any more credits.")) return } - qty := g.World.RemoveAvailableItem(p.RoomID, itemID, room, p.Name) + // Honor an explicit quantity (get 5 credits) instead of always sweeping + // the whole purse headroom. + take := room + if want > 0 && want < take { + take = want + } + qty := g.World.RemoveAvailableItem(p.RoomID, itemID, take, p.Name) if qty <= 0 { return } |
