mirror of
https://github.com/RustySamovar/RustySamovar.git
synced 2024-11-22 02:45:34 +00:00
Load all required avatar data from excel configs
This commit is contained in:
parent
f3d5f92232
commit
6b2634a74e
24
src/jsonmanager/avatar_skill.rs
Normal file
24
src/jsonmanager/avatar_skill.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
#[serde(rename_all="PascalCase")]
|
||||
pub struct AvatarSkill {
|
||||
pub id: u32,
|
||||
pub name_text_map_hash: u32,
|
||||
pub ability_name: String,
|
||||
pub desc_text_map_hash: u32,
|
||||
pub skill_icon: String,
|
||||
pub cost_stamina: Option<u32>,
|
||||
pub max_charge_num: u32,
|
||||
pub trigger_id: Option<u32>,
|
||||
pub lock_shape: String, // TODO: probably an enum
|
||||
pub lock_weight_params: Vec<f32>,
|
||||
pub drag_type: Option<String>, // TODO: an enum
|
||||
#[serde(default)]
|
||||
pub show_icon_arrow: bool,
|
||||
#[serde(default)]
|
||||
pub is_attack_camera_lock: bool,
|
||||
pub proud_skill_group_id: Option<u32>,
|
||||
pub buff_icon: String,
|
||||
pub global_value_key: String,
|
||||
}
|
@ -23,6 +23,7 @@ use super::world_level::WorldLevel;
|
||||
use super::gadget_prop::GadgetProp;
|
||||
|
||||
use crate::jsonmanager::avatar::Avatar;
|
||||
use crate::jsonmanager::avatar_skill::AvatarSkill;
|
||||
use crate::jsonmanager::proud_skill::ProudSkill;
|
||||
|
||||
fn group_nonconsec_by<A, B, I>(v: I, key: fn (&B) -> A) -> BTreeMap<A, Vec<B>>
|
||||
@ -67,6 +68,8 @@ pub struct JsonManager {
|
||||
pub avatars: HashMap<u32, Avatar>,
|
||||
|
||||
pub proud_skills: HashMap<u32, ProudSkill>,
|
||||
|
||||
pub avatar_skills: HashMap<u32, AvatarSkill>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for JsonManager { // TODO: fucking hack!
|
||||
@ -105,6 +108,8 @@ impl JsonManager {
|
||||
|
||||
let proud_skills: Vec<ProudSkill> = reader.read_json_list_game("ProudSkill");
|
||||
|
||||
let avatar_skills: Vec<AvatarSkill> = reader.read_json_list_game("AvatarSkill");
|
||||
|
||||
return JsonManager {
|
||||
reader: reader,
|
||||
avatar_skill_depot: asd.into_iter().map(|a| (a.id, a)).collect(),
|
||||
@ -137,6 +142,8 @@ impl JsonManager {
|
||||
avatars: avatars.into_iter().map(|a| (a.id, a)).collect(),
|
||||
|
||||
proud_skills: proud_skills.into_iter().map(|ps| (ps.proud_skill_id, ps)).collect(),
|
||||
|
||||
avatar_skills: avatar_skills.into_iter().map(|ass| (ass.id, ass)).collect(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ pub use self::json_manager::JsonManager;
|
||||
|
||||
mod proud_skill;
|
||||
mod avatar;
|
||||
mod avatar_skill;
|
||||
mod avatar_skill_depot;
|
||||
mod entity_curve;
|
||||
mod monster;
|
||||
|
@ -51,8 +51,16 @@ impl AvatarBuilder {
|
||||
.filter(|s| s.proud_skill_group_id != None)
|
||||
.filter(|s| s.need_avatar_promote_level == None || s.need_avatar_promote_level.unwrap() <= promote_level)
|
||||
.map(|s| s.proud_skill_group_id.unwrap())
|
||||
.map(|s| s * 100 + 1) // TODO: ugly hack! Fix it by reading ProudSkillExcelConfigData!
|
||||
|
||||
.map(|s| {
|
||||
let skill_ids: Vec<u32> = jm.proud_skills.values().filter(|ps| ps.proud_skill_group_id == s).map(|ps| ps.proud_skill_id).collect();
|
||||
skill_ids
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
/*
|
||||
.map(|s| s * 100 + 1) // TODO: ugly hack! Fix it by reading ProudSkillExcelConfigData!
|
||||
.collect();*/
|
||||
|
||||
// TODO: properly fill!
|
||||
let afi = build!(AvatarFetterInfo {
|
||||
@ -63,10 +71,21 @@ impl AvatarBuilder {
|
||||
let egi = db.get_avatar_equip(a.guid).unwrap_or_else(|| panic!("Equip not found for avatar {}!", a.guid));
|
||||
let egi = egi.into_iter().map(|g| g as u64).collect(); // FIXME
|
||||
|
||||
// TODO: ugly ugly hack!
|
||||
let mut fuck = HashMap::new();
|
||||
fuck.insert(732, 3);
|
||||
fuck.insert(739, 3);
|
||||
/*
|
||||
1. Get all the skill IDs from AvatarSkillDepot entry
|
||||
2. For each skill, get corresponding entry from AvatarSkill collection
|
||||
3. For each AvatarSkill, filter out ones that have ProudSkillGroupId set
|
||||
4. Specify the level for those proud skills
|
||||
*/
|
||||
let proud_skill_extra = asd.skills.iter()
|
||||
.map(|s| jm.avatar_skills.get(s))
|
||||
.filter(|ass| ass.is_some())
|
||||
.map(|ass| ass.unwrap())
|
||||
.filter(|ass| ass.proud_skill_group_id != None)
|
||||
.map(|ass| (ass.proud_skill_group_id.unwrap(), 3)) // TODO: fetch level from the database!
|
||||
.collect();
|
||||
|
||||
let avatar = &jm.avatars[&IdManager::get_avatar_id_by_char_id(a.character_id)];
|
||||
|
||||
let ai = build!(AvatarInfo {
|
||||
avatar_id: IdManager::get_avatar_id_by_char_id(a.character_id),
|
||||
@ -81,15 +100,15 @@ impl AvatarBuilder {
|
||||
equip_guid_list: egi,
|
||||
inherent_proud_skill_list: ips, //vec![72101, 72201],
|
||||
skill_level_map: slm,
|
||||
proud_skill_extra_level_map: fuck, //collection!{739 => 3, 732 => 3},
|
||||
proud_skill_extra_level_map: proud_skill_extra, //collection!{739 => 3, 732 => 3},
|
||||
wearing_flycloak_id: 140001, // TODO: hack!
|
||||
life_state: 1,
|
||||
excel_info: Some(build!(AvatarExcelInfo { // TODO: load values from config!
|
||||
prefab_path_hash: IdManager::get_hash_by_prefix_suffix(50, 2568507538),
|
||||
prefab_path_remote_hash: IdManager::get_hash_by_prefix_suffix(158, 3204428759),
|
||||
controller_path_hash: IdManager::get_hash_by_prefix_suffix(154, 3376713903),
|
||||
controller_path_remote_hash: IdManager::get_hash_by_prefix_suffix(228, 1479775384),
|
||||
combat_config_hash: IdManager::get_hash_by_prefix_suffix(244, 4049143033),
|
||||
excel_info: Some(build!(AvatarExcelInfo {
|
||||
prefab_path_hash: IdManager::get_hash_by_prefix_suffix(avatar.prefab_path_hash_pre, avatar.prefab_path_hash_suffix),
|
||||
prefab_path_remote_hash: IdManager::get_hash_by_prefix_suffix(avatar.prefab_path_remote_hash_pre, avatar.prefab_path_remote_hash_suffix),
|
||||
controller_path_hash: IdManager::get_hash_by_prefix_suffix(avatar.controller_path_hash_pre, avatar.controller_path_hash_suffix),
|
||||
controller_path_remote_hash: IdManager::get_hash_by_prefix_suffix(avatar.controller_path_remote_hash_pre, avatar.controller_path_remote_hash_suffix),
|
||||
combat_config_hash: IdManager::get_hash_by_prefix_suffix(avatar.combat_config_hash_pre, avatar.combat_config_hash_suffix),
|
||||
})),
|
||||
});
|
||||
return ai;
|
||||
|
Loading…
Reference in New Issue
Block a user