mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47: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:
parent
db0bdd511c
commit
d3647a4b3b
2 changed files with 24 additions and 8 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue