1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 03:37:45 +00:00

Fix unlocking all aetherytes

I also made it possible to toggle them off properly, that should be
saved now too.
This commit is contained in:
Joshua Goins 2025-06-28 00:07:56 -04:00
parent db0bdd511c
commit d3647a4b3b
2 changed files with 24 additions and 8 deletions

View file

@ -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;

View file

@ -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 {