Browse Source

misc formatting

pbs
jake 4 years ago
parent
commit
5637f49364
  1. 1
      src/entity/character.rs
  2. 16
      src/ship/packet/handler/lobby.rs
  3. 59
      src/ship/packet/handler/message.rs

1
src/entity/character.rs

@ -63,7 +63,6 @@ impl Into<u8> for CharacterClass {
}
#[derive(Copy, Clone, Hash, PartialEq, Eq, derive_more::Display)]
pub enum SectionID {
Viridia,

16
src/ship/packet/handler/lobby.rs

@ -63,14 +63,14 @@ pub fn send_player_to_lobby(id: ClientId,
}
pub async fn change_lobby<EG: EntityGateway>(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<Vec<(ClientId, SendShipPacket)>, 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<Vec<(ClientId, SendShipPacket)>, 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 {

59
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 {}

Loading…
Cancel
Save