commit 95636c611f6dda05bf80c17b4c17990f2dc844c3 parent 5775735e55aef2af09633595c212202751a75a05 Author: n0tr1v <n0tr1v@protonmail.com> Date: Mon, 18 Dec 2023 14:37:43 -0500 cleanup Diffstat:
| M | pkg/web/handlers/poker/poker.go | | | 23 | +++++++++++++++++------ |
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -88,6 +88,22 @@ type PlayerEvent struct { Bet database.PokerChip } +func (e PlayerEvent) getAction() int { + action := NoAction + if e.Fold { + action = FoldAction + } else if e.Call { + action = CallAction + } else if e.Check { + action = CheckAction + } else if e.Bet > 0 { + action = BetAction + } else if e.AllIn { + action = AllInAction + } + return action +} + var PokerInstance = NewPoker() type Ongoing struct { @@ -720,22 +736,17 @@ RoundIsSettledLoop: return continueGetPlayerEventLoop } - action := NoAction + action := evt.getAction() msg := "" if evt.Fold { - action = FoldAction msg = "Will auto fold" } else if evt.Call { - action = CallAction msg = "Will auto call" } else if evt.Check { - action = CheckAction msg = "Will auto check" } else if evt.Bet > 0 { - action = BetAction msg = "Will auto bet" } else if evt.AllIn { - action = AllInAction msg = "Will auto all-in" } if action != NoAction {