From 5637f493647f67f954e44fd76052f97f91f8e297 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 4 Aug 2020 19:50:58 -0600 Subject: [PATCH] misc formatting --- src/entity/character.rs | 1 - src/ship/packet/handler/lobby.rs | 16 ++++---- src/ship/packet/handler/message.rs | 59 ++++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/src/entity/character.rs b/src/entity/character.rs index a31cfc1..f146998 100644 --- a/src/entity/character.rs +++ b/src/entity/character.rs @@ -63,7 +63,6 @@ impl Into for CharacterClass { } - #[derive(Copy, Clone, Hash, PartialEq, Eq, derive_more::Display)] pub enum SectionID { Viridia, diff --git a/src/ship/packet/handler/lobby.rs b/src/ship/packet/handler/lobby.rs index 7f2393c..2112133 100644 --- a/src/ship/packet/handler/lobby.rs +++ b/src/ship/packet/handler/lobby.rs @@ -63,14 +63,14 @@ pub fn send_player_to_lobby(id: ClientId, } pub async fn change_lobby(id: ClientId, - requested_lobby: u32, - client_location: &mut ClientLocation, - clients: &Clients, - item_manager: &mut ItemManager, - level_table: &CharacterLevelTable, - ship_rooms: &mut Rooms, - entity_gateway: &mut EG) - -> Result, ShipError> { + requested_lobby: u32, + client_location: &mut ClientLocation, + clients: &Clients, + item_manager: &mut ItemManager, + level_table: &CharacterLevelTable, + ship_rooms: &mut Rooms, + entity_gateway: &mut EG) + -> Result, ShipError> { let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?; let prev_area = client_location.get_area(id).map_err(|err| -> ClientLocationError {err.into()})?; match prev_area { diff --git a/src/ship/packet/handler/message.rs b/src/ship/packet/handler/message.rs index ae054c2..9cf3df1 100644 --- a/src/ship/packet/handler/message.rs +++ b/src/ship/packet/handler/message.rs @@ -175,18 +175,55 @@ pub fn update_player_position(id: ClientId, .ok_or_else(|| ShipError::InvalidRoom(room_id.0 as u32))?; match &message.msg { - GameMessage::PlayerChangedMap(p) => {client.x = p.x; client.y = p.y; client.z = p.z;}, - GameMessage::PlayerChangedMap2(p) => {client.area = MapArea::from_value(&room.mode.episode(), p.map_area).ok();}, - GameMessage::TellOtherPlayerMyLocation(p) => {client.x = p.x; client.y = p.y; client.z = p.z; client.area = MapArea::from_value(&room.mode.episode(), p.map_area).ok();}, - GameMessage::PlayerWarpingToFloor(p) => {client.area = MapArea::from_value(&room.mode.episode(), p.area as u16).ok();}, - GameMessage::PlayerTeleported(p) => {client.x = p.x; client.y = p.y; client.z = p.z;}, - GameMessage::PlayerStopped(p) => {client.x = p.x; client.y = p.y; client.z = p.z;}, - GameMessage::PlayerLoadedIn(p) => {client.x = p.x; client.y = p.y; client.z = p.z;}, - GameMessage::PlayerWalking(p) => {client.x = p.x; client.z = p.z;}, - GameMessage::PlayerRunning(p) => {client.x = p.x; client.z = p.z;}, - GameMessage::PlayerWarped(p) => {client.x = p.x; client.y = p.y;}, + GameMessage::PlayerChangedMap(p) => { + client.x = p.x; + client.y = p.y; + client.z = p.z; + }, + GameMessage::PlayerChangedMap2(p) => { + client.area = room.map_areas.get_area_map(p.map_area).ok().cloned(); + }, + GameMessage::TellOtherPlayerMyLocation(p) => { + client.x = p.x; + client.y = p.y; + client.z = p.z; + client.area = room.map_areas.get_area_map(p.map_area).ok().cloned(); + }, + GameMessage::PlayerWarpingToFloor(p) => { + client.area = room.map_areas.get_area_map(p.area as u16).ok().cloned(); + }, + GameMessage::PlayerTeleported(p) => { + client.x = p.x; + client.y = p.y; + client.z = p.z; + }, + GameMessage::PlayerStopped(p) => { + client.x = p.x; + client.y = p.y; + client.z = p.z; + }, + GameMessage::PlayerLoadedIn(p) => { + client.x = p.x; + client.y = p.y; + client.z = p.z; + }, + GameMessage::PlayerWalking(p) => { + client.x = p.x; + client.z = p.z; + }, + GameMessage::PlayerRunning(p) => { + client.x = p.x; + client.z = p.z; + }, + GameMessage::PlayerWarped(p) => { + client.x = p.x; + client.y = p.y; + }, // GameMessage::PlayerChangedFloor(p) => {client.area = MapArea::from_value(&room.mode.episode(), p.map).ok();}, - GameMessage::InitializeSpeechNpc(p) => {client.x = p.x; client.z = p.z;} + GameMessage::InitializeSpeechNpc(p) => { + client.x = p.x; + client.z = p.z; + } _ => {}, } } else {}