From 57692ff8964bea8cc6167772da8d58c6246fa502 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 29 Apr 2025 14:57:09 -0500 Subject: improve the sealed activity Do not export the sealed client type. Validate the entered set list. Show the default set list. --- go/game/set.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'go/game') diff --git a/go/game/set.go b/go/game/set.go index 23cc7084..fe25e3a1 100644 --- a/go/game/set.go +++ b/go/game/set.go @@ -1,6 +1,8 @@ package game import ( + "errors" + "fmt" "log" "net/http" "path" @@ -115,3 +117,19 @@ func (set SetIdentifier) CardPaths() []string { walk(doc) return paths } + +func SetListToSets(setList string) ([]SetIdentifier, error) { + var err error + sets := []SetIdentifier{} + setList = strings.Replace(setList, " ", "", 0) + setsRaw := strings.Split(setList, ",") + for _, s := range setsRaw { + set, found := SetNames[s] + if found { + sets = append(sets, set) + } else { + err = errors.New(fmt.Sprintf("Unknown set: %s", set)) + } + } + return sets, err +} -- cgit v1.2.3