Skins and flycloaks (wind gliders) switching & unlock

This commit is contained in:
xeon 2024-04-12 22:41:43 +03:00
parent ac64a1b4fd
commit 8c1a42b9f4
12 changed files with 1455 additions and 18 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,123 @@
[
{
"flycloakId": 140001,
"nameTextMapHash": 1227437700,
"descTextMapHash": 2963284368,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Glider_01/Flycloak_Normal_Glider_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Glider",
"materialId": 140001
},
{
"flycloakId": 140002,
"nameTextMapHash": 3679998556,
"descTextMapHash": 2439760640,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Starlit_01/Flycloak_Normal_Starlit_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Starlit",
"materialId": 140002
},
{
"flycloakId": 140003,
"nameTextMapHash": 1307041812,
"descTextMapHash": 251460624,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Psalmus_01/Flycloak_Normal_Psalmus_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Psalmus",
"materialId": 140003
},
{
"flycloakId": 140004,
"nameTextMapHash": 3265724196,
"descTextMapHash": 95448472,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Gale_01/Flycloak_Normal_Gale_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Gale",
"materialId": 140004
},
{
"flycloakId": 140005,
"nameTextMapHash": 1800191236,
"descTextMapHash": 397410296,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Megalith_01/Flycloak_Normal_Megalith_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Megalith",
"materialId": 140005
},
{
"flycloakId": 140006,
"nameTextMapHash": 790364508,
"descTextMapHash": 2419069352,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Nixavis_01/Flycloak_Normal_Nixavis_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Nixavis",
"materialId": 140006
},
{
"flycloakId": 140007,
"nameTextMapHash": 972574812,
"descTextMapHash": 3582594568,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Redcomet_01/Flycloak_Normal_Redcomet_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Redcomet",
"materialId": 140007,
"hide": true
},
{
"flycloakId": 140008,
"nameTextMapHash": 1047777100,
"descTextMapHash": 533901256,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Thunderclap_01/Flycloak_Normal_Thunderclap_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Thunderclap",
"materialId": 140008
},
{
"flycloakId": 140009,
"nameTextMapHash": 14389020,
"descTextMapHash": 3075333936,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Skald_01/Flycloak_Normal_Skald_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Skald",
"materialId": 140009,
"hide": true
},
{
"flycloakId": 140010,
"nameTextMapHash": 2488969468,
"descTextMapHash": 1899653016,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Ayus_01/Flycloak_Normal_Ayus_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Ayus",
"materialId": 140010
},
{
"flycloakId": 140011,
"nameTextMapHash": 2292890772,
"descTextMapHash": 681143304,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Asterceno_01/Flycloak_Normal_Asterceno_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Asterceno",
"materialId": 140011,
"hide": true
},
{
"flycloakId": 140012,
"nameTextMapHash": 180645420,
"descTextMapHash": 1161581424,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Iustitia_01/Flycloak_Normal_Iustitia_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Iustitia",
"materialId": 140012
},
{
"flycloakId": 140013,
"nameTextMapHash": 2462291164,
"descTextMapHash": 1830391744,
"prefabPath": "ART/System/Flycloak/Flycloak_Normal_Sternlied_01/Flycloak_Normal_Sternlied_01",
"jsonName": "Flycloak_Default_01",
"icon": "UI_Gacha_FlycloakIcon_Sternlied",
"materialId": 140013,
"hide": true
}
]

View file

