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::*; use proto::*;
pub struct PlayerInfo { pub struct PlayerInfo {
pub uid: u32,
pub lineup: LineupInfo, pub lineup: LineupInfo,
} }
impl PlayerInfo { impl PlayerInfo {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
uid: 1337,
lineup: default_lineup(), lineup: default_lineup(),
} }
} }

View file

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

View file

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

View file

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