aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/craps.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/craps.go')
-rw-r--r--internal/casino/craps.go50
1 files changed, 4 insertions, 46 deletions
diff --git a/internal/casino/craps.go b/internal/casino/craps.go
index e9b87ec..95d3c21 100644
--- a/internal/casino/craps.go
+++ b/internal/casino/craps.go
@@ -250,7 +250,7 @@ func (t *crapsTable) bet(name, spot string, amount int, w Wallet) []Event {
}
kind, n, ok := parseCrapsTarget(spot)
if !ok || !t.Config.Craps.allows(kind) || ((kind == "place" || kind == "buy" || kind == "lay") && !t.Config.Craps.number(n)) {
- return reject("Unknown or unavailable craps target. Use table rules.")
+ return reject("Unknown or unavailable craps target. Use table to see the felt or rules for the guide.")
}
if (kind == "pass" || kind == "dontpass") && t.point != 0 {
return reject("Line bets are accepted only on come-out.")
@@ -484,52 +484,10 @@ func (t *crapsTable) action(name, action string) []Event {
}
return append(events, t.roll()...)
}
- if strings.HasPrefix(action, "unbet ") {
- target := strings.TrimPrefix(action, "unbet ")
- if strings.TrimSpace(strings.TrimPrefix(target, "odds ")) == "all" {
- return append(t.unbetAllLocked(p), t.finishCrapsControls()...)
- }
- oddsOnly := strings.HasPrefix(target, "odds ")
- target = strings.TrimPrefix(target, "odds ")
- if kind, n, ok := parseCrapsTarget(target); ok && kind == "hop" {
- target = crapsTarget(&crapsBet{kind: kind, number: n})
- }
- for i, b := range p.bets {
- if crapsTarget(b) != target && !(b.kind == target && (target == "pass" || target == "dontpass")) {
- continue
- }
- if oddsOnly {
- if b.odds.Total == 0 {
- continue
- }
- e := t.private(name, "Odds returned.")
- if err := p.Wallet.PayCredits(b.odds.Total, b.odds.ID); err != nil {
- e.Message = payoutFailedMessage()
- }
- b.odds = Wager{}
- return []Event{e, t.betSummary(p), t.reminder(name)}
- }
- if crapsContract(b.kind) {
- return []Event{t.private(name, "That contract bet cannot be removed.")}
- }
- line, failed := t.pay(p, b, 0, 1, 0, true)
- var lines []settlementLine
- if !failed {
- lines = append(lines, line)
- }
- e := t.settlementEvent(p, lines, failed)
- p.bets = append(p.bets[:i], p.bets[i+1:]...)
- p.HasBet = len(p.bets) > 0
- events := append([]Event{e}, t.finishCrapsControls()...)
- events = append(events, t.syncRoundClock()...)
- if t.players.has(name) {
- events = append(events, t.betSummary(p), t.reminder(name))
- }
- return events
- }
- return []Event{t.private(name, "No matching removable bet.")}
+ if action == "unbet" {
+ return append(t.unbetAllLocked(p), t.finishCrapsControls()...)
}
- return []Event{t.private(name, "Use table rules for craps commands.")}
+ return []Event{t.private(name, "Use table for the felt or rules for the craps guide.")}
}
func (t *crapsTable) rebet(name string) (string, int) {
t.mu.Lock()