Private
Public Access
1
0
Files
it232Abschied/types.go
Sebastian Unterschütz 0412168c4e
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Has been cancelled
better deploy
2025-11-27 19:42:08 +01:00

95 lines
2.2 KiB
Go

package main
type ObstacleDef struct {
ID string `json:"id"`
Type string `json:"type"`
Width float64 `json:"width"`
Height float64 `json:"height"`
Color string `json:"color"`
Image string `json:"image"`
CanTalk bool `json:"canTalk"`
SpeechLines []string `json:"speechLines"`
YOffset float64 `json:"yOffset"`
}
type GameConfig struct {
Obstacles []ObstacleDef `json:"obstacles"`
Backgrounds []string `json:"backgrounds"`
}
// Dynamischer State
type ActiveObstacle struct {
ID string `json:"id"`
Type string `json:"type"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"w"`
Height float64 `json:"h"`
}
// API Requests/Responses
type Input struct {
Tick int `json:"t"`
Act string `json:"act"`
}
type ValidateRequest struct {
SessionID string `json:"sessionId"`
Inputs []Input `json:"inputs"`
TotalTicks int `json:"totalTicks"`
}
type PowerUpState struct {
GodLives int `json:"godLives"`
HasBat bool `json:"hasBat"`
BootTicks int `json:"bootTicks"`
}
type ValidateResponse struct {
Status string `json:"status"`
VerifiedScore int `json:"verifiedScore"`
ServerObs []ActiveObstacle `json:"serverObs"`
PowerUps PowerUpState `json:"powerups"`
ServerTick int `json:"serverTick"`
NextSpawnTick int `json:"nextSpawnTick"`
}
type StartResponse struct {
SessionID string `json:"sessionId"`
Seed uint32 `json:"seed"`
}
type SubmitNameRequest struct {
SessionID string `json:"sessionId"`
Name string `json:"name"`
}
type SubmitResponse struct {
ClaimCode string `json:"claimCode"`
}
type LeaderboardEntry struct {
Rank int64 `json:"rank"`
Name string `json:"name"`
Score int `json:"score"`
IsMe bool `json:"isMe"`
}
type AdminActionRequest struct {
SessionID string `json:"sessionId"`
Action string `json:"action"`
}
type AdminEntry struct {
SessionID string `json:"sessionId"`
Name string `json:"name"`
Score int `json:"score"`
Code string `json:"code"`
Time string `json:"time"`
}
type ClaimDeleteRequest struct {
SessionID string `json:"sessionId"`
ClaimCode string `json:"claimCode"`
}