From 0ffd2c099ac68b1862892bc646822cd15cfbad92 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Thu, 17 Sep 2026 12:59:28 -0400 Subject: [PATCH] horse, mdb: include id in lobby conversations --- character.go | 2 ++ mdb/character.go | 15 ++++++++------- mdb/character_test.go | 11 +++++++++++ mdb/sql/conversation.sql | 1 + 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/character.go b/character.go index 576c100..32fe83b 100644 --- a/character.go +++ b/character.go @@ -28,6 +28,8 @@ type AffinityDetail struct { // Conversation describes a lobby conversation. type Conversation struct { + // ID is the conversation ID. + ID int32 `json:"id"` // CharacterID is the ID of the character who has the conversation as // a gallery entry. CharacterID CharacterID `json:"chara_id"` diff --git a/mdb/character.go b/mdb/character.go index 8459572..9e72372 100644 --- a/mdb/character.go +++ b/mdb/character.go @@ -89,13 +89,14 @@ func Umas(ctx context.Context, db *sqlitex.Pool) ([]horse.Uma, error) { 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), + ID: s.ColumnInt32(0), + CharacterID: horse.CharacterID(s.ColumnInt(1)), + Number: s.ColumnInt(2), + Location: horse.LobbyConversationLocationID(s.ColumnInt(3)), + Chara1: horse.CharacterID(s.ColumnInt(4)), + Chara2: horse.CharacterID(s.ColumnInt(5)), + Chara3: horse.CharacterID(s.ColumnInt(6)), + ConditionType: s.ColumnInt(7), } }) } diff --git a/mdb/character_test.go b/mdb/character_test.go index 806604a..c829938 100644 --- a/mdb/character_test.go +++ b/mdb/character_test.go @@ -238,12 +238,14 @@ func TestConversations(t *testing.T) { } want := []horse.Conversation{ { + ID: 1, CharacterID: 1001, Number: 1, Location: 410, Chara1: 1001, }, { + ID: 2, CharacterID: 1001, Number: 2, Location: 510, @@ -251,6 +253,7 @@ func TestConversations(t *testing.T) { ConditionType: 1, }, { + ID: 3, CharacterID: 1001, Number: 3, Location: 310, @@ -258,6 +261,7 @@ func TestConversations(t *testing.T) { ConditionType: 1, }, { + ID: 76, CharacterID: 1001, Number: 4, Location: 120, @@ -266,6 +270,7 @@ func TestConversations(t *testing.T) { ConditionType: 2, }, { + ID: 77, CharacterID: 1001, Number: 5, Location: 520, @@ -274,6 +279,7 @@ func TestConversations(t *testing.T) { ConditionType: 3, }, { + ID: 126, CharacterID: 1001, Number: 6, Location: 430, @@ -283,12 +289,14 @@ func TestConversations(t *testing.T) { ConditionType: 1, }, { + ID: 4, CharacterID: 1002, Number: 1, Location: 310, Chara1: 1002, }, { + ID: 5, CharacterID: 1002, Number: 2, Location: 210, @@ -296,6 +304,7 @@ func TestConversations(t *testing.T) { ConditionType: 1, }, { + ID: 6, CharacterID: 1002, Number: 3, Location: 110, @@ -303,6 +312,7 @@ func TestConversations(t *testing.T) { ConditionType: 1, }, { + ID: 78, CharacterID: 1002, Number: 4, Location: 520, @@ -311,6 +321,7 @@ func TestConversations(t *testing.T) { ConditionType: 3, }, { + ID: 79, CharacterID: 1002, Number: 5, Location: 220, diff --git a/mdb/sql/conversation.sql b/mdb/sql/conversation.sql index 965357a..9a23051 100644 --- a/mdb/sql/conversation.sql +++ b/mdb/sql/conversation.sql @@ -1,4 +1,5 @@ SELECT + id, gallery_chara_id, disp_order, pos_id,