horse, cmd/horsegen: include tags in generated skills

Fixes #6.
This commit is contained in:
2026-05-04 16:45:06 -04:00
parent 0c2db10082
commit 9cf9fd198f
5 changed files with 2205 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ import (
"os/signal"
"path/filepath"
"slices"
"strconv"
"strings"
"golang.org/x/sync/errgroup"
"zombiezen.com/go/sqlite"
@@ -170,6 +172,7 @@ func main() {
},
}),
UniqueOwner: s.ColumnText(52), // TODO(zeph): should be id, not name
Tags: parseTags(s.ColumnText(54)),
SPCost: s.ColumnInt(49),
IconID: s.ColumnInt(53),
}
@@ -395,6 +398,20 @@ type SparkEffImm struct {
Value2 int32
}
func parseTags(s string) []uint16 {
r := make([]uint16, 0, 8)
for s != "" {
t, u, _ := strings.Cut(s, "/")
s = u
v, err := strconv.ParseUint(t, 10, 16)
if err != nil {
panic(fmt.Errorf("parsing skill tags: %w", err))
}
r = append(r, uint16(v))
}
return trimZeros(r...)
}
func trimAbilities(s []horse.Ability) []horse.Ability {
for len(s) > 0 && s[len(s)-1].Type == 0 {
s = s[:len(s)-1]