|
|
@ -82,14 +82,14 @@ impl<EG: EntityGateway> LoginServerState<EG> { |
|
|
|
fn validate_login(&mut self, pkt: &Login) -> Vec<SendLoginPacket> {
|
|
|
|
match get_login_status(&self.entity_gateway, pkt) {
|
|
|
|
Ok(_user) => {
|
|
|
|
let response = SendLoginPacket::LoginResponse(LoginResponse::by_status(AccountStatus::Ok, pkt.security_data));
|
|
|
|
let response = SendLoginPacket::LoginResponse(LoginResponse::by_status(AccountStatus::Ok, pkt.session));
|
|
|
|
let ip = net::Ipv4Addr::new(127,0,0,1);
|
|
|
|
let ip = u32::from_ne_bytes(ip.octets());
|
|
|
|
vec![response,
|
|
|
|
SendLoginPacket::RedirectClient(RedirectClient::new(ip, crate::login::character::CHARACTER_PORT))]
|
|
|
|
},
|
|
|
|
Err(err) => {
|
|
|
|
vec![SendLoginPacket::LoginResponse(LoginResponse::by_status(err, pkt.security_data))]
|
|
|
|
vec![SendLoginPacket::LoginResponse(LoginResponse::by_status(err, pkt.session))]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -134,7 +134,6 @@ mod test { |
|
|
|
use super::*;
|
|
|
|
|
|
|
|
const LOGIN_PACKET: RecvLoginPacket = RecvLoginPacket::Login(Login {
|
|
|
|
flag: 0,
|
|
|
|
tag: 65536,
|
|
|
|
guildcard: 0,
|
|
|
|
version: 65,
|
|
|
@ -148,8 +147,14 @@ mod test { |
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
hwinfo: [129, 1, 1, 1, 1, 1, 1, 1],
|
|
|
|
security_data: [74, 97, 107, 101, 115, 101, 114, 118, 50, 48, 50, 48, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session: Session {
|
|
|
|
version: [69, 108, 115, 101, 119, 97, 114, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // utf8_to_array!("Elseware", 30),
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session_id: 0,
|
|
|
|
interserver_checksum: 0,
|
|
|
|
action: SessionAction::None,
|
|
|
|
character_slot: 0,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
#[test]
|
|
|
@ -183,8 +188,14 @@ mod test { |
|
|
|
tag: 65536,
|
|
|
|
guildcard: 0,
|
|
|
|
team_id: 0,
|
|
|
|
security_data: [74, 97, 107, 101, 115, 101, 114, 118, 50, 48, 50, 48, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session: Session {
|
|
|
|
version: [69, 108, 115, 101, 119, 97, 114, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // utf8_to_array!("Elseware", 30),
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session_id: 0,
|
|
|
|
interserver_checksum: 0,
|
|
|
|
action: SessionAction::None,
|
|
|
|
character_slot: 0,
|
|
|
|
},
|
|
|
|
caps: 258
|
|
|
|
})),
|
|
|
|
(ClientId(1), SendLoginPacket::RedirectClient(RedirectClient {
|
|
|
@ -214,8 +225,14 @@ mod test { |
|
|
|
tag: 65536,
|
|
|
|
guildcard: 0,
|
|
|
|
team_id: 0,
|
|
|
|
security_data: [74, 97, 107, 101, 115, 101, 114, 118, 50, 48, 50, 48, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session: Session {
|
|
|
|
version: [69, 108, 115, 101, 119, 97, 114, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // utf8_to_array!("Elseware", 30),
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session_id: 0,
|
|
|
|
interserver_checksum: 0,
|
|
|
|
action: SessionAction::None,
|
|
|
|
character_slot: 0,
|
|
|
|
},
|
|
|
|
caps: 258
|
|
|
|
}))])
|
|
|
|
}
|
|
|
@ -251,8 +268,14 @@ mod test { |
|
|
|
tag: 65536,
|
|
|
|
guildcard: 0,
|
|
|
|
team_id: 0,
|
|
|
|
security_data: [74, 97, 107, 101, 115, 101, 114, 118, 50, 48, 50, 48, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session: Session {
|
|
|
|
version: [69, 108, 115, 101, 119, 97, 114, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // utf8_to_array!("Elseware", 30),
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
session_id: 0,
|
|
|
|
interserver_checksum: 0,
|
|
|
|
action: SessionAction::None,
|
|
|
|
character_slot: 0,
|
|
|
|
},
|
|
|
|
caps: 258
|
|
|
|
}))])
|
|
|
|
}
|
|
|
|