Documentation
¶
Index ¶
- Constants
- Variables
- type Bank
- type CashOut
- type CrashedGame
- type Game
- func (game *Game) Emit(ev string, params ...any)
- func (game *Game) GetConfig() *config.CrashConfig
- func (game *Game) HandleCancelBet(wallet string) error
- func (game *Game) HandleCashOut(wallet string) error
- func (game *Game) HandleConnect(client *socket.Socket)
- func (game *Game) HandleDisconnect(client *socket.Socket)
- func (game *Game) HandleLogin(client *socket.Socket, wallet string)
- func (game *Game) HandlePlaceBet(client *socket.Socket, wallet string, currency string, ...) error
- type Log
- type Observer
- type Player
Constants ¶
View Source
const ( GAMESTATE_STOPPED = iota GAMESTATE_WAITING = iota GAMESTATE_RUNNING = iota GAMESTATE_CRASHED = iota GAMESTATE_INVALID = iota )
View Source
const ( EVENT_GAME_WAITING = "GameWaiting" EVENT_GAME_RUNNING = "GameRunning" EVENT_GAME_CRASHED = "GameCrashed" EVENT_PLAYER_WON = "PlayerWon" EVENT_PLAYER_LOST = "PlayerLost" )
View Source
const WAIT_TIME_SECS = 5
Variables ¶
View Source
var ( ErrUserAlreadyJoined = errors.New("user already joined game") ErrWrongGameState = errors.New("action invalid for current game state") ErrUserNotWaiting = errors.New("user not in waiting list") ErrUserNotPlaying = errors.New("user not playing") ErrAlreadyCashedOut = errors.New("player already cashed out") )
Functions ¶
This section is empty.
Types ¶
type Bank ¶
type Bank interface { IncreaseBalance( string, string, decimal.Decimal, string, uuid.UUID, ) (decimal.Decimal, error) DecreaseBalance( string, string, decimal.Decimal, string, uuid.UUID, ) (decimal.Decimal, error) GetBalance(string, string) (decimal.Decimal, error) GetBalances(wallet string) (map[string]decimal.Decimal, error) }
type CrashedGame ¶
type CrashedGame struct {
// contains filtered or unexported fields
}
func (*CrashedGame) MarshalJSON ¶
func (g *CrashedGame) MarshalJSON() ([]byte, error)
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) GetConfig ¶
func (game *Game) GetConfig() *config.CrashConfig
func (*Game) HandleCancelBet ¶
func (*Game) HandleCashOut ¶
func (*Game) HandleConnect ¶
func (*Game) HandleDisconnect ¶
Click to show internal directories.
Click to hide internal directories.