|
@ -1,28 +1,28 @@ |
|
|
|
|
|
#![allow(dead_code, unused_must_use)]
|
|
|
use std::collections::HashMap;
|
|
|
use std::collections::HashMap;
|
|
|
use log::warn;
|
|
|
|
|
|
|
|
|
|
|
|
use rand::Rng;
|
|
|
use rand::Rng;
|
|
|
use thiserror::Error;
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
use libpso::packet::ship::*;
|
|
|
use libpso::packet::ship::*;
|
|
|
use libpso::packet::login::{Login, LoginResponse, AccountStatus, Session};
|
|
|
|
|
|
|
|
|
use libpso::packet::login::{Login, LoginResponse, Session};
|
|
|
use libpso::packet::messages::*;
|
|
|
use libpso::packet::messages::*;
|
|
|
use libpso::{PacketParseError, PSOPacket};
|
|
|
use libpso::{PacketParseError, PSOPacket};
|
|
|
use libpso::crypto::bb::PSOBBCipher;
|
|
|
use libpso::crypto::bb::PSOBBCipher;
|
|
|
use libpso::character::character;
|
|
|
|
|
|
|
|
|
|
|
|
use libpso::packet::ship::{BLOCK_MENU_ID, ROOM_MENU_ID};
|
|
|
use libpso::packet::ship::{BLOCK_MENU_ID, ROOM_MENU_ID};
|
|
|
use libpso::{utf8_to_array, utf8_to_utf16_array};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crate::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY};
|
|
|
use crate::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY};
|
|
|
use crate::common::serverstate::{SendServerPacket, RecvServerPacket, ServerState, OnConnect, ClientId};
|
|
|
use crate::common::serverstate::{SendServerPacket, RecvServerPacket, ServerState, OnConnect, ClientId};
|
|
|
use crate::common::leveltable::CharacterLevelTable;
|
|
|
use crate::common::leveltable::CharacterLevelTable;
|
|
|
|
|
|
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
use crate::entity::account::{UserAccountEntity, UserSettingsEntity, USERFLAG_NEWCHAR, USERFLAG_DRESSINGROOM};
|
|
|
|
|
|
|
|
|
use crate::entity::account::{UserAccountEntity, UserSettingsEntity};
|
|
|
use crate::entity::character::CharacterEntity;
|
|
|
use crate::entity::character::CharacterEntity;
|
|
|
use crate::entity::item::{ItemLocation, ItemEntity};
|
|
|
|
|
|
use crate::ship::location::{ClientLocation, LobbyId, RoomId, RoomLobby, MAX_ROOMS, ClientLocationError};
|
|
|
|
|
|
use crate::ship::character::{CharacterBytesBuilder, FullCharacterBytesBuilder};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crate::ship::location::{ClientLocation, RoomLobby, MAX_ROOMS, ClientLocationError};
|
|
|
|
|
|
|
|
|
use crate::ship::items;
|
|
|
use crate::ship::items;
|
|
|
use crate::ship::room;
|
|
|
use crate::ship::room;
|
|
|
use crate::ship::map::MapsError;
|
|
|
use crate::ship::map::MapsError;
|
|
@ -243,7 +243,7 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> { |
|
|
type RecvPacket = RecvShipPacket;
|
|
|
type RecvPacket = RecvShipPacket;
|
|
|
type PacketError = ShipError;
|
|
|
type PacketError = ShipError;
|
|
|
|
|
|
|
|
|
fn on_connect(&mut self, id: ClientId) -> Vec<OnConnect<Self::SendPacket>> {
|
|
|
|
|
|
|
|
|
fn on_connect(&mut self, _id: ClientId) -> Vec<OnConnect<Self::SendPacket>> {
|
|
|
let mut rng = rand::thread_rng();
|
|
|
let mut rng = rand::thread_rng();
|
|
|
|
|
|
|
|
|
let mut server_key = [0u8; 48];
|
|
|
let mut server_key = [0u8; 48];
|
|
@ -305,8 +305,8 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> { |
|
|
RecvShipPacket::UpdateConfig(pkt) => {
|
|
|
RecvShipPacket::UpdateConfig(pkt) => {
|
|
|
handler::settings::update_config(id, pkt, &mut self.clients, &mut self.entity_gateway)
|
|
|
handler::settings::update_config(id, pkt, &mut self.clients, &mut self.entity_gateway)
|
|
|
},
|
|
|
},
|
|
|
RecvShipPacket::ViewInfoboardRequest(pkt) => {
|
|
|
|
|
|
handler::communication::request_infoboard(id, pkt, &self.client_location, &self.clients)
|
|
|
|
|
|
|
|
|
RecvShipPacket::ViewInfoboardRequest(_pkt) => {
|
|
|
|
|
|
handler::communication::request_infoboard(id, &self.client_location, &self.clients)
|
|
|
},
|
|
|
},
|
|
|
RecvShipPacket::WriteInfoboard(pkt) => {
|
|
|
RecvShipPacket::WriteInfoboard(pkt) => {
|
|
|
handler::communication::write_infoboard(id, pkt, &mut self.clients, &mut self.entity_gateway)
|
|
|
handler::communication::write_infoboard(id, pkt, &mut self.clients, &mut self.entity_gateway)
|
|
|