Add spin session functionality and update game mechanics
- Introduced a new `spin_sessions` table to track user spin activities. - Updated the API to include a new endpoint for spinning games, allowing users to place bets and specify spin counts. - Enhanced game information structure and added validation for bets and spin counts. - Implemented the `Forest Fortune` slot game mechanics, including payline evaluation and scatter functionality. - Updated dependencies in `pyproject.toml` for development and added `httpx` for HTTP requests. - Added unit tests for the new slot mechanics and API endpoints to ensure functionality and reliability.
This commit is contained in:
@@ -49,8 +49,53 @@ class WalletResponse(BaseModel):
|
||||
deposits: list[DepositResponse]
|
||||
|
||||
|
||||
class GameStub(BaseModel):
|
||||
class GameInfo(BaseModel):
|
||||
slug: str
|
||||
title: str
|
||||
description: str
|
||||
status: str = "coming_soon"
|
||||
min_bet: Decimal = Decimal("1.00")
|
||||
max_bet: Decimal = Decimal("1000.00")
|
||||
min_spin_count: int = 1
|
||||
max_spin_count: int = 1000
|
||||
|
||||
|
||||
# Backwards-compatible alias
|
||||
GameStub = GameInfo
|
||||
|
||||
|
||||
class SpinRequest(BaseModel):
|
||||
bet: Decimal = Field(..., gt=0)
|
||||
spin_count: int = Field(..., ge=1, le=1000)
|
||||
|
||||
|
||||
class PaylineWinResponse(BaseModel):
|
||||
line_index: int
|
||||
symbol: str
|
||||
count: int
|
||||
amount: Decimal
|
||||
path: list[int]
|
||||
|
||||
|
||||
class SpinOutcomeResponse(BaseModel):
|
||||
index: int
|
||||
grid: list[list[str]]
|
||||
line_wins: list[PaylineWinResponse]
|
||||
scatter_count: int
|
||||
scatter_win: Decimal
|
||||
total_win: Decimal
|
||||
level: int
|
||||
multiplier: int
|
||||
meta_triggered: bool
|
||||
|
||||
|
||||
class SessionSpinResponse(BaseModel):
|
||||
slug: str
|
||||
bet: Decimal
|
||||
spin_count: int
|
||||
total_bet: Decimal
|
||||
total_win: Decimal
|
||||
max_level: int
|
||||
trigger_count: int
|
||||
balance: Decimal
|
||||
spins: list[SpinOutcomeResponse]
|
||||
|
||||
Reference in New Issue
Block a user