Now load info about scenes from config

This commit is contained in:
Nobody 2022-04-05 22:32:04 +05:00
parent 5af44e8900
commit 87781530de
4 changed files with 31 additions and 1 deletions

View File

@ -10,6 +10,7 @@ use rand::{seq::IteratorRandom, thread_rng};
use crate::jsonmanager::gather::Gather; use crate::jsonmanager::gather::Gather;
use crate::jsonmanager::material::Material; use crate::jsonmanager::material::Material;
use crate::jsonmanager::reliquary::{Reliquary, ReliquaryAffix, ReliquaryMainProp}; use crate::jsonmanager::reliquary::{Reliquary, ReliquaryAffix, ReliquaryMainProp};
use crate::jsonmanager::scene::Scene;
use crate::jsonmanager::shop_goods::ShopGoods; use crate::jsonmanager::shop_goods::ShopGoods;
use crate::jsonmanager::shop_rotate::ShopRotate; use crate::jsonmanager::shop_rotate::ShopRotate;
use crate::jsonmanager::teleport_point::TeleportPoint; use crate::jsonmanager::teleport_point::TeleportPoint;
@ -57,6 +58,8 @@ pub struct JsonManager {
pub materials: HashMap<u32, Material>, pub materials: HashMap<u32, Material>,
pub teleport_points: HashMap<u32, HashMap<u32, TeleportPoint>>, pub teleport_points: HashMap<u32, HashMap<u32, TeleportPoint>>,
pub scenes: HashMap<u32, Scene>,
} }
impl std::fmt::Debug for JsonManager { // TODO: fucking hack! impl std::fmt::Debug for JsonManager { // TODO: fucking hack!
@ -89,6 +92,8 @@ impl JsonManager {
let teleport_points: Vec<TeleportPoint> = reader.read_json_list_3rdparty("TeleportPoints"); let teleport_points: Vec<TeleportPoint> = reader.read_json_list_3rdparty("TeleportPoints");
let scenes: Vec<Scene> = reader.read_json_list_game("Scene");
return JsonManager { return JsonManager {
reader: reader, reader: reader,
avatar_skill_depot: asd.into_iter().map(|a| (a.id, a)).collect(), avatar_skill_depot: asd.into_iter().map(|a| (a.id, a)).collect(),
@ -115,6 +120,8 @@ impl JsonManager {
teleport_points: group_nonconsec_by(teleport_points, |tp| tp.scene_id).into_iter() teleport_points: group_nonconsec_by(teleport_points, |tp| tp.scene_id).into_iter()
.map(|(scene_id, tp_list)| (scene_id, tp_list.into_iter().map(|tp| (tp.point_id, tp)).collect())) .map(|(scene_id, tp_list)| (scene_id, tp_list.into_iter().map(|tp| (tp.point_id, tp)).collect()))
.collect(), .collect(),
scenes: scenes.into_iter().map(|s| (s.id, s)).collect(),
}; };
} }

View File

@ -14,6 +14,7 @@ mod weapon;
mod reliquary; mod reliquary;
mod material; mod material;
mod teleport_point; mod teleport_point;
mod scene;
pub use entity_curve::{CurveInfo,EntityCurve}; pub use entity_curve::{CurveInfo,EntityCurve};
pub use shop_goods::ShopGoods; pub use shop_goods::ShopGoods;

20
src/jsonmanager/scene.rs Normal file
View File

@ -0,0 +1,20 @@
use serde::{Serialize, Deserialize};
#[derive(Deserialize, Clone)]
#[serde(rename_all="PascalCase")]
pub struct Scene {
pub id: u32,
pub r#type: String, // TODO: that's an enum!
pub script_data: String,
pub override_default_profile: String,
pub level_entity_config: String,
#[serde(default)]
pub max_specified_avatar_num: u32,
pub specified_avatar_list: Vec<u32>,
pub comment: String,
#[serde(default)]
pub ignore_nav_mesh: bool,
pub safe_point: Option<u32>,
}

View File

@ -172,8 +172,10 @@ impl GameWorld {
scene_time: 9000, scene_time: 9000,
}); });
let level_config = &self.jm.scenes[&current_scene_info.scene_id].level_entity_config;
build_and_send!(self, user_id, metadata, SceneDataNotify { build_and_send!(self, user_id, metadata, SceneDataNotify {
level_config_name_list: vec!["Level_BigWorld".to_string()], // TODO level_config_name_list: vec![level_config.to_string()], // TODO: maybe there's more?
}); });
build_and_send!(self, user_id, metadata, HostPlayerNotify { build_and_send!(self, user_id, metadata, HostPlayerNotify {