|
@ -1,11 +1,9 @@ |
|
|
use std::net::Ipv4Addr;
|
|
|
use std::net::Ipv4Addr;
|
|
|
use std::time::SystemTime;
|
|
|
|
|
|
use log::{info};
|
|
|
use log::{info};
|
|
|
|
|
|
|
|
|
use elseware::patch::patch::{PatchServerState, generate_patch_tree, load_config, load_motd};
|
|
|
use elseware::patch::patch::{PatchServerState, generate_patch_tree, load_config, load_motd};
|
|
|
use elseware::login::login::LoginServerState;
|
|
|
use elseware::login::login::LoginServerState;
|
|
|
use elseware::login::character::CharacterServerState;
|
|
|
use elseware::login::character::CharacterServerState;
|
|
|
use elseware::ship::ship::ShipServerState;
|
|
|
|
|
|
use elseware::ship::ship::ShipServerStateBuilder;
|
|
|
use elseware::ship::ship::ShipServerStateBuilder;
|
|
|
use elseware::entity::account::{NewUserAccountEntity, NewUserSettingsEntity};
|
|
|
use elseware::entity::account::{NewUserAccountEntity, NewUserSettingsEntity};
|
|
|
use elseware::entity::gateway::{EntityGateway, InMemoryGateway, PostgresGateway};
|
|
|
use elseware::entity::gateway::{EntityGateway, InMemoryGateway, PostgresGateway};
|
|
@ -64,10 +62,10 @@ fn main() { |
|
|
flags: 0,
|
|
|
flags: 0,
|
|
|
};
|
|
|
};
|
|
|
let fake_user = entity_gateway.create_user(fake_user).await.unwrap();
|
|
|
let fake_user = entity_gateway.create_user(fake_user).await.unwrap();
|
|
|
entity_gateway.create_user_settings(NewUserSettingsEntity::new(fake_user.id)).await;
|
|
|
|
|
|
|
|
|
entity_gateway.create_user_settings(NewUserSettingsEntity::new(fake_user.id)).await.unwrap();
|
|
|
let mut character = NewCharacterEntity::new(fake_user.id);
|
|
|
let mut character = NewCharacterEntity::new(fake_user.id);
|
|
|
character.name = format!("Test Char {}", i*2);
|
|
|
character.name = format!("Test Char {}", i*2);
|
|
|
entity_gateway.create_character(character).await;
|
|
|
|
|
|
|
|
|
entity_gateway.create_character(character).await.unwrap();
|
|
|
let mut character = NewCharacterEntity::new(fake_user.id);
|
|
|
let mut character = NewCharacterEntity::new(fake_user.id);
|
|
|
character.slot = 2;
|
|
|
character.slot = 2;
|
|
|
character.name = "ItemRefactor".into();
|
|
|
character.name = "ItemRefactor".into();
|
|
@ -75,6 +73,41 @@ fn main() { |
|
|
character.meseta = 999999;
|
|
|
character.meseta = 999999;
|
|
|
let character = entity_gateway.create_character(character).await.unwrap();
|
|
|
let character = entity_gateway.create_character(character).await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
for _ in 0..3 {
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
|
|
|
item::NewItemEntity {
|
|
|
|
|
|
item: item::ItemDetail::Weapon(
|
|
|
|
|
|
item::weapon::Weapon {
|
|
|
|
|
|
weapon: item::weapon::WeaponType::Vulcan,
|
|
|
|
|
|
grind: 0,
|
|
|
|
|
|
special: None,
|
|
|
|
|
|
attrs: [None, None, None],
|
|
|
|
|
|
tekked: true,
|
|
|
|
|
|
modifiers: Vec::new(),
|
|
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
location: item::ItemLocation::Bank {
|
|
|
|
|
|
character_id: character.id,
|
|
|
|
|
|
name: item::BankName("".to_string())
|
|
|
|
|
|
}
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _ in 0..8 {
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
|
|
|
NewItemEntity {
|
|
|
|
|
|
item: ItemDetail::Tool (
|
|
|
|
|
|
item::tool::Tool {
|
|
|
|
|
|
tool: item::tool::ToolType::Monomate,
|
|
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
location: item::ItemLocation::Bank {
|
|
|
|
|
|
character_id: character.id,
|
|
|
|
|
|
name: item::BankName("".to_string())
|
|
|
|
|
|
}
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -94,7 +127,7 @@ fn main() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -114,7 +147,7 @@ fn main() { |
|
|
slot: 1,
|
|
|
slot: 1,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -134,7 +167,7 @@ fn main() { |
|
|
slot: 2,
|
|
|
slot: 2,
|
|
|
equipped: true,
|
|
|
equipped: true,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -154,7 +187,7 @@ fn main() { |
|
|
slot: 3,
|
|
|
slot: 3,
|
|
|
equipped: true,
|
|
|
equipped: true,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -174,7 +207,59 @@ fn main() { |
|
|
slot: 4,
|
|
|
slot: 4,
|
|
|
equipped: true,
|
|
|
equipped: true,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
let mag = entity_gateway.create_item(
|
|
|
|
|
|
item::NewItemEntity {
|
|
|
|
|
|
item: item::ItemDetail::Mag(item::mag::Mag::baby_mag(0)),
|
|
|
|
|
|
location: item::ItemLocation::Inventory {
|
|
|
|
|
|
character_id: character.id,
|
|
|
|
|
|
slot: 5,
|
|
|
|
|
|
equipped: true,
|
|
|
|
|
|
}
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
for _ in 0..10 {
|
|
|
|
|
|
let fed_tool = entity_gateway.create_item(
|
|
|
|
|
|
NewItemEntity {
|
|
|
|
|
|
item: ItemDetail::Tool (
|
|
|
|
|
|
item::tool::Tool {
|
|
|
|
|
|
tool: item::tool::ToolType::Monomate,
|
|
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
location: item::ItemLocation::FedToMag {
|
|
|
|
|
|
mag: mag.id,
|
|
|
|
|
|
}
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
entity_gateway.feed_mag(&mag.id, &fed_tool.id).await.unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
//entity_gateway.bank(&mag.id).await;
|
|
|
|
|
|
entity_gateway.change_mag_owner(&mag.id, &character).await.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
|
|
|
item::NewItemEntity {
|
|
|
|
|
|
item: ItemDetail::Tool (
|
|
|
|
|
|
item::tool::Tool {
|
|
|
|
|
|
tool: item::tool::ToolType::CellOfMag502,
|
|
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
location: item::ItemLocation::Inventory {
|
|
|
|
|
|
character_id: character.id,
|
|
|
|
|
|
slot: 6,
|
|
|
|
|
|
equipped: true,
|
|
|
|
|
|
}
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
let cell = entity_gateway.create_item(
|
|
|
|
|
|
item::NewItemEntity {
|
|
|
|
|
|
item: ItemDetail::Tool (
|
|
|
|
|
|
item::tool::Tool {
|
|
|
|
|
|
tool: item::tool::ToolType::CellOfMag502,
|
|
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
location: item::ItemLocation::Consumed,
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
entity_gateway.use_mag_cell(&mag.id, &cell.id).await.unwrap();
|
|
|
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
NewItemEntity {
|
|
|
NewItemEntity {
|
|
|
item: ItemDetail::Weapon(
|
|
|
item: ItemDetail::Weapon(
|
|
@ -326,7 +411,7 @@ fn main() { |
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
info!("[ship] starting server");
|
|
|
info!("[ship] starting server");
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
.name("Sona-Nyl".into())
|
|
|
|
|
|
|
|
|
.name("US/Sona-Nyl".into())
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.port(elseware::ship::ship::SHIP_PORT)
|
|
|
.port(elseware::ship::ship::SHIP_PORT)
|
|
|
.gateway(thread_entity_gateway)
|
|
|
.gateway(thread_entity_gateway)
|
|
@ -335,7 +420,7 @@ fn main() { |
|
|
|
|
|
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
.name("Dylath-Leen".into())
|
|
|
|
|
|
|
|
|
.name("EU/Dylath-Leen".into())
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.port(elseware::ship::ship::SHIP_PORT+2000)
|
|
|
.port(elseware::ship::ship::SHIP_PORT+2000)
|
|
|
.gateway(thread_entity_gateway)
|
|
|
.gateway(thread_entity_gateway)
|
|
@ -344,7 +429,7 @@ fn main() { |
|
|
|
|
|
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
let ship_state = ShipServerStateBuilder::new()
|
|
|
.name("Thalarion".into())
|
|
|
|
|
|
|
|
|
.name("JP/Thalarion".into())
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.ip(Ipv4Addr::new(127,0,0,1))
|
|
|
.port(elseware::ship::ship::SHIP_PORT+3000)
|
|
|
.port(elseware::ship::ship::SHIP_PORT+3000)
|
|
|
.gateway(thread_entity_gateway)
|
|
|
.gateway(thread_entity_gateway)
|
|
|