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" "os/signal"
"path/filepath" "path/filepath"
"slices" "slices"
"strconv"
"strings"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"zombiezen.com/go/sqlite" "zombiezen.com/go/sqlite"
@@ -170,6 +172,7 @@ func main() {
}, },
}), }),
UniqueOwner: s.ColumnText(52), // TODO(zeph): should be id, not name UniqueOwner: s.ColumnText(52), // TODO(zeph): should be id, not name
Tags: parseTags(s.ColumnText(54)),
SPCost: s.ColumnInt(49), SPCost: s.ColumnInt(49),
IconID: s.ColumnInt(53), IconID: s.ColumnInt(53),
} }
@@ -395,6 +398,20 @@ type SparkEffImm struct {
Value2 int32 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 { func trimAbilities(s []horse.Ability) []horse.Ability {
for len(s) > 0 && s[len(s)-1].Type == 0 { for len(s) > 0 && s[len(s)-1].Type == 0 {
s = s[:len(s)-1] s = s[:len(s)-1]

View File

@@ -87,7 +87,7 @@ SELECT
COALESCE(u.owner_id, iu.owner_id, 0) AS unique_owner_id, COALESCE(u.owner_id, iu.owner_id, 0) AS unique_owner_id,
COALESCE(u.name, iu.name, '') AS unique_owner, COALESCE(u.name, iu.name, '') AS unique_owner,
d.icon_id, d.icon_id,
ROW_NUMBER() OVER (ORDER BY d.id) - 1 AS "index" d.tag_id
FROM skill_data d FROM skill_data d
JOIN skill_names n ON d.id = n.id JOIN skill_names n ON d.id = n.id
LEFT JOIN skill_data ud ON d.unique_skill_id_1 = ud.id LEFT JOIN skill_data ud ON d.unique_skill_id_1 = ud.id

File diff suppressed because it is too large Load Diff

View File

@@ -227,6 +227,10 @@ export interface Skill {
* Name of the Uma which owns this skill as a unique, if applicable. * Name of the Uma which owns this skill as a unique, if applicable.
*/ */
unique_owner?: string; unique_owner?: string;
/**
* Skill tags, numeric IDs for matching against other effects.
*/
tags: number[];
/** /**
* SP cost to purchase the skill, if applicable. * SP cost to purchase the skill, if applicable.
*/ */

View File

@@ -37,6 +37,7 @@ type Skill struct {
WitCheck bool `json:"wit_check"` WitCheck bool `json:"wit_check"`
Activations []Activation `json:"activations"` Activations []Activation `json:"activations"`
UniqueOwner string `json:"unique_owner,omitzero"` UniqueOwner string `json:"unique_owner,omitzero"`
Tags []uint16 `json:"tags"`
SPCost int `json:"sp_cost,omitzero"` SPCost int `json:"sp_cost,omitzero"`
IconID int `json:"icon_id"` IconID int `json:"icon_id"`
} }