From 61f0ccdacd23d86df3e117eb700a306efb08a69f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 28 Jun 2025 10:43:53 -0400 Subject: [PATCH] Fix deleting characters in the lobby not working This statement broke at some point, and the size of the custom IPC was wrong too. --- src/ipc/kawari/mod.rs | 2 +- src/world/database.rs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ipc/kawari/mod.rs b/src/ipc/kawari/mod.rs index 6d15e17..7cdaf4c 100644 --- a/src/ipc/kawari/mod.rs +++ b/src/ipc/kawari/mod.rs @@ -20,7 +20,7 @@ impl ReadWriteIpcSegment for CustomIpcSegment { CustomIpcType::NameIsAvailableResponse => 1, CustomIpcType::RequestCharacterList => 4, CustomIpcType::RequestCharacterListRepsonse => 1 + (1184 * 8), - CustomIpcType::DeleteCharacter => 4, + CustomIpcType::DeleteCharacter => 8, CustomIpcType::CharacterDeleted => 1, CustomIpcType::ImportCharacter => 132, CustomIpcType::RemakeCharacter => 1024 + 8, diff --git a/src/world/database.rs b/src/world/database.rs index 98b64e3..43bcf5e 100644 --- a/src/world/database.rs +++ b/src/world/database.rs @@ -478,10 +478,21 @@ impl WorldDatabase { pub fn delete_character(&self, content_id: u64) { let connection = self.connection.lock().unwrap(); - let mut stmt = connection - .prepare("DELETE FROM character_data WHERE content_id = ?1; DELETE FROM characters WHERE content_id = ?1;") - .unwrap(); - stmt.execute((content_id,)).unwrap(); + // delete data + { + let mut stmt = connection + .prepare("DELETE FROM character_data WHERE content_id = ?1") + .unwrap(); + stmt.execute((content_id,)).unwrap(); + } + + // delete char + { + let mut stmt = connection + .prepare("DELETE FROM characters WHERE content_id = ?1") + .unwrap(); + stmt.execute((content_id,)).unwrap(); + } } /// Sets the remake mode for a character