mdb, cmd/horsebot: affinity details
This commit is contained in:
@@ -15,6 +15,8 @@ var (
|
||||
characterSQL string
|
||||
//go:embed sql/affinity.sql
|
||||
affinitySQL string
|
||||
//go:embed sql/affinity-detail.sql
|
||||
affinityDetailSQL string
|
||||
//go:embed sql/uma.sql
|
||||
umaSQL string
|
||||
//go:embed sql/conversation.sql
|
||||
@@ -35,14 +37,25 @@ func Characters(ctx context.Context, db *sqlitex.Pool) ([]horse.Character, error
|
||||
func AffinitySummary(ctx context.Context, db *sqlitex.Pool) ([]horse.AffinityRelation, error) {
|
||||
return load(ctx, db, nil, affinitySQL, func(s *sqlite.Stmt) horse.AffinityRelation {
|
||||
return horse.AffinityRelation{
|
||||
IDA: s.ColumnInt(0),
|
||||
IDB: s.ColumnInt(1),
|
||||
IDC: s.ColumnInt(2),
|
||||
IDA: horse.CharacterID(s.ColumnInt(0)),
|
||||
IDB: horse.CharacterID(s.ColumnInt(1)),
|
||||
IDC: horse.CharacterID(s.ColumnInt(2)),
|
||||
Affinity: s.ColumnInt(3),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// AffinityDetail gets all individual affinity group entries.
|
||||
func AffinityDetail(ctx context.Context, db *sqlitex.Pool) ([]horse.AffinityDetail, error) {
|
||||
return load(ctx, db, nil, affinityDetailSQL, func(s *sqlite.Stmt) horse.AffinityDetail {
|
||||
return horse.AffinityDetail{
|
||||
CharaID: horse.CharacterID(s.ColumnInt(0)),
|
||||
Relation: uint16(s.ColumnInt(1)),
|
||||
Affinity: uint16(s.ColumnInt(2)),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Umas retrieves all trainable Uma variants.
|
||||
func Umas(ctx context.Context, db *sqlitex.Pool) ([]horse.Uma, error) {
|
||||
return load(ctx, db, make([]horse.Uma, 0, 128), umaSQL, func(s *sqlite.Stmt) horse.Uma {
|
||||
|
||||
Reference in New Issue
Block a user