From f3d5f92232940bb4949499436ea00715dc69f519 Mon Sep 17 00:00:00 2001 From: Nobody Date: Thu, 6 Oct 2022 23:02:23 +0500 Subject: [PATCH] Read Avatar and ProudSkill configs --- src/jsonmanager/avatar.rs | 118 ++++++++++++++++++++++++++++++++ src/jsonmanager/json_manager.rs | 15 ++++ src/jsonmanager/mod.rs | 2 + src/jsonmanager/proud_skill.rs | 30 ++++++++ 4 files changed, 165 insertions(+) create mode 100644 src/jsonmanager/avatar.rs create mode 100644 src/jsonmanager/proud_skill.rs diff --git a/src/jsonmanager/avatar.rs b/src/jsonmanager/avatar.rs new file mode 100644 index 0000000..afa925f --- /dev/null +++ b/src/jsonmanager/avatar.rs @@ -0,0 +1,118 @@ +use serde::{Serialize, Deserialize}; + +#[serde(rename_all="PascalCase")] +#[derive(Serialize, Deserialize, Clone)] +pub struct AvatarGachaHashes { + pub gacha_card_name_hash_pre: u8, + pub gacha_card_name_hash_suffix: u32, + pub gacha_image_name_hash_pre: u8, + pub gacha_image_name_hash_suffix: u32, +} + +#[serde(rename_all="PascalCase")] +#[derive(Serialize, Deserialize, Clone)] +pub struct Avatar { + // Entity fields + pub id: u32, + pub name_text_map_hash: u32, + pub prefab_path_hash_pre: u8, + pub prefab_path_hash_suffix: u32, + pub prefab_path_remote_hash_pre: u8, + pub prefab_path_remote_hash_suffix: u32, + pub controller_path_hash_pre: u8, + pub controller_path_hash_suffix: u32, + pub controller_path_remote_hash_pre: u8, + pub controller_path_remote_hash_suffix: u32, + //pub camp_id: Option, // Avatars don't have these + pub lod_pattern_name: String, + + // Creature fields + pub hp_base: f32, + pub attack_base: f32, + pub defense_base: f32, + pub critical: f32, + #[serde(default)] + pub anti_critical: f32, + pub critical_hurt: f32, + #[serde(default)] + pub fire_sub_hurt: f32, + #[serde(default)] + pub grass_sub_hurt: f32, + #[serde(default)] + pub water_sub_hurt: f32, + #[serde(default)] + pub elec_sub_hurt: f32, + #[serde(default)] + pub wind_sub_hurt: f32, + #[serde(default)] + pub ice_sub_hurt: f32, + #[serde(default)] + pub rock_sub_hurt: f32, + #[serde(default)] + pub fire_add_hurt: f32, + #[serde(default)] + pub grass_add_hurt: f32, + #[serde(default)] + pub water_add_hurt: f32, + #[serde(default)] + pub elec_add_hurt: f32, + #[serde(default)] + pub wind_add_hurt: f32, + #[serde(default)] + pub ice_add_hurt: f32, + #[serde(default)] + pub rock_add_hurt: f32, + #[serde(default)] + pub physical_sub_hurt: f32, + #[serde(default)] + pub physical_add_hurt: f32, + #[serde(default)] + pub element_mastery: f32, + + //pub prop_grow_curves: Vec, // TODO: unify with monster! + + pub prefab_path_ragdoll_hash_pre: u8, + pub prefab_path_ragdoll_hash_suffix: u32, + + // Avatar fields + pub use_type: Option, // TODO: actually an enum + pub body_type: String, // TODO: actually an enum + pub script_data_path_hash_pre: u8, + pub script_data_path_hash_suffix: u32, + pub icon_name: String, + pub side_icon_name: String, + pub quality_type: String, // TODO: actually an enum + pub charge_efficiency: f32, + #[serde(default)] + pub heal_add: f32, + #[serde(default)] + pub healed_add: f32, + pub combat_config_hash_pre: u8, + pub combat_config_hash_suffix: u32, + #[serde(default)] + pub is_range_attack: bool, + pub initial_weapon: u32, + pub weapon_type: String, // TODO: actually an enum + pub manekin_path_hash_pre: u8, + pub manekin_path_hash_suffix: u32, + pub image_name: String, + #[serde(flatten)] // Those fields are present or absent all together, so we grouped them + pub avatar_gacha_hashes: Option, + pub coop_pic_name_hash_pre: Option, + pub coop_pic_name_hash_suffix: Option, + pub cutscene_show: String, + pub skill_depot_id: u32, + pub stamina_recover_speed: f32, + pub cand_skill_depot_ids: Vec, + pub manekin_json_config_hash_pre: u8, + pub manekin_json_config_hash_suffix: u32, + pub manekin_motion_config: u32, + pub desc_text_map_hash: u32, + pub avatar_identity_type: Option, // TODO: actually an enum + pub avatar_promote_id: u32, + pub avatar_promote_reward_level_list: Vec, + pub avatar_promote_reward_id_list: Vec, + #[serde(rename = "FeatureTagGroupID")] + pub feature_tag_group_id: u32, + pub info_desc_text_map_hash: u32, +} \ No newline at end of file diff --git a/src/jsonmanager/json_manager.rs b/src/jsonmanager/json_manager.rs index a5fe6db..d1b3d4f 100644 --- a/src/jsonmanager/json_manager.rs +++ b/src/jsonmanager/json_manager.rs @@ -22,6 +22,9 @@ use super::monster::Monster; use super::world_level::WorldLevel; use super::gadget_prop::GadgetProp; +use crate::jsonmanager::avatar::Avatar; +use crate::jsonmanager::proud_skill::ProudSkill; + fn group_nonconsec_by(v: I, key: fn (&B) -> A) -> BTreeMap> where A: Ord, @@ -60,6 +63,10 @@ pub struct JsonManager { pub teleport_points: HashMap>, pub scenes: HashMap, + + pub avatars: HashMap, + + pub proud_skills: HashMap, } impl std::fmt::Debug for JsonManager { // TODO: fucking hack! @@ -94,6 +101,10 @@ impl JsonManager { let scenes: Vec = reader.read_json_list_game("Scene"); + let avatars: Vec = reader.read_json_list_game("Avatar"); + + let proud_skills: Vec = reader.read_json_list_game("ProudSkill"); + return JsonManager { reader: reader, avatar_skill_depot: asd.into_iter().map(|a| (a.id, a)).collect(), @@ -122,6 +133,10 @@ impl JsonManager { .collect(), scenes: scenes.into_iter().map(|s| (s.id, s)).collect(), + + avatars: avatars.into_iter().map(|a| (a.id, a)).collect(), + + proud_skills: proud_skills.into_iter().map(|ps| (ps.proud_skill_id, ps)).collect(), }; } diff --git a/src/jsonmanager/mod.rs b/src/jsonmanager/mod.rs index 64ed55d..ccbf8d2 100644 --- a/src/jsonmanager/mod.rs +++ b/src/jsonmanager/mod.rs @@ -2,6 +2,8 @@ mod json_manager; pub use self::json_manager::JsonManager; +mod proud_skill; +mod avatar; mod avatar_skill_depot; mod entity_curve; mod monster; diff --git a/src/jsonmanager/proud_skill.rs b/src/jsonmanager/proud_skill.rs new file mode 100644 index 0000000..c887289 --- /dev/null +++ b/src/jsonmanager/proud_skill.rs @@ -0,0 +1,30 @@ +use serde::{Serialize, Deserialize}; + +#[serde(rename_all="PascalCase")] +#[derive(Serialize, Deserialize, Clone)] +pub struct CostItem { + pub id: u32, + pub count: u32, +} + +#[serde(rename_all="PascalCase")] +#[derive(Serialize, Deserialize, Clone)] +pub struct ProudSkill { + pub proud_skill_id: u32, + pub proud_skill_group_id: u32, + pub level: u32, + pub name_text_map_hash: u32, + pub desc_text_map_hash: u32, + pub unlock_desc_text_map_hash: u32, + pub icon: String, + pub coin_cost: Option, + //pub cost_items: Vec, // TODO: those require wrapping + pub filter_conds: Vec, // TODO: actually an enum + pub break_level: Option, + pub param_desc_list: Vec, + pub life_effect_type: Option, // TODO: actually an enum + pub life_effect_params: Vec, + pub effective_for_team: Option, + #[serde(default)] + pub is_hide_life_proud_skill: bool, +} \ No newline at end of file