diff options
| author | historia <[not public]> | 2026-10-01 04:26:20 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-01 04:26:20 -0400 |
| commit | 0ba388bbe229dd1ccfcb0831d21a5542ae0935f1 (patch) | |
| tree | c5686cf404e3dc5001d2c9b2792749ae7a3c9801 /internal/game/casino.go | |
| parent | e3ff06fc79682673194c8913f0feb9e90920e7d0 (diff) | |
| download | thehouseoficarus-0ba388bbe229dd1ccfcb0831d21a5542ae0935f1.tar.gz | |
feat: video poker machines added to casino
Diffstat (limited to 'internal/game/casino.go')
| -rw-r--r-- | internal/game/casino.go | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go index f29efd6..8d6e2a5 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -263,7 +263,7 @@ func (g *Game) casinoTable(roomID int, gameName string) (*casino.Table, bool) { return nil, false } for _, cfg := range room.CasinoTables { - if strings.EqualFold(string(cfg.Game), gameName) { + if (cfg.Game == casino.GameVideoPoker && strings.EqualFold(cfg.ID, gameName)) || (cfg.Game != casino.GameVideoPoker && strings.EqualFold(string(cfg.Game), gameName)) { table := g.Casino.EnsureTable(roomID, cfg) if table == nil { return nil, false @@ -372,7 +372,13 @@ func (g *Game) startCasinoGame(sess *net.Session, p *player.Player, gameName str sess.WriteLine(fmt.Sprintf("There is no %s table here.", gameName)) return } - g.emitCasinoEvents(g.Casino.Join(table.RoomID, table.Config, p.Name)) + events := g.Casino.Join(table.RoomID, table.Config, p.Name) + if table.Config.Game == casino.GameVideoPoker { + if joined, playing := g.Casino.Participation(p.Name); playing && joined == table { + events = g.Casino.Bet(table.RoomID, table.Config.ID, p.Name, "view", 0, casinoWallet{g: g, p: p}) + } + } + g.emitCasinoEvents(events) } func (g *Game) executeBet(sess *net.Session, args []string, rawInput string) { @@ -409,6 +415,10 @@ func (g *Game) executeBet(sess *net.Session, args []string, rawInput string) { sess.WriteLine("You're not playing a game.") return } + if table.Config.Game == casino.GameVideoPoker { + g.emitCasinoEvents(g.Casino.Action(table.RoomID, table.Config.ID, p.Name, strings.TrimSpace("coins "+strings.Join(args, " ")))) + return + } // Table bet syntax: bet | bet <amount> [on] <target> | bet min|max [on] <target>. // BEFORE an "on" keyword, a token that parses as an amount (or min/max) // sets the wager and any other token is the bet target; AFTER "on", the @@ -517,6 +527,10 @@ func (g *Game) executeTableAction(sess *net.Session, action string) { sess.WriteLine("You're not playing a multiplayer casino game.") return } + if table.Config.Game == casino.GameVideoPoker && action == "deal" { + g.emitCasinoEvents(g.Casino.Bet(table.RoomID, table.Config.ID, p.Name, "deal", 0, casinoWallet{g: g, p: p})) + return + } g.emitCasinoEvents(g.Casino.Action(table.RoomID, table.Config.ID, p.Name, action)) } @@ -626,11 +640,12 @@ func (g *Game) casinoBoardReminder(sess *net.Session, category string, menu *cas return "", "", false } _, isCraps := snapshot.(*casino.CrapsSnapshot) + _, isPoker := snapshot.(*casino.VideoPokerSnapshot) s, isRoulette := snapshot.(*casino.RouletteSnapshot) - if !isCraps && (!isRoulette || s.Phase == "playing" || s.Phase == "result") { + if !isPoker && !isCraps && (!isRoulette || s.Phase == "playing" || s.Phase == "result") { return "", "", false } - if !isCraps && sess.Player.OptionString("casino_display") == "compact" && (menu.Repeat || !menu.ShowBalance) { + if !isPoker && !isCraps && sess.Player.OptionString("casino_display") == "compact" && (menu.Repeat || !menu.ShowBalance) { // The compact reminder is already a short block; leave it intact. return "", "", false } @@ -711,6 +726,8 @@ func (g *Game) renderCasinoSnapshot(sess *net.Session, snapshot casino.Snapshot) // how verbose the command menus are. size := sess.Player.OptionInt("card_size") switch s := snapshot.(type) { + case *casino.VideoPokerSnapshot: + return renderVideoPoker(s, mode, unicode, size, sess.Player.OptionString("card_style"), g.CardArt) case *casino.CrapsSnapshot: return renderCrapsSnapshot(s, mode, unicode, sess.Player.OptionString("card_style")) case *casino.RouletteSnapshot: |
