HollowPS/gameserver/src/net/handlers/role.rs
2024-05-26 19:00:45 +03:00

26 lines
767 B
Rust

use super::*;
pub async fn on_rpc_mod_nick_name(
session: &NetworkSession,
arg: &RpcModNickNameArg,
) -> Result<RpcModNickNameRet> {
tracing::info!("creating character");
let mut player = session.ns_prop_mgr.player_info.write().await;
player.nick_name.replace(arg.nick_name.clone());
player.avatar_id.replace(arg.avatar_id);
let player_info_changed = PtcPlayerInfoChangedArg {
player_uid: player.uid.unwrap(),
player_info: PlayerInfo {
nick_name: Some(arg.nick_name.clone()),
avatar_id: Some(arg.avatar_id),
..Default::default()
},
};
session
.send_rpc_arg(PTC_PLAYER_INFO_CHANGED_ID, &player_info_changed)
.await?;
Ok(RpcModNickNameRet::new())
}