Read Avatar and ProudSkill configs

This commit is contained in:
Nobody 2022-10-06 23:02:23 +05:00
parent 169d78f45d
commit f3d5f92232
4 changed files with 165 additions and 0 deletions

118
src/jsonmanager/avatar.rs Normal file
View File

@ -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<u32>, // 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<PropGrowConfig>, // TODO: unify with monster!
pub prefab_path_ragdoll_hash_pre: u8,
pub prefab_path_ragdoll_hash_suffix: u32,
// Avatar fields
pub use_type: Option<String>, // 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<AvatarGachaHashes>,
pub coop_pic_name_hash_pre: Option<u8>,
pub coop_pic_name_hash_suffix: Option<u32>,
pub cutscene_show: String,
pub skill_depot_id: u32,
pub stamina_recover_speed: f32,
pub cand_skill_depot_ids: Vec<u32>,
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<String>, // TODO: actually an enum
pub avatar_promote_id: u32,
pub avatar_promote_reward_level_list: Vec<u32>,
pub avatar_promote_reward_id_list: Vec<u32>,
#[serde(rename = "FeatureTagGroupID")]
pub feature_tag_group_id: u32,
pub info_desc_text_map_hash: u32,
}

View File

@ -22,6 +22,9 @@ use super::monster::Monster;
use super::world_level::WorldLevel; use super::world_level::WorldLevel;
use super::gadget_prop::GadgetProp; use super::gadget_prop::GadgetProp;
use crate::jsonmanager::avatar::Avatar;
use crate::jsonmanager::proud_skill::ProudSkill;
fn group_nonconsec_by<A, B, I>(v: I, key: fn (&B) -> A) -> BTreeMap<A, Vec<B>> fn group_nonconsec_by<A, B, I>(v: I, key: fn (&B) -> A) -> BTreeMap<A, Vec<B>>
where where
A: Ord, A: Ord,
@ -60,6 +63,10 @@ pub struct JsonManager {
pub teleport_points: HashMap<u32, HashMap<u32, TeleportPoint>>, pub teleport_points: HashMap<u32, HashMap<u32, TeleportPoint>>,
pub scenes: HashMap<u32, Scene>, pub scenes: HashMap<u32, Scene>,
pub avatars: HashMap<u32, Avatar>,
pub proud_skills: HashMap<u32, ProudSkill>,
} }
impl std::fmt::Debug for JsonManager { // TODO: fucking hack! impl std::fmt::Debug for JsonManager { // TODO: fucking hack!
@ -94,6 +101,10 @@ impl JsonManager {
let scenes: Vec<Scene> = reader.read_json_list_game("Scene"); let scenes: Vec<Scene> = reader.read_json_list_game("Scene");
let avatars: Vec<Avatar> = reader.read_json_list_game("Avatar");
let proud_skills: Vec<ProudSkill> = reader.read_json_list_game("ProudSkill");
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(),
@ -122,6 +133,10 @@ impl JsonManager {
.collect(), .collect(),
scenes: scenes.into_iter().map(|s| (s.id, s)).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(),
}; };
} }

View File

@ -2,6 +2,8 @@ mod json_manager;
pub use self::json_manager::JsonManager; pub use self::json_manager::JsonManager;
mod proud_skill;
mod avatar;
mod avatar_skill_depot; mod avatar_skill_depot;
mod entity_curve; mod entity_curve;
mod monster; mod monster;

View File

@ -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<u32>,
//pub cost_items: Vec<CostItem>, // TODO: those require wrapping
pub filter_conds: Vec<String>, // TODO: actually an enum
pub break_level: Option<u32>,
pub param_desc_list: Vec<u32>,
pub life_effect_type: Option<String>, // TODO: actually an enum
pub life_effect_params: Vec<String>,
pub effective_for_team: Option<u32>,
#[serde(default)]
pub is_hide_life_proud_skill: bool,
}