All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m18s
136 lines
3.4 KiB
Go
136 lines
3.4 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"`
|
|
ImgScale float64 `json:"imgScale"`
|
|
ImgOffsetX float64 `json:"imgOffsetX"`
|
|
ImgOffsetY float64 `json:"imgOffsetY"`
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
}
|