Private
Public Access
1
0
Files
it232Abschied/types.go
Sebastian Unterschütz 141f74c6ad
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m43s
fix
2025-12-05 21:56:44 +01:00

146 lines
3.6 KiB
Go

package main
// shared/types.go (oder types.go im Hauptverzeichnis)
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"`
// Visuelle Anpassungen
ImgScale float64 `json:"imgScale"`
ImgOffsetX float64 `json:"imgOffsetX"`
ImgOffsetY float64 `json:"imgOffsetY"`
// Logik
CanTalk bool `json:"canTalk"`
SpeechLines []string `json:"speechLines"`
YOffset float64 `json:"yOffset"`
// NEU: Verhindert, dass dieses Objekt vom Zufallsgenerator ausgewählt wird
NoRandomSpawn bool `json:"noRandomSpawn"`
}
type ChunkObstacle 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"`
Color string `json:"color"`
ImgScale float64 `json:"imgScale"`
ImgOffsetX float64 `json:"imgOffsetX"`
ImgOffsetY float64 `json:"imgOffsetY"`
}
type PlatformDef struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"w"`
Height float64 `json:"h"`
Type string `json:"type"`
}
type ChunkDef struct {
ID string `json:"id"`
Platforms []PlatformDef `json:"platforms"`
Obstacles []ChunkObstacle `json:"obstacles"`
TotalWidth int `json:"totalWidth"`
}
type GameConfig struct {
Obstacles []ObstacleDef `json:"obstacles"`
Backgrounds []string `json:"backgrounds"`
Chunks []ChunkDef `json:"chunks"`
}
// Dynamischer State (Simulation)
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"`
Speech string `json:"speech,omitempty"`
}
type ActivePlatform struct {
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"`
ServerPlats []ActivePlatform `json:"serverPlats"`
PowerUps PowerUpState `json:"powerups"`
ServerTick int `json:"serverTick"`
NextSpawnTick int `json:"nextSpawnTick"`
RngState uint32 `json:"rngState"`
}
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"`
}