From f40fea0ec592cbad4eed5c0fb60d0bc0673031be Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Tue, 2 Jun 2026 12:39:58 -0400 Subject: [PATCH] mdb: package for interacting with game's local database --- character.go | 2 - cmd/horsegen/generate.go | 1 - go.mod | 1 + mdb/character.go | 88 +++++ mdb/character_test.go | 224 ++++++++++++ mdb/mdb.go | 33 ++ mdb/mdb_test.go | 23 ++ mdb/race.go | 61 ++++ mdb/race_test.go | 230 ++++++++++++ mdb/skill.go | 152 ++++++++ mdb/skill_test.go | 701 +++++++++++++++++++++++++++++++++++++ mdb/spark.go | 93 +++++ mdb/spark_test.go | 345 ++++++++++++++++++ mdb/sql/affinity.sql | 60 ++++ mdb/sql/character.sql | 6 + mdb/sql/conversation.sql | 10 + mdb/sql/race.sql | 14 + mdb/sql/saddle.sql | 20 ++ mdb/sql/scenario.sql | 17 + mdb/sql/skill-group.sql | 17 + mdb/sql/skill.sql | 98 ++++++ mdb/sql/spark-effect.sql | 9 + mdb/sql/spark.sql | 20 ++ mdb/sql/uma.sql | 59 ++++ mdb/testdata/character.sql | 262 ++++++++++++++ mdb/testdata/race.sql | 86 +++++ mdb/testdata/skill.sql | 164 +++++++++ mdb/testdata/spark.sql | 113 ++++++ 28 files changed, 2906 insertions(+), 3 deletions(-) create mode 100644 mdb/character.go create mode 100644 mdb/character_test.go create mode 100644 mdb/mdb.go create mode 100644 mdb/mdb_test.go create mode 100644 mdb/race.go create mode 100644 mdb/race_test.go create mode 100644 mdb/skill.go create mode 100644 mdb/skill_test.go create mode 100644 mdb/spark.go create mode 100644 mdb/spark_test.go create mode 100644 mdb/sql/affinity.sql create mode 100644 mdb/sql/character.sql create mode 100644 mdb/sql/conversation.sql create mode 100644 mdb/sql/race.sql create mode 100644 mdb/sql/saddle.sql create mode 100644 mdb/sql/scenario.sql create mode 100644 mdb/sql/skill-group.sql create mode 100644 mdb/sql/skill.sql create mode 100644 mdb/sql/spark-effect.sql create mode 100644 mdb/sql/spark.sql create mode 100644 mdb/sql/uma.sql create mode 100644 mdb/testdata/character.sql create mode 100644 mdb/testdata/race.sql create mode 100644 mdb/testdata/skill.sql create mode 100644 mdb/testdata/spark.sql diff --git a/character.go b/character.go index 5ea700f..13e2413 100644 --- a/character.go +++ b/character.go @@ -27,8 +27,6 @@ type Conversation struct { Number int `json:"number"` // Location is the ID of the location the conversation occurs in the lobby. Location LobbyConversationLocationID `json:"location"` - // LocationName is the name of the lobby location, for convenience. - LocationName string `json:"location_name"` // Chara1 is the first conversation participant ID. // It does not necessarily match CharacterID. Chara1 CharacterID `json:"chara_1"` diff --git a/cmd/horsegen/generate.go b/cmd/horsegen/generate.go index 66247c9..1519b3d 100644 --- a/cmd/horsegen/generate.go +++ b/cmd/horsegen/generate.go @@ -231,7 +231,6 @@ func main() { CharacterID: horse.CharacterID(s.ColumnInt(0)), Number: s.ColumnInt(1), Location: horse.LobbyConversationLocationID(s.ColumnInt(2)), - LocationName: horse.LobbyConversationLocationID(s.ColumnInt(2)).String(), Chara1: horse.CharacterID(s.ColumnInt(3)), Chara2: horse.CharacterID(s.ColumnInt(4)), Chara3: horse.CharacterID(s.ColumnInt(5)), diff --git a/go.mod b/go.mod index fb9ea54..9e49d63 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.25.5 require ( github.com/disgoorg/disgo v0.19.0-rc.15 github.com/go-chi/chi/v5 v5.2.5 + github.com/google/go-cmp v0.6.0 github.com/junegunn/fzf v0.67.0 golang.org/x/sync v0.20.0 zombiezen.com/go/sqlite v1.4.2 diff --git a/mdb/character.go b/mdb/character.go new file mode 100644 index 0000000..10a3cca --- /dev/null +++ b/mdb/character.go @@ -0,0 +1,88 @@ +package mdb + +import ( + "context" + _ "embed" + + "zombiezen.com/go/sqlite" + "zombiezen.com/go/sqlite/sqlitex" + + "git.sunturtle.xyz/zephyr/horse" +) + +var ( + //go:embed sql/character.sql + characterSQL string + //go:embed sql/affinity.sql + affinitySQL string + //go:embed sql/uma.sql + umaSQL string + //go:embed sql/conversation.sql + conversationSQL string +) + +// Characters retrieves all named characters. +func Characters(ctx context.Context, db *sqlitex.Pool) ([]horse.Character, error) { + return load(ctx, db, make([]horse.Character, 0, 128), characterSQL, func(s *sqlite.Stmt) horse.Character { + return horse.Character{ + ID: horse.CharacterID(s.ColumnInt(0)), + Name: s.ColumnText(1), + } + }) +} + +// AffinitySummary gets precomputed base affinity for all pairs and trios of characters. +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), + Affinity: s.ColumnInt(3), + } + }) +} + +// 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 { + return horse.Uma{ + ID: horse.UmaID(s.ColumnInt(0)), + CharacterID: horse.CharacterID(s.ColumnInt(1)), + Name: s.ColumnText(2), + Variant: s.ColumnText(3), + Sprint: horse.AptitudeLevel(s.ColumnInt(5)), + Mile: horse.AptitudeLevel(s.ColumnInt(6)), + Medium: horse.AptitudeLevel(s.ColumnInt(7)), + Long: horse.AptitudeLevel(s.ColumnInt(8)), + Front: horse.AptitudeLevel(s.ColumnInt(9)), + Pace: horse.AptitudeLevel(s.ColumnInt(10)), + Late: horse.AptitudeLevel(s.ColumnInt(11)), + End: horse.AptitudeLevel(s.ColumnInt(12)), + Turf: horse.AptitudeLevel(s.ColumnInt(13)), + Dirt: horse.AptitudeLevel(s.ColumnInt(14)), + Unique: horse.SkillID(s.ColumnInt(15)), + Skill1: horse.SkillID(s.ColumnInt(16)), + Skill2: horse.SkillID(s.ColumnInt(17)), + Skill3: horse.SkillID(s.ColumnInt(18)), + SkillPL2: horse.SkillID(s.ColumnInt(19)), + SkillPL3: horse.SkillID(s.ColumnInt(20)), + SkillPL4: horse.SkillID(s.ColumnInt(21)), + SkillPL5: horse.SkillID(s.ColumnInt(22)), + } + }) +} + +func Conversations(ctx context.Context, db *sqlitex.Pool) ([]horse.Conversation, error) { + return load(ctx, db, make([]horse.Conversation, 0, 1024), conversationSQL, func(s *sqlite.Stmt) horse.Conversation { + return horse.Conversation{ + CharacterID: horse.CharacterID(s.ColumnInt(0)), + Number: s.ColumnInt(1), + Location: horse.LobbyConversationLocationID(s.ColumnInt(2)), + Chara1: horse.CharacterID(s.ColumnInt(3)), + Chara2: horse.CharacterID(s.ColumnInt(4)), + Chara3: horse.CharacterID(s.ColumnInt(5)), + ConditionType: s.ColumnInt(6), + } + }) +} diff --git a/mdb/character_test.go b/mdb/character_test.go new file mode 100644 index 0000000..8340032 --- /dev/null +++ b/mdb/character_test.go @@ -0,0 +1,224 @@ +package mdb_test + +import ( + _ "embed" + "testing" + + "git.sunturtle.xyz/zephyr/horse" + "git.sunturtle.xyz/zephyr/horse/mdb" + "github.com/google/go-cmp/cmp" +) + +//go:embed testdata/character.sql +var characterSQL string + +func TestCharacters(t *testing.T) { + db := testdb(t.Context(), "file:TestCharacters?mode=memory&cache=shared", characterSQL) + got, err := mdb.Characters(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Character{ + {ID: 1001, Name: "Special Week"}, + {ID: 1002, Name: "Silence Suzuka"}, + {ID: 1078, Name: "Yamanin Zephyr"}, + {ID: 2001, Name: "Happy Meek"}, + {ID: 9001, Name: "Tazuna Hayakawa"}, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong characters (+got/-want):\n%s", diff) + } +} + +func TestAffinitySummary(t *testing.T) { + db := testdb(t.Context(), "file:TestAffinitySummary?mode=memory&cache=shared", characterSQL) + got, err := mdb.AffinitySummary(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.AffinityRelation{ + {IDA: 1001, IDB: 1002, Affinity: 23}, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong affinity (+got/-want):\n%s", diff) + } +} + +func TestUmas(t *testing.T) { + db := testdb(t.Context(), "file:TestUmas?mode=memory&cache=shared", characterSQL) + got, err := mdb.Umas(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Uma{ + { + ID: 100101, + CharacterID: 1001, + Name: `[Special Dreamer] Special Week`, + Variant: `[Special Dreamer]`, + Sprint: 2, + Mile: 5, + Medium: 7, + Long: 7, + Front: 1, + Pace: 7, + Late: 7, + End: 5, + Turf: 7, + Dirt: 1, + Unique: 100011, + Skill1: 200512, + Skill2: 201352, + Skill3: 200732, + SkillPL2: 200162, + SkillPL3: 201351, + SkillPL4: 200612, + SkillPL5: 200511, + }, + { + ID: 100102, + CharacterID: 1001, + Name: `[Hopp'n♪Happy Heart] Special Week`, + Variant: `[Hopp'n♪Happy Heart]`, + Sprint: 2, + Mile: 5, + Medium: 7, + Long: 7, + Front: 1, + Pace: 7, + Late: 7, + End: 5, + Turf: 7, + Dirt: 1, + Unique: 110011, + Skill1: 200462, + Skill2: 200592, + Skill3: 201132, + SkillPL2: 200212, + SkillPL3: 200591, + SkillPL4: 201611, + SkillPL5: 200461, + }, + { + ID: 100201, + CharacterID: 1002, + Name: `[Innocent Silence] Silence Suzuka`, + Variant: `[Innocent Silence]`, + Sprint: 4, + Mile: 7, + Medium: 7, + Long: 3, + Front: 7, + Pace: 5, + Late: 3, + End: 1, + Turf: 7, + Dirt: 1, + Unique: 100021, + Skill1: 200432, + Skill2: 200552, + Skill3: 200712, + SkillPL2: 200022, + SkillPL3: 200431, + SkillPL4: 200542, + SkillPL5: 200551, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong umas (+got/-want):\n%s", diff) + } +} + +func TestConversations(t *testing.T) { + db := testdb(t.Context(), "file:TestConversations?mode=memory&cache=shared", characterSQL) + got, err := mdb.Conversations(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Conversation{ + { + CharacterID: 1001, + Number: 1, + Location: 410, + Chara1: 1001, + }, + { + CharacterID: 1001, + Number: 2, + Location: 510, + Chara1: 1001, + ConditionType: 1, + }, + { + CharacterID: 1001, + Number: 3, + Location: 310, + Chara1: 1001, + ConditionType: 1, + }, + { + CharacterID: 1001, + Number: 4, + Location: 120, + Chara1: 1001, + Chara2: 1002, + ConditionType: 2, + }, + { + CharacterID: 1001, + Number: 5, + Location: 520, + Chara1: 1003, + Chara2: 1001, + ConditionType: 3, + }, + { + CharacterID: 1001, + Number: 6, + Location: 430, + Chara1: 1001, + Chara2: 1014, + Chara3: 1011, + ConditionType: 1, + }, + { + CharacterID: 1002, + Number: 1, + Location: 310, + Chara1: 1002, + }, + { + CharacterID: 1002, + Number: 2, + Location: 210, + Chara1: 1002, + ConditionType: 1, + }, + { + CharacterID: 1002, + Number: 3, + Location: 110, + Chara1: 1002, + ConditionType: 1, + }, + { + CharacterID: 1002, + Number: 4, + Location: 520, + Chara1: 1010, + Chara2: 1002, + ConditionType: 3, + }, + { + CharacterID: 1002, + Number: 5, + Location: 220, + Chara1: 1002, + Chara2: 1018, + ConditionType: 2, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong conversations (+got/-want):\n%s", diff) + } +} diff --git a/mdb/mdb.go b/mdb/mdb.go new file mode 100644 index 0000000..a04c9b2 --- /dev/null +++ b/mdb/mdb.go @@ -0,0 +1,33 @@ +package mdb + +import ( + "context" + + "zombiezen.com/go/sqlite" + "zombiezen.com/go/sqlite/sqlitex" +) + +// load scans all results of sql and appends them to r. +func load[T any](ctx context.Context, db *sqlitex.Pool, r []T, sql string, row func(*sqlite.Stmt) T) ([]T, error) { + conn, err := db.Take(ctx) + defer db.Put(conn) + if err != nil { + return nil, err + } + stmt, err := conn.Prepare(sql) + if err != nil { + return nil, err + } + + for { + ok, err := stmt.Step() + if err != nil { + return r, err + } + if !ok { + break + } + r = append(r, row(stmt)) + } + return r, err +} diff --git a/mdb/mdb_test.go b/mdb/mdb_test.go new file mode 100644 index 0000000..e8c75d8 --- /dev/null +++ b/mdb/mdb_test.go @@ -0,0 +1,23 @@ +package mdb_test + +import ( + "context" + + "zombiezen.com/go/sqlite" + "zombiezen.com/go/sqlite/sqlitex" +) + +func testdb(ctx context.Context, uri, schema string) *sqlitex.Pool { + db, err := sqlitex.NewPool(uri, sqlitex.PoolOptions{Flags: sqlite.OpenCreate | sqlite.OpenReadWrite | sqlite.OpenMemory | sqlite.OpenSharedCache | sqlite.OpenURI}) + if err != nil { + panic(err) + } + conn, err := db.Take(ctx) + if err != nil { + panic(err) + } + if err := sqlitex.ExecScript(conn, schema); err != nil { + panic(err) + } + return db +} diff --git a/mdb/race.go b/mdb/race.go new file mode 100644 index 0000000..446ae46 --- /dev/null +++ b/mdb/race.go @@ -0,0 +1,61 @@ +package mdb + +import ( + "context" + _ "embed" + + "zombiezen.com/go/sqlite" + "zombiezen.com/go/sqlite/sqlitex" + + "git.sunturtle.xyz/zephyr/horse" +) + +var ( + //go:embed sql/race.sql + raceSQL string + //go:embed sql/saddle.sql + saddleSQL string + //go:embed sql/scenario.sql + scenarioSQL string +) + +// Races retrieves all races. +func Races(ctx context.Context, db *sqlitex.Pool) ([]horse.Race, error) { + return load(ctx, db, nil, raceSQL, func(s *sqlite.Stmt) horse.Race { + return horse.Race{ + ID: horse.RaceID(s.ColumnInt(0)), + Name: s.ColumnText(1), + // TODO(zeph): grade + Thumbnail: s.ColumnInt(3), + Primary: horse.RaceID(s.ColumnInt(4)), + } + }) +} + +// Saddles retrieves all saddles. +func Saddles(ctx context.Context, db *sqlitex.Pool) ([]horse.Saddle, error) { + return load(ctx, db, nil, saddleSQL, func(s *sqlite.Stmt) horse.Saddle { + return horse.Saddle{ + ID: horse.SaddleID(s.ColumnInt(0)), + Name: s.ColumnText(1), + Races: trimZeros( + horse.RaceID(s.ColumnInt(2)), + horse.RaceID(s.ColumnInt(3)), + horse.RaceID(s.ColumnInt(4)), + ), + Type: horse.SaddleType(s.ColumnInt(5)), + Primary: horse.SaddleID(s.ColumnInt(6)), + } + }) +} + +// Scenarios retrieves all scenarios. +func Scenarios(ctx context.Context, db *sqlitex.Pool) ([]horse.Scenario, error) { + return load(ctx, db, nil, scenarioSQL, func(s *sqlite.Stmt) horse.Scenario { + return horse.Scenario{ + ID: horse.ScenarioID(s.ColumnInt(0)), + Name: s.ColumnText(1), + Title: s.ColumnText(2), + } + }) +} diff --git a/mdb/race_test.go b/mdb/race_test.go new file mode 100644 index 0000000..09b4f1f --- /dev/null +++ b/mdb/race_test.go @@ -0,0 +1,230 @@ +package mdb_test + +import ( + _ "embed" + "testing" + + "git.sunturtle.xyz/zephyr/horse" + "git.sunturtle.xyz/zephyr/horse/mdb" + "github.com/google/go-cmp/cmp" +) + +//go:embed testdata/race.sql +var raceSQL string + +func TestRaces(t *testing.T) { + db := testdb(t.Context(), "file:TestRaces?mode=memory&cache=shared", raceSQL) + got, err := mdb.Races(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Race{ + { + ID: 1005, + Name: "Satsuki Sho", + Thumbnail: 1005, + Primary: 1005, + }, + { + ID: 1010, + Name: "Tokyo Yushun (Japanese Derby)", + Thumbnail: 1010, + Primary: 1010, + }, + { + ID: 1015, + Name: "Kikuka Sho", + Thumbnail: 1015, + Primary: 1015, + }, + { + ID: 1026, + Name: "Kikuka Sho", + Thumbnail: 1015, + Primary: 1015, + }, + { + ID: 1028, + Name: "Satsuki Sho", + Thumbnail: 1028, + Primary: 1005, + }, + { + ID: 1101, + Name: "Teio Sho", + Thumbnail: 1101, + Primary: 1101, + }, + { + ID: 2001, + Name: "Nikkei Shinshun Hai", + Thumbnail: 2001, + Primary: 2001, + }, + { + ID: 2010, + Name: "Spring Stakes", + Thumbnail: 2010, + Primary: 2010, + }, + { + ID: 2035, + Name: "Spring Stakes", + Thumbnail: 2010, + Primary: 2010, + }, + { + ID: 3001, + Name: "Kyoto Kimpai", + Thumbnail: 3001, + Primary: 3001, + }, + { + ID: 4001, + Name: "Manyo Stakes", + Thumbnail: 4001, + Primary: 4001, + }, + { + ID: 4501, + Name: "Aster Sho", + Thumbnail: 4501, + Primary: 4501, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong races (+got/-want):\n%s", diff) + } +} + +func TestSaddles(t *testing.T) { + db := testdb(t.Context(), "file:TestSaddles?mode=memory&cache=shared", raceSQL) + got, err := mdb.Saddles(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Saddle{ + { + ID: 1, + Name: "Classic Triple Crown", + Races: []horse.RaceID{100501, 101001, 101501}, + Type: 0, + Primary: 1, + }, + { + ID: 12, + Name: "Japanese Derby", + Races: []horse.RaceID{101001}, + Type: 3, + Primary: 12, + }, + { + ID: 16, + Name: "Kikuka Sho", + Races: []horse.RaceID{101501}, + Type: 3, + Primary: 16, + }, + { + ID: 18, + Name: "Satsuki Sho", + Races: []horse.RaceID{100501}, + Type: 3, + Primary: 18, + }, + { + ID: 36, + Name: "Teio Sho", + Races: []horse.RaceID{110101}, + Type: 3, + Primary: 36, + }, + { + ID: 40, + Name: "Nikkei Shinshun Hai", + Races: []horse.RaceID{200101}, + Type: 2, + Primary: 40, + }, + { + ID: 49, + Name: "Spring S.", + Races: []horse.RaceID{201001}, + Type: 2, + Primary: 49, + }, + { + ID: 74, + Name: "Kyoto Kimpai", + Races: []horse.RaceID{300101}, + Type: 1, + Primary: 74, + }, + { + ID: 144, + Name: "Classic Triple Crown", + Races: []horse.RaceID{100501, 101001, 102601}, + Type: 0, + Primary: 1, + }, + { + ID: 148, + Name: "Kikuka Sho", + Races: []horse.RaceID{102601}, + Type: 3, + Primary: 16, + }, + { + ID: 149, + Name: "Spring S.", + Races: []horse.RaceID{203501}, + Type: 2, + Primary: 49, + }, + { + ID: 154, + Name: "Classic Triple Crown", + Races: []horse.RaceID{102801, 101001, 101501}, + Type: 0, + Primary: 1, + }, + { + ID: 155, + Name: "Satsuki Sho", + Races: []horse.RaceID{102801}, + Type: 3, + Primary: 18, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong saddles (+got/-want):\n%s", diff) + } +} + +func TestScenarios(t *testing.T) { + db := testdb(t.Context(), "file:TestScenarios?mode=memory&cache=shared", raceSQL) + got, err := mdb.Scenarios(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Scenario{ + { + ID: 1, + Name: "URA Finale", + Title: "The Beginning: URA Finale", + }, + { + ID: 2, + Name: "Unity Cup", + Title: "Unity Cup: Shine On, Team Spirit!", + }, + { + ID: 4, + Name: "TS Climax", + Title: "Trackblazer: Start of the Climax", + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong scenarios (+got/-want):\n%s", diff) + } +} diff --git a/mdb/skill.go b/mdb/skill.go new file mode 100644 index 0000000..be1c27b --- /dev/null +++ b/mdb/skill.go @@ -0,0 +1,152 @@ +package mdb + +import ( + "context" + _ "embed" + "fmt" + "strconv" + "strings" + + "zombiezen.com/go/sqlite" + "zombiezen.com/go/sqlite/sqlitex" + + "git.sunturtle.xyz/zephyr/horse" +) + +var ( + //go:embed sql/skill-group.sql + skillGroupSQL string + //go:embed sql/skill.sql + skillSQL string +) + +// SkillGroups retrieves all skill groups. +func SkillGroups(ctx context.Context, db *sqlitex.Pool) ([]horse.SkillGroup, error) { + return load(ctx, db, nil, skillGroupSQL, func(s *sqlite.Stmt) horse.SkillGroup { + return horse.SkillGroup{ + ID: horse.SkillGroupID(s.ColumnInt(0)), + Skill1: horse.SkillID(s.ColumnInt(1)), + Skill2: horse.SkillID(s.ColumnInt(2)), + Skill3: horse.SkillID(s.ColumnInt(3)), + SkillBad: horse.SkillID(s.ColumnInt(4)), + } + }) +} + +// Skills retrieves all skills. +func Skills(ctx context.Context, db *sqlitex.Pool) ([]horse.Skill, error) { + return load(ctx, db, nil, skillSQL, func(s *sqlite.Stmt) horse.Skill { + return horse.Skill{ + ID: horse.SkillID(s.ColumnInt(0)), + Name: s.ColumnText(1), + Description: s.ColumnText(2), + Group: horse.SkillGroupID(s.ColumnInt32(3)), + Rarity: int8(s.ColumnInt(5)), + GroupRate: int8(s.ColumnInt(6)), + GradeValue: s.ColumnInt32(7), + WitCheck: s.ColumnBool(8), + Activations: trimActivations([]horse.Activation{ + { + Precondition: s.ColumnText(9), + Condition: s.ColumnText(10), + Duration: horse.TenThousandths(s.ColumnInt(11)), + DurScale: horse.DurScale(s.ColumnInt(12)), + Cooldown: horse.TenThousandths(s.ColumnInt(13)), + Abilities: trimAbilities([]horse.Ability{ + { + Type: horse.AbilityType(s.ColumnInt(14)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(15)), + Value: horse.TenThousandths(s.ColumnInt(16)), + Target: horse.AbilityTarget(s.ColumnInt(17)), + TargetValue: s.ColumnInt32(18), + }, + { + Type: horse.AbilityType(s.ColumnInt(19)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(20)), + Value: horse.TenThousandths(s.ColumnInt(21)), + Target: horse.AbilityTarget(s.ColumnInt(22)), + TargetValue: s.ColumnInt32(23), + }, + { + Type: horse.AbilityType(s.ColumnInt(24)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(25)), + Value: horse.TenThousandths(s.ColumnInt(26)), + Target: horse.AbilityTarget(s.ColumnInt(27)), + TargetValue: s.ColumnInt32(28), + }, + }), + }, + { + Precondition: s.ColumnText(29), + Condition: s.ColumnText(30), + Duration: horse.TenThousandths(s.ColumnInt(31)), + DurScale: horse.DurScale(s.ColumnInt(32)), + Cooldown: horse.TenThousandths(s.ColumnInt(33)), + Abilities: trimAbilities([]horse.Ability{ + { + Type: horse.AbilityType(s.ColumnInt(34)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(35)), + Value: horse.TenThousandths(s.ColumnInt(36)), + Target: horse.AbilityTarget(s.ColumnInt(37)), + TargetValue: s.ColumnInt32(38), + }, + { + Type: horse.AbilityType(s.ColumnInt(39)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(40)), + Value: horse.TenThousandths(s.ColumnInt(41)), + Target: horse.AbilityTarget(s.ColumnInt(42)), + TargetValue: s.ColumnInt32(43), + }, + { + Type: horse.AbilityType(s.ColumnInt(44)), + ValueUsage: horse.AbilityValueUsage(s.ColumnInt(45)), + Value: horse.TenThousandths(s.ColumnInt(46)), + Target: horse.AbilityTarget(s.ColumnInt(47)), + TargetValue: s.ColumnInt32(48), + }, + }), + }, + }), + UniqueOwner: s.ColumnText(52), // TODO(zeph): should be id, not name + Tags: parseTags(s.ColumnText(54)), + SPCost: s.ColumnInt(49), + IconID: s.ColumnInt(53), + } + }) +} + +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] + } + return s +} + +func trimActivations(s []horse.Activation) []horse.Activation { + for len(s) > 0 && s[len(s)-1].Condition == "" { + s = s[:len(s)-1] + } + return s +} + +func trimZeros[T comparable](s ...T) []T { + var zero T + for len(s) > 0 && s[len(s)-1] == zero { + s = s[:len(s)-1] + } + return s +} diff --git a/mdb/skill_test.go b/mdb/skill_test.go new file mode 100644 index 0000000..604ef6d --- /dev/null +++ b/mdb/skill_test.go @@ -0,0 +1,701 @@ +package mdb_test + +import ( + _ "embed" + "testing" + + "git.sunturtle.xyz/zephyr/horse" + "git.sunturtle.xyz/zephyr/horse/mdb" + "github.com/google/go-cmp/cmp" +) + +//go:embed testdata/skill.sql +var skillSQL string + +func TestSkillGroups(t *testing.T) { + db := testdb(t.Context(), "file:TestSkillGroups?mode=memory&cache=shared", skillSQL) + got, err := mdb.SkillGroups(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.SkillGroup{ + {ID: 1035, Skill1: 10351}, + {ID: 10001, Skill1: 100011, Skill2: 900011}, + {ID: 10035, Skill1: 100351, Skill2: 900351}, + {ID: 11024, Skill1: 110241, Skill2: 910241}, + {ID: 20001, Skill1: 200012, Skill2: 200011, Skill3: 200014, SkillBad: 200013}, + {ID: 20002, Skill1: 200022, Skill2: 200021, SkillBad: 200023}, + {ID: 20036, Skill1: 200362, Skill2: 200361}, + {ID: 20083, Skill1: 200831}, + {ID: 20180, SkillBad: 201801}, + {ID: 30001, Skill1: 300011}, + {ID: 90001, Skill1: 100011, Skill2: 900011}, + {ID: 90035, Skill1: 100351, Skill2: 900351}, + {ID: 91024, Skill1: 110241, Skill2: 910241}, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong skill groups (+got/-want):\n%s", diff) + } +} + +func TestSkills(t *testing.T) { + db := testdb(t.Context(), "file:TestSkills?mode=memory&cache=shared", skillSQL) + got, err := mdb.Skills(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Skill{ + { + ID: 10351, + Name: "V Is for Victory!", + Description: "Moderately increase velocity with winning ambition when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.", + Group: 1035, + Rarity: 3, + GroupRate: 1, + GradeValue: 240, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "is_finalcorner==1&blocked_side_continuetime>=2", + Condition: "is_finalcorner==1&corner==0&order<=5", + Duration: 50000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 2500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Get to Winning!] Winning Ticket", + Tags: []uint16{401}, + SPCost: 0, + IconID: 20013, + }, + { + ID: 100011, + Name: "Shooting Star", + Description: "Ride the momentum to increase velocity and very slightly increase acceleration after passing another runner toward the front late-race.", + Group: 10001, + Rarity: 5, + GroupRate: 1, + GradeValue: 340, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "phase>=2&order>=1&order_rate<=50&change_order_onetime<0", + Duration: 50000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 3500, + Target: 1, + TargetValue: 0, + }, + { + Type: 31, + ValueUsage: 1, + Value: 1000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Special Dreamer] Special Week", + Tags: []uint16{401, 403}, + SPCost: 0, + IconID: 20013, + }, + { + ID: 100351, + Name: "Our Ticket to Win!", + Description: "Increase velocity with winning ambition when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.", + Group: 10035, + Rarity: 4, + GroupRate: 1, + GradeValue: 340, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "is_finalcorner==1&blocked_side_continuetime>=2", + Condition: "is_finalcorner==1&corner==0&order<=5", + Duration: 50000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 3500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Get to Winning!] Winning Ticket", + Tags: []uint16{401}, + SPCost: 0, + IconID: 20013, + }, + { + ID: 110241, + Name: "Flowery☆Maneuver", + Description: "Increase velocity when passing another runner toward the front on the final corner. If passing toward the back, increase acceleration instead.", + Group: 11024, + Rarity: 5, + GroupRate: 1, + GradeValue: 340, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "is_finalcorner==1&corner!=0&order_rate<=40&change_order_onetime<0", + Duration: 50000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 3500, + Target: 1, + TargetValue: 0, + }, + }, + }, + { + Precondition: "", + Condition: "is_finalcorner==1&corner!=0&order_rate>=50&order_rate<=80&change_order_onetime<0", + Duration: 40000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 31, + ValueUsage: 1, + Value: 4000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Sunlight Bouquet] Mayano Top Gun", + Tags: []uint16{401, 403}, + SPCost: 0, + IconID: 20013, + }, + { + ID: 200011, + Name: "Right-Handed ◎", + Description: "Increase performance on right-handed tracks.", + Group: 20001, + Rarity: 1, + GroupRate: 2, + GradeValue: 174, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==1", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: 600000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 110, + IconID: 10011, + }, + { + ID: 200012, + Name: "Right-Handed ○", + Description: "Moderately increase performance on right-handed tracks.", + Group: 20001, + Rarity: 1, + GroupRate: 1, + GradeValue: 129, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==1", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: 400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 90, + IconID: 10011, + }, + { + ID: 200013, + Name: "Right-Handed ×", + Description: "Moderately decrease performance on right-handed tracks.", + Group: 20001, + Rarity: 1, + GroupRate: -1, + GradeValue: -129, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==1", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: -400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 50, + IconID: 10014, + }, + { + ID: 200014, + Name: "Right-Handed Demon", + Description: "Increase proficiency in right-handed tracks, increasing Speed and Power.", + Group: 20001, + Rarity: 2, + GroupRate: 3, + GradeValue: 461, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==1", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: 600000, + Target: 1, + TargetValue: 0, + }, + { + Type: 3, + ValueUsage: 1, + Value: 600000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401, 403}, + SPCost: 130, + IconID: 10012, + }, + { + ID: 200021, + Name: "Left-Handed ◎", + Description: "Increase performance on left-handed tracks.", + Group: 20002, + Rarity: 1, + GroupRate: 2, + GradeValue: 174, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==2", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: 600000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 110, + IconID: 10011, + }, + { + ID: 200022, + Name: "Left-Handed ○", + Description: "Moderately increase performance on left-handed tracks.", + Group: 20002, + Rarity: 1, + GroupRate: 1, + GradeValue: 129, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==2", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: 400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 90, + IconID: 10011, + }, + { + ID: 200023, + Name: "Left-Handed ×", + Description: "Moderately decrease performance on left-handed tracks.", + Group: 20002, + Rarity: 1, + GroupRate: -1, + GradeValue: -129, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "rotation==2", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: -400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 50, + IconID: 10014, + }, + { + ID: 200361, + Name: "Beeline Burst", + Description: "Increase velocity on a straight.", + Group: 20036, + Rarity: 2, + GroupRate: 2, + GradeValue: 508, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "straight_random==1", + Duration: 24000, + DurScale: 1, + Cooldown: 300000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 3500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 170, + IconID: 20012, + }, + { + ID: 200362, + Name: "Straightaway Adept", + Description: "Slightly increase velocity on a straight.", + Group: 20036, + Rarity: 1, + GroupRate: 1, + GradeValue: 217, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "straight_random==1", + Duration: 24000, + DurScale: 1, + Cooldown: 300000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 1500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 170, + IconID: 20011, + }, + { + ID: 200831, + Name: "Subdued Front Runners", + Description: "Slightly increase fatigue for front runners early-race.", + Group: 20083, + Rarity: 1, + GroupRate: 1, + GradeValue: 217, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "running_style_count_nige_otherself>=1&phase_random==0&accumulatetime>=5", + Duration: 0, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 9, + ValueUsage: 1, + Value: -100, + Target: 18, + TargetValue: 1, + }, + }, + }, + }, + Tags: []uint16{301, 406}, + SPCost: 130, + IconID: 30051, + }, + { + ID: 201801, + Name: "♡ 3D Nail Art", + Description: "Moderately decrease performance on firm ground.", + Group: 20180, + Rarity: 1, + GroupRate: -1, + GradeValue: -129, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "ground_condition==1", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 1, + ValueUsage: 1, + Value: -400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{401}, + SPCost: 50, + IconID: 10014, + }, + { + ID: 300011, + Name: "Unquenched Thirst", + Description: "Moderately increase performance with the desire to race.", + Group: 30001, + Rarity: 1, + GroupRate: 1, + GradeValue: 0, + WitCheck: false, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "track_id==10008", + Duration: -1, + DurScale: 1, + Cooldown: 0, + Abilities: []horse.Ability{ + { + Type: 2, + ValueUsage: 1, + Value: 400000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + Tags: []uint16{402}, + SPCost: 0, + IconID: 10021, + }, + { + ID: 900011, + Name: "Shooting Star", + Description: "Slightly increase velocity and very minimally increase acceleration after passing another runner toward the front late-race.", + Group: 10001, + Rarity: 1, + GroupRate: 2, + GradeValue: 180, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "phase>=2&order>=1&order_rate<=50&change_order_onetime<0", + Duration: 30000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 1500, + Target: 1, + TargetValue: 0, + }, + { + Type: 31, + ValueUsage: 1, + Value: 500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Special Dreamer] Special Week", + Tags: []uint16{401, 403}, + SPCost: 200, + IconID: 20011, + }, + { + ID: 900351, + Name: "Our Ticket to Win!", + Description: "Slightly increase velocity when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.", + Group: 10035, + Rarity: 1, + GroupRate: 2, + GradeValue: 180, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "is_finalcorner==1&blocked_side_continuetime>=2", + Condition: "is_finalcorner==1&corner==0&order<=5", + Duration: 30000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 1500, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Get to Winning!] Winning Ticket", + Tags: []uint16{401}, + SPCost: 200, + IconID: 20011, + }, + { + ID: 910241, + Name: "Flowery☆Maneuver", + Description: "Slightly increase velocity when passing another runner toward the front on the final corner. If passing toward the back, slightly increase acceleration instead.", + Group: 11024, + Rarity: 1, + GroupRate: 2, + GradeValue: 180, + WitCheck: true, + Activations: []horse.Activation{ + { + Precondition: "", + Condition: "is_finalcorner==1&corner!=0&order_rate<=40&change_order_onetime<0", + Duration: 30000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 27, + ValueUsage: 1, + Value: 1500, + Target: 1, + TargetValue: 0, + }, + }, + }, + { + Precondition: "", + Condition: "is_finalcorner==1&corner!=0&order_rate>=50&order_rate<=80&change_order_onetime<0", + Duration: 24000, + DurScale: 1, + Cooldown: 5000000, + Abilities: []horse.Ability{ + { + Type: 31, + ValueUsage: 1, + Value: 2000, + Target: 1, + TargetValue: 0, + }, + }, + }, + }, + UniqueOwner: "[Sunlight Bouquet] Mayano Top Gun", + Tags: []uint16{401, 403}, + SPCost: 200, + IconID: 20011, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong skills (+got/-want):\n%s", diff) + } +} diff --git a/mdb/spark.go b/mdb/spark.go new file mode 100644 index 0000000..eaa0e50 --- /dev/null +++ b/mdb/spark.go @@ -0,0 +1,93 @@ +package mdb + +import ( + "context" + _ "embed" + + "zombiezen.com/go/sqlite/sqlitex" + + "git.sunturtle.xyz/zephyr/horse" +) + +var ( + //go:embed sql/spark.sql + sparkSQL string + //go:embed sql/spark-effect.sql + sparkEffectSQL string +) + +func Sparks(ctx context.Context, db *sqlitex.Pool) ([]horse.Spark, error) { + // We don't use func load here because we have multiple queries to run. + conn, err := db.Take(ctx) + defer db.Put(conn) + if err != nil { + return nil, err + } + var sp []horse.Spark + { + stmt := conn.Prep(sparkSQL) + for { + ok, err := stmt.Step() + if err != nil { + return nil, err + } + if !ok { + break + } + sp = append(sp, horse.Spark{ + ID: horse.SparkID(stmt.ColumnInt(0)), + Name: stmt.ColumnText(1), + Description: stmt.ColumnText(2), + Group: horse.SparkGroupID(stmt.ColumnInt(3)), + Rarity: horse.SparkRarity(stmt.ColumnInt(4)), + Type: horse.SparkType(stmt.ColumnInt(5)), + // Effects filled in later, but we can start with space. + // The vast majority of sparks are skill sparks, + // which have five rolls. + Effects: make([][]horse.SparkEffect, 0, 5), + }) + } + } + stmt := conn.Prep(sparkEffectSQL) + cur := sp + last := 0 + for { + ok, err := stmt.Step() + if err != nil { + return nil, err + } + if !ok { + break + } + // We sort sparks by group ID first, so we can add effects in a single pass. + group := stmt.ColumnInt(0) + for len(cur) > 0 && cur[0].Group != horse.SparkGroupID(group) { + cur = cur[1:] + last = 0 // reset whenever we change group IDs + } + effect := stmt.ColumnInt(1) + if effect != last { + // This effect is a separate roll from the previous one. + // Create a new slot for the effects to go into. + for i := range cur { + if cur[i].Group != horse.SparkGroupID(group) { + break + } + cur[i].Effects = append(cur[i].Effects, make([]horse.SparkEffect, 0, 1)) + } + last = effect + } + for i := range cur { + if cur[i].Group != horse.SparkGroupID(group) { + break + } + e := horse.SparkEffect{ + Target: horse.SparkTarget(stmt.ColumnInt(2)), + Value1: stmt.ColumnInt32(3), + Value2: stmt.ColumnInt32(4), + } + cur[i].Effects[len(cur[i].Effects)-1] = append(cur[i].Effects[len(cur[i].Effects)-1], e) + } + } + return sp, nil +} diff --git a/mdb/spark_test.go b/mdb/spark_test.go new file mode 100644 index 0000000..65d8081 --- /dev/null +++ b/mdb/spark_test.go @@ -0,0 +1,345 @@ +package mdb_test + +import ( + _ "embed" + "testing" + + "github.com/google/go-cmp/cmp" + + "git.sunturtle.xyz/zephyr/horse" + "git.sunturtle.xyz/zephyr/horse/mdb" +) + +//go:embed testdata/spark.sql +var sparkSQL string + +func TestSparks(t *testing.T) { + db := testdb(t.Context(), "file:TestSparks?mode=memory&cache=shared", sparkSQL) + got, err := mdb.Sparks(t.Context(), db) + if err != nil { + t.Error(err) + } + want := []horse.Spark{ + { + ID: 101, + Name: "Speed", + Description: "A Spark that increases Speed.", + Group: 1, + Rarity: 1, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 1}}, + {{Target: 1, Value1: 4}}, + {{Target: 1, Value1: 7}}, + {{Target: 1, Value1: 10}}, + {{Target: 1, Value1: 13}}, + {{Target: 1, Value1: 16}}, + {{Target: 1, Value1: 19}}, + {{Target: 1, Value1: 22}}, + {{Target: 1, Value1: 25}}, + {{Target: 1, Value1: 28}}, + }, + }, + { + ID: 102, + Name: "Speed", + Description: "A Spark that increases Speed.", + Group: 1, + Rarity: 2, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 1}}, + {{Target: 1, Value1: 4}}, + {{Target: 1, Value1: 7}}, + {{Target: 1, Value1: 10}}, + {{Target: 1, Value1: 13}}, + {{Target: 1, Value1: 16}}, + {{Target: 1, Value1: 19}}, + {{Target: 1, Value1: 22}}, + {{Target: 1, Value1: 25}}, + {{Target: 1, Value1: 28}}, + }, + }, + { + ID: 103, + Name: "Speed", + Description: "A Spark that increases Speed.", + Group: 1, + Rarity: 3, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 1}}, + {{Target: 1, Value1: 4}}, + {{Target: 1, Value1: 7}}, + {{Target: 1, Value1: 10}}, + {{Target: 1, Value1: 13}}, + {{Target: 1, Value1: 16}}, + {{Target: 1, Value1: 19}}, + {{Target: 1, Value1: 22}}, + {{Target: 1, Value1: 25}}, + {{Target: 1, Value1: 28}}, + }, + }, + { + ID: 201, + Name: "Stamina", + Description: "A Spark that increases Stamina.", + Group: 2, + Rarity: 1, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 2, Value1: 1}}, + {{Target: 2, Value1: 4}}, + {{Target: 2, Value1: 7}}, + {{Target: 2, Value1: 10}}, + {{Target: 2, Value1: 13}}, + {{Target: 2, Value1: 16}}, + {{Target: 2, Value1: 19}}, + {{Target: 2, Value1: 22}}, + {{Target: 2, Value1: 25}}, + {{Target: 2, Value1: 28}}, + }, + }, + { + ID: 202, + Name: "Stamina", + Description: "A Spark that increases Stamina.", + Group: 2, + Rarity: 2, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 2, Value1: 1}}, + {{Target: 2, Value1: 4}}, + {{Target: 2, Value1: 7}}, + {{Target: 2, Value1: 10}}, + {{Target: 2, Value1: 13}}, + {{Target: 2, Value1: 16}}, + {{Target: 2, Value1: 19}}, + {{Target: 2, Value1: 22}}, + {{Target: 2, Value1: 25}}, + {{Target: 2, Value1: 28}}, + }, + }, + { + ID: 203, + Name: "Stamina", + Description: "A Spark that increases Stamina.", + Group: 2, + Rarity: 3, + Type: 1, + Effects: [][]horse.SparkEffect{ + {{Target: 2, Value1: 1}}, + {{Target: 2, Value1: 4}}, + {{Target: 2, Value1: 7}}, + {{Target: 2, Value1: 10}}, + {{Target: 2, Value1: 13}}, + {{Target: 2, Value1: 16}}, + {{Target: 2, Value1: 19}}, + {{Target: 2, Value1: 22}}, + {{Target: 2, Value1: 25}}, + {{Target: 2, Value1: 28}}, + }, + }, + { + ID: 1101, + Name: "Turf", + Description: "A Spark that increases Turf Aptitude.", + Group: 11, + Rarity: 1, + Type: 2, + Effects: [][]horse.SparkEffect{ + {{Target: 11, Value1: 1}}, + {{Target: 11, Value1: 2}}, + }, + }, + { + ID: 1102, + Name: "Turf", + Description: "A Spark that increases Turf Aptitude.", + Group: 11, + Rarity: 2, + Type: 2, + Effects: [][]horse.SparkEffect{ + {{Target: 11, Value1: 1}}, + {{Target: 11, Value1: 2}}, + }, + }, + { + ID: 1103, + Name: "Turf", + Description: "A Spark that increases Turf Aptitude.", + Group: 11, + Rarity: 3, + Type: 2, + Effects: [][]horse.SparkEffect{ + {{Target: 11, Value1: 1}}, + {{Target: 11, Value1: 2}}, + }, + }, + { + ID: 1000101, + Name: "February S.", + Description: `A Spark that increases Power and gives a skill hint for "Winter Runner ○".`, + Group: 10001, + Rarity: 1, + Type: 5, + Effects: [][]horse.SparkEffect{ + {{Target: 3, Value1: 3}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 6}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 9}, {Target: 41, Value1: 200202, Value2: 1}}, + }, + }, + { + ID: 1000102, + Name: "February S.", + Description: `A Spark that increases Power and gives a skill hint for "Winter Runner ○".`, + Group: 10001, + Rarity: 2, + Type: 5, + Effects: [][]horse.SparkEffect{ + {{Target: 3, Value1: 3}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 6}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 9}, {Target: 41, Value1: 200202, Value2: 1}}, + }, + }, + { + ID: 1000103, + Name: "February S.", + Description: `A Spark that increases Power and gives a skill hint for "Winter Runner ○".`, + Group: 10001, + Rarity: 3, + Type: 5, + Effects: [][]horse.SparkEffect{ + {{Target: 3, Value1: 3}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 6}, {Target: 41, Value1: 200202, Value2: 1}}, + {{Target: 3, Value1: 9}, {Target: 41, Value1: 200202, Value2: 1}}, + }, + }, + { + ID: 2000101, + Name: "Right-Handed ○", + Description: `A Spark that gives a skill hint for "Right-Handed ○".`, + Group: 20001, + Rarity: 1, + Type: 4, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 200012, Value2: 1}}, + {{Target: 41, Value1: 200012, Value2: 2}}, + {{Target: 41, Value1: 200012, Value2: 3}}, + {{Target: 41, Value1: 200012, Value2: 4}}, + {{Target: 41, Value1: 200012, Value2: 5}}, + }, + }, + { + ID: 2000102, + Name: "Right-Handed ○", + Description: `A Spark that gives a skill hint for "Right-Handed ○".`, + Group: 20001, + Rarity: 2, + Type: 4, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 200012, Value2: 1}}, + {{Target: 41, Value1: 200012, Value2: 2}}, + {{Target: 41, Value1: 200012, Value2: 3}}, + {{Target: 41, Value1: 200012, Value2: 4}}, + {{Target: 41, Value1: 200012, Value2: 5}}, + }, + }, + { + ID: 2000103, + Name: "Right-Handed ○", + Description: `A Spark that gives a skill hint for "Right-Handed ○".`, + Group: 20001, + Rarity: 3, + Type: 4, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 200012, Value2: 1}}, + {{Target: 41, Value1: 200012, Value2: 2}}, + {{Target: 41, Value1: 200012, Value2: 3}}, + {{Target: 41, Value1: 200012, Value2: 4}}, + {{Target: 41, Value1: 200012, Value2: 5}}, + }, + }, + { + ID: 3000101, + Name: "URA Finale", + Description: `A Spark that increases Speed and Stamina.`, + Group: 30001, + Rarity: 1, + Type: 6, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 10}, {Target: 2, Value1: 10}}, + {{Target: 1, Value1: 20}, {Target: 2, Value1: 20}}, + {{Target: 1, Value1: 30}, {Target: 2, Value1: 30}}, + }, + }, + { + ID: 3000102, + Name: "URA Finale", + Description: `A Spark that increases Speed and Stamina.`, + Group: 30001, + Rarity: 2, + Type: 6, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 10}, {Target: 2, Value1: 10}}, + {{Target: 1, Value1: 20}, {Target: 2, Value1: 20}}, + {{Target: 1, Value1: 30}, {Target: 2, Value1: 30}}, + }, + }, + { + ID: 3000103, + Name: "URA Finale", + Description: `A Spark that increases Speed and Stamina.`, + Group: 30001, + Rarity: 3, + Type: 6, + Effects: [][]horse.SparkEffect{ + {{Target: 1, Value1: 10}, {Target: 2, Value1: 10}}, + {{Target: 1, Value1: 20}, {Target: 2, Value1: 20}}, + {{Target: 1, Value1: 30}, {Target: 2, Value1: 30}}, + }, + }, + { + ID: 10010101, + Name: "Shooting Star", + Description: `A Spark that gives a skill hint for "Shooting Star".`, + Group: 100101, + Rarity: 1, + Type: 3, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 900011, Value2: 1}}, + {{Target: 41, Value1: 900011, Value2: 2}}, + {{Target: 41, Value1: 900011, Value2: 3}}, + }, + }, + { + ID: 10010102, + Name: "Shooting Star", + Description: `A Spark that gives a skill hint for "Shooting Star".`, + Group: 100101, + Rarity: 2, + Type: 3, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 900011, Value2: 1}}, + {{Target: 41, Value1: 900011, Value2: 2}}, + {{Target: 41, Value1: 900011, Value2: 3}}, + }, + }, + { + ID: 10010103, + Name: "Shooting Star", + Description: `A Spark that gives a skill hint for "Shooting Star".`, + Group: 100101, + Rarity: 3, + Type: 3, + Effects: [][]horse.SparkEffect{ + {{Target: 41, Value1: 900011, Value2: 1}}, + {{Target: 41, Value1: 900011, Value2: 2}}, + {{Target: 41, Value1: 900011, Value2: 3}}, + }, + }, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("wrong sparks (+got/-want):\n%s", diff) + } +} diff --git a/mdb/sql/affinity.sql b/mdb/sql/affinity.sql new file mode 100644 index 0000000..03e4eab --- /dev/null +++ b/mdb/sql/affinity.sql @@ -0,0 +1,60 @@ +WITH pairs AS ( + SELECT + a.id AS id_a, + b.id AS id_b + FROM chara_data a + JOIN chara_data b ON a.id < b.id + -- Exclude characters who have no succession relations defined. + WHERE a.id IN (SELECT chara_id FROM succession_relation_member) + AND b.id IN (SELECT chara_id FROM succession_relation_member) +), trios AS ( + SELECT + a.id AS id_a, + b.id AS id_b, + c.id AS id_c + FROM chara_data a + JOIN chara_data b ON a.id < b.id + JOIN chara_data c ON a.id < c.id AND b.id < c.id + -- Exclude characters who have no succession relations defined. + WHERE a.id IN (SELECT chara_id FROM succession_relation_member) + AND b.id IN (SELECT chara_id FROM succession_relation_member) + AND c.id IN (SELECT chara_id FROM succession_relation_member) +), pair_relations AS ( + SELECT + ra.relation_type, + ra.chara_id AS id_a, + rb.chara_id AS id_b + FROM succession_relation_member ra + JOIN succession_relation_member rb ON ra.relation_type = rb.relation_type +), trio_relations AS ( + SELECT + ra.relation_type, + ra.chara_id AS id_a, + rb.chara_id AS id_b, + rc.chara_id AS id_c + FROM succession_relation_member ra + JOIN succession_relation_member rb ON ra.relation_type = rb.relation_type + JOIN succession_relation_member rc ON ra.relation_type = rc.relation_type +), affinity AS ( + SELECT + pairs.*, + 0 AS id_c, + SUM(IFNULL(relation_point, 0)) AS base_affinity + FROM pairs + LEFT JOIN pair_relations rp ON pairs.id_a = rp.id_a AND pairs.id_b = rp.id_b + LEFT JOIN succession_relation sr ON rp.relation_type = sr.relation_type + GROUP BY pairs.id_a, pairs.id_b + + UNION ALL + + SELECT + trios.*, + SUM(IFNULL(relation_point, 0)) AS base_affinity + FROM trios + LEFT JOIN trio_relations rt ON trios.id_a = rt.id_a AND trios.id_b = rt.id_b AND trios.id_c = rt.id_c + LEFT JOIN succession_relation sr ON rt.relation_type = sr.relation_type + GROUP BY trios.id_a, trios.id_b, trios.id_c +) +SELECT * FROM affinity +WHERE base_affinity != 0 +ORDER BY id_a, id_b, id_c diff --git a/mdb/sql/character.sql b/mdb/sql/character.sql new file mode 100644 index 0000000..08c2bec --- /dev/null +++ b/mdb/sql/character.sql @@ -0,0 +1,6 @@ +SELECT + "index" AS "id", + "text" AS "name" +FROM text_data +WHERE category = 6 +ORDER BY "id" diff --git a/mdb/sql/conversation.sql b/mdb/sql/conversation.sql new file mode 100644 index 0000000..965357a --- /dev/null +++ b/mdb/sql/conversation.sql @@ -0,0 +1,10 @@ +SELECT + gallery_chara_id, + disp_order, + pos_id, + chara_id_1, + chara_id_2, + chara_id_3, + condition_type +FROM home_story_trigger +ORDER BY gallery_chara_id, disp_order diff --git a/mdb/sql/race.sql b/mdb/sql/race.sql new file mode 100644 index 0000000..fb29c8e --- /dev/null +++ b/mdb/sql/race.sql @@ -0,0 +1,14 @@ +WITH race_names AS ( + SELECT "index" AS id, "text" AS name FROM text_data WHERE category = 33 +) +SELECT + race.id, + race_names.name, + race.grade, + race.thumbnail_id, + MIN(race.id) OVER (PARTITION BY race_names.name) AS "primary", + ROW_NUMBER() OVER (PARTITION BY race_names.name ORDER BY race.id) - 1 AS "alternate" +FROM race + JOIN race_names ON race.id = race_names.id +WHERE race."group" = 1 +ORDER BY race.id diff --git a/mdb/sql/saddle.sql b/mdb/sql/saddle.sql new file mode 100644 index 0000000..ade4270 --- /dev/null +++ b/mdb/sql/saddle.sql @@ -0,0 +1,20 @@ +WITH saddle_names AS ( + SELECT "index" AS id, "text" AS name + FROM text_data + WHERE category = 111 +) +SELECT + s.id, + n.name, + ri1.id AS race1, + IFNULL(ri2.id, 0) AS race2, + IFNULL(ri3.id, 0) AS race3, + s.win_saddle_type, + MIN(s.id) OVER (PARTITION BY n.name) AS "primary", + ROW_NUMBER() OVER (PARTITION BY n.name ORDER BY s.id) - 1 AS "alternate" +FROM single_mode_wins_saddle s + JOIN race_instance ri1 ON s.race_instance_id_1 = ri1.id + LEFT JOIN race_instance ri2 ON s.race_instance_id_2 = ri2.id + LEFT JOIN race_instance ri3 ON s.race_instance_id_3 = ri3.id + LEFT JOIN saddle_names n ON s.id = n.id +ORDER BY s.id diff --git a/mdb/sql/scenario.sql b/mdb/sql/scenario.sql new file mode 100644 index 0000000..f802651 --- /dev/null +++ b/mdb/sql/scenario.sql @@ -0,0 +1,17 @@ +WITH scenario_name AS ( + SELECT "index" AS id, "text" AS name + FROM text_data + WHERE category = 237 +), scenario_title AS ( + SELECT "index" AS id, "text" AS title + FROM text_data + WHERE category = 119 +) +SELECT + sc.id, + n.name, + t.title +FROM single_mode_scenario sc + JOIN scenario_name n ON sc.id = n.id + JOIN scenario_title t ON sc.id = t.id +ORDER BY sc.id diff --git a/mdb/sql/skill-group.sql b/mdb/sql/skill-group.sql new file mode 100644 index 0000000..0bc0016 --- /dev/null +++ b/mdb/sql/skill-group.sql @@ -0,0 +1,17 @@ +WITH skill_groups AS ( + SELECT DISTINCT group_id FROM skill_data +) +SELECT + g.group_id, + COALESCE(inh_from.id, s1.id, 0) AS skill1, + COALESCE(inh_to.id, s2.id, 0) AS skill2, + IFNULL(s3.id, 0) AS skill3, + IFNULL(m1.id, 0) AS skill_bad +FROM skill_groups g + LEFT JOIN skill_data s1 ON g.group_id = s1.group_id AND s1.group_rate = 1 + LEFT JOIN skill_data s2 ON g.group_id = s2.group_id AND s2.group_rate = 2 + LEFT JOIN skill_data s3 ON g.group_id = s3.group_id AND s3.group_rate = 3 + LEFT JOIN skill_data m1 ON g.group_id = m1.group_id AND m1.group_rate = -1 + LEFT JOIN skill_data inh_to ON s1.id = inh_to.unique_skill_id_1 + LEFT JOIN skill_data inh_from ON s2.unique_skill_id_1 = inh_from.id +ORDER BY g.group_id diff --git a/mdb/sql/skill.sql b/mdb/sql/skill.sql new file mode 100644 index 0000000..d372e60 --- /dev/null +++ b/mdb/sql/skill.sql @@ -0,0 +1,98 @@ +WITH skill_names AS ( + SELECT + n."index" AS "id", + n."text" AS "name", + d."text" AS "description" + FROM text_data n + JOIN text_data d ON n."index" = d."index" AND n."category" = 47 AND d."category" = 48 +), skill_groups AS ( + SELECT + group_id, + name + FROM skill_data d + JOIN skill_names n ON d.id = n.id + WHERE group_rate = 1 +), card_name AS ( + SELECT + "index" AS "id", + "text" AS "name" + FROM text_data n + WHERE category = 4 +), card_unique AS ( + SELECT DISTINCT + ss.skill_id1 AS unique_id, + card_name.id AS owner_id, + card_name.name + FROM card_data card + JOIN card_name ON card.id = card_name.id + JOIN card_rarity_data rd ON card.id = rd.card_id + JOIN skill_set ss ON rd.skill_set = ss.id +) +SELECT + d.id, + n.name, + n.description, + IIF(d.unique_skill_id_1 = 0, d.group_id, ud.group_id) AS group_id, + CASE + WHEN g.name IS NOT NULL THEN g.name + WHEN d.unique_skill_id_1 != 0 THEN n.name + ELSE '' + END AS group_name, + d.rarity, + d.group_rate, + d.grade_value, + d.activate_lot, + d.precondition_1, + d.condition_1, + d.float_ability_time_1, + d.ability_time_usage_1, + d.float_cooldown_time_1, + d.ability_type_1_1, + d.ability_value_usage_1_1, + d.float_ability_value_1_1, + d.target_type_1_1, + d.target_value_1_1, + d.ability_type_1_2, + d.ability_value_usage_1_2, + d.float_ability_value_1_2, + d.target_type_1_2, + d.target_value_1_2, + d.ability_type_1_3, + d.ability_value_usage_1_3, + d.float_ability_value_1_3, + d.target_type_1_3, + d.target_value_1_3, + d.precondition_2, + d.condition_2, + d.float_ability_time_2, + d.ability_time_usage_2, + d.float_cooldown_time_2, + d.ability_type_2_1, + d.ability_value_usage_2_1, + d.float_ability_value_2_1, + d.target_type_2_1, + d.target_value_2_1, + d.ability_type_2_2, + d.ability_value_usage_2_2, + d.float_ability_value_2_2, + d.target_type_2_2, + d.target_value_2_2, + d.ability_type_2_3, + d.ability_value_usage_2_3, + d.float_ability_value_2_3, + d.target_type_2_3, + d.target_value_2_3, + IFNULL(p.need_skill_point, 0) AS sp_cost, + d.unique_skill_id_1, + COALESCE(u.owner_id, iu.owner_id, 0) AS unique_owner_id, + COALESCE(u.name, iu.name, '') AS unique_owner, + d.icon_id, + d.tag_id +FROM skill_data d + 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_groups g ON d.group_id = g.group_id + LEFT JOIN single_mode_skill_need_point p ON d.id = p.id + LEFT JOIN card_unique u ON d.id = u.unique_id + LEFT JOIN card_unique iu ON d.unique_skill_id_1 = iu.unique_id +ORDER BY d.id diff --git a/mdb/sql/spark-effect.sql b/mdb/sql/spark-effect.sql new file mode 100644 index 0000000..cf84c92 --- /dev/null +++ b/mdb/sql/spark-effect.sql @@ -0,0 +1,9 @@ +SELECT + factor_group_id, + effect_id, + target_type, + value_1, + value_2 +FROM succession_factor_effect +WHERE factor_group_id NOT IN (40001) -- exclude Carnival Bonus +ORDER BY factor_group_id, effect_id, id diff --git a/mdb/sql/spark.sql b/mdb/sql/spark.sql new file mode 100644 index 0000000..890e56c --- /dev/null +++ b/mdb/sql/spark.sql @@ -0,0 +1,20 @@ +WITH spark AS ( + SELECT + n."index" AS "id", + n."text" AS "name", + d."text" AS "description" + FROM text_data n + LEFT JOIN text_data d ON n."index" = d."index" AND d."category" = 172 + WHERE n.category = 147 +) +SELECT + sf.factor_id, + spark.name, + spark.description, + sf.factor_group_id, + sf.rarity, + sf.factor_type +FROM spark + JOIN succession_factor sf ON spark.id = sf.factor_id +WHERE sf.factor_type != 7 -- exclude Carnival Bonus +ORDER BY sf.factor_group_id, sf.factor_id diff --git a/mdb/sql/uma.sql b/mdb/sql/uma.sql new file mode 100644 index 0000000..068b9a9 --- /dev/null +++ b/mdb/sql/uma.sql @@ -0,0 +1,59 @@ +WITH uma_name AS ( + SELECT "index" AS id, "text" AS name + FROM text_data + WHERE category = 4 +), uma_variant AS ( + SELECT "index" AS id, "text" AS variant + FROM text_data + WHERE category = 5 +), chara_name AS ( + SELECT "index" AS id, "text" AS name + FROM text_data + WHERE category = 6 +), skills AS ( + SELECT + uma.id, + s.skill_id, + s.need_rank, + ROW_NUMBER() OVER (PARTITION BY s.available_skill_set_id, s.need_rank ORDER BY s.id) AS idx + FROM card_data uma + LEFT JOIN available_skill_set s ON uma.available_skill_set_id = s.available_skill_set_id +) +SELECT + uma.card_id, + card_data.chara_id, + n.name, + v.variant, + c.name AS chara_name, + uma.proper_distance_short, + uma.proper_distance_mile, + uma.proper_distance_middle, + uma.proper_distance_long, + uma.proper_running_style_nige, + uma.proper_running_style_senko, + uma.proper_running_style_sashi, + uma.proper_running_style_oikomi, + uma.proper_ground_turf, + uma.proper_ground_dirt, + su.skill_id1 AS unique_skill, + s1.skill_id AS skill1, + s2.skill_id AS skill2, + s3.skill_id AS skill3, + sp2.skill_id AS skill_pl2, + sp3.skill_id AS skill_pl3, + sp4.skill_id AS skill_pl4, + sp5.skill_id AS skill_pl5 +FROM card_data + JOIN card_rarity_data uma ON card_data.id = uma.card_id + JOIN chara_name c ON card_data.chara_id = c.id + JOIN skill_set su ON uma.skill_set = su.id + JOIN skills s1 ON uma.card_id = s1.id AND s1.need_rank = 0 AND s1.idx = 1 + JOIN skills s2 ON uma.card_id = s2.id AND s2.need_rank = 0 AND s2.idx = 2 + JOIN skills s3 ON uma.card_id = s3.id AND s3.need_rank = 0 AND s3.idx = 3 + JOIN skills sp2 ON uma.card_id = sp2.id AND sp2.need_rank = 2 + JOIN skills sp3 ON uma.card_id = sp3.id AND sp3.need_rank = 3 + JOIN skills sp4 ON uma.card_id = sp4.id AND sp4.need_rank = 4 + JOIN skills sp5 ON uma.card_id = sp5.id AND sp5.need_rank = 5 + LEFT JOIN uma_name n ON uma.card_id = n.id + LEFT JOIN uma_variant v ON uma.card_id = v.id +WHERE uma.rarity = 5 diff --git a/mdb/testdata/character.sql b/mdb/testdata/character.sql new file mode 100644 index 0000000..99b1dfb --- /dev/null +++ b/mdb/testdata/character.sql @@ -0,0 +1,262 @@ +CREATE TABLE IF NOT EXISTS 'text_data' ('id' INTEGER NOT NULL, 'category' INTEGER NOT NULL, 'index' INTEGER NOT NULL, 'text' TEXT NOT NULL, PRIMARY KEY('category','index')); +-- SELECT * FROM text_data WHERE category = 6 AND "index" IN (1001, 1002, 1078, 2001, 9001) OR category IN (4, 5) AND "index" IN (SELECT id FROM card_data WHERE chara_id IN (1001, 1002, 1078, 2001, 9001)); +INSERT INTO text_data VALUES(6,6,1001,'Special Week'); +INSERT INTO text_data VALUES(6,6,1002,'Silence Suzuka'); +INSERT INTO text_data VALUES(6,6,1078,'Yamanin Zephyr'); +INSERT INTO text_data VALUES(6,6,2001,'Happy Meek'); +INSERT INTO text_data VALUES(6,6,9001,'Tazuna Hayakawa'); +INSERT INTO text_data VALUES(4,4,100101,'[Special Dreamer] Special Week'); +INSERT INTO text_data VALUES(4,4,100102,'[Hopp''n♪Happy Heart] Special Week'); +INSERT INTO text_data VALUES(4,4,100201,'[Innocent Silence] Silence Suzuka'); +INSERT INTO text_data VALUES(5,5,100101,'[Special Dreamer]'); +INSERT INTO text_data VALUES(5,5,100102,'[Hopp''n♪Happy Heart]'); +INSERT INTO text_data VALUES(5,5,100201,'[Innocent Silence]'); + +CREATE TABLE IF NOT EXISTS 'chara_data' ('id' INTEGER NOT NULL, 'birth_year' INTEGER NOT NULL, 'birth_month' INTEGER NOT NULL, 'birth_day' INTEGER NOT NULL, 'sex' INTEGER NOT NULL, 'image_color_main' TEXT NOT NULL, 'image_color_sub' TEXT NOT NULL, 'ui_color_main' TEXT NOT NULL, 'ui_color_sub' TEXT NOT NULL, 'ui_training_color_1' TEXT NOT NULL, 'ui_training_color_2' TEXT NOT NULL, 'ui_border_color' TEXT NOT NULL, 'ui_num_color_1' TEXT NOT NULL, 'ui_num_color_2' TEXT NOT NULL, 'ui_turn_color' TEXT NOT NULL, 'ui_wipe_color_1' TEXT NOT NULL, 'ui_wipe_color_2' TEXT NOT NULL, 'ui_wipe_color_3' TEXT NOT NULL, 'ui_speech_color_1' TEXT NOT NULL, 'ui_speech_color_2' TEXT NOT NULL, 'ui_nameplate_color_1' TEXT NOT NULL, 'ui_nameplate_color_2' TEXT NOT NULL, 'height' INTEGER NOT NULL, 'bust' INTEGER NOT NULL, 'scale' INTEGER NOT NULL, 'skin' INTEGER NOT NULL, 'shape' INTEGER NOT NULL, 'socks' INTEGER NOT NULL, 'personal_dress' INTEGER NOT NULL, 'tail_model_id' INTEGER NOT NULL, 'race_running_type' INTEGER NOT NULL, 'ear_random_time_min' INTEGER NOT NULL, 'ear_random_time_max' INTEGER NOT NULL, 'tail_random_time_min' INTEGER NOT NULL, 'tail_random_time_max' INTEGER NOT NULL, 'story_ear_random_time_min' INTEGER NOT NULL, 'story_ear_random_time_max' INTEGER NOT NULL, 'story_tail_random_time_min' INTEGER NOT NULL, 'story_tail_random_time_max' INTEGER NOT NULL, 'attachment_model_id' INTEGER NOT NULL, 'mini_mayu_shader_type' INTEGER NOT NULL, 'start_date' INTEGER NOT NULL, 'chara_category' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM chara_data WHERE id IN (1001, 1002, 1078, 2001, 9001); +INSERT INTO chara_data VALUES(1001,1995,5,2,1,'FCA7FF','FF58D9','EE6DCB','FFDEF9','FF7FDD','F759CD','F759CD','FF7FDD','FA50CD','FA50CD','FCCAEE','FCE3F5','FDEDFE','FF7FDD','FF7FDD','FF7CDC','FEB4EA',1,2,158,1,0,3,0,1,1,110,220,30,90,275,425,130,250,-1,0,1483228800,0); +INSERT INTO chara_data VALUES(1002,1994,5,1,1,'8FE78D','FBFF3B','29BD70','FFCE48','4BD18C','27B36B','27B36B','4BD18C','27B36B','27B36B','BDF2D6','D4F2E2','FFF5CC','4BD18C','4BD18C','43C883','82ECB5',1,0,161,1,1,6,0,1,1,170,270,180,310,275,425,180,310,-1,0,1483228800,0); +INSERT INTO chara_data VALUES(1078,1988,5,27,1,'A8C6FD','5277D6','da483a','ffda93','4C91F1','2B75DD','2B75DD','71ADFF','1667D9','1667D9','BCD5F5','D6E4F6','FFEBF6','4C91F1','4C91F1','4C91F1','8DBCFD',1,3,154,1,0,1,0,1,1,170,270,180,310,275,425,180,310,-1,0,2524608000,0); +INSERT INTO chara_data VALUES(2001,1971,3,15,1,'FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','68D25D','68D25D','66D713','25C4A4',2,2,163,0,0,3,0,2,1,170,270,180,310,275,425,180,310,-1,0,2524608000,0); +INSERT INTO chara_data VALUES(9001,1948,5,2,2,'44A705','FFFFFF','44A705','F3CD00','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','FFFFFF','68D25D','68D25D','66D713','25C4A4',2,2,166,1,2,7,0,-1,1,170,270,180,310,275,425,180,310,-1,0,2524608000,1); + +CREATE TABLE IF NOT EXISTS 'card_data' ('id' INTEGER NOT NULL, 'chara_id' INTEGER NOT NULL, 'default_rarity' INTEGER NOT NULL, 'limited_chara' INTEGER NOT NULL, 'available_skill_set_id' INTEGER NOT NULL, 'talent_speed' INTEGER NOT NULL, 'talent_stamina' INTEGER NOT NULL, 'talent_pow' INTEGER NOT NULL, 'talent_guts' INTEGER NOT NULL, 'talent_wiz' INTEGER NOT NULL, 'talent_group_id' INTEGER NOT NULL, 'bg_id' INTEGER NOT NULL, 'get_piece_id' INTEGER NOT NULL, 'running_style' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM card_data WHERE chara_id IN (1001, 1002, 1078, 2001, 9001); +INSERT INTO card_data VALUES(100101,1001,3,0,100101,0,20,0,0,10,100101,8,100101,3); +INSERT INTO card_data VALUES(100102,1001,3,0,100102,0,10,10,10,0,100102,317,100102,3); +INSERT INTO card_data VALUES(100201,1002,3,0,100201,20,0,0,10,0,100201,30,100201,1); + +CREATE TABLE IF NOT EXISTS 'card_rarity_data' ('id' INTEGER NOT NULL, 'card_id' INTEGER NOT NULL, 'rarity' INTEGER NOT NULL, 'race_dress_id' INTEGER NOT NULL, 'skill_set' INTEGER NOT NULL, 'speed' INTEGER NOT NULL, 'stamina' INTEGER NOT NULL, 'pow' INTEGER NOT NULL, 'guts' INTEGER NOT NULL, 'wiz' INTEGER NOT NULL, 'max_speed' INTEGER NOT NULL, 'max_stamina' INTEGER NOT NULL, 'max_pow' INTEGER NOT NULL, 'max_guts' INTEGER NOT NULL, 'max_wiz' INTEGER NOT NULL, 'proper_distance_short' INTEGER NOT NULL, 'proper_distance_mile' INTEGER NOT NULL, 'proper_distance_middle' INTEGER NOT NULL, 'proper_distance_long' INTEGER NOT NULL, 'proper_running_style_nige' INTEGER NOT NULL, 'proper_running_style_senko' INTEGER NOT NULL, 'proper_running_style_sashi' INTEGER NOT NULL, 'proper_running_style_oikomi' INTEGER NOT NULL, 'proper_ground_turf' INTEGER NOT NULL, 'proper_ground_dirt' INTEGER NOT NULL, 'get_dress_id_1' INTEGER NOT NULL, 'get_dress_id_2' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM card_rarity_data WHERE card_id IN (SELECT id FROM card_data WHERE chara_id IN (1001, 1002, 1078, 2001, 9001)); +INSERT INTO card_rarity_data VALUES(10010103,100101,3,100101,10010103,83,88,98,90,91,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10010104,100101,4,100101,10010104,92,98,109,100,101,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10010105,100101,5,100101,10010105,102,108,120,110,110,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10010203,100102,3,100130,11010103,77,90,103,98,82,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100130); +INSERT INTO card_rarity_data VALUES(10010204,100102,4,100130,11010104,86,100,114,109,91,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100130); +INSERT INTO card_rarity_data VALUES(10010205,100102,5,100130,11010105,94,110,125,119,102,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100130); +INSERT INTO card_rarity_data VALUES(10020103,100201,3,100201,10020103,101,84,77,100,88,1200,1200,1200,1200,1200,4,7,7,3,7,5,3,1,7,1,101,100201); +INSERT INTO card_rarity_data VALUES(10020104,100201,4,100201,10020104,112,93,85,111,99,1200,1200,1200,1200,1200,4,7,7,3,7,5,3,1,7,1,101,100201); +INSERT INTO card_rarity_data VALUES(10020105,100201,5,100201,10020105,124,102,94,122,108,1200,1200,1200,1200,1200,4,7,7,3,7,5,3,1,7,1,101,100201); + +CREATE TABLE IF NOT EXISTS 'available_skill_set' ('id' INTEGER NOT NULL, 'available_skill_set_id' INTEGER NOT NULL, 'skill_id' INTEGER NOT NULL, 'need_rank' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM available_skill_set WHERE available_skill_set_id IN (SELECT available_skill_set_id FROM card_data WHERE chara_id IN (1001, 1002, 1078, 2001, 9001)); +INSERT INTO available_skill_set VALUES(1,100101,200512,0); +INSERT INTO available_skill_set VALUES(2,100101,201352,0); +INSERT INTO available_skill_set VALUES(3,100101,200732,0); +INSERT INTO available_skill_set VALUES(11,100101,200162,2); +INSERT INTO available_skill_set VALUES(12,100101,201351,3); +INSERT INTO available_skill_set VALUES(13,100101,200612,4); +INSERT INTO available_skill_set VALUES(14,100101,200511,5); +INSERT INTO available_skill_set VALUES(715,100102,200462,0); +INSERT INTO available_skill_set VALUES(716,100102,200592,0); +INSERT INTO available_skill_set VALUES(717,100102,201132,0); +INSERT INTO available_skill_set VALUES(718,100102,200212,2); +INSERT INTO available_skill_set VALUES(719,100102,200591,3); +INSERT INTO available_skill_set VALUES(720,100102,201611,4); +INSERT INTO available_skill_set VALUES(721,100102,200461,5); +INSERT INTO available_skill_set VALUES(15,100201,200432,0); +INSERT INTO available_skill_set VALUES(16,100201,200552,0); +INSERT INTO available_skill_set VALUES(17,100201,200712,0); +INSERT INTO available_skill_set VALUES(25,100201,200022,2); +INSERT INTO available_skill_set VALUES(26,100201,200431,3); +INSERT INTO available_skill_set VALUES(27,100201,200542,4); +INSERT INTO available_skill_set VALUES(28,100201,200551,5); + +CREATE TABLE IF NOT EXISTS 'skill_set' ('id' INTEGER NOT NULL, 'skill_id1' INTEGER NOT NULL, 'skill_level1' INTEGER NOT NULL, 'skill_id2' INTEGER NOT NULL, 'skill_level2' INTEGER NOT NULL, 'skill_id3' INTEGER NOT NULL, 'skill_level3' INTEGER NOT NULL, 'skill_id4' INTEGER NOT NULL, 'skill_level4' INTEGER NOT NULL, 'skill_id5' INTEGER NOT NULL, 'skill_level5' INTEGER NOT NULL, 'skill_id6' INTEGER NOT NULL, 'skill_level6' INTEGER NOT NULL, 'skill_id7' INTEGER NOT NULL, 'skill_level7' INTEGER NOT NULL, 'skill_id8' INTEGER NOT NULL, 'skill_level8' INTEGER NOT NULL, 'skill_id9' INTEGER NOT NULL, 'skill_level9' INTEGER NOT NULL, 'skill_id10' INTEGER NOT NULL, 'skill_level10' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM skill_set WHERE id IN (SELECT skill_set FROM card_rarity_data WHERE card_id IN (SELECT id FROM card_data WHERE chara_id IN (1001, 1002, 1078, 2001, 9001))); +INSERT INTO skill_set VALUES(10010103,100011,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10010104,100011,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10010105,100011,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10020103,100021,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10020104,100021,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10020105,100021,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11010103,110011,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11010104,110011,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11010105,110011,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + +CREATE TABLE IF NOT EXISTS 'succession_relation_member' ('id' INTEGER NOT NULL, 'relation_type' INTEGER NOT NULL, 'chara_id' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM succession_relation_member WHERE chara_id IN (1001, 1002, 1078, 2001, 9001); +INSERT INTO succession_relation_member VALUES(18,103,1001); +INSERT INTO succession_relation_member VALUES(80,202,1001); +INSERT INTO succession_relation_member VALUES(123,301,1001); +INSERT INTO succession_relation_member VALUES(169,401,1001); +INSERT INTO succession_relation_member VALUES(188,502,1001); +INSERT INTO succession_relation_member VALUES(208,2001,1001); +INSERT INTO succession_relation_member VALUES(220,2102,1001); +INSERT INTO succession_relation_member VALUES(235,2301,1001); +INSERT INTO succession_relation_member VALUES(241,2601,1001); +INSERT INTO succession_relation_member VALUES(308,7003,1001); +INSERT INTO succession_relation_member VALUES(310,7004,1001); +INSERT INTO succession_relation_member VALUES(312,7005,1001); +INSERT INTO succession_relation_member VALUES(314,7006,1001); +INSERT INTO succession_relation_member VALUES(316,7007,1001); +INSERT INTO succession_relation_member VALUES(397,2811,1001); +INSERT INTO succession_relation_member VALUES(448,2903,1001); +INSERT INTO succession_relation_member VALUES(509,3003,1001); +INSERT INTO succession_relation_member VALUES(555,3004,1001); +INSERT INTO succession_relation_member VALUES(570,3101,1001); +INSERT INTO succession_relation_member VALUES(662,2510,1001); +INSERT INTO succession_relation_member VALUES(674,2506,1001); +INSERT INTO succession_relation_member VALUES(686,2516,1001); +INSERT INTO succession_relation_member VALUES(758,2519,1001); +INSERT INTO succession_relation_member VALUES(825,3205,1001); +INSERT INTO succession_relation_member VALUES(835,8001,1001); +INSERT INTO succession_relation_member VALUES(837,8002,1001); +INSERT INTO succession_relation_member VALUES(839,8003,1001); +INSERT INTO succession_relation_member VALUES(841,8004,1001); +INSERT INTO succession_relation_member VALUES(843,8005,1001); +INSERT INTO succession_relation_member VALUES(845,8006,1001); +INSERT INTO succession_relation_member VALUES(847,8007,1001); +INSERT INTO succession_relation_member VALUES(849,8008,1001); +INSERT INTO succession_relation_member VALUES(851,8009,1001); +INSERT INTO succession_relation_member VALUES(853,8010,1001); +INSERT INTO succession_relation_member VALUES(855,8011,1001); +INSERT INTO succession_relation_member VALUES(857,8012,1001); +INSERT INTO succession_relation_member VALUES(859,8013,1001); +INSERT INTO succession_relation_member VALUES(861,8014,1001); +INSERT INTO succession_relation_member VALUES(863,8015,1001); +INSERT INTO succession_relation_member VALUES(865,8016,1001); +INSERT INTO succession_relation_member VALUES(1703,2406,1001); +INSERT INTO succession_relation_member VALUES(1715,2603,1001); +INSERT INTO succession_relation_member VALUES(1740,510,1001); +INSERT INTO succession_relation_member VALUES(1802,8443,1001); +INSERT INTO succession_relation_member VALUES(1876,8479,1001); +INSERT INTO succession_relation_member VALUES(1940,8511,1001); +INSERT INTO succession_relation_member VALUES(1990,8536,1001); +INSERT INTO succession_relation_member VALUES(2198,8640,1001); +INSERT INTO succession_relation_member VALUES(31,104,1002); +INSERT INTO succession_relation_member VALUES(81,202,1002); +INSERT INTO succession_relation_member VALUES(124,301,1002); +INSERT INTO succession_relation_member VALUES(174,402,1002); +INSERT INTO succession_relation_member VALUES(207,2001,1002); +INSERT INTO succession_relation_member VALUES(242,2601,1002); +INSERT INTO succession_relation_member VALUES(302,7000,1002); +INSERT INTO succession_relation_member VALUES(304,7001,1002); +INSERT INTO succession_relation_member VALUES(306,7002,1002); +INSERT INTO succession_relation_member VALUES(329,7013,1002); +INSERT INTO succession_relation_member VALUES(333,7015,1002); +INSERT INTO succession_relation_member VALUES(392,2810,1002); +INSERT INTO succession_relation_member VALUES(416,2901,1002); +INSERT INTO succession_relation_member VALUES(510,3003,1002); +INSERT INTO succession_relation_member VALUES(571,3101,1002); +INSERT INTO succession_relation_member VALUES(648,2512,1002); +INSERT INTO succession_relation_member VALUES(826,3205,1002); +INSERT INTO succession_relation_member VALUES(867,8017,1002); +INSERT INTO succession_relation_member VALUES(869,8018,1002); +INSERT INTO succession_relation_member VALUES(871,8019,1002); +INSERT INTO succession_relation_member VALUES(873,8020,1002); +INSERT INTO succession_relation_member VALUES(875,8021,1002); +INSERT INTO succession_relation_member VALUES(877,8022,1002); +INSERT INTO succession_relation_member VALUES(879,8023,1002); +INSERT INTO succession_relation_member VALUES(881,8024,1002); +INSERT INTO succession_relation_member VALUES(883,8025,1002); +INSERT INTO succession_relation_member VALUES(885,8026,1002); +INSERT INTO succession_relation_member VALUES(887,8027,1002); +INSERT INTO succession_relation_member VALUES(889,8028,1002); +INSERT INTO succession_relation_member VALUES(891,8029,1002); +INSERT INTO succession_relation_member VALUES(893,8030,1002); +INSERT INTO succession_relation_member VALUES(895,8031,1002); +INSERT INTO succession_relation_member VALUES(897,8032,1002); +INSERT INTO succession_relation_member VALUES(1704,2406,1002); +INSERT INTO succession_relation_member VALUES(1716,2603,1002); +INSERT INTO succession_relation_member VALUES(1804,8444,1002); +INSERT INTO succession_relation_member VALUES(1878,8480,1002); +INSERT INTO succession_relation_member VALUES(1942,8512,1002); +INSERT INTO succession_relation_member VALUES(1992,8537,1002); +INSERT INTO succession_relation_member VALUES(2200,8641,1002); + +CREATE TABLE IF NOT EXISTS 'succession_relation' ('relation_type' INTEGER NOT NULL, 'relation_point' INTEGER NOT NULL, PRIMARY KEY('relation_type')); +-- SELECT * FROM succession_relation WHERE relation_type IN (SELECT relation_type FROM succession_relation_member WHERE chara_id IN (1001, 1002, 1078, 2001, 9001)); +INSERT INTO succession_relation VALUES(103,2); +INSERT INTO succession_relation VALUES(104,2); +INSERT INTO succession_relation VALUES(202,2); +INSERT INTO succession_relation VALUES(301,2); +INSERT INTO succession_relation VALUES(401,2); +INSERT INTO succession_relation VALUES(402,2); +INSERT INTO succession_relation VALUES(502,2); +INSERT INTO succession_relation VALUES(510,2); +INSERT INTO succession_relation VALUES(2001,1); +INSERT INTO succession_relation VALUES(2102,1); +INSERT INTO succession_relation VALUES(2301,1); +INSERT INTO succession_relation VALUES(2406,1); +INSERT INTO succession_relation VALUES(2506,1); +INSERT INTO succession_relation VALUES(2510,1); +INSERT INTO succession_relation VALUES(2512,1); +INSERT INTO succession_relation VALUES(2516,1); +INSERT INTO succession_relation VALUES(2519,1); +INSERT INTO succession_relation VALUES(2601,1); +INSERT INTO succession_relation VALUES(2603,1); +INSERT INTO succession_relation VALUES(2810,1); +INSERT INTO succession_relation VALUES(2811,1); +INSERT INTO succession_relation VALUES(2901,7); +INSERT INTO succession_relation VALUES(2903,7); +INSERT INTO succession_relation VALUES(3003,7); +INSERT INTO succession_relation VALUES(3004,7); +INSERT INTO succession_relation VALUES(3101,7); +INSERT INTO succession_relation VALUES(3205,1); +INSERT INTO succession_relation VALUES(7000,1); +INSERT INTO succession_relation VALUES(7001,1); +INSERT INTO succession_relation VALUES(7002,1); +INSERT INTO succession_relation VALUES(7003,1); +INSERT INTO succession_relation VALUES(7004,1); +INSERT INTO succession_relation VALUES(7005,1); +INSERT INTO succession_relation VALUES(7006,1); +INSERT INTO succession_relation VALUES(7007,1); +INSERT INTO succession_relation VALUES(7013,1); +INSERT INTO succession_relation VALUES(7015,1); +INSERT INTO succession_relation VALUES(8001,1); +INSERT INTO succession_relation VALUES(8002,1); +INSERT INTO succession_relation VALUES(8003,1); +INSERT INTO succession_relation VALUES(8004,1); +INSERT INTO succession_relation VALUES(8005,1); +INSERT INTO succession_relation VALUES(8006,1); +INSERT INTO succession_relation VALUES(8007,1); +INSERT INTO succession_relation VALUES(8008,1); +INSERT INTO succession_relation VALUES(8009,1); +INSERT INTO succession_relation VALUES(8010,1); +INSERT INTO succession_relation VALUES(8011,1); +INSERT INTO succession_relation VALUES(8012,1); +INSERT INTO succession_relation VALUES(8013,1); +INSERT INTO succession_relation VALUES(8014,1); +INSERT INTO succession_relation VALUES(8015,1); +INSERT INTO succession_relation VALUES(8016,1); +INSERT INTO succession_relation VALUES(8017,1); +INSERT INTO succession_relation VALUES(8018,1); +INSERT INTO succession_relation VALUES(8019,1); +INSERT INTO succession_relation VALUES(8020,1); +INSERT INTO succession_relation VALUES(8021,1); +INSERT INTO succession_relation VALUES(8022,1); +INSERT INTO succession_relation VALUES(8023,1); +INSERT INTO succession_relation VALUES(8024,1); +INSERT INTO succession_relation VALUES(8025,1); +INSERT INTO succession_relation VALUES(8026,1); +INSERT INTO succession_relation VALUES(8027,1); +INSERT INTO succession_relation VALUES(8028,1); +INSERT INTO succession_relation VALUES(8029,1); +INSERT INTO succession_relation VALUES(8030,1); +INSERT INTO succession_relation VALUES(8031,1); +INSERT INTO succession_relation VALUES(8032,1); +INSERT INTO succession_relation VALUES(8443,1); +INSERT INTO succession_relation VALUES(8444,1); +INSERT INTO succession_relation VALUES(8479,1); +INSERT INTO succession_relation VALUES(8480,1); +INSERT INTO succession_relation VALUES(8511,1); +INSERT INTO succession_relation VALUES(8512,1); +INSERT INTO succession_relation VALUES(8536,1); +INSERT INTO succession_relation VALUES(8537,1); +INSERT INTO succession_relation VALUES(8640,1); +INSERT INTO succession_relation VALUES(8641,1); + +CREATE TABLE IF NOT EXISTS 'home_story_trigger' ('id' INTEGER NOT NULL, 'pos_id' INTEGER NOT NULL, 'home_event_type' INTEGER NOT NULL, 'num' INTEGER NOT NULL, 'story_id' INTEGER NOT NULL, 'chara_id_1' INTEGER NOT NULL, 'chara_id_2' INTEGER NOT NULL, 'chara_id_3' INTEGER NOT NULL, 'condition_type' INTEGER NOT NULL, 'gallery_chara_id' INTEGER NOT NULL, 'disp_order' INTEGER NOT NULL, PRIMARY KEY('id'), UNIQUE('gallery_chara_id','disp_order')); +-- SELECT * FROM home_story_trigger WHERE gallery_chara_id IN (1001, 1002, 1078, 2001, 9001); +INSERT INTO home_story_trigger VALUES(1,410,0,1,1001001,1001,0,0,0,1001,1); +INSERT INTO home_story_trigger VALUES(2,510,0,1,1001002,1001,0,0,1,1001,2); +INSERT INTO home_story_trigger VALUES(3,310,0,1,1001003,1001,0,0,1,1001,3); +INSERT INTO home_story_trigger VALUES(76,120,0,2,1001001,1001,1002,0,2,1001,4); +INSERT INTO home_story_trigger VALUES(77,520,0,2,1001002,1003,1001,0,3,1001,5); +INSERT INTO home_story_trigger VALUES(126,430,0,3,1,1001,1014,1011,1,1001,6); +INSERT INTO home_story_trigger VALUES(4,310,0,1,1002001,1002,0,0,0,1002,1); +INSERT INTO home_story_trigger VALUES(5,210,0,1,1002002,1002,0,0,1,1002,2); +INSERT INTO home_story_trigger VALUES(6,110,0,1,1002003,1002,0,0,1,1002,3); +INSERT INTO home_story_trigger VALUES(78,520,0,2,1002001,1010,1002,0,3,1002,4); +INSERT INTO home_story_trigger VALUES(79,220,0,2,1002002,1002,1018,0,2,1002,5); diff --git a/mdb/testdata/race.sql b/mdb/testdata/race.sql new file mode 100644 index 0000000..6c01a05 --- /dev/null +++ b/mdb/testdata/race.sql @@ -0,0 +1,86 @@ +CREATE TABLE IF NOT EXISTS 'text_data' ('id' INTEGER NOT NULL, 'category' INTEGER NOT NULL, 'index' INTEGER NOT NULL, 'text' TEXT NOT NULL, PRIMARY KEY('category','index')); +-- SELECT * FROM text_data WHERE category = 33 AND "index" IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501) OR category = 111 AND "index" IN (SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_1 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501)) UNION SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_2 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501)) UNION SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_3 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501))) OR category IN (237, 119) AND "index" IN (1, 2, 4); +INSERT INTO text_data VALUES(33,33,1005,'Satsuki Sho'); +INSERT INTO text_data VALUES(33,33,1010,'Tokyo Yushun (Japanese Derby)'); +INSERT INTO text_data VALUES(33,33,1015,'Kikuka Sho'); +INSERT INTO text_data VALUES(33,33,1026,'Kikuka Sho'); +INSERT INTO text_data VALUES(33,33,1028,'Satsuki Sho'); +INSERT INTO text_data VALUES(33,33,1101,'Teio Sho'); +INSERT INTO text_data VALUES(33,33,2001,'Nikkei Shinshun Hai'); +INSERT INTO text_data VALUES(33,33,2010,'Spring Stakes'); +INSERT INTO text_data VALUES(33,33,2035,'Spring Stakes'); +INSERT INTO text_data VALUES(33,33,3001,'Kyoto Kimpai'); +INSERT INTO text_data VALUES(33,33,4001,'Manyo Stakes'); +INSERT INTO text_data VALUES(33,33,4501,'Aster Sho'); +INSERT INTO text_data VALUES(111,111,1,'Classic Triple Crown'); +INSERT INTO text_data VALUES(111,111,12,'Japanese Derby'); +INSERT INTO text_data VALUES(111,111,16,'Kikuka Sho'); +INSERT INTO text_data VALUES(111,111,18,'Satsuki Sho'); +INSERT INTO text_data VALUES(111,111,36,'Teio Sho'); +INSERT INTO text_data VALUES(111,111,40,'Nikkei Shinshun Hai'); +INSERT INTO text_data VALUES(111,111,49,'Spring S.'); +INSERT INTO text_data VALUES(111,111,74,'Kyoto Kimpai'); +INSERT INTO text_data VALUES(111,111,144,'Classic Triple Crown'); +INSERT INTO text_data VALUES(111,111,148,'Kikuka Sho'); +INSERT INTO text_data VALUES(111,111,149,'Spring S.'); +INSERT INTO text_data VALUES(111,111,154,'Classic Triple Crown'); +INSERT INTO text_data VALUES(111,111,155,'Satsuki Sho'); +INSERT INTO text_data VALUES(119,119,1,'The Beginning: URA Finale'); +INSERT INTO text_data VALUES(119,119,2,'Unity Cup: Shine On, Team Spirit!'); +INSERT INTO text_data VALUES(119,119,4,'Trackblazer: Start of the Climax'); +INSERT INTO text_data VALUES(237,237,1,'URA Finale'); +INSERT INTO text_data VALUES(237,237,2,'Unity Cup'); +INSERT INTO text_data VALUES(237,237,4,'TS Climax'); + +CREATE TABLE IF NOT EXISTS 'race' ('id' INTEGER NOT NULL, 'group' INTEGER NOT NULL, 'grade' INTEGER NOT NULL, 'course_set' INTEGER NOT NULL, 'thumbnail_id' INTEGER NOT NULL, 'ff_cue_name' TEXT NOT NULL, 'ff_cuesheet_name' TEXT NOT NULL, 'ff_anim' INTEGER NOT NULL, 'ff_camera' INTEGER NOT NULL, 'ff_camera_sub' INTEGER NOT NULL, 'ff_sub' INTEGER NOT NULL, 'goal_gate' INTEGER NOT NULL, 'goal_flower' INTEGER NOT NULL, 'audience' INTEGER NOT NULL, 'entry_num' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM race WHERE id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501); +INSERT INTO race VALUES(1005,1,100,10504,1005,'snd_mfx_1001_CL','snd_mfx_1001_CL',1005,101,0,0,1,1,0,18); +INSERT INTO race VALUES(1010,1,100,10606,1010,'snd_mfx_1001_CL','snd_mfx_1001_CL',1010,101,0,0,5,5,0,18); +INSERT INTO race VALUES(1015,1,100,10810,1015,'snd_mfx_1002_CL','snd_mfx_1002_CL',1015,102,0,0,3,3,0,18); +INSERT INTO race VALUES(1026,1,100,10810,1015,'snd_mfx_1002_CL','snd_mfx_1002_CL',1015,102,0,0,3,3,0,17); +INSERT INTO race VALUES(1028,1,100,10604,1028,'snd_mfx_1001_CL','snd_mfx_1001_CL',1028,101,0,0,9,0,0,18); +INSERT INTO race VALUES(1101,1,100,11103,1101,'snd_mfx_1015_CL','snd_mfx_1015_CL',1101,313,0,0,1,0,0,16); +INSERT INTO race VALUES(2001,1,200,10809,2001,'snd_mfx_1008_CL','snd_mfx_1008_CL',2001,208,0,0,0,0,0,18); +INSERT INTO race VALUES(2010,1,200,10503,2010,'snd_mfx_1005_CL','snd_mfx_1005_CL',2010,205,0,0,0,0,0,16); +INSERT INTO race VALUES(2035,1,200,10503,2010,'snd_mfx_1005_CL','snd_mfx_1005_CL',2010,205,0,0,0,0,0,5); +INSERT INTO race VALUES(3001,1,300,10805,3001,'snd_mfx_1008_CL','snd_mfx_1008_CL',3001,208,0,0,0,0,0,18); +INSERT INTO race VALUES(4001,1,400,10810,4001,'snd_mfx_1013_CL','snd_mfx_1013_CL',4001,313,0,0,0,0,0,18); +INSERT INTO race VALUES(4501,1,700,10502,4501,'snd_mfx_1010_CL','snd_mfx_1010_CL',4501,310,0,0,0,0,0,16); + +CREATE TABLE IF NOT EXISTS 'race_instance' ('id' INTEGER NOT NULL, 'race_id' INTEGER NOT NULL, 'npc_group_id' INTEGER NOT NULL, 'date' INTEGER NOT NULL, 'time' INTEGER NOT NULL, 'clock_time' INTEGER NOT NULL, 'race_number' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501); +INSERT INTO race_instance VALUES(100501,1005,199,414,2,0,11); +INSERT INTO race_instance VALUES(101001,1010,199,526,2,0,11); +INSERT INTO race_instance VALUES(701301,1010,0,0,2,0,11); +INSERT INTO race_instance VALUES(101501,1015,199,1020,2,0,11); +INSERT INTO race_instance VALUES(102601,1026,199,1020,2,0,11); +INSERT INTO race_instance VALUES(102801,1028,199,414,2,0,11); +INSERT INTO race_instance VALUES(110101,1101,303,626,4,0,11); +INSERT INTO race_instance VALUES(200101,2001,103,117,2,0,11); +INSERT INTO race_instance VALUES(201001,2010,102,317,2,0,11); +INSERT INTO race_instance VALUES(203501,2035,102,317,2,0,11); +INSERT INTO race_instance VALUES(300101,3001,102,105,2,0,11); +INSERT INTO race_instance VALUES(400101,4001,104,105,2,0,10); +INSERT INTO race_instance VALUES(450101,4501,102,907,2,0,9); + +CREATE TABLE IF NOT EXISTS 'single_mode_wins_saddle' ('id' INTEGER NOT NULL, 'priority' INTEGER NOT NULL, 'group_id' INTEGER NOT NULL, 'condition' INTEGER NOT NULL, 'win_saddle_type' INTEGER NOT NULL, 'race_instance_id_1' INTEGER NOT NULL, 'race_instance_id_2' INTEGER NOT NULL, 'race_instance_id_3' INTEGER NOT NULL, 'race_instance_id_4' INTEGER NOT NULL, 'race_instance_id_5' INTEGER NOT NULL, 'race_instance_id_6' INTEGER NOT NULL, 'race_instance_id_7' INTEGER NOT NULL, 'race_instance_id_8' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM single_mode_wins_saddle WHERE id IN (SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_1 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501)) UNION SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_2 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501)) UNION SELECT id FROM single_mode_wins_saddle WHERE race_instance_id_3 IN (SELECT id FROM race_instance WHERE race_id IN (1005, 1010, 1015, 1026, 1028, 1101, 2001, 2010, 2035, 3001, 4001, 4501))); +INSERT INTO single_mode_wins_saddle VALUES(1,1,1,0,0,100501,101001,101501,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(12,15,22,0,3,101001,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(16,20,28,0,3,101501,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(18,23,17,0,3,100501,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(36,41,39,0,3,110101,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(40,45,45,0,2,200101,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(49,54,54,0,2,201001,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(74,80,80,0,1,300101,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(144,2,1,0,0,100501,101001,102601,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(148,21,28,0,3,102601,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(149,55,54,0,2,203501,0,0,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(154,2,1,0,0,102801,101001,101501,0,0,0,0,0); +INSERT INTO single_mode_wins_saddle VALUES(155,23,17,0,3,102801,0,0,0,0,0,0,0); + +CREATE TABLE IF NOT EXISTS 'single_mode_scenario' ('id' INTEGER NOT NULL, 'sort_id' INTEGER NOT NULL, 'scenario_image_id' INTEGER NOT NULL, 'prologue_id' INTEGER NOT NULL, 'turn_set_id' INTEGER NOT NULL, 'hint_rate' INTEGER NOT NULL, 'start_date' INTEGER NOT NULL, 'end_date' INTEGER NOT NULL, 'bg_id' INTEGER NOT NULL, 'bg_sub_id' INTEGER NOT NULL, 'bg_offset_x' INTEGER NOT NULL, 'sec_bg_id' INTEGER NOT NULL, 'sec_bg_sub_id' INTEGER NOT NULL, 'label_font_color' TEXT NOT NULL, 'label_bg_color' TEXT NOT NULL, 'chara_program_change_flag' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM single_mode_scenario WHERE id IN (1, 2, 4); +INSERT INTO single_mode_scenario VALUES(1,1,1,80000001,1,0,1577836800,2524608000,5,5110,375,37,110,'FFFFFF','9CD127',0); +INSERT INTO single_mode_scenario VALUES(2,2,2,80000002,2,0,1762466400,2524608000,124,2111,0,79,110,'FFFFFF','18B1FF',0); +INSERT INTO single_mode_scenario VALUES(4,3,4,80000004,4,0,1773352800,2524608000,24,110,0,56,111,'FFFFFF','EABA00',1); \ No newline at end of file diff --git a/mdb/testdata/skill.sql b/mdb/testdata/skill.sql new file mode 100644 index 0000000..32fe93f --- /dev/null +++ b/mdb/testdata/skill.sql @@ -0,0 +1,164 @@ +CREATE TABLE IF NOT EXISTS 'text_data' ('id' INTEGER NOT NULL, 'category' INTEGER NOT NULL, 'index' INTEGER NOT NULL, 'text' TEXT NOT NULL, PRIMARY KEY('category','index')); +-- SELECT * FROM text_data WHERE category IN (47, 48) AND "index" IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241) OR category = 4 AND "index" IN (SELECT card_id FROM card_rarity_data WHERE skill_set IN (SELECT id FROM skill_set WHERE skill_id1 IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241))); +INSERT INTO text_data VALUES(47,47,10351,'V Is for Victory!'); +INSERT INTO text_data VALUES(47,47,100011,'Shooting Star'); +INSERT INTO text_data VALUES(47,47,100351,'Our Ticket to Win!'); +INSERT INTO text_data VALUES(47,47,110241,'Flowery☆Maneuver'); +INSERT INTO text_data VALUES(47,47,200011,'Right-Handed ◎'); +INSERT INTO text_data VALUES(47,47,200012,'Right-Handed ○'); +INSERT INTO text_data VALUES(47,47,200013,'Right-Handed ×'); +INSERT INTO text_data VALUES(47,47,200014,'Right-Handed Demon'); +INSERT INTO text_data VALUES(47,47,200021,'Left-Handed ◎'); +INSERT INTO text_data VALUES(47,47,200022,'Left-Handed ○'); +INSERT INTO text_data VALUES(47,47,200023,'Left-Handed ×'); +INSERT INTO text_data VALUES(47,47,200361,'Beeline Burst'); +INSERT INTO text_data VALUES(47,47,200362,'Straightaway Adept'); +INSERT INTO text_data VALUES(47,47,200831,'Subdued Front Runners'); +INSERT INTO text_data VALUES(47,47,201801,'♡ 3D Nail Art'); +INSERT INTO text_data VALUES(47,47,300011,'Unquenched Thirst'); +INSERT INTO text_data VALUES(47,47,900011,'Shooting Star'); +INSERT INTO text_data VALUES(47,47,900351,'Our Ticket to Win!'); +INSERT INTO text_data VALUES(47,47,910241,'Flowery☆Maneuver'); +INSERT INTO text_data VALUES(48,48,10351,'Moderately increase velocity with winning ambition when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.'); +INSERT INTO text_data VALUES(48,48,100011,'Ride the momentum to increase velocity and very slightly increase acceleration after passing another runner toward the front late-race.'); +INSERT INTO text_data VALUES(48,48,100351,'Increase velocity with winning ambition when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.'); +INSERT INTO text_data VALUES(48,48,110241,'Increase velocity when passing another runner toward the front on the final corner. If passing toward the back, increase acceleration instead.'); +INSERT INTO text_data VALUES(48,48,200011,'Increase performance on right-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200012,'Moderately increase performance on right-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200013,'Moderately decrease performance on right-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200014,'Increase proficiency in right-handed tracks, increasing Speed and Power.'); +INSERT INTO text_data VALUES(48,48,200021,'Increase performance on left-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200022,'Moderately increase performance on left-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200023,'Moderately decrease performance on left-handed tracks.'); +INSERT INTO text_data VALUES(48,48,200361,'Increase velocity on a straight.'); +INSERT INTO text_data VALUES(48,48,200362,'Slightly increase velocity on a straight.'); +INSERT INTO text_data VALUES(48,48,200831,'Slightly increase fatigue for front runners early-race.'); +INSERT INTO text_data VALUES(48,48,201801,'Moderately decrease performance on firm ground.'); +INSERT INTO text_data VALUES(48,48,300011,'Moderately increase performance with the desire to race.'); +INSERT INTO text_data VALUES(48,48,900011,'Slightly increase velocity and very minimally increase acceleration after passing another runner toward the front late-race.'); +INSERT INTO text_data VALUES(48,48,900351,'Slightly increase velocity when positioned toward the front on the final straight after engaging in a challenge on the final corner or later.'); +INSERT INTO text_data VALUES(48,48,910241,'Slightly increase velocity when passing another runner toward the front on the final corner. If passing toward the back, slightly increase acceleration instead.'); +INSERT INTO text_data VALUES(4,4,100101,'[Special Dreamer] Special Week'); +INSERT INTO text_data VALUES(4,4,102402,'[Sunlight Bouquet] Mayano Top Gun'); +INSERT INTO text_data VALUES(4,4,103501,'[Get to Winning!] Winning Ticket'); + +CREATE TABLE IF NOT EXISTS 'skill_data' ('id' INTEGER NOT NULL, 'rarity' INTEGER NOT NULL, 'group_id' INTEGER NOT NULL, 'group_rate' INTEGER NOT NULL, 'filter_switch' INTEGER NOT NULL, 'grade_value' INTEGER NOT NULL, 'skill_category' INTEGER NOT NULL, 'tag_id' TEXT NOT NULL, 'unique_skill_id_1' INTEGER NOT NULL, 'unique_skill_id_2' INTEGER NOT NULL, 'exp_type' INTEGER NOT NULL, 'potential_per_default' INTEGER NOT NULL, 'activate_lot' INTEGER NOT NULL, 'precondition_1' TEXT NOT NULL, 'condition_1' TEXT NOT NULL, 'float_ability_time_1' INTEGER NOT NULL, 'ability_time_usage_1' INTEGER NOT NULL, 'float_cooldown_time_1' INTEGER NOT NULL, 'ability_type_1_1' INTEGER NOT NULL, 'ability_value_usage_1_1' INTEGER NOT NULL, 'ability_value_level_usage_1_1' INTEGER NOT NULL, 'float_ability_value_1_1' INTEGER NOT NULL, 'target_type_1_1' INTEGER NOT NULL, 'target_value_1_1' INTEGER NOT NULL, 'ability_type_1_2' INTEGER NOT NULL, 'ability_value_usage_1_2' INTEGER NOT NULL, 'ability_value_level_usage_1_2' INTEGER NOT NULL, 'float_ability_value_1_2' INTEGER NOT NULL, 'target_type_1_2' INTEGER NOT NULL, 'target_value_1_2' INTEGER NOT NULL, 'ability_type_1_3' INTEGER NOT NULL, 'ability_value_usage_1_3' INTEGER NOT NULL, 'ability_value_level_usage_1_3' INTEGER NOT NULL, 'float_ability_value_1_3' INTEGER NOT NULL, 'target_type_1_3' INTEGER NOT NULL, 'target_value_1_3' INTEGER NOT NULL, 'precondition_2' TEXT NOT NULL, 'condition_2' TEXT NOT NULL, 'float_ability_time_2' INTEGER NOT NULL, 'ability_time_usage_2' INTEGER NOT NULL, 'float_cooldown_time_2' INTEGER NOT NULL, 'ability_type_2_1' INTEGER NOT NULL, 'ability_value_usage_2_1' INTEGER NOT NULL, 'ability_value_level_usage_2_1' INTEGER NOT NULL, 'float_ability_value_2_1' INTEGER NOT NULL, 'target_type_2_1' INTEGER NOT NULL, 'target_value_2_1' INTEGER NOT NULL, 'ability_type_2_2' INTEGER NOT NULL, 'ability_value_usage_2_2' INTEGER NOT NULL, 'ability_value_level_usage_2_2' INTEGER NOT NULL, 'float_ability_value_2_2' INTEGER NOT NULL, 'target_type_2_2' INTEGER NOT NULL, 'target_value_2_2' INTEGER NOT NULL, 'ability_type_2_3' INTEGER NOT NULL, 'ability_value_usage_2_3' INTEGER NOT NULL, 'ability_value_level_usage_2_3' INTEGER NOT NULL, 'float_ability_value_2_3' INTEGER NOT NULL, 'target_type_2_3' INTEGER NOT NULL, 'target_value_2_3' INTEGER NOT NULL, 'popularity_add_param_1' INTEGER NOT NULL, 'popularity_add_value_1' INTEGER NOT NULL, 'popularity_add_param_2' INTEGER NOT NULL, 'popularity_add_value_2' INTEGER NOT NULL, 'disp_order' INTEGER NOT NULL, 'icon_id' INTEGER NOT NULL, 'plate_type' INTEGER NOT NULL, 'disable_singlemode' INTEGER NOT NULL, 'disable_count_condition' INTEGER NOT NULL, 'is_general_skill' INTEGER NOT NULL, 'start_date' INTEGER NOT NULL, 'end_date' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM skill_data WHERE id IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241); +INSERT INTO skill_data VALUES(10351,3,1035,1,0,240,5,'401',0,0,1,0,0,'is_finalcorner==1&blocked_side_continuetime>=2','is_finalcorner==1&corner==0&order<=5',50000,1,5000000,27,1,1,2500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,30,0,0,10,20013,0,1,0,0,1483228800,2524608000); +INSERT INTO skill_data VALUES(100011,5,10001,1,0,340,5,'401/403',0,0,1,0,0,'','phase>=2&order>=1&order_rate<=50&change_order_onetime<0',50000,1,5000000,27,1,1,3500,1,0,31,1,1,1000,1,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,60,0,0,10,20013,0,1,0,0,1483228800,2524608000); +INSERT INTO skill_data VALUES(100351,4,10035,1,0,340,5,'401',0,0,1,0,0,'is_finalcorner==1&blocked_side_continuetime>=2','is_finalcorner==1&corner==0&order<=5',50000,1,5000000,27,1,1,3500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,60,0,0,10,20013,0,1,0,0,1483228800,2524608000); +INSERT INTO skill_data VALUES(110241,5,11024,1,0,340,5,'401/403',0,0,1,0,0,'','is_finalcorner==1&corner!=0&order_rate<=40&change_order_onetime<0',50000,1,5000000,27,1,1,3500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','is_finalcorner==1&corner!=0&order_rate>=50&order_rate<=80&change_order_onetime<0',40000,1,5000000,31,1,1,4000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,30,3,30,10,20013,0,1,0,0,1483228800,2524608000); +INSERT INTO skill_data VALUES(200011,1,20001,2,0,174,0,'401',0,0,0,10,0,'','rotation==1',-1,1,0,1,1,1,600000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,45,0,0,1005,10011,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200012,1,20001,1,0,129,0,'401',0,0,0,10,0,'','rotation==1',-1,1,0,1,1,1,400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,30,0,0,1010,10011,0,0,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200013,1,20001,-1,0,-129,0,'401',0,0,0,10,0,'','rotation==1',-1,1,0,1,1,1,-400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,-30,0,0,1020,10014,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200014,2,20001,3,0,461,0,'401/403',0,0,0,10,0,'','rotation==1',-1,1,0,1,1,1,600000,1,0,3,1,1,600000,1,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,30,3,30,1000,10012,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200021,1,20002,2,0,174,0,'401',0,0,0,10,0,'','rotation==2',-1,1,0,1,1,1,600000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,45,0,0,1030,10011,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200022,1,20002,1,0,129,0,'401',0,0,0,10,0,'','rotation==2',-1,1,0,1,1,1,400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,30,0,0,1040,10011,0,0,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200023,1,20002,-1,0,-129,0,'401',0,0,0,10,0,'','rotation==2',-1,1,0,1,1,1,-400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,-30,0,0,1050,10014,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200361,2,20036,2,0,508,4,'401',0,0,0,10,1,'','straight_random==1',24000,1,300000,27,1,1,3500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,60,0,0,1980,20012,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200362,1,20036,1,0,217,4,'401',0,0,0,10,1,'','straight_random==1',24000,1,300000,27,1,1,1500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,20,0,0,1990,20011,0,0,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(200831,1,20083,1,0,217,1,'301/406',0,0,0,10,1,'','running_style_count_nige_otherself>=1&phase_random==0&accumulatetime>=5',0,1,5000000,9,1,1,-100,18,1,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,2,10,5,10,2820,30051,0,0,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(201801,1,20180,-1,0,-129,0,'401',0,0,0,10,0,'','ground_condition==1',-1,1,0,1,1,1,-400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,-30,0,0,20,10014,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(300011,1,30001,1,0,0,0,'402',0,0,0,0,0,'','track_id==10008',-1,1,0,2,1,1,400000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,2,30,0,0,70000,10021,1,1,0,0,1483228800,2524608000); +INSERT INTO skill_data VALUES(900011,1,90001,2,0,180,5,'401/403',100011,0,0,0,1,'','phase>=2&order>=1&order_rate<=50&change_order_onetime<0',30000,1,5000000,27,1,1,1500,1,0,31,1,1,500,1,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,15,0,0,30,20011,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(900351,1,90035,2,0,180,5,'401',100351,10351,0,0,1,'is_finalcorner==1&blocked_side_continuetime>=2','is_finalcorner==1&corner==0&order<=5',30000,1,5000000,27,1,1,1500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','',0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,15,0,0,30,20011,0,1,0,1,1483228800,2524608000); +INSERT INTO skill_data VALUES(910241,1,91024,2,0,180,5,'401/403',110241,0,0,0,1,'','is_finalcorner==1&corner!=0&order_rate<=40&change_order_onetime<0',30000,1,5000000,27,1,1,1500,1,0,0,1,1,0,0,0,0,1,1,0,0,0,'','is_finalcorner==1&corner!=0&order_rate>=50&order_rate<=80&change_order_onetime<0',24000,1,5000000,31,1,1,2000,1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,7,3,7,30,20011,0,1,0,1,1483228800,2524608000); + +CREATE TABLE IF NOT EXISTS 'single_mode_skill_need_point' ('id' INTEGER NOT NULL, 'need_skill_point' INTEGER NOT NULL, 'status_type' INTEGER NOT NULL, 'status_value' INTEGER NOT NULL, 'solvable_type' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM single_mode_skill_need_point WHERE id IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241); +INSERT INTO single_mode_skill_need_point VALUES(200011,110,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200012,90,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200013,50,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200014,130,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200021,110,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200022,90,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200023,50,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200361,170,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200362,170,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(200831,130,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(201801,50,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(900011,200,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(900351,200,0,0,0); +INSERT INTO single_mode_skill_need_point VALUES(910241,200,0,0,0); + +CREATE TABLE IF NOT EXISTS 'card_data' ('id' INTEGER NOT NULL, 'chara_id' INTEGER NOT NULL, 'default_rarity' INTEGER NOT NULL, 'limited_chara' INTEGER NOT NULL, 'available_skill_set_id' INTEGER NOT NULL, 'talent_speed' INTEGER NOT NULL, 'talent_stamina' INTEGER NOT NULL, 'talent_pow' INTEGER NOT NULL, 'talent_guts' INTEGER NOT NULL, 'talent_wiz' INTEGER NOT NULL, 'talent_group_id' INTEGER NOT NULL, 'bg_id' INTEGER NOT NULL, 'get_piece_id' INTEGER NOT NULL, 'running_style' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM card_data WHERE id IN (SELECT card_id FROM card_rarity_data WHERE skill_set IN (SELECT id FROM skill_set WHERE skill_id1 IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241))); +INSERT INTO card_data VALUES(100101,1001,3,0,100101,0,20,0,0,10,100101,8,100101,3); +INSERT INTO card_data VALUES(102402,1024,3,0,102402,10,10,0,0,10,102402,291,102402,2); +INSERT INTO card_data VALUES(103501,1035,1,0,103501,0,10,20,0,0,103501,8,103501,3); + +CREATE TABLE IF NOT EXISTS 'card_rarity_data' ('id' INTEGER NOT NULL, 'card_id' INTEGER NOT NULL, 'rarity' INTEGER NOT NULL, 'race_dress_id' INTEGER NOT NULL, 'skill_set' INTEGER NOT NULL, 'speed' INTEGER NOT NULL, 'stamina' INTEGER NOT NULL, 'pow' INTEGER NOT NULL, 'guts' INTEGER NOT NULL, 'wiz' INTEGER NOT NULL, 'max_speed' INTEGER NOT NULL, 'max_stamina' INTEGER NOT NULL, 'max_pow' INTEGER NOT NULL, 'max_guts' INTEGER NOT NULL, 'max_wiz' INTEGER NOT NULL, 'proper_distance_short' INTEGER NOT NULL, 'proper_distance_mile' INTEGER NOT NULL, 'proper_distance_middle' INTEGER NOT NULL, 'proper_distance_long' INTEGER NOT NULL, 'proper_running_style_nige' INTEGER NOT NULL, 'proper_running_style_senko' INTEGER NOT NULL, 'proper_running_style_sashi' INTEGER NOT NULL, 'proper_running_style_oikomi' INTEGER NOT NULL, 'proper_ground_turf' INTEGER NOT NULL, 'proper_ground_dirt' INTEGER NOT NULL, 'get_dress_id_1' INTEGER NOT NULL, 'get_dress_id_2' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM card_rarity_data WHERE skill_set IN (SELECT id FROM skill_set WHERE skill_id1 IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241)); +INSERT INTO card_rarity_data VALUES(10010103,100101,3,100101,10010103,83,88,98,90,91,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10010104,100101,4,100101,10010104,92,98,109,100,101,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10010105,100101,5,100101,10010105,102,108,120,110,110,1200,1200,1200,1200,1200,2,5,7,7,1,7,7,5,7,1,101,100101); +INSERT INTO card_rarity_data VALUES(10240203,102402,3,102426,11240103,83,100,82,90,95,1200,1200,1200,1200,1200,4,4,7,7,7,7,6,6,7,3,101,102426); +INSERT INTO card_rarity_data VALUES(10240204,102402,4,102426,11240104,92,112,91,100,105,1200,1200,1200,1200,1200,4,4,7,7,7,7,6,6,7,3,101,102426); +INSERT INTO card_rarity_data VALUES(10240205,102402,5,102426,11240105,102,123,100,110,115,1200,1200,1200,1200,1200,4,4,7,7,7,7,6,6,7,3,101,102426); +INSERT INTO card_rarity_data VALUES(10350101,103501,1,101,10350101,87,68,91,74,80,1200,1200,1200,1200,1200,1,2,7,6,1,6,7,1,7,1,101,0); +INSERT INTO card_rarity_data VALUES(10350102,103501,2,101,10350102,93,72,97,78,85,1200,1200,1200,1200,1200,1,2,7,6,1,6,7,1,7,1,101,0); +INSERT INTO card_rarity_data VALUES(10350103,103501,3,103501,10350103,98,76,102,83,91,1200,1200,1200,1200,1200,1,2,7,6,1,6,7,1,7,1,101,103501); +INSERT INTO card_rarity_data VALUES(10350104,103501,4,103501,10350104,109,85,114,92,100,1200,1200,1200,1200,1200,1,2,7,6,1,6,7,1,7,1,101,103501); +INSERT INTO card_rarity_data VALUES(10350105,103501,5,103501,10350105,120,93,125,101,111,1200,1200,1200,1200,1200,1,2,7,6,1,6,7,1,7,1,101,103501); + +CREATE TABLE IF NOT EXISTS 'skill_set' ('id' INTEGER NOT NULL, 'skill_id1' INTEGER NOT NULL, 'skill_level1' INTEGER NOT NULL, 'skill_id2' INTEGER NOT NULL, 'skill_level2' INTEGER NOT NULL, 'skill_id3' INTEGER NOT NULL, 'skill_level3' INTEGER NOT NULL, 'skill_id4' INTEGER NOT NULL, 'skill_level4' INTEGER NOT NULL, 'skill_id5' INTEGER NOT NULL, 'skill_level5' INTEGER NOT NULL, 'skill_id6' INTEGER NOT NULL, 'skill_level6' INTEGER NOT NULL, 'skill_id7' INTEGER NOT NULL, 'skill_level7' INTEGER NOT NULL, 'skill_id8' INTEGER NOT NULL, 'skill_level8' INTEGER NOT NULL, 'skill_id9' INTEGER NOT NULL, 'skill_level9' INTEGER NOT NULL, 'skill_id10' INTEGER NOT NULL, 'skill_level10' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM skill_set WHERE skill_id1 IN (10351, 100011, 100351, 110241, 200011, 200012, 200013, 200014, 200021, 200022, 200023, 200361, 200362, 200831, 201801, 300011, 900011, 900351, 910241); +INSERT INTO skill_set VALUES(8001,200012,1,200433,1,200532,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8007,200022,1,200572,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8008,200362,1,200562,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8011,200012,1,200592,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8016,200022,1,200472,1,200502,1,200632,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8028,200012,1,200492,1,200572,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8034,200022,1,200612,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8037,200362,1,200632,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8043,200012,1,200401,1,200532,1,200712,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8053,200362,1,200502,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8054,200022,1,200352,1,200612,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8057,200012,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8068,200022,1,200572,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8072,200022,1,200612,1,200752,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8078,200012,1,200401,1,200202,1,200622,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8083,200022,1,200332,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8101,200362,1,200352,1,200552,1,200682,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8103,200012,1,200052,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8107,200012,1,200372,1,200582,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8114,200012,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8117,200022,1,200332,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8123,200362,1,200532,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8124,200012,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(8133,200022,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(100013,100351,1,200591,1,201401,1,201392,1,201422,1,200492,1,200432,1,200612,1,200032,1,200732,1); +INSERT INTO skill_set VALUES(100037,100351,1,201401,1,200612,1,200462,1,200732,1,200032,1,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(100046,100351,1,201401,1,200612,1,200462,1,200732,1,200032,1,201691,1,200441,1,0,0,0,0); +INSERT INTO skill_set VALUES(400007,200012,1,200492,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(400012,200022,1,200612,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(400019,200012,1,200401,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(400028,200022,1,200352,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(400030,200012,1,200871,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(1100101,100011,1,200511,1,200612,1,200602,1,200032,1,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(1100102,100011,1,200511,1,200491,1,200602,1,200032,1,200132,1,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(1103401,200361,1,200461,1,202002,1,200172,1,200292,1,200752,1,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(1103501,100351,1,200282,1,200612,1,200462,1,200732,1,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(1106701,200361,1,201242,1,201262,1,201522,1,200352,1,200382,1,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10010103,100011,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10010104,100011,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10010105,100011,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10350101,10351,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10350102,10351,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10350103,100351,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10350104,100351,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(10350105,100351,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11240103,110241,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11240104,110241,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(11240105,110241,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32100101,100011,1,200511,1,200612,1,201402,1,200592,1,200342,1,200562,1,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32100102,100011,1,200511,1,200611,1,201401,1,200592,1,200342,1,200332,1,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32100106,100011,1,200511,1,201401,1,200592,1,200342,1,200332,1,200732,1,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32101301,200361,1,200562,1,200462,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32101304,200361,1,200462,1,200742,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32103502,100351,1,200591,1,201401,1,201392,1,200732,1,201422,1,200492,1,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32801301,200012,1,201352,1,200432,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32802801,200362,1,200992,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(32804001,200362,1,200622,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(51100132,100011,1,200511,1,200612,1,200732,1,200592,1,0,0,0,0,0,0,0,0,0,0); +INSERT INTO skill_set VALUES(51103531,100351,1,202081,1,201402,1,200612,1,200602,1,0,0,0,0,0,0,0,0,0,0); \ No newline at end of file diff --git a/mdb/testdata/spark.sql b/mdb/testdata/spark.sql new file mode 100644 index 0000000..9d0b7d7 --- /dev/null +++ b/mdb/testdata/spark.sql @@ -0,0 +1,113 @@ +CREATE TABLE IF NOT EXISTS 'text_data' ('id' INTEGER NOT NULL, 'category' INTEGER NOT NULL, 'index' INTEGER NOT NULL, 'text' TEXT NOT NULL, PRIMARY KEY('category','index')); +-- SELECT * FROM text_data WHERE category IN (147, 172) AND "index" in (101, 102, 103, 201, 202, 203, 1101, 1102, 1103, 1000101, 1000102, 1000103, 2000101, 2000102, 2000103, 3000101, 3000102, 3000103, 10010101, 10010102, 10010103); +INSERT INTO text_data VALUES(147,147,101,'Speed'); +INSERT INTO text_data VALUES(147,147,102,'Speed'); +INSERT INTO text_data VALUES(147,147,103,'Speed'); +INSERT INTO text_data VALUES(147,147,201,'Stamina'); +INSERT INTO text_data VALUES(147,147,202,'Stamina'); +INSERT INTO text_data VALUES(147,147,203,'Stamina'); +INSERT INTO text_data VALUES(147,147,1101,'Turf'); +INSERT INTO text_data VALUES(147,147,1102,'Turf'); +INSERT INTO text_data VALUES(147,147,1103,'Turf'); +INSERT INTO text_data VALUES(147,147,1000101,'February S.'); +INSERT INTO text_data VALUES(147,147,1000102,'February S.'); +INSERT INTO text_data VALUES(147,147,1000103,'February S.'); +INSERT INTO text_data VALUES(147,147,2000101,'Right-Handed ○'); +INSERT INTO text_data VALUES(147,147,2000102,'Right-Handed ○'); +INSERT INTO text_data VALUES(147,147,2000103,'Right-Handed ○'); +INSERT INTO text_data VALUES(147,147,3000101,'URA Finale'); +INSERT INTO text_data VALUES(147,147,3000102,'URA Finale'); +INSERT INTO text_data VALUES(147,147,3000103,'URA Finale'); +INSERT INTO text_data VALUES(147,147,10010101,'Shooting Star'); +INSERT INTO text_data VALUES(147,147,10010102,'Shooting Star'); +INSERT INTO text_data VALUES(147,147,10010103,'Shooting Star'); +INSERT INTO text_data VALUES(172,172,101,'A Spark that increases Speed.'); +INSERT INTO text_data VALUES(172,172,102,'A Spark that increases Speed.'); +INSERT INTO text_data VALUES(172,172,103,'A Spark that increases Speed.'); +INSERT INTO text_data VALUES(172,172,201,'A Spark that increases Stamina.'); +INSERT INTO text_data VALUES(172,172,202,'A Spark that increases Stamina.'); +INSERT INTO text_data VALUES(172,172,203,'A Spark that increases Stamina.'); +INSERT INTO text_data VALUES(172,172,1101,'A Spark that increases Turf Aptitude.'); +INSERT INTO text_data VALUES(172,172,1102,'A Spark that increases Turf Aptitude.'); +INSERT INTO text_data VALUES(172,172,1103,'A Spark that increases Turf Aptitude.'); +INSERT INTO text_data VALUES(172,172,1000101,'A Spark that increases Power and gives a skill hint for "Winter Runner ○".'); +INSERT INTO text_data VALUES(172,172,1000102,'A Spark that increases Power and gives a skill hint for "Winter Runner ○".'); +INSERT INTO text_data VALUES(172,172,1000103,'A Spark that increases Power and gives a skill hint for "Winter Runner ○".'); +INSERT INTO text_data VALUES(172,172,2000101,'A Spark that gives a skill hint for "Right-Handed ○".'); +INSERT INTO text_data VALUES(172,172,2000102,'A Spark that gives a skill hint for "Right-Handed ○".'); +INSERT INTO text_data VALUES(172,172,2000103,'A Spark that gives a skill hint for "Right-Handed ○".'); +INSERT INTO text_data VALUES(172,172,3000101,'A Spark that increases Speed and Stamina.'); +INSERT INTO text_data VALUES(172,172,3000102,'A Spark that increases Speed and Stamina.'); +INSERT INTO text_data VALUES(172,172,3000103,'A Spark that increases Speed and Stamina.'); +INSERT INTO text_data VALUES(172,172,10010101,'A Spark that gives a skill hint for "Shooting Star".'); +INSERT INTO text_data VALUES(172,172,10010102,'A Spark that gives a skill hint for "Shooting Star".'); +INSERT INTO text_data VALUES(172,172,10010103,'A Spark that gives a skill hint for "Shooting Star".'); + +CREATE TABLE IF NOT EXISTS 'succession_factor' ('factor_id' INTEGER NOT NULL, 'factor_group_id' INTEGER NOT NULL, 'rarity' INTEGER NOT NULL, 'grade' INTEGER NOT NULL, 'factor_type' INTEGER NOT NULL, 'effect_group_id' INTEGER NOT NULL, 'start_date' INTEGER NOT NULL, 'end_date' INTEGER NOT NULL, PRIMARY KEY('factor_id')); +-- SELECT * FROM succession_factor WHERE factor_id IN (101, 102, 103, 201, 202, 203, 1101, 1102, 1103, 1000101, 1000102, 1000103, 2000101, 2000102, 2000103, 3000101, 3000102, 3000103, 10010101, 10010102, 10010103); +INSERT INTO succession_factor VALUES(101,1,1,1,1,11,1483228800,2524608000); +INSERT INTO succession_factor VALUES(102,1,2,1,1,12,1483228800,2524608000); +INSERT INTO succession_factor VALUES(103,1,3,1,1,13,1483228800,2524608000); +INSERT INTO succession_factor VALUES(201,2,1,1,1,11,1483228800,2524608000); +INSERT INTO succession_factor VALUES(202,2,2,1,1,12,1483228800,2524608000); +INSERT INTO succession_factor VALUES(203,2,3,1,1,13,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1101,11,1,1,2,21,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1102,11,2,1,2,22,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1103,11,3,1,2,23,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1000101,10001,1,1,5,51,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1000102,10001,2,1,5,52,1483228800,2524608000); +INSERT INTO succession_factor VALUES(1000103,10001,3,1,5,53,1483228800,2524608000); +INSERT INTO succession_factor VALUES(2000101,20001,1,1,4,41,1483228800,2524608000); +INSERT INTO succession_factor VALUES(2000102,20001,2,1,4,42,1483228800,2524608000); +INSERT INTO succession_factor VALUES(2000103,20001,3,1,4,43,1483228800,2524608000); +INSERT INTO succession_factor VALUES(3000101,30001,1,1,6,51,1483228800,2524608000); +INSERT INTO succession_factor VALUES(3000102,30001,2,1,6,52,1483228800,2524608000); +INSERT INTO succession_factor VALUES(3000103,30001,3,1,6,53,1483228800,2524608000); +INSERT INTO succession_factor VALUES(10010101,100101,1,2,3,31,1483228800,2524608000); +INSERT INTO succession_factor VALUES(10010102,100101,2,2,3,32,1483228800,2524608000); +INSERT INTO succession_factor VALUES(10010103,100101,3,2,3,33,1483228800,2524608000); + +CREATE TABLE IF NOT EXISTS 'succession_factor_effect' ('id' INTEGER NOT NULL, 'factor_group_id' INTEGER NOT NULL, 'effect_id' INTEGER NOT NULL, 'target_type' INTEGER NOT NULL, 'value_1' INTEGER NOT NULL, 'value_2' INTEGER NOT NULL, PRIMARY KEY('id')); +-- SELECT * FROM succession_factor_effect WHERE factor_group_id IN (SELECT factor_group_id FROM succession_factor WHERE factor_id IN (101, 102, 103, 201, 202, 203, 1101, 1102, 1103, 1000101, 1000102, 1000103, 2000101, 2000102, 2000103, 3000101, 3000102, 3000103, 10010101, 10010102, 10010103)); +INSERT INTO succession_factor_effect VALUES(1,1,1,1,1,0); +INSERT INTO succession_factor_effect VALUES(2,1,2,1,4,0); +INSERT INTO succession_factor_effect VALUES(3,1,3,1,7,0); +INSERT INTO succession_factor_effect VALUES(4,1,4,1,10,0); +INSERT INTO succession_factor_effect VALUES(5,1,5,1,13,0); +INSERT INTO succession_factor_effect VALUES(6,1,6,1,16,0); +INSERT INTO succession_factor_effect VALUES(7,1,7,1,19,0); +INSERT INTO succession_factor_effect VALUES(8,1,8,1,22,0); +INSERT INTO succession_factor_effect VALUES(9,1,9,1,25,0); +INSERT INTO succession_factor_effect VALUES(10,1,10,1,28,0); +INSERT INTO succession_factor_effect VALUES(11,2,1,2,1,0); +INSERT INTO succession_factor_effect VALUES(12,2,2,2,4,0); +INSERT INTO succession_factor_effect VALUES(13,2,3,2,7,0); +INSERT INTO succession_factor_effect VALUES(14,2,4,2,10,0); +INSERT INTO succession_factor_effect VALUES(15,2,5,2,13,0); +INSERT INTO succession_factor_effect VALUES(16,2,6,2,16,0); +INSERT INTO succession_factor_effect VALUES(17,2,7,2,19,0); +INSERT INTO succession_factor_effect VALUES(18,2,8,2,22,0); +INSERT INTO succession_factor_effect VALUES(19,2,9,2,25,0); +INSERT INTO succession_factor_effect VALUES(20,2,10,2,28,0); +INSERT INTO succession_factor_effect VALUES(51,11,1,11,1,0); +INSERT INTO succession_factor_effect VALUES(52,11,2,11,2,0); +INSERT INTO succession_factor_effect VALUES(1144,10001,1,3,3,0); +INSERT INTO succession_factor_effect VALUES(1145,10001,1,41,200202,1); +INSERT INTO succession_factor_effect VALUES(1146,10001,2,3,6,0); +INSERT INTO succession_factor_effect VALUES(1147,10001,2,41,200202,1); +INSERT INTO succession_factor_effect VALUES(1148,10001,3,3,9,0); +INSERT INTO succession_factor_effect VALUES(1149,10001,3,41,200202,1); +INSERT INTO succession_factor_effect VALUES(344,20001,1,41,200012,1); +INSERT INTO succession_factor_effect VALUES(345,20001,2,41,200012,2); +INSERT INTO succession_factor_effect VALUES(346,20001,3,41,200012,3); +INSERT INTO succession_factor_effect VALUES(347,20001,4,41,200012,4); +INSERT INTO succession_factor_effect VALUES(348,20001,5,41,200012,5); +INSERT INTO succession_factor_effect VALUES(1324,30001,1,1,10,0); +INSERT INTO succession_factor_effect VALUES(1325,30001,1,2,10,0); +INSERT INTO succession_factor_effect VALUES(1326,30001,2,1,20,0); +INSERT INTO succession_factor_effect VALUES(1327,30001,2,2,20,0); +INSERT INTO succession_factor_effect VALUES(1328,30001,3,1,30,0); +INSERT INTO succession_factor_effect VALUES(1329,30001,3,2,30,0); +INSERT INTO succession_factor_effect VALUES(71,100101,1,41,900011,1); +INSERT INTO succession_factor_effect VALUES(73,100101,2,41,900011,2); +INSERT INTO succession_factor_effect VALUES(75,100101,3,41,900011,3); \ No newline at end of file