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"
|
// id == 0 means "all"
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
for i in 1..239 {
|
for i in 1..231 {
|
||||||
let (value, index) = value_to_flag_byte_index_value(id);
|
let (value, index) = value_to_flag_byte_index_value(i);
|
||||||
|
if on {
|
||||||
connection.player_data.aetherytes[index as usize] |= value;
|
connection.player_data.aetherytes[index as usize] |= value;
|
||||||
|
} else {
|
||||||
|
connection.player_data.aetherytes[index as usize] ^= value;
|
||||||
|
}
|
||||||
|
|
||||||
connection.actor_control_self(ActorControlSelf {
|
connection.actor_control_self(ActorControlSelf {
|
||||||
category: ActorControlCategory::LearnTeleport { id: i, unlocked: on } }).await;
|
category: ActorControlCategory::LearnTeleport { id: i, unlocked: on } }).await;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let (value, index) = value_to_flag_byte_index_value(id);
|
let (value, index) = value_to_flag_byte_index_value(id);
|
||||||
|
if on {
|
||||||
connection.player_data.aetherytes[index as usize] |= value;
|
connection.player_data.aetherytes[index as usize] |= value;
|
||||||
|
} else {
|
||||||
|
connection.player_data.aetherytes[index as usize] ^= value;
|
||||||
|
}
|
||||||
|
|
||||||
connection.actor_control_self(ActorControlSelf {
|
connection.actor_control_self(ActorControlSelf {
|
||||||
category: ActorControlCategory::LearnTeleport { id, unlocked: on } }).await;
|
category: ActorControlCategory::LearnTeleport { id, unlocked: on } }).await;
|
||||||
|
|
|
@ -694,9 +694,13 @@ impl ZoneConnection {
|
||||||
Task::UnlockAetheryte { id, on } => {
|
Task::UnlockAetheryte { id, on } => {
|
||||||
let unlock_all = *id == 0;
|
let unlock_all = *id == 0;
|
||||||
if unlock_all {
|
if unlock_all {
|
||||||
for i in 1..239 {
|
for i in 1..231 {
|
||||||
let (value, index) = value_to_flag_byte_index_value(*id);
|
let (value, index) = value_to_flag_byte_index_value(i);
|
||||||
|
if *on {
|
||||||
self.player_data.aetherytes[index as usize] |= value;
|
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.
|
/* Unknown if this will make the server panic from a flood of packets.
|
||||||
* Needs testing once toggling aetherytes actually works. */
|
* Needs testing once toggling aetherytes actually works. */
|
||||||
|
@ -710,7 +714,11 @@ impl ZoneConnection {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let (value, index) = value_to_flag_byte_index_value(*id);
|
let (value, index) = value_to_flag_byte_index_value(*id);
|
||||||
|
if *on {
|
||||||
self.player_data.aetherytes[index as usize] |= value;
|
self.player_data.aetherytes[index as usize] |= value;
|
||||||
|
} else {
|
||||||
|
self.player_data.aetherytes[index as usize] ^= value;
|
||||||
|
}
|
||||||
|
|
||||||
self.actor_control_self(ActorControlSelf {
|
self.actor_control_self(ActorControlSelf {
|
||||||
category: ActorControlCategory::LearnTeleport {
|
category: ActorControlCategory::LearnTeleport {
|
||||||
|
|
Loading…
Add table
Reference in a new issue