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> { fn send_ship_list(&mut self, _id: ClientId, _pkt: &Login) -> Result<Vec<SendCharacterPacket>, CharacterError> {
Ok(vec![SendCharacterPacket::Timestamp(Timestamp::new(chrono::Utc::now())), Ok(vec![SendCharacterPacket::Timestamp(Timestamp::new(chrono::Utc::now())),
SendCharacterPacket::ShipList(ShipList { SendCharacterPacket::ShipList(ShipList {
flag: 0,
ships: self.ships.iter().enumerate().map(|(i, s)| { ships: self.ships.iter().enumerate().map(|(i, s)| {
ShipListEntry { ShipListEntry {
menu: SHIP_MENU_ID, menu: SHIP_MENU_ID,
@ -252,14 +251,12 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
let chars = client.characters.as_ref().unwrap(); let chars = client.characters.as_ref().unwrap();
Ok(if let Some(char) = &chars[select.slot as usize] { Ok(if let Some(char) = &chars[select.slot as usize] {
vec![SendCharacterPacket::CharacterPreview(CharacterPreview { vec![SendCharacterPacket::CharacterPreview(CharacterPreview {
flag: 0,
slot: select.slot, slot: select.slot,
character: char.character.as_select_screen(), character: char.character.as_select_screen(),
})] })]
} }
else { else {
vec![SendCharacterPacket::CharAck(CharAck { vec![SendCharacterPacket::CharAck(CharAck {
flag: 0,
slot: select.slot, slot: select.slot,
code: 2, code: 2,
})] })]
@ -274,7 +271,6 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
user.team_id.unwrap_or(1), user.team_id.unwrap_or(1),
client.security_data)), client.security_data)),
SendCharacterPacket::CharAck(CharAck { SendCharacterPacket::CharAck(CharAck {
flag: 0,
slot: select.slot, slot: select.slot,
code: 1, code: 1,
}) })
@ -284,7 +280,6 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
fn validate_checksum(&mut self) -> Vec<SendCharacterPacket> { fn validate_checksum(&mut self) -> Vec<SendCharacterPacket> {
vec![SendCharacterPacket::ChecksumAck(ChecksumAck { vec![SendCharacterPacket::ChecksumAck(ChecksumAck {
flag: 0,
ack: 1, ack: 1,
})] })]
} }
@ -398,7 +393,6 @@ impl<EG: EntityGateway> ServerState for CharacterServerState<EG> {
Box::new(vec![SendCharacterPacket::ParamDataChunk( Box::new(vec![SendCharacterPacket::ParamDataChunk(
ParamDataChunk { ParamDataChunk {
flag: 0,
chunk: chunk as u32, chunk: chunk as u32,
data: data, data: data,
} }
@ -432,7 +426,6 @@ impl<EG: EntityGateway> ServerState for CharacterServerState<EG> {
user.team_id.unwrap_or(1), user.team_id.unwrap_or(1),
client.security_data)), client.security_data)),
SendCharacterPacket::CharAck(CharAck { SendCharacterPacket::CharAck(CharAck {
flag: 0,
slot: preview.slot, slot: preview.slot,
code: 0 code: 0
}) })
@ -482,7 +475,7 @@ mod test {
}); });
server.clients.insert(ClientId(5), clientstate); 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() .unwrap()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
assert!(send.len() == 1); assert!(send.len() == 1);
@ -498,8 +491,7 @@ mod test {
struct TestData; struct TestData;
impl EntityGateway for TestData {} impl EntityGateway for TestData {}
let mut server = CharacterServerState::new(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, padding: 0,
})).unwrap().collect::<Vec<_>>(); })).unwrap().collect::<Vec<_>>();
assert!(send.len() == 1); 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<_>>(); let send = server.handle(ClientId(1), &LOGIN_PACKET).unwrap().collect::<Vec<_>>();
assert!(send == vec![ assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse { (ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::Ok, status: AccountStatus::Ok,
tag: 65536, tag: 65536,
guildcard: 0, guildcard: 0,
@ -189,7 +188,6 @@ mod test {
caps: 258 caps: 258
})), })),
(ClientId(1), SendLoginPacket::RedirectClient(RedirectClient { (ClientId(1), SendLoginPacket::RedirectClient(RedirectClient {
flag: 0,
ip: 16777343, ip: 16777343,
port: 12001, port: 12001,
padding: 0, padding: 0,
@ -212,7 +210,6 @@ mod test {
assert!(send == vec![ assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse { (ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::InvalidUser, status: AccountStatus::InvalidUser,
tag: 65536, tag: 65536,
guildcard: 0, guildcard: 0,
@ -250,7 +247,6 @@ mod test {
assert!(send == vec![ assert!(send == vec![
(ClientId(1), SendLoginPacket::LoginResponse(LoginResponse { (ClientId(1), SendLoginPacket::LoginResponse(LoginResponse {
flag: 0,
status: AccountStatus::InvalidPassword, status: AccountStatus::InvalidPassword,
tag: 65536, tag: 65536,
guildcard: 0, guildcard: 0,

Loading…
Cancel
Save