|
|
@ -17,7 +17,7 @@ use crate::common::serverstate::{SendServerPacket, RecvServerPacket, ServerState |
|
|
|
use crate::common::leveltable::CharacterLevelTable;
|
|
|
|
|
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
|
use crate::entity::account::{UserAccount, UserSettings, USERFLAG_NEWCHAR, USERFLAG_DRESSINGROOM};
|
|
|
|
use crate::entity::account::{UserAccountEntity, UserSettingsEntity, USERFLAG_NEWCHAR, USERFLAG_DRESSINGROOM};
|
|
|
|
use crate::entity::character::CharacterEntity;
|
|
|
|
use crate::entity::item::{ItemLocation, ItemEntity};
|
|
|
|
use crate::login::login::get_login_status;
|
|
|
@ -119,8 +119,8 @@ impl SendServerPacket for SendShipPacket { |
|
|
|
}
|
|
|
|
|
|
|
|
struct ClientState {
|
|
|
|
user: UserAccount,
|
|
|
|
settings: UserSettings,
|
|
|
|
user: UserAccountEntity,
|
|
|
|
settings: UserSettingsEntity,
|
|
|
|
character: CharacterEntity,
|
|
|
|
session: Session,
|
|
|
|
//guildcard: GuildCard,
|
|
|
@ -130,7 +130,7 @@ struct ClientState { |
|
|
|
}
|
|
|
|
|
|
|
|
impl ClientState {
|
|
|
|
fn new(user: UserAccount, settings: UserSettings, character: CharacterEntity, inventory: items::ActiveInventory, /*bank: Bank,*/ session: Session) -> ClientState {
|
|
|
|
fn new(user: UserAccountEntity, settings: UserSettingsEntity, character: CharacterEntity, inventory: items::ActiveInventory, /*bank: Bank,*/ session: Session) -> ClientState {
|
|
|
|
ClientState {
|
|
|
|
user: user,
|
|
|
|
settings: settings,
|
|
|
@ -171,7 +171,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
Ok(match get_login_status(&self.entity_gateway, pkt) {
|
|
|
|
Ok(user) => {
|
|
|
|
let mut response = LoginResponse::by_status(AccountStatus::Ok, Session::new());
|
|
|
|
response.guildcard = user.id as u32;
|
|
|
|
response.guildcard = user.id.0 as u32;
|
|
|
|
response.team_id = user.team_id.map_or(31, |ti| ti) as u32;
|
|
|
|
let characters = self.entity_gateway.get_characters_by_user(&user);
|
|
|
|
let character = characters
|
|
|
@ -233,7 +233,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
PlayerInfo {
|
|
|
|
header: PlayerHeader {
|
|
|
|
tag: 0x100,
|
|
|
|
guildcard: client.user.id,
|
|
|
|
guildcard: client.user.id.0,
|
|
|
|
_unknown1: [0; 5],
|
|
|
|
client_id: room_client.index as u32,
|
|
|
|
name: c.name,
|
|
|
@ -289,7 +289,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
playerinfo: PlayerInfo {
|
|
|
|
header: PlayerHeader {
|
|
|
|
tag: 0x100,
|
|
|
|
guildcard: client.user.id,
|
|
|
|
guildcard: client.user.id.0,
|
|
|
|
_unknown1: [0; 5],
|
|
|
|
client_id: client_id as u32,
|
|
|
|
name: c.name,
|
|
|
@ -336,7 +336,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
msg: GameMessage::GuildcardRecv(GuildcardRecv {
|
|
|
|
client: guildcard_send.client,
|
|
|
|
target: guildcard_send.target,
|
|
|
|
guildcard: client.user.id,
|
|
|
|
guildcard: client.user.id.0,
|
|
|
|
name: utf8_to_utf16_array!(client.character.name, 0x18),
|
|
|
|
team: [0; 0x10], // TODO: teams not yet implemented
|
|
|
|
desc: utf8_to_utf16_array!(client.character.guildcard.description, 0x58),
|
|
|
@ -365,7 +365,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
|
|
|
|
fn player_chat(&mut self, id: ClientId, msg: &PlayerChat) -> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError> {
|
|
|
|
let client = self.clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
let cmsg = PlayerChat::new(client.user.id, msg.message.clone());
|
|
|
|
let cmsg = PlayerChat::new(client.user.id.0, msg.message.clone());
|
|
|
|
|
|
|
|
Ok(Box::new(self.client_location.get_area_by_user(id).clients().iter()
|
|
|
|
.map(move |client| {
|
|
|
@ -392,7 +392,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
|
let client = self.clients.get_mut(&id).unwrap();//.ok_or(ShipError::ClientNotFound(id)).unwrap();
|
|
|
|
let players = [PlayerHeader {
|
|
|
|
tag: 0x00010000,
|
|
|
|
guildcard: client.user.id,
|
|
|
|
guildcard: client.user.id.0,
|
|
|
|
_unknown1: [0; 5],
|
|
|
|
client_id: 0,
|
|
|
|
name: libpso::utf8_to_utf16_array!(client.character.name, 16),
|
|
|
|