Kick on RpcReenterWorld to avoid stuck

This commit is contained in:
xeon 2024-05-31 19:44:41 +03:00
parent 1a41d4b07b
commit f97bc25688
3 changed files with 33 additions and 0 deletions

View file

@ -68,6 +68,7 @@ protocol_handlers! {
RpcDelNewMap;
RpcEndBattle;
RpcEnterWorld;
RpcReenterWorld;
RpcFinishActPerformShow;
RpcFinishEventGraphPerformShow;
RpcGetPlayerMails;

View file

@ -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<RpcReenterWorldRet> {
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()))
}

View file

@ -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<CPlayerMailInfo>, TODO!
}