Add uid field in PlayerInfo

This commit is contained in:
xeon 2024-03-30 00:16:06 +03:00
parent a856f719f0
commit adbdaa38ab
4 changed files with 8 additions and 2 deletions

View file

@ -5,12 +5,14 @@ use anyhow::Result;
use proto::*;
pub struct PlayerInfo {
pub uid: u32,
pub lineup: LineupInfo,
}
impl PlayerInfo {
pub fn new() -> Self {
Self {
uid: 1337,
lineup: default_lineup(),
}
}

View file

@ -13,7 +13,7 @@ pub async fn on_player_get_token_cs_req(
PlayerGetTokenScRsp {
retcode: 0,
msg: String::from("OK"),
uid: 1337,
uid: session.player_uid(),
..Default::default()
},
)

View file

@ -26,7 +26,7 @@ pub async fn on_get_cur_scene_info_cs_req(
avatar_type: 3,
base_avatar_id: 1309,
map_layer: 2,
uid: 1337,
uid: session.player_uid(),
}),
motion: Some(MotionInfo {
aomilajjmii: Some(Vector {

View file

@ -51,6 +51,10 @@ impl PlayerSession {
self.client_socket.lock().await
}
pub fn player_uid(&self) -> u32 {
self.player_info().uid
}
pub fn player_info(&self) -> AtomicRef<PlayerInfo> {
self.player_info.borrow()
}