From f97bc256889da03a5a6683ae3e573994a0f7abec Mon Sep 17 00:00:00 2001 From: xeon Date: Fri, 31 May 2024 19:44:41 +0300 Subject: [PATCH] Kick on RpcReenterWorld to avoid stuck --- gameserver/src/net/handlers/mod.rs | 1 + gameserver/src/net/handlers/world.rs | 19 +++++++++++++++++++ protocol/src/rpc_ptc.rs | 13 +++++++++++++ 3 files changed, 33 insertions(+) diff --git a/gameserver/src/net/handlers/mod.rs b/gameserver/src/net/handlers/mod.rs index 75cd12c..533c194 100644 --- a/gameserver/src/net/handlers/mod.rs +++ b/gameserver/src/net/handlers/mod.rs @@ -68,6 +68,7 @@ protocol_handlers! { RpcDelNewMap; RpcEndBattle; RpcEnterWorld; + RpcReenterWorld; RpcFinishActPerformShow; RpcFinishEventGraphPerformShow; RpcGetPlayerMails; diff --git a/gameserver/src/net/handlers/world.rs b/gameserver/src/net/handlers/world.rs index db8d9ee..04149a5 100644 --- a/gameserver/src/net/handlers/world.rs +++ b/gameserver/src/net/handlers/world.rs @@ -350,3 +350,22 @@ pub async fn on_rpc_enter_world( session.ns_prop_mgr.serialize_player_info().await, )) } + +pub async fn on_rpc_reenter_world( + session: &NetworkSession, + _arg: &RpcReenterWorldArg, +) -> Result { + tracing::warn!("OnRpcReenterWorld: world re-entrance is not implemented yet, kicking player!"); + + session + .send_rpc_arg( + PTC_KICK_PLAYER_ID, + &PtcKickPlayerArg { + reason_id: 2, + reason_str: String::new(), + }, + ) + .await?; + + Ok(RpcReenterWorldRet::error(ErrorCode::Fail, Vec::new())) +} diff --git a/protocol/src/rpc_ptc.rs b/protocol/src/rpc_ptc.rs index fe63da1..782a38a 100644 --- a/protocol/src/rpc_ptc.rs +++ b/protocol/src/rpc_ptc.rs @@ -76,6 +76,9 @@ pub struct PtcEnterSceneArg { pub camera_y: u32, } +#[derive(OctData, Clone, Debug)] +pub struct RpcReenterWorldArg {} + #[derive(OctData, Clone, Debug)] pub struct RpcEnterWorldArg {} @@ -343,6 +346,12 @@ pub struct PtcSyncSceneTimeArg { pub last_timestamp: u64, } +#[derive(OctData, Debug)] +pub struct PtcKickPlayerArg { + pub reason_id: i32, + pub reason_str: String, +} + ret! { struct RpcLoginRet { account_info: PropertyBlob, @@ -352,6 +361,10 @@ ret! { player_info: PropertyBlob, } + struct RpcReenterWorldRet { + player_info: PropertyBlob, + } + struct RpcGetPlayerMailsRet { mail_count: u32, // Actually List, TODO! }