diff --git a/Dockerfile-service b/Dockerfile-service index 9234785..3cbc311 100644 --- a/Dockerfile-service +++ b/Dockerfile-service @@ -1,4 +1,4 @@ -FROM alpine:3.20 as release +FROM alpine:3.20 ARG MICROSERVICE WORKDIR /app diff --git a/common/src/config_util.rs b/common/src/config_util.rs index a7031a9..ff59adb 100644 --- a/common/src/config_util.rs +++ b/common/src/config_util.rs @@ -4,7 +4,7 @@ pub trait TomlConfig: DeserializeOwned { const DEFAULT_TOML: &str; } -pub fn load_or_create<'a, C>(path: &str) -> C +pub fn load_or_create(path: &str) -> C where C: DeserializeOwned + TomlConfig, { diff --git a/common/src/time_util.rs b/common/src/time_util.rs index 450d598..050c89f 100644 --- a/common/src/time_util.rs +++ b/common/src/time_util.rs @@ -4,7 +4,7 @@ pub fn unix_timestamp() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() - .as_secs() as u64 + .as_secs() } pub fn unix_timestamp_ms() -> u64 { diff --git a/game-server/src/logic/components/attribute.rs b/game-server/src/logic/components/attribute.rs index 9269f1e..d37c61a 100644 --- a/game-server/src/logic/components/attribute.rs +++ b/game-server/src/logic/components/attribute.rs @@ -26,10 +26,7 @@ macro_rules! impl_from_data { impl Component for Attribute { fn set_pb_data(&self, pb: &mut shorekeeper_protocol::EntityPb) { - pb.living_status = self - .is_alive() - .then_some(LivingStatus::Alive) - .unwrap_or(LivingStatus::Dead) + pb.living_status = (if self.is_alive() { LivingStatus::Alive } else { LivingStatus::Dead }) .into(); pb.component_pbs.push(EntityComponentPb { diff --git a/game-server/src/logic/components/mod.rs b/game-server/src/logic/components/mod.rs index 33f840b..d090d34 100644 --- a/game-server/src/logic/components/mod.rs +++ b/game-server/src/logic/components/mod.rs @@ -5,6 +5,7 @@ mod owner_player; mod player_entity_marker; mod position; mod visibility; +mod weapon; pub use attribute::Attribute; pub use entity_config::EntityConfig; @@ -13,3 +14,4 @@ pub use owner_player::OwnerPlayer; pub use player_entity_marker::PlayerEntityMarker; pub use position::Position; pub use visibility::Visibility; +pub use weapon::Weapon; diff --git a/game-server/src/logic/components/weapon.rs b/game-server/src/logic/components/weapon.rs new file mode 100644 index 0000000..a2e6031 --- /dev/null +++ b/game-server/src/logic/components/weapon.rs @@ -0,0 +1,19 @@ +use shorekeeper_protocol::{EntityComponentPb, EquipComponentPb}; +use shorekeeper_protocol::entity_component_pb::ComponentPb; +use crate::logic::ecs::component::Component; + +pub struct Weapon { + pub weapon_id: i32, + pub weapon_breach_level: i32, +} + +impl Component for Weapon { + fn set_pb_data(&self, pb: &mut shorekeeper_protocol::EntityPb) { + pb.component_pbs.push(EntityComponentPb { + component_pb: Some(ComponentPb::EquipComponent(EquipComponentPb { + weapon_id: self.weapon_id, + weapon_breach_level: self.weapon_breach_level, + })) + }) + } +} diff --git a/game-server/src/logic/ecs/component.rs b/game-server/src/logic/ecs/component.rs index bf073be..a50c162 100644 --- a/game-server/src/logic/ecs/component.rs +++ b/game-server/src/logic/ecs/component.rs @@ -30,6 +30,7 @@ impl_component_container! { Attribute; PlayerEntityMarker; Movement; + Weapon; } pub trait Component { diff --git a/game-server/src/logic/ecs/mod.rs b/game-server/src/logic/ecs/mod.rs index abd3564..6c51998 100644 --- a/game-server/src/logic/ecs/mod.rs +++ b/game-server/src/logic/ecs/mod.rs @@ -59,6 +59,6 @@ macro_rules! query_components { }), )*) }) - .unwrap_or_else(|| ($( crate::ident_as_none!($comp), )*)) + .unwrap_or_else(|| ($( $crate::ident_as_none!($comp), )*)) }; } diff --git a/game-server/src/logic/ecs/world.rs b/game-server/src/logic/ecs/world.rs index e8dfbe2..28e4291 100644 --- a/game-server/src/logic/ecs/world.rs +++ b/game-server/src/logic/ecs/world.rs @@ -24,7 +24,7 @@ impl World { pub fn create_entity(&mut self) -> EntityBuilder { let entity = self.entity_manager.create(); - EntityBuilder::builder(entity, self.components.entry(entity).or_insert(Vec::new())) + EntityBuilder::builder(entity, self.components.entry(entity).or_default()) } pub fn is_in_world(&self, entity_id: i64) -> bool { diff --git a/game-server/src/logic/handler/mod.rs b/game-server/src/logic/handler/mod.rs index 3d00785..72ae68a 100644 --- a/game-server/src/logic/handler/mod.rs +++ b/game-server/src/logic/handler/mod.rs @@ -4,23 +4,23 @@ pub use scene::*; use shorekeeper_protocol::message::Message; macro_rules! handle_request { - ($($name:ident;)*) => { + ($($name:ident $(, $inner_package:ident)?;)*) => { fn handle_request(player: &mut super::player::Player, mut msg: Message) { use ::shorekeeper_protocol::{MessageID, Protobuf}; ::paste::paste! { match msg.get_message_id() { $( - ::shorekeeper_protocol::[<$name Request>]::MESSAGE_ID => { - let Ok(request) = ::shorekeeper_protocol::[<$name Request>]::decode(&*msg.remove_payload()) else { - tracing::debug!("failed to decode {}, player_id: {}", stringify!([<$name Request>]), player.basic_info.id); + ::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => { + let Ok(request) = ::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::decode(&*msg.remove_payload()) else { + tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), player.basic_info.id); return; }; - tracing::debug!("logic: processing request {}", stringify!([<$name Request>])); + tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>])); - let mut response = ::shorekeeper_protocol::[<$name Response>]::default(); - [](player, request, &mut response); + let mut response = ::shorekeeper_protocol::$($inner_package::)?[<$name Response>]::default(); + [](player, request, &mut response); player.respond(response, msg.get_rpc_id()); }, @@ -33,20 +33,22 @@ macro_rules! handle_request { } macro_rules! handle_push { - ($($name:ident;)*) => { + ($($name:ident $(, $inner_package:ident)?;)*) => { fn handle_push(player: &mut super::player::Player, mut msg: Message) { use ::shorekeeper_protocol::{MessageID, Protobuf}; ::paste::paste! { match msg.get_message_id() { $( - ::shorekeeper_protocol::[<$name Push>]::MESSAGE_ID => { - let Ok(push) = ::shorekeeper_protocol::[<$name Push>]::decode(&*msg.remove_payload()) else { - tracing::debug!("failed to decode {}, player_id: {}", stringify!([<$name Push>]), player.basic_info.id); + ::shorekeeper_protocol::$($inner_package::)?[<$name Push>]::MESSAGE_ID => { + let Ok(push) = ::shorekeeper_protocol::$($inner_package::)?[<$name Push>]::decode(&*msg.remove_payload()) else { + tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Push>]), player.basic_info.id); return; }; - [](player, push); + tracing::debug!("logic: processing push {}", stringify!($($inner_package::)?[<$name Push>])); + + [](player, push); }, )* unhandled => ::tracing::warn!("can't find handler for push with message_id={unhandled}") @@ -60,6 +62,7 @@ handle_request! { UpdateSceneDate; EntityActive; EntityOnLanded; + CombatSendPack, combat_message; } handle_push! { diff --git a/game-server/src/logic/handler/scene.rs b/game-server/src/logic/handler/scene.rs index 0f47681..827ae17 100644 --- a/game-server/src/logic/handler/scene.rs +++ b/game-server/src/logic/handler/scene.rs @@ -2,6 +2,7 @@ use shorekeeper_protocol::{ EntityActiveRequest, EntityActiveResponse, EntityOnLandedRequest, EntityOnLandedResponse, ErrorCode, MovePackagePush, UpdateSceneDateRequest, UpdateSceneDateResponse, }; +use shorekeeper_protocol::combat_message::{CombatSendPackRequest, CombatSendPackResponse}; use crate::{logic::ecs::component::ComponentContainer, logic::player::Player, query_components}; @@ -13,6 +14,14 @@ pub fn on_update_scene_date_request( response.error_code = ErrorCode::Success.into(); } +pub fn on_combat_message_combat_send_pack_request( + _player: &Player, + _request: CombatSendPackRequest, + response: &mut CombatSendPackResponse, +) { + response.error_code = ErrorCode::Success.into(); +} + pub fn on_entity_active_request( player: &Player, request: EntityActiveRequest, diff --git a/game-server/src/logic/player/mod.rs b/game-server/src/logic/player/mod.rs index fd1331a..671b173 100644 --- a/game-server/src/logic/player/mod.rs +++ b/game-server/src/logic/player/mod.rs @@ -43,7 +43,7 @@ impl Player { // we need shorekeeper // TODO: remove this part after implementing team switch if !self.role_list.iter().any(|r| r.role_id == 1505) { - self.role_list.push(Role::new(1505)); + self.role_list.push(Role::new(1505, Some(21050036))); } self.formation_list.clear(); @@ -126,8 +126,7 @@ impl Player { .unwrap() .role_id_set .iter() - .map(|id| self.role_list.iter().find(|r| r.role_id == *id)) - .flatten() + .flat_map(|id| self.role_list.iter().find(|r| r.role_id == *id)) .collect() } @@ -217,8 +216,8 @@ impl Player { fn create_main_character_role(name: String, sex: i32) -> Role { let mut role = match sex { - 0 => Role::new(Role::MAIN_CHARACTER_FEMALE_ID), - 1 => Role::new(Role::MAIN_CHARACTER_MALE_ID), + 0 => Role::new(Role::MAIN_CHARACTER_FEMALE_ID, None), + 1 => Role::new(Role::MAIN_CHARACTER_MALE_ID, None), _ => unreachable!(), }; diff --git a/game-server/src/logic/role/mod.rs b/game-server/src/logic/role/mod.rs index beaafc1..e3a76a0 100644 --- a/game-server/src/logic/role/mod.rs +++ b/game-server/src/logic/role/mod.rs @@ -1,12 +1,11 @@ use std::collections::HashMap; use common::time_util; +pub use formation::RoleFormation; use shorekeeper_data::role_info_data; use shorekeeper_protocol::{ArrayIntInt, RoleData, RoleInfo}; mod formation; -pub use formation::RoleFormation; - pub struct Role { pub role_id: i32, pub name: String, @@ -17,14 +16,19 @@ pub struct Role { pub star: i32, pub favor: i32, pub create_time: u32, + pub equip_weapon: i32, } impl Role { pub const MAIN_CHARACTER_MALE_ID: i32 = 1501; pub const MAIN_CHARACTER_FEMALE_ID: i32 = 1502; - pub fn new(role_id: i32) -> Self { + pub fn new(role_id: i32, weapon_id: Option) -> Self { let data = role_info_data::iter().find(|d| d.id == role_id).unwrap(); + let equip_weapon = match weapon_id { + None => data.init_weapon_item_id, + Some(x) => x, + }; Self { role_id, @@ -36,6 +40,7 @@ impl Role { star: 0, favor: 0, create_time: time_util::unix_timestamp() as u32, + equip_weapon, } } @@ -69,6 +74,7 @@ impl Role { star: data.star, favor: data.favor, create_time: data.create_time, + equip_weapon: data.equip_weapon, } } @@ -83,6 +89,7 @@ impl Role { star: self.star, favor: self.favor, create_time: self.create_time, + equip_weapon: self.equip_weapon, ..Default::default() } } diff --git a/game-server/src/logic/thread_mgr.rs b/game-server/src/logic/thread_mgr.rs index 8ebd476..e91667b 100644 --- a/game-server/src/logic/thread_mgr.rs +++ b/game-server/src/logic/thread_mgr.rs @@ -11,8 +11,9 @@ use std::{ }; use common::time_util; -use shorekeeper_protocol::{message::Message, JoinSceneNotify, TransitionOptionPb}; -use shorekeeper_protocol::{AfterJoinSceneNotify, EnterGameResponse, PlayerSaveData}; +use shorekeeper_protocol::{message::Message, JoinSceneNotify, TransitionOptionPb, + AfterJoinSceneNotify, EnterGameResponse, JsPatchNotify}; +use shorekeeper_protocol::{PlayerSaveData}; use crate::{ player_save_task::{self, PlayerSaveReason}, @@ -21,6 +22,9 @@ use crate::{ use super::{ecs::world::World, player::Player, utils::world_util}; +const WATER_MASK: &str = include_str!("../../watermask.js"); +const UID_FIX: &str = include_str!("../../uidfix.js"); + pub enum LogicInput { AddPlayer { player_id: i32, @@ -105,8 +109,7 @@ fn logic_thread_func(receiver: mpsc::Receiver, load: Arc>(); super::systems::tick_systems(&mut world, &mut players); @@ -164,6 +167,14 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) { scene_info: Some(scene_info), transition_option: Some(TransitionOptionPb::default()), }); + player.notify(JsPatchNotify { + content: WATER_MASK.to_string(), + }); + player.notify(JsPatchNotify { + content: UID_FIX + .replace("{PLAYER_USERNAME}", &player.basic_info.name) + .replace("{SELECTED_COLOR}", "50FC71"), + }); player.respond(EnterGameResponse::default(), enter_rpc_id); player.notify(AfterJoinSceneNotify::default()); diff --git a/game-server/src/logic/utils/entity_serializer.rs b/game-server/src/logic/utils/entity_serializer.rs index 05d2639..c3d32b8 100644 --- a/game-server/src/logic/utils/entity_serializer.rs +++ b/game-server/src/logic/utils/entity_serializer.rs @@ -11,8 +11,7 @@ pub fn build_scene_add_on_init_data(world: &World) -> PlayerSceneAoiData { let mut aoi_data = PlayerSceneAoiData::default(); for entity in entities { - let mut pb = EntityPb::default(); - pb.id = entity.into(); + let mut pb = EntityPb { id: entity.into(), ..Default::default() }; world .get_entity_components(entity) diff --git a/game-server/src/logic/utils/world_util.rs b/game-server/src/logic/utils/world_util.rs index dbf74e1..5099a17 100644 --- a/game-server/src/logic/utils/world_util.rs +++ b/game-server/src/logic/utils/world_util.rs @@ -8,14 +8,13 @@ use crate::{ logic::{ components::{ Attribute, EntityConfig, Movement, OwnerPlayer, PlayerEntityMarker, Position, - Visibility, + Visibility, Weapon }, ecs::{component::ComponentContainer, world::World}, player::Player, }, query_with, }; - use super::entity_serializer; pub fn add_player_entities(world: &mut World, player: &Player) { @@ -44,6 +43,10 @@ pub fn add_player_entities(world: &mut World, player: &Player) { .unwrap(), ))) .with(ComponentContainer::Movement(Movement::default())) + .with(ComponentContainer::Weapon(Weapon { + weapon_id: role.equip_weapon, + weapon_breach_level: 0, // TODO: store this too + })) .build(); tracing::debug!( diff --git a/game-server/uidfix.js b/game-server/uidfix.js new file mode 100644 index 0000000..48d15c0 --- /dev/null +++ b/game-server/uidfix.js @@ -0,0 +1,9 @@ +setTimeout(() => { + const UiManager_1 = require("../Ui/UiManager"); + const UE = require("ue"); + const ControllerManagerBase_1 = require("../../Core/Framework/ControllerManagerBase"); + + const UiText = UiManager_1.UiManager.GetViewByName("UidView").GetText(0); + UiText.SetText("{PLAYER_USERNAME} - Reversed Rooms"); + UiText.SetColor(UE. Color.FromHex("{SELECTED_COLOR}")); +}, 10000); \ No newline at end of file diff --git a/game-server/watermask.js b/game-server/watermask.js new file mode 100644 index 0000000..f2efcaf --- /dev/null +++ b/game-server/watermask.js @@ -0,0 +1,38 @@ +const UE = require("ue"), + Info_1 = require("../../../Core/Common/Info"), + MathUtils_1 = require("../../../Core/Utils/MathUtils"), + EventDefine_1 = require("../../Common/Event/EventDefine"), + EventSystem_1 = require("../../Common/Event/EventSystem"), + UiControllerBase_1 = require("../../Ui/Base/UiControllerBase"), + UiLayerType_1 = require("../../Ui/Define/UiLayerType"), + UiLayer_1 = require("../../Ui/UiLayer"); + +var _a = require('../Module/WaterMask/WaterMaskController').WaterMaskView; +_a.vOo = function () { + void 0 !== _a.SOo && _a.EOo(); + var e = UiLayer_1.UiLayer.GetLayerRootUiItem(UiLayerType_1.ELayerType.WaterMask), + t = (_a.SOo = UE.KuroActorManager.SpawnActor(Info_1.Info.World, UE.UIContainerActor.StaticClass(), + MathUtils_1.MathUtils.DefaultTransform, void 0), _a.SOo.RootComponent), + e = (t.SetDisplayName("WaterMaskContainer"), UE.KuroStaticLibrary.SetActorPermanent(_a.SOo, !0, !0), _a.SOo + .K2_AttachRootComponentTo(e), t.GetRootCanvas().GetOwner().RootComponent), + i = e.widget.width % _a.yOo / 2, + r = e.widget.height % _a.IOo / 2, + n = e.widget.width / 2, + _ = e.widget.height / 2, + s = Math.ceil(e.widget.width / _a.yOo), + o = Math.ceil(e.widget.height / _a.IOo), + v = "discord.gg/reversedrooms"; + for (let a = 0; a < s; a++) + for (let e = 0; e < o; e++) { + var E = UE.KuroActorManager.SpawnActor(Info_1.Info.World, UE.UITextActor.StaticClass(), MathUtils_1 + .MathUtils.DefaultTransform, void 0), + U = E.RootComponent, + U = (E.K2_AttachRootComponentTo(t), U.SetDisplayName("WaterMaskText"), E.GetComponentByClass(UE + .UIText.StaticClass())); + U.SetFontSize(_a.vFt), U.SetOverflowType(0), U.SetAlpha(_a.LOo), U.SetFont(UE.LGUIFontData + .GetDefaultFont()), U.SetText(v), U.SetUIRelativeLocation(new UE.Vector(a * _a.yOo - n + i, e * + _a.IOo - _ + r, 0)), U.SetUIRelativeRotation(new UE.Rotator(0, _a.TOo, 0)), UE.KuroStaticLibrary + .SetActorPermanent(E, !0, !0) + } +}; +_a.vOo(); \ No newline at end of file diff --git a/gateway-server/kcp/src/kcp.rs b/gateway-server/kcp/src/kcp.rs index 7d5ef80..ea88edd 100644 --- a/gateway-server/kcp/src/kcp.rs +++ b/gateway-server/kcp/src/kcp.rs @@ -867,7 +867,7 @@ impl Kcp { } let mut ts_flush = self.ts_flush; - let mut tm_packet = u32::max_value(); + let mut tm_packet = u32::MAX; if timediff(current, ts_flush) >= 10000 || timediff(current, ts_flush) < -10000 { ts_flush = current; @@ -1142,7 +1142,7 @@ impl Kcp { let resent = if self.fastresend > 0 { self.fastresend } else { - u32::max_value() + u32::MAX }; let rtomin = if !self.nodelay { self.rx_rto >> 3 } else { 0 }; @@ -1381,7 +1381,7 @@ impl Kcp { let resent = if self.fastresend > 0 { self.fastresend } else { - u32::max_value() + u32::MAX }; let rtomin = if !self.nodelay { self.rx_rto >> 3 } else { 0 }; diff --git a/gateway-server/src/handler/client_request_handler.rs b/gateway-server/src/handler/client_request_handler.rs index f9a9775..c481643 100644 --- a/gateway-server/src/handler/client_request_handler.rs +++ b/gateway-server/src/handler/client_request_handler.rs @@ -140,7 +140,7 @@ async fn on_login_request( session.player_id = Some(player_id); response.code = ErrorCode::Success.into(); - response.timestamp = time_util::unix_timestamp() as i64; + response.timestamp = time_util::unix_timestamp_ms() as i64; tracing::info!( "login success, user_id: {}, player_id: {}", diff --git a/gateway-server/src/session/mod.rs b/gateway-server/src/session/mod.rs index 37a7d80..c207728 100644 --- a/gateway-server/src/session/mod.rs +++ b/gateway-server/src/session/mod.rs @@ -155,11 +155,11 @@ impl Session { fn next_message(&mut self) -> Option { self.decoder.pop_with(|buf| { - Message::decode(&buf) + Message::decode(buf) .inspect_err(|err| { tracing::error!( "failed to decode a message, err: {err}, buf: {}", - hex::encode(&buf) + hex::encode(buf) ) }) .ok() diff --git a/gateway-server/src/session/util.rs b/gateway-server/src/session/util.rs index 4e49740..effe8ed 100644 --- a/gateway-server/src/session/util.rs +++ b/gateway-server/src/session/util.rs @@ -15,8 +15,7 @@ impl LengthFieldBasedDecoder { pub fn input(&mut self, data: &[u8]) { self.ensure_capacity(data.len()); - - (&mut self.buffer[self.cur_index..self.cur_index + data.len()]).copy_from_slice(data); + self.buffer[self.cur_index..self.cur_index + data.len()].copy_from_slice(data); self.cur_index += data.len(); } diff --git a/gateway-server/src/udp_server.rs b/gateway-server/src/udp_server.rs index 9773ac9..f56ac71 100644 --- a/gateway-server/src/udp_server.rs +++ b/gateway-server/src/udp_server.rs @@ -64,7 +64,7 @@ impl UdpServer { conv_id, addr, self.socket.clone(), - &self.protokey_helper, + self.protokey_helper, self.db.clone(), ); self.session_mgr.add(conv_id, session); diff --git a/login-server/src/handler.rs b/login-server/src/handler.rs index 2e78ff1..27e1259 100644 --- a/login-server/src/handler.rs +++ b/login-server/src/handler.rs @@ -11,13 +11,10 @@ pub async fn handle_login_api_call( tracing::debug!("login requested"); let user_data = parameters.user_data; - let result = match login(&state, parameters).await { - Ok(result) => result, - Err(err) => { - tracing::warn!("login: internal error occurred {err:?}"); - schema::LoginResult::error(-1, String::from("Internal server error")) - } - }; + let result = login(&state, parameters).await.unwrap_or_else(|err| { + tracing::warn!("login: internal error occurred {err:?}"); + schema::LoginResult::error(-1, String::from("Internal server error")) + }); Json(result.with_user_data(user_data)) } @@ -32,7 +29,7 @@ async fn login(state: &ServiceState, params: schema::LoginParameters) -> Result< Some(account) => { if let Some(ban_time_stamp) = account.ban_time_stamp { if time_util::unix_timestamp() < ban_time_stamp as u64 { - return Ok(schema::LoginResult::banned(String::from("You're banned MF"), ban_time_stamp as i64)); + return Ok(schema::LoginResult::banned(String::from("You're banned MF"), ban_time_stamp)); } } diff --git a/shorekeeper-http/src/lib.rs b/shorekeeper-http/src/lib.rs index e366d3b..9ae3725 100644 --- a/shorekeeper-http/src/lib.rs +++ b/shorekeeper-http/src/lib.rs @@ -24,6 +24,12 @@ pub struct Application { impl Application<()> { pub fn new() -> Self { + Default::default() + } +} + +impl Default for Application<()> { + fn default() -> Self { Self { router: Router::new(), state: (), diff --git a/shorekeeper-network/src/message.rs b/shorekeeper-network/src/message.rs index ee43db2..5aa19b5 100644 --- a/shorekeeper-network/src/message.rs +++ b/shorekeeper-network/src/message.rs @@ -15,7 +15,7 @@ impl ServiceMessage { w.write_u16::(self.rpc_id)?; w.write_u16::(self.message_id)?; w.write_u32::(self.data.len() as u32)?; - w.write(&self.data)?; + w.write_all(&self.data)?; Ok(()) } diff --git a/shorekeeper-network/src/server.rs b/shorekeeper-network/src/server.rs index bdeb161..1d6d66c 100644 --- a/shorekeeper-network/src/server.rs +++ b/shorekeeper-network/src/server.rs @@ -28,8 +28,7 @@ impl ServiceListener { for message in data .into_vec() .into_iter() - .map(|b| ServiceMessage::decode(b.as_ref())) - .flatten() + .flat_map(|b| ServiceMessage::decode(b.as_ref())) { let _ = sender.send(message).await; } diff --git a/shorekeeper-protocol/build.rs b/shorekeeper-protocol/build.rs index 23eec8f..14e3a4f 100644 --- a/shorekeeper-protocol/build.rs +++ b/shorekeeper-protocol/build.rs @@ -15,7 +15,7 @@ pub fn main() { let config_path = Path::new("proto/config.csv"); if config_path.exists() { println!("cargo:rerun-if-changed={config_file}"); - impl_proto_config(config_path, &Path::new("generated/proto_config.rs")).unwrap(); + impl_proto_config(config_path, Path::new("generated/proto_config.rs")).unwrap(); } let proto_file = "proto/shorekeeper.proto"; diff --git a/shorekeeper-protocol/proto/data.proto b/shorekeeper-protocol/proto/data.proto index 637e418..87e4d68 100644 --- a/shorekeeper-protocol/proto/data.proto +++ b/shorekeeper-protocol/proto/data.proto @@ -43,6 +43,7 @@ message RoleData { repeated int32 models = 12; repeated RoleSkillNodeData skill_node_state = 13; int32 resonant_chain_group_index = 14; + int32 equip_weapon = 15; } message RoleFormationData { diff --git a/shorekeeper-protocol/src/message.rs b/shorekeeper-protocol/src/message.rs index 3566dc6..87fd3c6 100644 --- a/shorekeeper-protocol/src/message.rs +++ b/shorekeeper-protocol/src/message.rs @@ -92,7 +92,7 @@ impl Message { let recv_crc = r.read_u32::()?; let mut payload = vec![0u8; src.len() - r.position() as usize].into_boxed_slice(); - r.read(&mut payload)?; + let _ = r.read(&mut payload)?; let calc_crc = crc32fast::hash(&payload); diff --git a/shorekeeper-protokey/src/lib.rs b/shorekeeper-protokey/src/lib.rs index 08a5f24..44cacb1 100644 --- a/shorekeeper-protokey/src/lib.rs +++ b/shorekeeper-protokey/src/lib.rs @@ -187,6 +187,6 @@ fn encrypt_aes256_ecb_pkcs7( ) -> Result, InvalidLength> { let cipher = Aes256::new_from_slice(session_key)?; Ok(cipher - .encrypt_padded_vec::(&data[..]) + .encrypt_padded_vec::(data) .into_boxed_slice()) }