diff options
Diffstat (limited to 'internal/casino/machine.go')
| -rw-r--r-- | internal/casino/machine.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/casino/machine.go b/internal/casino/machine.go index 97b846d..7821975 100644 --- a/internal/casino/machine.go +++ b/internal/casino/machine.go @@ -402,12 +402,23 @@ func (m *Machine) markDisconnected(name string) []Event { if !m.owns(name) { return nil } + // A spin whose reels have all stopped has already been revealed to the + // player, so its result is final. Settle it through the normal path + // before the seat is reset: otherwise a disconnect during the cosmetic + // payout delay forfeits an already-shown win and consumes the stake for a + // spin the player watched land. finishSpin consumes the stake itself on a + // resolved round (or banks a feature win), so resetSeat below neither + // double-pays nor double-consumes. + var events []Event + if m.phase == machinePayout && m.spin != nil { + events = append(events, m.finishSpin()...) + } bank := int(m.featureBank) wallet := m.player.Wallet stakeFailed := m.stakeFailed m.resetSeat() - events := []Event{{RoomID: m.RoomID, TableID: m.Config.ID, Type: EventLeft, Player: name, - Message: fmt.Sprintf("%s stands up from the slots machine.", name), Color: "casino_action", Public: true}} + events = append(events, Event{RoomID: m.RoomID, TableID: m.Config.ID, Type: EventLeft, Player: name, + Message: fmt.Sprintf("%s stands up from the slots machine.", name), Color: "casino_action", Public: true}) if bank <= 0 || wallet == nil { return events } |
