From fb69689f2aff2232de33255c53b01b5306bc370b Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 2 May 2025 00:17:15 -0400 Subject: [PATCH] Change server_id field in IpcSegment to option --- src/bin/kawari-lobby.rs | 2 +- src/bin/kawari-login.rs | 2 +- src/bin/kawari-world.rs | 10 +++++----- src/lobby/connection.rs | 28 ++++++++++++++-------------- src/lobby/ipc/mod.rs | 6 +++--- src/packet/ipc.rs | 2 +- src/world/chat.rs | 2 +- src/world/chat_handler.rs | 14 +++++++------- src/world/connection.rs | 4 ++-- src/world/ipc/mod.rs | 6 +++--- src/world/lua.rs | 2 +- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/bin/kawari-lobby.rs b/src/bin/kawari-lobby.rs index ef6b52b..ffffb78 100644 --- a/src/bin/kawari-lobby.rs +++ b/src/bin/kawari-lobby.rs @@ -127,7 +127,7 @@ async fn main() { unk1: 0, unk2: 0, op_code: CustomIpcType::GetActorId, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::GetActorId { content_id: *content_id, diff --git a/src/bin/kawari-login.rs b/src/bin/kawari-login.rs index e18ac78..e07bf4b 100644 --- a/src/bin/kawari-login.rs +++ b/src/bin/kawari-login.rs @@ -211,7 +211,7 @@ async fn upload_character_backup( unk1: 0, unk2: 0, op_code: CustomIpcType::ImportCharacter, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::ImportCharacter { service_account_id, diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 39af4a8..c0de4ce 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -923,7 +923,7 @@ async fn client_loop( unk1: 0, unk2: 0, op_code: CustomIpcType::CharacterCreated, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::CharacterCreated { actor_id, @@ -952,7 +952,7 @@ async fn client_loop( unk1: 0, unk2: 0, op_code: CustomIpcType::ActorIdFound, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::ActorIdFound { actor_id }, }, @@ -976,7 +976,7 @@ async fn client_loop( unk1: 0, unk2: 0, op_code: CustomIpcType::NameIsAvailableResponse, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::NameIsAvailableResponse { free: is_name_free, @@ -1024,7 +1024,7 @@ async fn client_loop( unk1: 0, unk2: 0, op_code: CustomIpcType::RequestCharacterListRepsonse, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::RequestCharacterListRepsonse { characters @@ -1055,7 +1055,7 @@ async fn client_loop( unk1: 0, unk2: 0, op_code: CustomIpcType::CharacterDeleted, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::CharacterDeleted { deleted: 1, diff --git a/src/lobby/connection.rs b/src/lobby/connection.rs index 77f5989..ba32ff8 100644 --- a/src/lobby/connection.rs +++ b/src/lobby/connection.rs @@ -96,7 +96,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::LoginReply, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: service_account_list, }; @@ -140,7 +140,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::DistWorldInfo, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: lobby_server_list, }; @@ -162,7 +162,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::DistRetainerInfo, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: lobby_retainer_list, }; @@ -191,7 +191,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: CustomIpcType::RequestCharacterList, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::RequestCharacterList { service_account_id: self.selected_service_account.unwrap(), @@ -265,7 +265,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::ServiceLoginReply, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerLobbyIpcData::ServiceLoginReply(lobby_character_list), }; @@ -298,7 +298,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::GameLoginReply, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: enter_world, }; @@ -326,7 +326,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::NackReply, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: lobby_error, }; @@ -353,7 +353,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: CustomIpcType::CheckNameIsAvailable, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::CheckNameIsAvailable { name: character_action.name.clone(), @@ -376,7 +376,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::CharaMakeReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerLobbyIpcData::CharaMakeReply { sequence: character_action.sequence + 1, @@ -404,7 +404,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::NackReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerLobbyIpcData::NackReply { sequence: character_action.sequence, @@ -438,7 +438,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: CustomIpcType::RequestCreateCharacter, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::RequestCreateCharacter { service_account_id: self.selected_service_account.unwrap(), @@ -470,7 +470,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::CharaMakeReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerLobbyIpcData::CharaMakeReply { sequence: character_action.sequence + 1, @@ -505,7 +505,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: CustomIpcType::DeleteCharacter, - server_id: 0, + option: 0, timestamp: 0, data: CustomIpcData::DeleteCharacter { content_id: character_action.content_id, @@ -523,7 +523,7 @@ impl LobbyConnection { unk1: 0, unk2: 0, op_code: ServerLobbyIpcType::CharaMakeReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerLobbyIpcData::CharaMakeReply { sequence: character_action.sequence + 1, diff --git a/src/lobby/ipc/mod.rs b/src/lobby/ipc/mod.rs index 3f89144..56f4874 100644 --- a/src/lobby/ipc/mod.rs +++ b/src/lobby/ipc/mod.rs @@ -36,7 +36,7 @@ impl Default for ClientLobbyIpcSegment { unk1: 0x14, unk2: 0, op_code: ClientLobbyIpcType::LoginEx, - server_id: 0, + option: 0, timestamp: 0, data: ClientLobbyIpcData::LoginEx { sequence: 0, @@ -63,7 +63,7 @@ impl Default for ServerLobbyIpcSegment { unk1: 0x14, unk2: 0, op_code: ServerLobbyIpcType::NackReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerLobbyIpcData::NackReply { sequence: 0, @@ -250,7 +250,7 @@ mod tests { unk1: 0, unk2: 0, op_code: opcode.clone(), - server_id: 0, + option: 0, timestamp: 0, data: ipc.clone(), }; diff --git a/src/packet/ipc.rs b/src/packet/ipc.rs index fc41db1..f9d8060 100644 --- a/src/packet/ipc.rs +++ b/src/packet/ipc.rs @@ -48,7 +48,7 @@ where pub op_code: OpCode, #[brw(pad_before = 2)] // empty /// Unknown purpose, but safe to keep 0. - pub server_id: u16, + pub option: u16, /// The timestamp of this packet in seconds since UNIX epoch. pub timestamp: u32, /// The data associated with the opcode. diff --git a/src/world/chat.rs b/src/world/chat.rs index d0581ed..3889e00 100644 --- a/src/world/chat.rs +++ b/src/world/chat.rs @@ -21,7 +21,7 @@ impl Default for ServerChatIpcSegment { unk1: 0x14, unk2: 0, op_code: ServerChatIpcType::LoginReply, - server_id: 0, + option: 0, timestamp: 0, data: ServerChatIpcData::LoginReply { timestamp: 0, diff --git a/src/world/chat_handler.rs b/src/world/chat_handler.rs index 9cfb0f8..20d1dba 100644 --- a/src/world/chat_handler.rs +++ b/src/world/chat_handler.rs @@ -78,7 +78,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::PlayerSpawn, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::PlayerSpawn(PlayerSpawn { account_id: 1000000, @@ -134,7 +134,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::ActorControl, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::ActorControl(ActorControl { category: ActorControlCategory::ZoneIn { @@ -159,7 +159,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::NpcSpawn, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::NpcSpawn(NpcSpawn { common: CommonSpawn { @@ -214,7 +214,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::NpcSpawn, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::NpcSpawn(NpcSpawn { aggression_mode: 1, @@ -263,7 +263,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::EventStart, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::EventStart(EventStart { target_id: ObjectTypeId { @@ -293,7 +293,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::ActorControl, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::ActorControl(ActorControl { category: ActorControlCategory::SetStatusIcon { @@ -338,7 +338,7 @@ impl ChatHandler { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::NpcSpawn, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::NpcSpawn(NpcSpawn { common, diff --git a/src/world/connection.rs b/src/world/connection.rs index a51e757..e60d257 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -276,7 +276,7 @@ impl ZoneConnection { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::NpcSpawn, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::NpcSpawn(NpcSpawn { common, @@ -303,7 +303,7 @@ impl ZoneConnection { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::Delete, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::Delete { spawn_index: actor.spawn_index as u8, diff --git a/src/world/ipc/mod.rs b/src/world/ipc/mod.rs index c6880e7..64dc1ac 100644 --- a/src/world/ipc/mod.rs +++ b/src/world/ipc/mod.rs @@ -100,7 +100,7 @@ impl Default for ClientZoneIpcSegment { unk1: 0x14, unk2: 0, op_code: ClientZoneIpcType::InitRequest, - server_id: 0, + option: 0, timestamp: 0, data: ClientZoneIpcData::InitRequest { unk: [0; 120] }, } @@ -123,7 +123,7 @@ impl Default for ServerZoneIpcSegment { unk1: 0x14, unk2: 0, op_code: ServerZoneIpcType::InitZone, - server_id: 0, + option: 0, timestamp: 0, data: ServerZoneIpcData::InitZone(InitZone::default()), } @@ -481,7 +481,7 @@ mod tests { unk1: 0, unk2: 0, op_code: opcode.clone(), // doesn't matter for this test - server_id: 0, + option: 0, timestamp: 0, data: data.clone(), }; diff --git a/src/world/lua.rs b/src/world/lua.rs index edb544d..fac0e31 100644 --- a/src/world/lua.rs +++ b/src/world/lua.rs @@ -59,7 +59,7 @@ impl LuaPlayer { unk1: 20, unk2: 0, op_code: ServerZoneIpcType::EventScene, - server_id: 0, + option: 0, timestamp: timestamp_secs(), data: ServerZoneIpcData::EventScene(EventPlay { actor_id: ObjectTypeId {