Documentation ¶
Index ¶
- Constants
- func NewActionProcessedEvent(player *models.PublicPlayer, action, position int, ...) *models.Event
- func NewDealerSetEvent(player *models.PublicPlayer, index int) *models.Event
- func NewFlopEvent(cards [5]models.Card) *models.Event
- func NewGameEndEvent(winners []models.PublicPlayer, shares *money.Money) *models.Event
- func NewGameStartEvent(publicPlayers []models.PublicPlayer, position int, pot *money.Money) *models.Event
- func NewHoleCardsEvent(cards [2]models.Card) *models.Event
- func NewJoinSuccessEvent(players []models.PublicPlayer, position int, buyIn *money.Money, ...) *models.Event
- func NewLobbyInfoEvent(lobbyId string, ...) *models.Event
- func NewLobbyPauseEvent(players []models.PublicPlayer, playerCount int) *models.Event
- func NewPlayerJoinEvent(player *models.PublicPlayer, index, playerCount int, gameStarted bool) *models.Event
- func NewPlayerLeavesEvent(player *models.PublicPlayer, i, playerCount int, gameStarted bool) *models.Event
- func NewRiverEvent(cards [5]models.Card) *models.Event
- func NewTurnEvent(cards [5]models.Card) *models.Event
- func NewWaitForActionEvent(player *models.PublicPlayer, position int, possibleActions byte) *models.Event
- func ValidateEventName(expected, live string) bool
- type Action
- type ActionDTO
- type ActionProcessedEvent
- type BoardEvent
- type DealerSetEvent
- type GameEndEvent
- type GameStartEvent
- type HoleCardsEvent
- type JoinEvent
- type JoinSuccess
- type LobbyInfo
- type LobbyPause
- type PlayerJoinEvent
- type PlayerLeavesEvent
- type WaitForActionEvent
Constants ¶
const ACTION_PROCESSED = "ACTION_PROCESSED"
const ALL_IN = 5
ALL_IN action bets the entire wallet of the user in this round
const BET = 2
BET describes the action of a player betting the same amount as the highest bet and therefore go along or calling the hand
const CHECK = 4
CHECK action pushes the action requirement to the next player
const DEALER_SET = "DEALER_SET"
const FLOP = "FLOP"
const FOLD = 1
FOLD describes the action of a player quiting this hand
const GAME_END = "GAME_END"
const GAME_START = "GAME_START"
const HOLE_CARDS = "HOLE_CARDS"
const JOIN = "JOIN"
const JOIN_SUCCESS = "JOIN_SUCCESS"
const LOBBY_INFO = "LOBBY_INFO"
const LOBBY_PAUSE = "LOBBY_PAUSE"
const PLAYER_ACTION = "PLAYER_ACTION"
const PLAYER_JOIN = "PLAYER_JOIN"
const PLAYER_LEAVE = "PLAYER_LEAVE"
const RAISE = 3
RAISE raises sets the highest bet a certain amount
const REQUIRED_EVENT_NAME_MISSING = "The event received does not match the required event name"
const RIVER = "RIVER"
const TURN = "TURN"
const WAIT_FOR_PLAYER_ACTION = "WAIT_FOR_PLAYER_ACTION"
Variables ¶
This section is empty.
Functions ¶
func NewActionProcessedEvent ¶
func NewActionProcessedEvent(player *models.PublicPlayer, action, position int, amount, totalAmount, wallet, pot *money.Money) *models.Event
func NewDealerSetEvent ¶
func NewDealerSetEvent(player *models.PublicPlayer, index int) *models.Event
func NewGameEndEvent ¶
func NewGameEndEvent(winners []models.PublicPlayer, shares *money.Money) *models.Event
func NewGameStartEvent ¶
func NewGameStartEvent(publicPlayers []models.PublicPlayer, position int, pot *money.Money) *models.Event
func NewJoinSuccessEvent ¶
func NewLobbyInfoEvent ¶
func NewLobbyInfoEvent(lobbyId string, players, minToStart, maxBuyIn, minBuyIn, blind, gameStartTimeout int, gameStarted bool) *models.Event
NewLobbyInfoEvent
func NewLobbyPauseEvent ¶
func NewLobbyPauseEvent(players []models.PublicPlayer, playerCount int) *models.Event
func NewPlayerJoinEvent ¶
func NewPlayerJoinEvent(player *models.PublicPlayer, index, playerCount int, gameStarted bool) *models.Event
NewPlayerJoinEvent creates a player join event for all other players to receive. The joining player receives a join success message
func NewPlayerLeavesEvent ¶
func NewWaitForActionEvent ¶
func NewWaitForActionEvent(player *models.PublicPlayer, position int, possibleActions byte) *models.Event
NewWaitForAction is an event that the server is waiting for an action from a given player. The possible actions range from 0001 = Fold | 0010=Bet | 0100=Raise | 1000=Check to 1111=All
func ValidateEventName ¶
ValidateEventName validates if the live event name equals the required with case insensetivity
Types ¶
type Action ¶
type Action struct { Action int `json:"action" mapstructure:"action"` Payload *money.Money `json:"payload" mapstructure:"payload"` }
Action describes a action a player can make one a normal hand stage
type ActionDTO ¶
type ActionDTO struct { Action int `json:"action" mapstructure:"action"` Payload int `json:"payload" mapstructure:"payload"` }
Action describes a action a player can make one a normal hand stage
type ActionProcessedEvent ¶
type ActionProcessedEvent struct { Player *models.PublicPlayer `json:"player" mapstructure:"player"` Pot string `json:"pot" mapstructure:"pot"` PotNum float64 `json:"potNum" mapstructure:"potNum"` Wallet string `json:"wallet" mapstructure:"wallet"` WalletNum float64 `json:"walletNum" mapstructure:"wallet"` TotalAmount string `json:"totalAmount" mapstructure:"totalAmount"` TotalAmountNum float64 `json:"totalAmountNum" mapstructure:"totalAmountNum"` Amount string `json:"amount" mapstructure:"amount"` AmountNum float64 `json:"amountNum" mapstructure:"amountNum"` Action int `json:"action" mapstructure:"action"` Position int `json:"position" mapstructure:"position"` }
type BoardEvent ¶
type DealerSetEvent ¶
type DealerSetEvent struct { Player *models.PublicPlayer `json:"player"` Index int `json:"index"` }
type GameEndEvent ¶
type GameEndEvent struct { Winners []models.PublicPlayer `json:"winners"` }
type GameStartEvent ¶
type GameStartEvent struct { Players []models.PublicPlayer `json:"players"` Pot string `json:"pot"` PotNum float64 `json:"potNum"` Position int `json:"position"` }
type HoleCardsEvent ¶
type JoinSuccess ¶
type LobbyInfo ¶
type LobbyInfo struct { LobbyID string `json:"lobbyId"` MaxBuyIn int `json:"maxBuyIn"` MinBuyIn int `json:"minBuyIn"` Blind int `json:"blind"` MinToStart int `json:"minPlayersToStart"` PlayerCount int `json:"playerCount"` GameStartTimeout int `json:"gameStartTimeout"` GameStarted bool `json:"gameStarted"` }
type LobbyPause ¶
type LobbyPause struct { Players []models.PublicPlayer `json:"players"` PlayerCount int `json:"playerCount"` }
type PlayerJoinEvent ¶
type PlayerJoinEvent struct { Player *models.PublicPlayer `json:"player"` Index int `json:"index"` PlayerCount int `json:"playerCount"` GameStarted bool `json:"gameStarted"` }
NewPlayerJoinEvent is the event for all other players to receive when another player joins. The joining player receives a join success message
type PlayerLeavesEvent ¶
type PlayerLeavesEvent struct { Player *models.PublicPlayer `json:"player"` Index int `json:"index"` PlayerCount int `json:"playerCount"` GameStarted bool `json:"gameStarted"` }
PlayerLeavesEvent messages that a player left
type WaitForActionEvent ¶
type WaitForActionEvent struct { Player *models.PublicPlayer `json:"player"` Position int `json:"position" mapstructure:"position"` PossibleActions byte `json:"possibleActions" mapstructure:"possibleActions"` }
WaitForActionEvent encodes all possible actions the user can perform.