From d3647a4b3b8925fb71d29bf43a6377cb21bebfcb Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 28 Jun 2025 00:07:56 -0400 Subject: [PATCH] Fix unlocking all aetherytes I also made it possible to toggle them off properly, that should be saved now too. --- src/bin/kawari-world.rs | 16 ++++++++++++---- src/world/connection.rs | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 0d29a23..13208aa 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -689,16 +689,24 @@ async fn client_loop( // id == 0 means "all" if id == 0 { - for i in 1..239 { - let (value, index) = value_to_flag_byte_index_value(id); - connection.player_data.aetherytes[index as usize] |= value; + for i in 1..231 { + let (value, index) = value_to_flag_byte_index_value(i); + if on { + connection.player_data.aetherytes[index as usize] |= value; + } else { + connection.player_data.aetherytes[index as usize] ^= value; + } connection.actor_control_self(ActorControlSelf { category: ActorControlCategory::LearnTeleport { id: i, unlocked: on } }).await; } } else { let (value, index) = value_to_flag_byte_index_value(id); - connection.player_data.aetherytes[index as usize] |= value; + if on { + connection.player_data.aetherytes[index as usize] |= value; + } else { + connection.player_data.aetherytes[index as usize] ^= value; + } connection.actor_control_self(ActorControlSelf { category: ActorControlCategory::LearnTeleport { id, unlocked: on } }).await; diff --git a/src/world/connection.rs b/src/world/connection.rs index ec79bb1..1a99aa7 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -694,9 +694,13 @@ impl ZoneConnection { Task::UnlockAetheryte { id, on } => { let unlock_all = *id == 0; if unlock_all { - for i in 1..239 { - let (value, index) = value_to_flag_byte_index_value(*id); - self.player_data.aetherytes[index as usize] |= value; + for i in 1..231 { + let (value, index) = value_to_flag_byte_index_value(i); + if *on { + self.player_data.aetherytes[index as usize] |= value; + } else { + self.player_data.aetherytes[index as usize] ^= value; + } /* Unknown if this will make the server panic from a flood of packets. * Needs testing once toggling aetherytes actually works. */ @@ -710,7 +714,11 @@ impl ZoneConnection { } } else { let (value, index) = value_to_flag_byte_index_value(*id); - self.player_data.aetherytes[index as usize] |= value; + if *on { + self.player_data.aetherytes[index as usize] |= value; + } else { + self.player_data.aetherytes[index as usize] ^= value; + } self.actor_control_self(ActorControlSelf { category: ActorControlCategory::LearnTeleport {