feat: handle avatar enhanced state
This commit is contained in:
@@ -69,6 +69,7 @@ impl FreesrData {
|
|||||||
equipment_unique_id: lightcone.map(|v| v.get_unique_id()).unwrap_or_default(),
|
equipment_unique_id: lightcone.map(|v| v.get_unique_id()).unwrap_or_default(),
|
||||||
first_met_timestamp: 1712924677,
|
first_met_timestamp: 1712924677,
|
||||||
equip_relic_list: relics.map(|v| v.into()).collect::<Vec<_>>(),
|
equip_relic_list: relics.map(|v| v.into()).collect::<Vec<_>>(),
|
||||||
|
unk_enhanced_id: avatar.enhanced_id.unwrap_or_default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ pub struct AvatarJson {
|
|||||||
pub sp_value: Option<u32>,
|
pub sp_value: Option<u32>,
|
||||||
#[serde(alias = "spMax")]
|
#[serde(alias = "spMax")]
|
||||||
pub sp_max: Option<u32>,
|
pub sp_max: Option<u32>,
|
||||||
|
pub enhanced_id: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
@@ -164,6 +165,7 @@ impl AvatarJson {
|
|||||||
equipment_unique_id: lightcone.map(|v| v.get_unique_id()).unwrap_or_default(),
|
equipment_unique_id: lightcone.map(|v| v.get_unique_id()).unwrap_or_default(),
|
||||||
first_met_timestamp: 1712924677,
|
first_met_timestamp: 1712924677,
|
||||||
equip_relic_list: relics.iter().map(|v| (*v).into()).collect::<Vec<_>>(),
|
equip_relic_list: relics.iter().map(|v| (*v).into()).collect::<Vec<_>>(),
|
||||||
|
unk_enhanced_id: self.enhanced_id.unwrap_or_default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,6 +204,7 @@ impl AvatarJson {
|
|||||||
cur_sp: self.sp_value.unwrap_or(10_000),
|
cur_sp: self.sp_value.unwrap_or(10_000),
|
||||||
max_sp: self.sp_max.unwrap_or(10_000),
|
max_sp: self.sp_max.unwrap_or(10_000),
|
||||||
}),
|
}),
|
||||||
|
enhanced_id: self.enhanced_id.unwrap_or_default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -256,11 +259,12 @@ impl AvatarJson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_lineup_info(lineups: &BTreeMap<u32, u32>) -> LineupInfo {
|
pub fn to_lineup_info(lineups: &BTreeMap<u32, u32>) -> LineupInfo {
|
||||||
|
let max_mp = if lineups.contains_key(&1408) { 8 } else { 5 };
|
||||||
let mut lineup_info = LineupInfo {
|
let mut lineup_info = LineupInfo {
|
||||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||||
name: "Squad 1".to_string(),
|
name: "Squad 1".to_string(),
|
||||||
mp: 5,
|
mp: max_mp,
|
||||||
max_mp: 5,
|
max_mp,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+15068
-37223
File diff suppressed because it is too large
Load Diff
@@ -70,3 +70,23 @@ pub async fn on_get_avatar_data_cs_req(
|
|||||||
|
|
||||||
res.multi_path_avatar_type_info_list = json.get_multi_path_info();
|
res.multi_path_avatar_type_info_list = json.get_multi_path_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn on_set_avatar_enhanced_id_cs_req(
|
||||||
|
_session: &mut PlayerSession,
|
||||||
|
_req: &SetAvatarEnhancedIdCsReq,
|
||||||
|
_res: &mut SetAvatarEnhancedIdScRsp,
|
||||||
|
) {
|
||||||
|
// let Some(json) = session.json_data.get_mut() else {
|
||||||
|
// return;
|
||||||
|
// };
|
||||||
|
// let Some(avatar) = json.avatars.get_mut(&req.avatar_id) else {
|
||||||
|
// return;
|
||||||
|
// };
|
||||||
|
// avatar.enhanced_id = if req.enhanced_id == 0 {
|
||||||
|
// Option::<u32>::None
|
||||||
|
// } else {
|
||||||
|
// Some(req.enhanced_id)
|
||||||
|
// };
|
||||||
|
// res.growth_avatar_id = avatar.avatar_id;
|
||||||
|
// res.unk_enhanced_id = req.enhanced_id;
|
||||||
|
}
|
||||||
|
|||||||
@@ -217,21 +217,27 @@ async fn create_battle_info(
|
|||||||
// pf score object
|
// pf score object
|
||||||
if player.battle_config.battle_type == BattleType::PF {
|
if player.battle_config.battle_type == BattleType::PF {
|
||||||
if battle_info.stage_id >= 30309011 {
|
if battle_info.stage_id >= 30309011 {
|
||||||
battle_info.battle_target_info.insert(1, BattleTargetList {
|
battle_info.battle_target_info.insert(
|
||||||
|
1,
|
||||||
|
BattleTargetList {
|
||||||
battle_target_list: vec![BattleTarget {
|
battle_target_list: vec![BattleTarget {
|
||||||
id: 10003,
|
id: 10003,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}],
|
}],
|
||||||
});
|
},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
battle_info.battle_target_info.insert(1, BattleTargetList {
|
battle_info.battle_target_info.insert(
|
||||||
|
1,
|
||||||
|
BattleTargetList {
|
||||||
battle_target_list: vec![BattleTarget {
|
battle_target_list: vec![BattleTarget {
|
||||||
id: 10002,
|
id: 10002,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}],
|
}],
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 2..=4 {
|
for i in 2..=4 {
|
||||||
@@ -240,7 +246,9 @@ async fn create_battle_info(
|
|||||||
.insert(i, BattleTargetList::default());
|
.insert(i, BattleTargetList::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
battle_info.battle_target_info.insert(5, BattleTargetList {
|
battle_info.battle_target_info.insert(
|
||||||
|
5,
|
||||||
|
BattleTargetList {
|
||||||
battle_target_list: vec![
|
battle_target_list: vec![
|
||||||
BattleTarget {
|
BattleTarget {
|
||||||
id: 2001,
|
id: 2001,
|
||||||
@@ -253,18 +261,22 @@ async fn create_battle_info(
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apocalyptic Shadow
|
// Apocalyptic Shadow
|
||||||
if player.battle_config.battle_type == BattleType::AS {
|
if player.battle_config.battle_type == BattleType::AS {
|
||||||
battle_info.battle_target_info.insert(1, BattleTargetList {
|
battle_info.battle_target_info.insert(
|
||||||
|
1,
|
||||||
|
BattleTargetList {
|
||||||
battle_target_list: vec![BattleTarget {
|
battle_target_list: vec![BattleTarget {
|
||||||
id: 90005,
|
id: 90005,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}],
|
}],
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SU
|
// SU
|
||||||
|
|||||||
@@ -172,12 +172,12 @@ trait_handler! {
|
|||||||
PlayerLogin;
|
PlayerLogin;
|
||||||
GetMissionStatus;
|
GetMissionStatus;
|
||||||
GetBasicInfo;
|
GetBasicInfo;
|
||||||
// GetMultiPathAvatarInfo;
|
|
||||||
GetAvatarData;
|
GetAvatarData;
|
||||||
GetAllLineupData;
|
GetAllLineupData;
|
||||||
GetCurLineupData;
|
GetCurLineupData;
|
||||||
GetCurSceneInfo;
|
GetCurSceneInfo;
|
||||||
PlayerHeartBeat;
|
PlayerHeartBeat;
|
||||||
|
SetAvatarEnhancedId;
|
||||||
|
|
||||||
|
|
||||||
// Entity move (dummy!)
|
// Entity move (dummy!)
|
||||||
|
|||||||
@@ -41,10 +41,12 @@ impl PlayerSession {
|
|||||||
let (shutdown_tx, shutdown_rx) = watch::channel(());
|
let (shutdown_tx, shutdown_rx) = watch::channel(());
|
||||||
Self {
|
Self {
|
||||||
token,
|
token,
|
||||||
kcp: Arc::new(Mutex::new(Kcp::new(conv, token, false, RemoteEndPoint {
|
kcp: Arc::new(Mutex::new(Kcp::new(
|
||||||
socket,
|
conv,
|
||||||
addr,
|
token,
|
||||||
}))),
|
false,
|
||||||
|
RemoteEndPoint { socket, addr },
|
||||||
|
))),
|
||||||
start_time: util::cur_timestamp_secs(),
|
start_time: util::cur_timestamp_secs(),
|
||||||
json_data: OnceLock::new(),
|
json_data: OnceLock::new(),
|
||||||
shutdown_rx,
|
shutdown_rx,
|
||||||
|
|||||||
+12
-12
@@ -1,21 +1,21 @@
|
|||||||
{
|
{
|
||||||
"lineups": {
|
"lineups": {
|
||||||
"0": 1403,
|
"0": 1005,
|
||||||
"1": 1407,
|
"1": 1006,
|
||||||
"2": 8001,
|
"2": 1301,
|
||||||
"3": 1405
|
"3": 1309
|
||||||
},
|
},
|
||||||
"position": {
|
"position": {
|
||||||
"x": -26968,
|
"x": 162379,
|
||||||
"y": 78953,
|
"y": 220000,
|
||||||
"z": 14457,
|
"z": 265445,
|
||||||
"rot_y": 11858
|
"rot_y": 122650
|
||||||
},
|
},
|
||||||
"scene": {
|
"scene": {
|
||||||
"plane_id": 20411,
|
"plane_id": 20421,
|
||||||
"floor_id": 20411001,
|
"floor_id": 20421001,
|
||||||
"entry_id": 2041101
|
"entry_id": 2042101
|
||||||
},
|
},
|
||||||
"main_character": "FemaleRememberance",
|
"main_character": "MaleRememberance",
|
||||||
"march_type": "MarchHunt"
|
"march_type": "MarchHunt"
|
||||||
}
|
}
|
||||||
+5
-5
@@ -16105,7 +16105,7 @@ pub struct UpdateTrackMainMissionIdScRsp {
|
|||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct FinishedMissionScNotify {
|
pub struct FinishedMissionScNotify {
|
||||||
#[prost(uint32, repeated, tag = "3")]
|
#[prost(uint32, repeated, tag = "3")]
|
||||||
pub finished_mission_id: ::prost::alloc::vec::Vec<u32>,
|
pub finished_mission_id_list: ::prost::alloc::vec::Vec<u32>,
|
||||||
}
|
}
|
||||||
/// Obf: PILPBOGGLKO
|
/// Obf: PILPBOGGLKO
|
||||||
#[derive(proto_derive::CmdID)]
|
#[derive(proto_derive::CmdID)]
|
||||||
@@ -29513,11 +29513,11 @@ pub struct MissionStatusBySceneInfo {
|
|||||||
#[prost(uint32, repeated, tag = "2")]
|
#[prost(uint32, repeated, tag = "2")]
|
||||||
pub icbikgmghik: ::prost::alloc::vec::Vec<u32>,
|
pub icbikgmghik: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(uint32, repeated, tag = "4")]
|
#[prost(uint32, repeated, tag = "4")]
|
||||||
pub finished_mission_id: ::prost::alloc::vec::Vec<u32>,
|
pub finished_mission_id_list: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(uint32, repeated, tag = "6")]
|
#[prost(uint32, repeated, tag = "6")]
|
||||||
pub ndnonhfimfi: ::prost::alloc::vec::Vec<u32>,
|
pub ndnonhfimfi: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(message, repeated, tag = "11")]
|
#[prost(message, repeated, tag = "11")]
|
||||||
pub dgkjillcfla: ::prost::alloc::vec::Vec<Mission>,
|
pub sub_mission_status_list: ::prost::alloc::vec::Vec<Mission>,
|
||||||
}
|
}
|
||||||
#[derive(proto_derive::CmdID)]
|
#[derive(proto_derive::CmdID)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
@@ -29535,7 +29535,7 @@ pub struct SceneInfo {
|
|||||||
#[prost(uint32, tag = "8")]
|
#[prost(uint32, tag = "8")]
|
||||||
pub plane_id: u32,
|
pub plane_id: u32,
|
||||||
#[prost(uint32, repeated, tag = "1906")]
|
#[prost(uint32, repeated, tag = "1906")]
|
||||||
pub djbibijmebh: ::prost::alloc::vec::Vec<u32>,
|
pub chest_id_list: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(uint32, tag = "13")]
|
#[prost(uint32, tag = "13")]
|
||||||
pub floor_id: u32,
|
pub floor_id: u32,
|
||||||
#[prost(message, repeated, tag = "14")]
|
#[prost(message, repeated, tag = "14")]
|
||||||
@@ -32159,7 +32159,7 @@ pub struct MissionSync {
|
|||||||
#[prost(uint32, repeated, tag = "7")]
|
#[prost(uint32, repeated, tag = "7")]
|
||||||
pub hnepoedcidk: ::prost::alloc::vec::Vec<u32>,
|
pub hnepoedcidk: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(uint32, repeated, tag = "6")]
|
#[prost(uint32, repeated, tag = "6")]
|
||||||
pub finished_mission_id: ::prost::alloc::vec::Vec<u32>,
|
pub finished_mission_id_list: ::prost::alloc::vec::Vec<u32>,
|
||||||
#[prost(uint32, repeated, tag = "12")]
|
#[prost(uint32, repeated, tag = "12")]
|
||||||
pub mcfonopkokd: ::prost::alloc::vec::Vec<u32>,
|
pub mcfonopkokd: ::prost::alloc::vec::Vec<u32>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use quote::{quote, ToTokens};
|
use quote::{ToTokens, quote};
|
||||||
use syn::{parse_macro_input, DeriveInput, Meta, MetaList};
|
use syn::{DeriveInput, Meta, MetaList, parse_macro_input};
|
||||||
|
|
||||||
#[proc_macro_derive(CmdID, attributes(cmdid))]
|
#[proc_macro_derive(CmdID, attributes(cmdid))]
|
||||||
pub fn message_id_derive(input: TokenStream) -> TokenStream {
|
pub fn message_id_derive(input: TokenStream) -> TokenStream {
|
||||||
|
|||||||
Reference in New Issue
Block a user