@ -37,6 +37,41 @@ pub struct AvatarExcelConfig {
pub lodpattern_name: String,
}
#[derive(Deserialize, Default)]
#[serde(default)]
#[serde(rename_all = "camelCase")]
pub struct AvatarCostumeExcelConfig {
pub skin_id: u32,
#[serde(rename = "indexID")]
pub index_id: u32,
pub name_text_map_hash: u64,
pub desc_text_map_hash: u64,
pub item_id: u32,
pub character_id: u32,
pub json_name: String,
pub prefab_path_hash: u64,
pub prefab_remote_path_hash: u64,
pub prefab_npc_path_hash: u64,
pub prefab_manekin_path_hash: u64,
pub quality: u32,
pub front_icon_name: String,
pub side_icon_name: String,
pub image_name_hash: u64,
}
#[derive(Deserialize, Default)]
#[serde(default)]
#[serde(rename_all = "camelCase")]
pub struct AvatarFlycloakExcelConfig {
pub flycloak_id: u32,
pub name_text_map_hash: u64,
pub desc_text_map_hash: u64,
pub prefab_path: String,
pub json_name: String,
pub icon: String,
pub material_id: u32,
}
#[derive(Deserialize, Default)]
#[serde(default)]
#[serde(rename_all = "camelCase")]

View file

@ -20,6 +20,8 @@ lazy_static! {
pub struct ExcelCollection {
pub avatar_configs: Vec<AvatarExcelConfig>,
pub avatar_flycloak_configs: Vec<AvatarFlycloakExcelConfig>,
pub avatar_costume_configs: Vec<AvatarCostumeExcelConfig>,
pub open_state_configs: Vec<OpenStateConfig>,
}
@ -34,6 +36,14 @@ impl ExcelCollection {
"assets/ExcelBinOutput/AvatarExcelConfigData.json",
))
.unwrap(),
avatar_flycloak_configs: from_str(&load_asset(
"assets/ExcelBinOutput/AvatarFlycloakExcelConfigData.json",
))
.unwrap(),
avatar_costume_configs: from_str(&load_asset(
"assets/ExcelBinOutput/AvatarCostumeExcelConfigData.json",
))
.unwrap(),
open_state_configs: from_str(&load_asset(
"assets/ExcelBinOutput/OpenStateConfigData.json",
))
@ -42,7 +52,7 @@ impl ExcelCollection {
}
pub fn table_count(&self) -> usize {
2
4
}
}

View file

