Browse Source

readme change

pbs
Jake Probst 5 years ago
parent
commit
6f0bacd64e
  1. 9
      README.md
  2. 18
      src/login/character.rs

9
README.md

@ -3,7 +3,10 @@
* get the latest nightly `rustup install nightly`
* grab elseware and [libpso](https://github.com/jakeprobst/libpso)
* have elseware and libpso in the same directory
* `cargo install diesel-cli`
* `diesel database setup`
* `cargo run --bin patch` or `cargo run --bin login`
* `cargo test` to run tests
# to actually run it
* `cargo install diesel_cli`
* `diesel database setup`
* [some sort of step that seeds the db with fake data to be useful]
* `cargo run --bin patch` and `cargo run --bin login`

18
src/login/character.rs

@ -30,6 +30,7 @@ pub enum CharacterError {
pub enum RecvCharacterPacket {
Login(Login),
RequestSettings(RequestSettings),
CharSelect(CharSelect)
}
impl RecvServerPacket for RecvCharacterPacket {
@ -37,6 +38,7 @@ impl RecvServerPacket for RecvCharacterPacket {
match data[2] {
0x93 => Ok(RecvCharacterPacket::Login(Login::from_bytes(data)?)),
0xE0 => Ok(RecvCharacterPacket::RequestSettings(RequestSettings::from_bytes(data)?)),
0xE3 => Ok(RecvCharacterPacket::CharSelect(CharSelect::from_bytes(data)?)),
_ => Err(PacketParseError::WrongPacketForServerType)
}
}
@ -102,6 +104,10 @@ impl<DA: DataAccess> CharacterServerState<DA> {
vec![pkt]
}
fn char_select(&mut self) -> Vec<SendCharacterPacket> {
Vec::new()
}
}
impl<DA: DataAccess> ServerState for CharacterServerState<DA> {
@ -130,15 +136,14 @@ impl<DA: DataAccess> ServerState for CharacterServerState<DA> {
},
RecvCharacterPacket::RequestSettings(_req) => {
Box::new(self.get_settings().into_iter())
},
RecvCharacterPacket::CharSelect(sel) => {
Box::new(self.char_select().into_iter())
}
}
}
}
pub fn new_client<DA: DataAccess + 'static>(socket: mio::tcp::TcpStream, shared_state: SharedLoginState<DA>) {
let state = CharacterServerState::new(shared_state);
let client = Client::new(socket, Box::new(state));
@ -153,10 +158,6 @@ mod test {
use libpso::character::settings;
use std::time::SystemTime;
#[test]
fn test_login() {
}
#[test]
fn test_option_send() {
struct TestData {
@ -192,5 +193,4 @@ mod test {
assert!(bytes[2] == 0xE2);
assert!(bytes.len() == 0xAFC);
}
}
Loading…
Cancel
Save