Browse Source

packets no longer need flag explicitly defined

pbs
jake 5 years ago
parent
commit
fc7338356b
  1. 12
      src/login/character.rs
  2. 4
      src/login/login.rs

12
src/login/character.rs

@ -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);

4
src/login/login.rs

@ -179,7 +179,6 @@ mod test {
let send = server.handle(ClientId(1), &LOGIN_PACKET).unwrap().collect::<Vec<_>>();
assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::Ok,
tag: 65536,
guildcard: 0,
@ -189,7 +188,6 @@ mod test {
caps: 258
})),
(ClientId(1), SendLoginPacket::RedirectClient(RedirectClient {
flag: 0,
ip: 16777343,
port: 12001,
padding: 0,
@ -212,7 +210,6 @@ mod test {
assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::InvalidUser,
tag: 65536,
guildcard: 0,
@ -250,7 +247,6 @@ mod test {
assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::InvalidPassword,
tag: 65536,
guildcard: 0,

Loading…
Cancel
Save