From 2c353574af95af0faa8e30b32bea6925778c6686 Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 17 Oct 2019 22:35:46 -0700 Subject: [PATCH] some test data --- src/main.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 68d5265..fd738e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,16 +8,39 @@ mod login; mod ship; use std::thread; +use std::time::SystemTime; use patch::patch::{PatchServerState, generate_patch_tree}; use login::login::LoginServerState; use login::character::CharacterServerState; use ship::ship::ShipServerState; - +use entity::account::{UserAccount, UserSettings}; use entity::gateway::{EntityGateway, InMemoryGateway}; +//use crate::utf8_to_utf16_array; fn main() { - let entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::new(); + + let fake_user = UserAccount { + id: 1, + username: "hi".to_string(), + password: bcrypt::hash("qwer", 5).unwrap(), + guildcard: None, + team_id: None, + banned: false, + muted_until: SystemTime::now(), + created_at: SystemTime::now(), + flags: 0, + }; + entity_gateway.set_user(&fake_user); + entity_gateway.create_user_settings_by_user(&fake_user); + let mut character = entity_gateway.new_character_by_user(&fake_user); + character.character.name = utf8_to_utf16_array!("Test Char 1", 0x10); + entity_gateway.set_character(&character); + let mut character = entity_gateway.new_character_by_user(&fake_user); + character.slot = 2; + character.character.name = utf8_to_utf16_array!("Test Char 2", 0x10); + entity_gateway.set_character(&character); let patch_thread = thread::spawn(|| { println!("[patch] starting server");