|
|
@ -213,7 +213,6 @@ impl<EG: EntityGateway> CharacterServerState<EG> { |
|
|
|
fn send_ship_list(&mut self, _id: ClientId, _pkt: &Login) -> Result<Vec<SendCharacterPacket>, CharacterError> {
|
|
|
|
Ok(vec![SendCharacterPacket::Timestamp(Timestamp::new(chrono::Utc::now())),
|
|
|
|
SendCharacterPacket::ShipList(ShipList {
|
|
|
|
flag: 0,
|
|
|
|
ships: self.ships.iter().enumerate().map(|(i, s)| {
|
|
|
|
ShipListEntry {
|
|
|
|
menu: SHIP_MENU_ID,
|
|
|
@ -252,14 +251,12 @@ impl<EG: EntityGateway> CharacterServerState<EG> { |
|
|
|
let chars = client.characters.as_ref().unwrap();
|
|
|
|
Ok(if let Some(char) = &chars[select.slot as usize] {
|
|
|
|
vec![SendCharacterPacket::CharacterPreview(CharacterPreview {
|
|
|
|
flag: 0,
|
|
|
|
slot: select.slot,
|
|
|
|
character: char.character.as_select_screen(),
|
|
|
|
})]
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
vec![SendCharacterPacket::CharAck(CharAck {
|
|
|
|
flag: 0,
|
|
|
|
slot: select.slot,
|
|
|
|
code: 2,
|
|
|
|
})]
|
|
|
@ -274,7 +271,6 @@ impl<EG: EntityGateway> CharacterServerState<EG> { |
|
|
|
user.team_id.unwrap_or(1),
|
|
|
|
client.security_data)),
|
|
|
|
SendCharacterPacket::CharAck(CharAck {
|
|
|
|
flag: 0,
|
|
|
|
slot: select.slot,
|
|
|
|
code: 1,
|
|
|
|
})
|
|
|
@ -284,7 +280,6 @@ impl<EG: EntityGateway> CharacterServerState<EG> { |
|
|
|
|
|
|
|
fn validate_checksum(&mut self) -> Vec<SendCharacterPacket> {
|
|
|
|
vec![SendCharacterPacket::ChecksumAck(ChecksumAck {
|
|
|
|
flag: 0,
|
|
|
|
ack: 1,
|
|
|
|
})]
|
|
|
|
}
|
|
|
@ -398,7 +393,6 @@ impl<EG: EntityGateway> ServerState for CharacterServerState<EG> { |
|
|
|
|
|
|
|
Box::new(vec![SendCharacterPacket::ParamDataChunk(
|
|
|
|
ParamDataChunk {
|
|
|
|
flag: 0,
|
|
|
|
chunk: chunk as u32,
|
|
|
|
data: data,
|
|
|
|
}
|
|
|
@ -432,7 +426,6 @@ impl<EG: EntityGateway> ServerState for CharacterServerState<EG> { |
|
|
|
user.team_id.unwrap_or(1),
|
|
|
|
client.security_data)),
|
|
|
|
SendCharacterPacket::CharAck(CharAck {
|
|
|
|
flag: 0,
|
|
|
|
slot: preview.slot,
|
|
|
|
code: 0
|
|
|
|
})
|
|
|
@ -482,7 +475,7 @@ mod test { |
|
|
|
});
|
|
|
|
server.clients.insert(ClientId(5), clientstate);
|
|
|
|
|
|
|
|
let send = server.handle(ClientId(5), &RecvCharacterPacket::RequestSettings(RequestSettings {flag: 0}))
|
|
|
|
let send = server.handle(ClientId(5), &RecvCharacterPacket::RequestSettings(RequestSettings{}))
|
|
|
|
.unwrap()
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
assert!(send.len() == 1);
|
|
|
@ -498,8 +491,7 @@ mod test { |
|
|
|
struct TestData;
|
|
|
|
impl EntityGateway for TestData {}
|
|
|
|
let mut server = CharacterServerState::new(TestData {});
|
|
|
|
let send = server.handle(ClientId(1), &RecvCharacterPacket::Checksum(Checksum {flag: 0,
|
|
|
|
checksum: 1234,
|
|
|
|
let send = server.handle(ClientId(1), &RecvCharacterPacket::Checksum(Checksum {checksum: 1234,
|
|
|
|
padding: 0,
|
|
|
|
})).unwrap().collect::<Vec<_>>();
|
|
|
|
assert!(send.len() == 1);
|
|
|
|