game stats shows planes and population

This commit is contained in:
Ilia Denisov
2026-04-26 21:12:51 +02:00
parent fe829285a6
commit b4591cabd4
11 changed files with 84 additions and 22 deletions
+6 -4
View File
@@ -1,9 +1,11 @@
package rest
type Init struct {
Races []Race `json:"races" binding:"required,gte=10"`
type InitRequest struct {
// List of the Races in the Game
Races []InitRace `json:"races" binding:"required,gte=10"`
}
type Race struct {
Name string `json:"name" binding:"required,notblank"`
type InitRace struct {
// Name of the Race
RaceName string `json:"raceName" binding:"required,notblank"`
}
+17 -6
View File
@@ -3,14 +3,25 @@ package rest
import "github.com/google/uuid"
type StateResponse struct {
ID uuid.UUID `json:"id"`
Turn uint `json:"turn"`
Stage uint `json:"stage"`
// Unique Game ID
ID uuid.UUID `json:"id"`
// Current Game Turn
Turn uint `json:"turn"`
// Turn stage (for games that support stste modification)
Stage uint `json:"stage"`
// List of Game's players
Players []PlayerState `json:"player"`
}
type PlayerState struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Extinct bool `json:"extinct"`
// Unique Player ID within Game
ID uuid.UUID `json:"id"`
// Player's Race name
RaceName string `json:"raceName"`
// Number of planets owned by player
Planets uint `json:"planets"`
// Total population summ from all player's planets
Population float64 `json:"population"`
// True when Race is eliminated or left the game
Extinct bool `json:"extinct"`
}