@ -25,6 +25,14 @@ impl SceneAvatar {
self.data.clone()
}
pub fn update_data(&mut self, data: &AvatarData) {
self.data = AvatarData {
properties: self.data.properties.clone(),
fight_properties: self.data.fight_properties.clone(),
..data.clone()
};
}
pub fn avatar_guid(&self) -> u64 {
self.data.guid
}
@ -132,6 +140,7 @@ impl Entity for SceneAvatar {
skill_depot_id: self.data.skill_depot_id,
weapon: Some(self.weapon.scene_weapon_info()),
team_resonance_list: vec![10301],
costume_id: self.data.costume_id,
wearing_flycloak_id: self.data.wearing_flycloak_id,
born_time: self.data.born_time,
excel_info: Some(AvatarExcelInfo::default()),

View file

@ -15,6 +15,7 @@ pub struct AvatarData {
pub avatar_id: u32,
pub skill_depot_id: u32,
pub wearing_flycloak_id: u32,
pub costume_id: u32,
pub born_time: u32,
pub weapon: WeaponData,
pub properties: Vec<PropValue>,
@ -52,6 +53,7 @@ impl PlayerInfo {
avatar_id: config.id,
skill_depot_id: config.skill_depot_id,
wearing_flycloak_id: 140001,
costume_id: 0,
born_time: util::cur_timestamp() as u32,
weapon: WeaponData {
guid: self.next_guid(),
@ -161,6 +163,7 @@ impl From<AvatarData> for AvatarInfo {
avatar_id: value.avatar_id,
skill_depot_id: value.skill_depot_id,
wearing_flycloak_id: value.wearing_flycloak_id,
costume_id: value.costume_id,
born_time: value.born_time,
life_state: 1,
avatar_type: 1,

View file

@ -105,6 +105,16 @@ pub async fn on_player_login_req(session: &PlayerSession, _body: &PlayerLoginReq
team_name: String::from("LogicTeam"),
},
)]),
owned_costume_list: EXCEL_COLLECTION
.avatar_costume_configs
.iter()
.map(|a| a.skin_id)
.collect(),
owned_flycloak_list: EXCEL_COLLECTION
.avatar_flycloak_configs
.iter()
.map(|a| a.flycloak_id)
.collect(),
..Default::default()
};

View file

@ -33,6 +33,112 @@ pub async fn on_change_avatar_req(session: &PlayerSession, body: &ChangeAvatarRe
.await
}
pub async fn on_avatar_change_costume_req(
session: &PlayerSession,
body: &AvatarChangeCostumeReq,
) -> Result<()> {
let mut player = session.player_info_mut();
let Some(avatar) = player
.avatars
.iter_mut()
.find(|a| a.guid == body.avatar_guid)
else {
return session
.send(
AVATAR_CHANGE_COSTUME_RSP,
AvatarChangeCostumeRsp {
retcode: -1,
..Default::default()
},
)
.await;
};
avatar.costume_id = body.costume_id;
let mut scene = session.context.scene.borrow_mut();
if let Some(avatar_entity) = scene
.avatars
.iter_mut()
.find(|a| a.avatar_guid() == body.avatar_guid)
{
avatar_entity.update_data(avatar);
session
.send(
AVATAR_CHANGE_COSTUME_NOTIFY,
AvatarChangeCostumeNotify {
entity_info: Some(avatar_entity.info()),
},
)
.await?;
}
session
.send(
AVATAR_CHANGE_COSTUME_RSP,
AvatarChangeCostumeRsp {
avatar_guid: body.avatar_guid,
costume_id: body.costume_id,
retcode: 0,
},
)
.await
}
pub async fn on_avatar_wear_flycloak_req(
session: &PlayerSession,
body: &AvatarWearFlycloakReq,
) -> Result<()> {
let mut player = session.player_info_mut();
let Some(avatar) = player
.avatars
.iter_mut()
.find(|a| a.guid == body.avatar_guid)
else {
return session
.send(
AVATAR_WEAR_FLYCLOAK_RSP,
AvatarWearFlycloakRsp {
retcode: -1,
..Default::default()
},
)
.await;
};
avatar.wearing_flycloak_id = body.flycloak_id;
let mut scene = session.context.scene.borrow_mut();
if let Some(avatar_entity) = scene
.avatars
.iter_mut()
.find(|a| a.avatar_guid() == body.avatar_guid)
{
avatar_entity.update_data(avatar);
}
session
.send(
AVATAR_FLYCLOAK_CHANGE_NOTIFY,
AvatarFlycloakChangeNotify {
avatar_guid: body.avatar_guid,
flycloak_id: body.flycloak_id,
},
)
.await?;
session
.send(
AVATAR_WEAR_FLYCLOAK_RSP,
AvatarWearFlycloakRsp {
retcode: 0,
avatar_guid: body.avatar_guid,
flycloak_id: body.flycloak_id,
},
)
.await
}
pub async fn on_set_up_avatar_team_req(
session: &PlayerSession,
body: &SetUpAvatarTeamReq,

View file

@ -138,4 +138,6 @@ trait_handler! {
EvtAvatarStandUpNotify 8549;
MarkMapReq 7802;
GetSceneAreaReq 5114;
AvatarChangeCostumeReq 24368;
AvatarWearFlycloakReq 27466;
}

View file

@ -37,10 +37,7 @@ pub fn xor(bytes: &mut [u8], key: &[u8]) {
}
pub fn hash_str(value: &str) -> u32 {
let mut hash = 0;
value
.chars()
.for_each(|c| hash = (((c as u64) + 131 * hash as u64) & 0xFFFFFFFF) as u32);
hash
value.chars().fold(0, |hash, c| {
(((c as u64) + 131 * hash as u64) & 0xFFFFFFFF) as u32
})
}

View file

@ -1986,11 +1986,11 @@ pub mod oojabholigi {
/// CmdId: 25960
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Cjanmienhbl {
pub struct AvatarWearFlycloakRsp {
#[prost(uint64, tag = "2")]
pub avatar_guid: u64,
#[prost(uint32, tag = "7")]
pub kljbfbpndna: u32,
pub flycloak_id: u32,
#[prost(int32, tag = "5")]
pub retcode: i32,
}
@ -13254,7 +13254,7 @@ pub struct Oaigllmcelh {
/// CmdId: 24368
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hjinepcidjh {
pub struct AvatarChangeCostumeReq {
#[prost(uint32, tag = "10")]
pub costume_id: u32,
#[prost(uint64, tag = "6")]
@ -19231,9 +19231,9 @@ pub struct Aiibeahbkhc {
/// CmdId: 27466
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hhlkjbhphip {
pub struct AvatarWearFlycloakReq {
#[prost(uint32, tag = "12")]
pub kljbfbpndna: u32,
pub flycloak_id: u32,
#[prost(uint64, tag = "6")]
pub avatar_guid: u64,
}
@ -19338,9 +19338,9 @@ pub struct Hdjnkgeffje {
/// CmdId: 8370
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Igbfidbinoi {
pub struct AvatarChangeCostumeNotify {
#[prost(message, optional, tag = "14")]
pub egoffcgnheo: ::core::option::Option<SceneEntityInfo>,
pub entity_info: ::core::option::Option<SceneEntityInfo>,
}
/// CmdId: 28319
#[allow(clippy::derive_partial_eq_without_eq)]
@ -31064,7 +31064,7 @@ pub struct Mfdepinclgn {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Inpoaflcccj {
#[prost(uint32, tag = "5")]
pub kljbfbpndna: u32,
pub flycloak_id: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@ -35604,7 +35604,7 @@ pub struct Pcjmneheebn {
/// CmdId: 21748
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Jckkocbhhfm {
pub struct AvatarChangeCostumeRsp {
#[prost(uint64, tag = "5")]
pub avatar_guid: u64,
#[prost(uint32, tag = "3")]
@ -36775,9 +36775,9 @@ pub struct Hggggikbdml {
/// CmdId: 23818
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Nmkabkacpjo {
pub struct AvatarFlycloakChangeNotify {
#[prost(uint32, tag = "12")]
pub kljbfbpndna: u32,
pub flycloak_id: u32,
#[prost(uint64, tag = "11")]
pub avatar_guid: u64,
}
@ -43180,6 +43180,10 @@ pub struct AvatarDataNotify {
pub cur_avatar_team_id: u32,
#[prost(map = "uint32, message", tag = "12")]
pub avatar_team_map: ::std::collections::HashMap<u32, AvatarTeam>,
#[prost(uint32, repeated, tag = "15")]
pub owned_flycloak_list: ::prost::alloc::vec::Vec<u32>,
#[prost(uint32, repeated, tag = "13")]
pub owned_costume_list: ::prost::alloc::vec::Vec<u32>,
#[prost(message, repeated, tag = "14")]
pub avatar_list: ::prost::alloc::vec::Vec<AvatarInfo>,
}

View file

@ -23,3 +23,7 @@ pub const EVT_AVATAR_SIT_DOWN_RSP: u16 = 29232;
pub const EVT_AVATAR_STAND_UP_NOTIFY: u16 = 8549;
pub const MARK_MAP_RSP: u16 = 25569;
pub const GET_SCENE_AREA_RSP: u16 = 22648;
pub const AVATAR_CHANGE_COSTUME_RSP: u16 = 21748;
pub const AVATAR_CHANGE_COSTUME_NOTIFY: u16 = 8370;
pub const AVATAR_WEAR_FLYCLOAK_RSP: u16 = 25960;
pub const AVATAR_FLYCLOAK_CHANGE_NOTIFY: u16 = 23818;