refactor: Refactor json loading mechanism & more

- Move json loading into separate crate `common`
- Add new http route for handling SRTools API
- Listen to `freesr-data.json` file change, and sync with client immediately
- Move json loading into `PlayerSession`, instead of load it everytime
- Implement global buff for Castorice
- Implement `GetBigDataAllRecommendCsReq`
This commit is contained in:
amizing25
2025-03-03 08:02:51 +07:00
parent 50a05a5cc2
commit de22105514
28 changed files with 7113 additions and 12024 deletions
+5 -4
View File
@@ -1,7 +1,5 @@
use std::collections::HashMap;
use crate::net::tools::FreesrData;
use super::*;
pub async fn on_get_basic_info_cs_req(
@@ -56,11 +54,14 @@ pub async fn on_player_login_finish_cs_req(
}
pub async fn on_get_multi_path_avatar_info_cs_req(
_session: &mut PlayerSession,
session: &mut PlayerSession,
_req: &GetMultiPathAvatarInfoCsReq,
res: &mut GetMultiPathAvatarInfoScRsp,
) {
let json = FreesrData::load().await;
let Some(json) = session.json_data.get() else {
tracing::error!("data is not set!");
return;
};
res.current_multi_path_avatar_id = HashMap::from([
(8001, json.main_character.get_type().into()),