package scripts import ( _ "embed" "encoding/json" "log" ) //go:embed sample_data.json var dataJSON []byte var SCRIPTS []Script func init() { if err := json.Unmarshal(dataJSON, &SCRIPTS); err != nil { log.Fatalf("failed to parse sample_data.json: %v", err) } } type Script struct { ID string `json:"id"` Title string `json:"title"` Type string `json:"type"` Difficulty int `json:"difficulty"` PlayerCount PlayerCount `json:"playerCount"` Duration string `json:"duration"` Background string `json:"background"` Phases []Phase `json:"phases"` Roles []Role `json:"roles"` Clues []Clue `json:"clues"` Truth string `json:"truth"` } type PlayerCount struct { Min int `json:"min"` Max int `json:"max"` } type Phase struct { Name string `json:"name"` Description string `json:"description"` PublicInfo string `json:"publicInfo"` Clues []string `json:"clues"` } type Role struct { ID string `json:"id"` Name string `json:"name"` PublicProfile string `json:"publicProfile"` SecretProfile string `json:"secretProfile"` Secret string `json:"secret"` Goal string `json:"goal"` WinCondition string `json:"winCondition"` Personality string `json:"personality"` } type Clue struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Phase int `json:"phase"` } func GetByID(id string) *Script { for i := range SCRIPTS { if SCRIPTS[i].ID == id { return &SCRIPTS[i] } } return nil } func GetByTitle(title string) *Script { for i := range SCRIPTS { if SCRIPTS[i].Title == title { return &SCRIPTS[i] } } return nil }