feat: Add support for 3.8.5x
This commit is contained in:
@@ -7,7 +7,6 @@ pub async fn on_player_get_token_cs_req(
|
||||
_body: &PlayerGetTokenCsReq,
|
||||
res: &mut PlayerGetTokenScRsp,
|
||||
) {
|
||||
res.msg = String::from("OK");
|
||||
res.uid = 25;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub static UNLOCKED_AVATARS: [u32; 74] = [
|
||||
pub static UNLOCKED_AVATARS: [u32; 76] = [
|
||||
1002, 1003, 1004, 1005, 1006, 1008, 1009, 1013, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108,
|
||||
1109, 1110, 1111, 1112, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212,
|
||||
1213, 1214, 1215, 1217, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1312, 1315, 1310,
|
||||
1314, 1218, 1221, 1220, 1222, 1223, 1317, 1313, 1225, 1402, 1401, 1404, 1403, 1405, 1407, 1406,
|
||||
1409, 1014, 1015, 1408, 1410, 1412, 1413, 1414, 1415, 1321,
|
||||
1409, 1014, 1015, 1408, 1410, 1412, 1413, 1414, 1415, 1321, 1501, 1502,
|
||||
];
|
||||
|
||||
pub async fn on_get_avatar_data_cs_req(
|
||||
@@ -37,38 +35,37 @@ pub async fn on_get_avatar_data_cs_req(
|
||||
.map(|id| {
|
||||
json.avatars
|
||||
.get(&id)
|
||||
.map(|v| {
|
||||
v.to_avatar_proto(
|
||||
json.lightcones.iter().find(|v| v.equip_avatar == id),
|
||||
json.relics
|
||||
.iter()
|
||||
.filter(|v| v.equip_avatar == id)
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.map(|v| v.to_avatar_proto(json.lightcones.iter().find(|v| v.equip_avatar == id)))
|
||||
.unwrap_or(Avatar {
|
||||
base_avatar_id: id,
|
||||
level: 80,
|
||||
promotion: 6,
|
||||
rank: 6,
|
||||
skilltree_list: (1..=4)
|
||||
.map(|m| AvatarSkillTree {
|
||||
point_id: id * 1000 + m,
|
||||
level: 1,
|
||||
})
|
||||
.collect(),
|
||||
first_met_time_stamp: 1712924677,
|
||||
..Default::default()
|
||||
cur_multi_path_avatar_type: 0,
|
||||
equipment_unique_id: 0,
|
||||
has_taken_promotion_reward_list: Vec::with_capacity(0),
|
||||
is_marked: false,
|
||||
exp: 0,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
res.cur_avatar_path = HashMap::from([
|
||||
(8001, json.main_character.get_type().into()),
|
||||
(1001, json.march_type.get_type().into()),
|
||||
]);
|
||||
|
||||
res.multi_path_avatar_info_list = json.get_multi_path_info();
|
||||
res.avatar_path_data_info_list = UNLOCKED_AVATARS
|
||||
.into_iter()
|
||||
.chain(mc_ids.iter().copied())
|
||||
.chain(march_ids.iter().copied())
|
||||
.filter_map(|id| {
|
||||
json.avatars.get(&id).map(|v| {
|
||||
v.to_avatar_path_data_proto(
|
||||
json.lightcones.iter().find(|v| v.equip_avatar == id),
|
||||
json.relics
|
||||
.iter()
|
||||
.filter(|v| v.equip_avatar == id)
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
}
|
||||
|
||||
pub async fn on_set_avatar_enhanced_id_cs_req(
|
||||
|
||||
@@ -22,10 +22,10 @@ pub async fn on_start_cocoon_stage_cs_req(
|
||||
res.battle_info = Some(battle_info);
|
||||
}
|
||||
|
||||
pub async fn on_quick_start_cocoon_stage_cs_req(
|
||||
pub async fn on_start_quick_cocoon_stage_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
req: &QuickStartCocoonStageCsReq,
|
||||
res: &mut QuickStartCocoonStageScRsp,
|
||||
req: &StartQuickCocoonStageCsReq,
|
||||
res: &mut StartQuickCocoonStageScRsp,
|
||||
) {
|
||||
let mut battle_info = create_battle_info(session, 0, 0).await;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use common::structs::MultiPathAvatar;
|
||||
use proto::chat_message_extend_data::ExtendType;
|
||||
|
||||
use crate::{net::PlayerSession, util::cur_timestamp_ms};
|
||||
|
||||
@@ -20,8 +21,8 @@ pub async fn on_get_friend_login_info_cs_req(
|
||||
_req: &GetFriendLoginInfoCsReq,
|
||||
res: &mut GetFriendLoginInfoScRsp,
|
||||
) {
|
||||
res.cmcilifageb = vec![SERVER_UID];
|
||||
res.gddmgcalkhc = vec![SERVER_UID];
|
||||
res.ckjhinjopgk = vec![SERVER_UID];
|
||||
res.dfommfkiami = vec![SERVER_UID];
|
||||
}
|
||||
|
||||
pub async fn on_get_friend_list_info_cs_req(
|
||||
@@ -36,7 +37,7 @@ pub async fn on_get_friend_list_info_cs_req(
|
||||
platform: PlatformType::Pc.into(),
|
||||
online_status: FriendOnlineStatus::Online.into(),
|
||||
head_icon: SERVER_HEAD_ICON,
|
||||
chat_bubble: SERVER_CHAT_BUBBLE_ID,
|
||||
chat_bubble_id: SERVER_CHAT_BUBBLE_ID,
|
||||
level: 70,
|
||||
nickname: String::from("Server"),
|
||||
signature: String::from("omg"),
|
||||
@@ -61,6 +62,18 @@ pub async fn on_get_private_chat_history_cs_req(
|
||||
create_time: cur_time,
|
||||
content: String::from(*text),
|
||||
sender_id: SERVER_UID,
|
||||
chat_message_extend_data: Some(ChatMessageExtendData {
|
||||
extend_type: Some(ExtendType::MessageText(String::from(*text))),
|
||||
}),
|
||||
bofjjhikijl: Some(Dabbfcoafjg {
|
||||
..Default::default()
|
||||
}),
|
||||
dgmnkagbcem: Some(Gpcnkeaofea {
|
||||
chat_message_extend_data: Some(ChatMessageExtendData {
|
||||
extend_type: Some(ExtendType::MessageText(String::from(*text))),
|
||||
}),
|
||||
message_type: MsgType::CustomText.into(),
|
||||
}),
|
||||
..Default::default()
|
||||
})
|
||||
.collect();
|
||||
@@ -86,11 +99,12 @@ pub async fn on_send_msg_cs_req(
|
||||
.send(RevcMsgScNotify {
|
||||
message_type: body.message_type,
|
||||
message_text: String::from("Inventory Synced"),
|
||||
extra_id: body.extra_id,
|
||||
source_uid: SERVER_UID,
|
||||
target_uid: 25,
|
||||
chat_type: body.chat_type,
|
||||
dijgjpgfflg: body.dijgjpgfflg.clone(),
|
||||
chat_message_extend_data: body.chat_message_extend_data.clone(),
|
||||
mjaocldhphm: 0,
|
||||
pfjjlomkbfa: None,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -120,11 +134,12 @@ pub async fn on_send_msg_cs_req(
|
||||
.send(RevcMsgScNotify {
|
||||
message_type: body.message_type,
|
||||
message_text: format!("Success change mc to {mc:#?}"),
|
||||
extra_id: body.extra_id,
|
||||
source_uid: SERVER_UID,
|
||||
target_uid: 25,
|
||||
chat_type: body.chat_type,
|
||||
dijgjpgfflg: body.dijgjpgfflg.clone(),
|
||||
chat_message_extend_data: body.chat_message_extend_data.clone(),
|
||||
mjaocldhphm: 0,
|
||||
pfjjlomkbfa: None,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -158,11 +173,12 @@ pub async fn on_send_msg_cs_req(
|
||||
.send(RevcMsgScNotify {
|
||||
message_type: body.message_type,
|
||||
message_text: format!("Success change march to {march_type:#?}"),
|
||||
extra_id: body.extra_id,
|
||||
source_uid: SERVER_UID,
|
||||
target_uid: 25,
|
||||
chat_type: body.chat_type,
|
||||
dijgjpgfflg: body.dijgjpgfflg.clone(),
|
||||
chat_message_extend_data: body.chat_message_extend_data.clone(),
|
||||
mjaocldhphm: 0,
|
||||
pfjjlomkbfa: None,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -135,10 +135,10 @@ pub async fn on_get_big_data_all_recommend_cs_req(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn on_rank_up_avatar_cs_req(
|
||||
pub async fn on_active_eidolon_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
req: &RankUpAvatarCsReq,
|
||||
_: &mut RankUpAvatarScRsp,
|
||||
req: &ActiveEidolonCsReq,
|
||||
_: &mut ActiveEidolonScRsp,
|
||||
) -> Option<()> {
|
||||
let player = session.json_data.get_mut()?;
|
||||
let avatar = player.avatars.get_mut(&req.avatar_id)?;
|
||||
@@ -326,11 +326,16 @@ fn build_sync(
|
||||
.iter()
|
||||
.filter_map(|id| player.get_avatar_proto(*id))
|
||||
.collect::<Vec<_>>();
|
||||
ret.avatar_sync = Some(AvatarSync { avatar_list });
|
||||
ret.multi_path_avatar_info_list = avatar_ids
|
||||
|
||||
let avatar_path_data_info_list = avatar_ids
|
||||
.into_iter()
|
||||
.filter_map(|id| player.get_avatar_multipath_proto(id))
|
||||
.filter_map(|id| player.get_avatar_path_data_proto(id))
|
||||
.collect();
|
||||
|
||||
ret.avatar_sync = Some(AvatarSync {
|
||||
avatar_list,
|
||||
avatar_path_data_info_list,
|
||||
});
|
||||
ret.relic_list = relic_indexes
|
||||
.into_iter()
|
||||
.map(|id| (&player.relics[id]).into())
|
||||
|
||||
@@ -36,19 +36,19 @@ use proto::{
|
||||
CmdBattleType::*, CmdBoxingClubType::*, CmdChallengeType::*, CmdChatType::*,
|
||||
CmdChessRogueType::*, CmdClockParkType::*, CmdContentPackageType::*, CmdDailyActiveType::*,
|
||||
CmdDrinkMakerType::*, CmdExpeditionType::*, CmdFantasticStoryActivityType::*,
|
||||
CmdFeverTimeActivityType::*, CmdFightActivityType::*, CmdFightMathc3Type::*, CmdFightType::*,
|
||||
CmdFeverTimeActivityType::*, CmdFightActivityType::*, CmdFightMatch3Type::*, CmdFightType::*,
|
||||
CmdFriendType::*, CmdGachaType::*, CmdHeartdialType::*, CmdHeliobusType::*, CmdItemType::*,
|
||||
CmdJukeboxType::*, CmdLineupType::*, CmdLobbyType::*, CmdMailType::*, CmdMapRotationType::*,
|
||||
CmdMatchThreeModuleType::*, CmdMatchType::*, CmdMessageType::*, CmdMiscModuleType::*,
|
||||
CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*,
|
||||
CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*,
|
||||
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*,
|
||||
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSyncType::*, CmdPlayerType::*,
|
||||
CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*,
|
||||
CmdRechargeGiftType::*, CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*,
|
||||
CmdRndOptionType::*, CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*,
|
||||
CmdRndOptionType::*, CmdRogueCommon::*, CmdRogueEndlessType::*, CmdRogueModifierType::*,
|
||||
CmdRogueTournType::*, CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*,
|
||||
CmdServerPrefsType::*, CmdShopType::*, CmdSpaceZooType::*, CmdStarFightType::*,
|
||||
CmdStoryLineType::*, CmdStrongChallengeActivityType::*, CmdTalkRewardType::*,
|
||||
CmdStoryLineType::*, CmdStrongChallengeActivityType::*, CmdTalkEventType::*,
|
||||
CmdTelevisionActivityType::*, CmdTextJoinType::*, CmdTrainVisitorType::*,
|
||||
CmdTreasureDungeonType::*, CmdTutorialType::*, CmdWaypointType::*, CmdWolfBroType::*,
|
||||
};
|
||||
|
||||
@@ -102,15 +102,14 @@ pub async fn on_get_scene_map_info_cs_req(
|
||||
group_id: prop.group_id,
|
||||
state: prop.prop_state,
|
||||
config_id: prop.inst_id,
|
||||
extra_info: None,
|
||||
});
|
||||
map_info
|
||||
.maze_prop_extra_state_list
|
||||
.push(MazePropExtraState {
|
||||
group_id: prop.group_id,
|
||||
state: prop.prop_state,
|
||||
config_id: prop.inst_id,
|
||||
extra_info: Option::None,
|
||||
});
|
||||
// map_info.maze_group_list.push(MazeGroup {
|
||||
// group_id: prop.group_id,
|
||||
// state: prop.prop_state,
|
||||
// config_id: prop.inst_id,
|
||||
// extra_info: Option::None,
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ async fn load_scene(
|
||||
scene.world_id
|
||||
},
|
||||
lighten_section_list: scene.sections.clone(),
|
||||
lddigmlcgdb: scene
|
||||
opened_chests_list: scene
|
||||
.scenes
|
||||
.values()
|
||||
.flat_map(|v| v.chests.clone())
|
||||
@@ -394,7 +393,7 @@ async fn load_scene(
|
||||
|
||||
scene_info.entity_group_list.push(group_info);
|
||||
|
||||
scene_info.clecmgljocl.push(SceneGroupState {
|
||||
scene_info.group_state_list.push(SceneGroupState {
|
||||
group_id: *group_id,
|
||||
is_default: true,
|
||||
state: 0,
|
||||
@@ -405,7 +404,7 @@ async fn load_scene(
|
||||
scene_info.entity_group_list.push(SceneEntityGroupInfo {
|
||||
state: 0,
|
||||
group_id: 0,
|
||||
jnajakchjdf: HashMap::with_capacity(0),
|
||||
jjeeocobckc: HashMap::with_capacity(0),
|
||||
entity_list: json
|
||||
.lineups
|
||||
.iter()
|
||||
|
||||
@@ -10,19 +10,19 @@ use proto::{
|
||||
CmdBattleType::*, CmdBoxingClubType::*, CmdChallengeType::*, CmdChatType::*,
|
||||
CmdChessRogueType::*, CmdClockParkType::*, CmdContentPackageType::*, CmdDailyActiveType::*,
|
||||
CmdDrinkMakerType::*, CmdExpeditionType::*, CmdFantasticStoryActivityType::*,
|
||||
CmdFeverTimeActivityType::*, CmdFightActivityType::*, CmdFightMathc3Type::*, CmdFightType::*,
|
||||
CmdFeverTimeActivityType::*, CmdFightActivityType::*, CmdFightMatch3Type::*, CmdFightType::*,
|
||||
CmdFriendType::*, CmdGachaType::*, CmdHeartdialType::*, CmdHeliobusType::*, CmdItemType::*,
|
||||
CmdJukeboxType::*, CmdLineupType::*, CmdLobbyType::*, CmdMailType::*, CmdMapRotationType::*,
|
||||
CmdMatchThreeModuleType::*, CmdMatchType::*, CmdMessageType::*, CmdMiscModuleType::*,
|
||||
CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*,
|
||||
CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*,
|
||||
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*,
|
||||
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSyncType::*, CmdPlayerType::*,
|
||||
CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*,
|
||||
CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*, CmdRndOptionType::*,
|
||||
CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*, CmdRogueTournType::*,
|
||||
CmdRogueCommon::*, CmdRogueEndlessType::*, CmdRogueModifierType::*, CmdRogueTournType::*,
|
||||
CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*, CmdServerPrefsType::*, CmdShopType::*,
|
||||
CmdSpaceZooType::*, CmdStarFightType::*, CmdStoryLineType::*,
|
||||
CmdStrongChallengeActivityType::*, CmdTalkRewardType::*, CmdTelevisionActivityType::*,
|
||||
CmdStrongChallengeActivityType::*, CmdTalkEventType::*, CmdTelevisionActivityType::*,
|
||||
CmdTextJoinType::*, CmdTrainVisitorType::*, CmdTreasureDungeonType::*, CmdTutorialType::*,
|
||||
CmdWaypointType::*, CmdWolfBroType::*,
|
||||
};
|
||||
@@ -190,7 +190,7 @@ trait_handler! {
|
||||
TakeOffEquipment;
|
||||
DressRelicAvatar;
|
||||
TakeOffRelic;
|
||||
RankUpAvatar;
|
||||
ActiveEidolon;
|
||||
|
||||
// Chat (dummy!)
|
||||
SendMsg;
|
||||
@@ -208,7 +208,7 @@ trait_handler! {
|
||||
StartCocoonStage;
|
||||
PveBattleResult;
|
||||
SceneCastSkill;
|
||||
QuickStartCocoonStage;
|
||||
StartQuickCocoonStage;
|
||||
|
||||
// Teleport
|
||||
GetEnteredScene;
|
||||
|
||||
@@ -10,7 +10,7 @@ use anyhow::Result;
|
||||
use common::sr_tools::FreesrData;
|
||||
use mhy_kcp::Kcp;
|
||||
use prost::Message;
|
||||
use proto::{AvatarSync, CmdID, PlayerSyncScNotify};
|
||||
use proto::{AvatarSync, CmdID, CmdPlayerType, PlayerSyncScNotify};
|
||||
use tokio::{
|
||||
io::AsyncWrite,
|
||||
net::UdpSocket,
|
||||
@@ -70,12 +70,11 @@ impl PlayerSession {
|
||||
drop(kcp);
|
||||
|
||||
for packet in packets {
|
||||
// #TODO
|
||||
// if packet.cmd_type == CmdPlayerType::CmdPlayerLogoutCsReq as u16 {
|
||||
// tracing::info!("Player logged out");
|
||||
// let _ = self.shutdown_tx.send(());
|
||||
// return Ok(());
|
||||
// };
|
||||
if packet.cmd_type == CmdPlayerType::CmdPlayerLogoutCsReq as u16 {
|
||||
tracing::info!("Player logged out");
|
||||
let _ = self.shutdown_tx.send(());
|
||||
return Ok(());
|
||||
};
|
||||
Self::on_message(self, packet.cmd_type, packet.body).await?;
|
||||
}
|
||||
|
||||
@@ -132,22 +131,29 @@ impl PlayerSession {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Sync avatars
|
||||
// clear all avatars equip item
|
||||
self.send(PlayerSyncScNotify {
|
||||
avatar_sync: Some(AvatarSync {
|
||||
avatar_list: json
|
||||
.avatars
|
||||
.values()
|
||||
.map(|avatar| avatar.to_avatar_proto(Option::None, vec![]))
|
||||
.map(|avatar| avatar.to_avatar_proto(Option::None))
|
||||
.collect::<Vec<_>>(),
|
||||
avatar_path_data_info_list: json
|
||||
.avatars
|
||||
.values()
|
||||
.map(|avatar| {
|
||||
avatar.to_avatar_path_data_proto(Option::None, Vec::with_capacity(0))
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
}),
|
||||
multi_path_avatar_info_list: json.get_multi_path_info(),
|
||||
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Sync new relics
|
||||
// Sync new relics & lightcones
|
||||
self.send(PlayerSyncScNotify {
|
||||
relic_list: json.relics.iter().map(|v| v.into()).collect(),
|
||||
equipment_list: json.lightcones.iter().map(|v| v.into()).collect(),
|
||||
@@ -156,7 +162,7 @@ impl PlayerSession {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Sync new lightcones
|
||||
// Sync new avatars equip item
|
||||
self.send(PlayerSyncScNotify {
|
||||
avatar_sync: Some(AvatarSync {
|
||||
avatar_list: json
|
||||
@@ -167,13 +173,24 @@ impl PlayerSession {
|
||||
json.lightcones
|
||||
.iter()
|
||||
.find(|v| v.equip_avatar == avatar.avatar_id),
|
||||
json.relics
|
||||
.iter()
|
||||
.filter(|v| v.equip_avatar == avatar.avatar_id)
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
avatar_path_data_info_list: json
|
||||
.avatars
|
||||
.values()
|
||||
.map(|avatar| {
|
||||
avatar.to_avatar_path_data_proto(
|
||||
json.lightcones
|
||||
.iter()
|
||||
.find(|v| v.equip_avatar == avatar.avatar_id),
|
||||
json.relics
|
||||
.iter()
|
||||
.filter(|r| r.equip_avatar == avatar.avatar_id)
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
}),
|
||||
..Default::default()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user