feat: Add support for 3.7.5x

This commit is contained in:
amizing25
2025-11-04 23:16:14 +07:00
parent f1ef8d8da2
commit 56bdb1abc1
20 changed files with 59097 additions and 61538 deletions
+8 -8
View File
@@ -1,4 +1,4 @@
use proto::{Avatar, AvatarSkillTree, MultiPathAvatarTypeInfo}; use proto::{Avatar, AvatarSkillTree, MultiPathAvatarInfo};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
@@ -67,14 +67,14 @@ impl FreesrData {
}) })
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
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_time_stamp: 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(), unk_enhanced_id: avatar.enhanced_id.unwrap_or_default(),
..Default::default() ..Default::default()
}) })
} }
pub fn get_avatar_multipath_proto(&self, avatar_id: u32) -> Option<MultiPathAvatarTypeInfo> { pub fn get_avatar_multipath_proto(&self, avatar_id: u32) -> Option<MultiPathAvatarInfo> {
let avatar = self.avatars.get(&avatar_id)?; let avatar = self.avatars.get(&avatar_id)?;
let mp_type = MultiPathAvatar::from(avatar_id); let mp_type = MultiPathAvatar::from(avatar_id);
@@ -82,7 +82,7 @@ impl FreesrData {
return None; return None;
} }
Some(MultiPathAvatarTypeInfo { Some(MultiPathAvatarInfo {
avatar_id: mp_type as i32, avatar_id: mp_type as i32,
rank: avatar.data.rank, rank: avatar.data.rank,
equip_relic_list: self equip_relic_list: self
@@ -91,7 +91,7 @@ impl FreesrData {
.filter(|relic| relic.equip_avatar == mp_type as u32) .filter(|relic| relic.equip_avatar == mp_type as u32)
.map(|relic| relic.into()) .map(|relic| relic.into())
.collect(), .collect(),
skilltree_list: avatar multi_path_skill_tree: avatar
.data .data
.skills .skills
.iter() .iter()
@@ -111,7 +111,7 @@ impl FreesrData {
}) })
} }
pub fn get_multi_path_info(&self) -> Vec<MultiPathAvatarTypeInfo> { pub fn get_multi_path_info(&self) -> Vec<MultiPathAvatarInfo> {
MultiPathAvatar::to_vec() MultiPathAvatar::to_vec()
.into_iter() .into_iter()
.filter_map(|mp_type| { .filter_map(|mp_type| {
@@ -120,7 +120,7 @@ impl FreesrData {
} }
let avatar_info = self.avatars.get(&((mp_type) as u32))?; let avatar_info = self.avatars.get(&((mp_type) as u32))?;
Some(MultiPathAvatarTypeInfo { Some(MultiPathAvatarInfo {
avatar_id: mp_type as i32, avatar_id: mp_type as i32,
rank: avatar_info.data.rank, rank: avatar_info.data.rank,
equip_relic_list: self equip_relic_list: self
@@ -129,7 +129,7 @@ impl FreesrData {
.filter(|relic| relic.equip_avatar == mp_type as u32) .filter(|relic| relic.equip_avatar == mp_type as u32)
.map(|relic| relic.into()) .map(|relic| relic.into())
.collect(), .collect(),
skilltree_list: avatar_info multi_path_skill_tree: avatar_info
.data .data
.skills .skills
.iter() .iter()
+2 -2
View File
@@ -163,7 +163,7 @@ impl AvatarJson {
}) })
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
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_time_stamp: 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(), unk_enhanced_id: self.enhanced_id.unwrap_or_default(),
..Default::default() ..Default::default()
@@ -212,7 +212,7 @@ impl AvatarJson {
for buff_id in &self.techniques { for buff_id in &self.techniques {
battle_buff.push(BattleBuff { battle_buff.push(BattleBuff {
wave_flag: 0xffffffff, wave_flag: 0xffffffff,
owner_id: index, owner_index: index,
level: 1, level: 1,
id: *buff_id, id: *buff_id,
dynamic_values: HashMap::from([(String::from("SkillIndex"), 2.0)]), dynamic_values: HashMap::from([(String::from("SkillIndex"), 2.0)]),
+3 -8
View File
@@ -37,9 +37,10 @@ impl Default for BattleConfig {
} }
} }
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum BattleType { pub enum BattleType {
#[serde(alias = "DEFAULT")] #[serde(alias = "DEFAULT")]
#[default]
Default = 0, Default = 0,
#[serde(alias = "MOC")] #[serde(alias = "MOC")]
Moc = 1, Moc = 1,
@@ -49,12 +50,6 @@ pub enum BattleType {
AA = 5, AA = 5,
} }
impl Default for BattleType {
fn default() -> Self {
Self::Default
}
}
// BATTLE BUFFS // BATTLE BUFFS
#[derive(Debug, Serialize, Deserialize, Clone, Default)] #[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct BattleBuffJson { pub struct BattleBuffJson {
@@ -78,7 +73,7 @@ impl BattleBuffJson {
id: self.id, id: self.id,
level: self.level, level: self.level,
wave_flag: 0xffffffff, wave_flag: 0xffffffff,
owner_id: 0xffffffff, owner_index: 0xffffffff,
dynamic_values: if let Some(dyn_key) = &self.dynamic_key { dynamic_values: if let Some(dyn_key) = &self.dynamic_key {
HashMap::from([(dyn_key.key.clone(), dyn_key.value as f32)]) HashMap::from([(dyn_key.key.clone(), dyn_key.value as f32)])
} else { } else {
+1 -1
View File
@@ -18,7 +18,7 @@ pub struct Lightcone {
impl_from!(Lightcone, Equipment, |value| { impl_from!(Lightcone, Equipment, |value| {
Equipment { Equipment {
equip_avatar_id: value.equip_avatar, dress_avatar_id: value.equip_avatar,
exp: 0, exp: 0,
is_protected: false, is_protected: false,
level: value.level, level: value.level,
+2 -2
View File
@@ -28,8 +28,8 @@ impl Monster {
} }
SceneMonsterWave { SceneMonsterWave {
wave_id, battle_wave_id: wave_id,
wave_param: Some(SceneMonsterWaveParam { monster_param: Some(SceneMonsterWaveParam {
level: monsters.iter().map(|v| v.level).max().unwrap_or(95), level: monsters.iter().map(|v| v.level).max().unwrap_or(95),
..Default::default() ..Default::default()
}), }),
+1 -1
View File
@@ -74,7 +74,7 @@ impl_from!(Relic, EquipRelic, |value| {
impl_from!(Relic, proto::Relic, |value| { impl_from!(Relic, proto::Relic, |value| {
proto::Relic { proto::Relic {
equip_avatar_id: value.equip_avatar, dress_avatar_id: value.equip_avatar,
exp: 0, exp: 0,
is_protected: false, is_protected: false,
level: value.level, level: value.level,
-1
View File
@@ -1,4 +1,3 @@
#![feature(let_chains)]
use anyhow::Result; use anyhow::Result;
mod net; mod net;
+5 -5
View File
@@ -2,12 +2,12 @@ use std::collections::HashMap;
use super::*; use super::*;
pub static UNLOCKED_AVATARS: [u32; 73] = [ pub static UNLOCKED_AVATARS: [u32; 74] = [
1002, 1003, 1004, 1005, 1006, 1008, 1009, 1013, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 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, 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, 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, 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 1409, 1014, 1015, 1408, 1410, 1412, 1413, 1414, 1415, 1321,
]; ];
pub async fn on_get_avatar_data_cs_req( pub async fn on_get_avatar_data_cs_req(
@@ -57,18 +57,18 @@ pub async fn on_get_avatar_data_cs_req(
level: 1, level: 1,
}) })
.collect(), .collect(),
first_met_timestamp: 1712924677, first_met_time_stamp: 1712924677,
..Default::default() ..Default::default()
}) })
}) })
.collect(); .collect();
res.current_multi_path_avatar_id = HashMap::from([ res.cur_avatar_path = HashMap::from([
(8001, json.main_character.get_type().into()), (8001, json.main_character.get_type().into()),
(1001, json.march_type.get_type().into()), (1001, json.march_type.get_type().into()),
]); ]);
res.multi_path_avatar_type_info_list = json.get_multi_path_info(); res.multi_path_avatar_info_list = json.get_multi_path_info();
} }
pub async fn on_set_avatar_enhanced_id_cs_req( pub async fn on_set_avatar_enhanced_id_cs_req(
+68 -68
View File
@@ -1,11 +1,10 @@
use std::collections::HashMap; use std::collections::HashMap;
use rand::Rng; use rand::Rng;
use rogue_magic_battle_unit_info::Item;
use common::{ use common::{
resources::GAME_RES, resources::GAME_RES,
structs::{BattleType, Monster, RogueMagicComponentType}, structs::{BattleType, Monster},
}; };
use super::*; use super::*;
@@ -50,7 +49,7 @@ pub async fn on_scene_cast_skill_cs_req(
req: &SceneCastSkillCsReq, req: &SceneCastSkillCsReq,
res: &mut SceneCastSkillScRsp, res: &mut SceneCastSkillScRsp,
) { ) {
res.attacked_group_id = req.attacked_group_id; res.cast_entity_id = req.cast_entity_id;
let targets = req let targets = req
.hit_target_entity_id_list .hit_target_entity_id_list
@@ -64,9 +63,9 @@ pub async fn on_scene_cast_skill_cs_req(
return; return;
} }
let battle_info = create_battle_info(session, req.caster_id, req.skill_index).await; let battle_info = create_battle_info(session, req.attacked_by_entity_id, req.skill_index).await;
res.attacked_group_id = req.attacked_group_id; res.cast_entity_id = req.cast_entity_id;
res.battle_info = Some(battle_info); res.battle_info = Some(battle_info);
} }
@@ -133,7 +132,7 @@ async fn create_battle_info(
battle_info.buff_list.push(BattleBuff { battle_info.buff_list.push(BattleBuff {
id: avatar_config.weakness_buff_id, id: avatar_config.weakness_buff_id,
level: 1, level: 1,
owner_id: *avatar_index, owner_index: *avatar_index,
wave_flag: 0xffffffff, wave_flag: 0xffffffff,
dynamic_values: HashMap::from([( dynamic_values: HashMap::from([(
String::from("SkillIndex"), String::from("SkillIndex"),
@@ -151,7 +150,7 @@ async fn create_battle_info(
id: 122401, id: 122401,
level: 3, level: 3,
wave_flag: 0xffffffff, wave_flag: 0xffffffff,
owner_id: *avatar_index, owner_index: *avatar_index,
dynamic_values: HashMap::from([ dynamic_values: HashMap::from([
(String::from("#ADF_1"), 3f32), (String::from("#ADF_1"), 3f32),
(String::from("#ADF_2"), 3f32), (String::from("#ADF_2"), 3f32),
@@ -168,7 +167,7 @@ async fn create_battle_info(
if first_avatar_id != 0 { if first_avatar_id != 0 {
for buff in battle_info.buff_list.iter_mut() { for buff in battle_info.buff_list.iter_mut() {
if buff.id == 141202 || buff.id == 141403 { if buff.id == 141202 || buff.id == 141403 {
buff.owner_id = first_avatar_id buff.owner_index = first_avatar_id
} }
} }
} }
@@ -207,7 +206,7 @@ async fn create_battle_info(
id: blessing.id, id: blessing.id,
level: blessing.level, level: blessing.level,
wave_flag: 0xffffffff, wave_flag: 0xffffffff,
owner_id: 0xffffffff, owner_index: 0xffffffff,
..Default::default() ..Default::default()
}; };
@@ -296,72 +295,73 @@ async fn create_battle_info(
// SU // SU
if player.battle_config.battle_type == BattleType::SU { if player.battle_config.battle_type == BattleType::SU {
battle_info battle_info.battle_event.push(BattleEventBattleInfo {
.event_battle_info_list battle_event_id: player.battle_config.path_resonance_id,
.push(BattleEventBattleInfo { status: Some(BattleEventProperty {
battle_event_id: player.battle_config.path_resonance_id, sp_bar: Some(SpBarInfo {
status: Some(BattleEventInitedData { cur_sp: 10_000,
sp_bar: Some(SpBarInfo { max_sp: 10_000,
cur_sp: 10_000,
max_sp: 10_000,
}),
}), }),
skill_info: Vec::with_capacity(0), }),
}) skill_info: Vec::with_capacity(0),
})
} }
// Monsters // Monsters
battle_info.monster_wave_list = Monster::to_scene_monster_waves(&player.battle_config.monsters); battle_info.monster_wave_list = Monster::to_scene_monster_waves(&player.battle_config.monsters);
// Rogue Magic // Rogue Magic
// TODO: i dont need these shit
if !player.battle_config.scepters.is_empty() { if !player.battle_config.scepters.is_empty() {
battle_info.rogue_magic_battle_info = Some(RogueMagicBattleInfo { // battle_info.battle_rogue_magic_info = Some(BattleRogueMagicInfo {
player_detail_info: Some(RogueMagicBattleUnitInfo { // detail_info: Some(BattleRogueMagicDetailInfo {
item: Some(Item::BattleRogueMagicData(BattleRogueMagicData { // paiigoggofj: Some(Item::BattleRogueMagicData(BattleRogueMagicData {
round_cnt: Some(BattleRogueMagicRoundCount { // round_cnt: Some(BattleRogueMagicRoundCount {
gpojenhaiba: 3, // gpojenhaiba: 3,
kljklbmlefo: 0, // kljklbmlefo: 0,
}), // }),
battle_scepter_list: player // battle_scepter_list: player
.battle_config // .battle_config
.scepters // .scepters
.iter() // .iter()
.map(|scepter| { // .map(|scepter| {
let mut battle_scepter = BattleRogueMagicScepter { // let mut battle_scepter = BattleRogueMagicScepter {
level: scepter.level, // level: scepter.level,
scepter_id: scepter.id, // scepter_id: scepter.id,
magic_list: Vec::new(), // magic_list: Vec::new(),
trench_count: HashMap::from([(3, 0), (4, 0), (5, 0)]), // trench_count: HashMap::from([(3, 0), (4, 0), (5, 0)]),
}; // };
//
let mut index = [0u32; 3]; // let mut index = [0u32; 3];
//
for component in &scepter.components { // for component in &scepter.components {
let (slot_type, locked) = match component.component_type { // let (slot_type, locked) = match component.component_type {
RogueMagicComponentType::Passive => (3u32, false), // RogueMagicComponentType::Passive => (3u32, false),
RogueMagicComponentType::Active => (4, true), // RogueMagicComponentType::Active => (4, true),
RogueMagicComponentType::Attach => (5, false), // RogueMagicComponentType::Attach => (5, false),
}; // };
//
let slot_index = &mut index[slot_type as usize - 3]; // let slot_index = &mut index[slot_type as usize - 3];
battle_scepter.magic_list.push(BattleRogueMagicUnit { // battle_scepter.magic_list.push(BattleRogueMagicUnit {
level: component.level, // level: component.level,
unit_id: component.id, // unit_id: component.id,
slot_id: *slot_index, // slot_id: *slot_index,
locked, // locked,
counter_map: Default::default(), // counter_map: Default::default(),
}); // });
*slot_index += 1; // *slot_index += 1;
*battle_scepter.trench_count.get_mut(&slot_type).unwrap() += 1; // *battle_scepter.trench_count.get_mut(&slot_type).unwrap() += 1;
} // }
//
battle_scepter // battle_scepter
}) // })
.collect(), // .collect(),
})), // })),
}), // }),
scepter: Some(Plgjihifpag { egmebanhhnf: 5 }), // modifier_content: Some(BattleRogueMagicModifierInfo {
}); // rogue_magic_battle_const: 5,
// }),
// });
} }
// Global Buff // Global Buff
@@ -369,7 +369,7 @@ async fn create_battle_info(
battle_info.buff_list.push(BattleBuff { battle_info.buff_list.push(BattleBuff {
id: 140703, id: 140703,
level: 1, level: 1,
owner_id: u32::MAX, owner_index: u32::MAX,
wave_flag: u32::MAX, wave_flag: u32::MAX,
target_index_list: Vec::with_capacity(0), target_index_list: Vec::with_capacity(0),
dynamic_values: HashMap::with_capacity(0), dynamic_values: HashMap::with_capacity(0),
+33 -32
View File
@@ -20,7 +20,8 @@ pub async fn on_get_friend_login_info_cs_req(
_req: &GetFriendLoginInfoCsReq, _req: &GetFriendLoginInfoCsReq,
res: &mut GetFriendLoginInfoScRsp, res: &mut GetFriendLoginInfoScRsp,
) { ) {
res.friend_uid_list = vec![SERVER_UID]; res.cmcilifageb = vec![SERVER_UID];
res.gddmgcalkhc = vec![SERVER_UID];
} }
pub async fn on_get_friend_list_info_cs_req( pub async fn on_get_friend_list_info_cs_req(
@@ -28,9 +29,9 @@ pub async fn on_get_friend_list_info_cs_req(
_req: &GetFriendListInfoCsReq, _req: &GetFriendListInfoCsReq,
res: &mut GetFriendListInfoScRsp, res: &mut GetFriendListInfoScRsp,
) { ) {
res.friend_list = vec![FriendListInfo { res.friend_list = vec![FriendSimpleInfo {
friend_name: String::from("RobinSR"), remark_name: String::from("RobinSR"),
simple_info: Some(PlayerSimpleInfo { player_info: Some(PlayerSimpleInfo {
uid: SERVER_UID, uid: SERVER_UID,
platform: PlatformType::Pc.into(), platform: PlatformType::Pc.into(),
online_status: FriendOnlineStatus::Online.into(), online_status: FriendOnlineStatus::Online.into(),
@@ -42,7 +43,7 @@ pub async fn on_get_friend_list_info_cs_req(
..Default::default() ..Default::default()
}), }),
is_marked: true, is_marked: true,
sent_time: 0, create_time: 0,
..Default::default() ..Default::default()
}]; }];
} }
@@ -53,18 +54,18 @@ pub async fn on_get_private_chat_history_cs_req(
res: &mut GetPrivateChatHistoryScRsp, res: &mut GetPrivateChatHistoryScRsp,
) { ) {
let cur_time = cur_timestamp_ms(); let cur_time = cur_timestamp_ms();
res.chat_list = SERVER_CHAT_HISTORY res.chat_message_list = SERVER_CHAT_HISTORY
.iter() .iter()
.map(|text| Chat { .map(|text| ChatMessageData {
msg_type: MsgType::CustomText.into(), message_type: MsgType::CustomText.into(),
sent_time: cur_time, create_time: cur_time,
text: String::from(*text), content: String::from(*text),
sender_uid: SERVER_UID, sender_id: SERVER_UID,
..Default::default() ..Default::default()
}) })
.collect(); .collect();
res.to_uid = req.to_uid; res.target_side = req.target_side;
res.from_uid = SERVER_UID; res.contact_side = SERVER_UID;
} }
pub async fn on_send_msg_cs_req( pub async fn on_send_msg_cs_req(
@@ -77,19 +78,19 @@ pub async fn on_send_msg_cs_req(
return; return;
}; };
if let Some((cmd, args)) = parse_command(&body.text) { if let Some((cmd, args)) = parse_command(&body.message_text) {
match cmd { match cmd {
"sync" => { "sync" => {
session.sync_player().await; session.sync_player().await;
session session
.send(RevcMsgScNotify { .send(RevcMsgScNotify {
msg_type: body.msg_type, message_type: body.message_type,
text: String::from("Inventory Synced"), message_text: String::from("Inventory Synced"),
emote: body.emote, extra_id: body.extra_id,
from_uid: SERVER_UID, source_uid: SERVER_UID,
to_uid: 25, target_uid: 25,
chat_type: body.chat_type, chat_type: body.chat_type,
hnbepabnbng: body.hnbepabnbng, dijgjpgfflg: body.dijgjpgfflg.clone(),
}) })
.await .await
.unwrap(); .unwrap();
@@ -117,13 +118,13 @@ pub async fn on_send_msg_cs_req(
session session
.send(RevcMsgScNotify { .send(RevcMsgScNotify {
msg_type: body.msg_type, message_type: body.message_type,
text: format!("Success change mc to {mc:#?}"), message_text: format!("Success change mc to {mc:#?}"),
emote: body.emote, extra_id: body.extra_id,
from_uid: SERVER_UID, source_uid: SERVER_UID,
to_uid: 25, target_uid: 25,
chat_type: body.chat_type, chat_type: body.chat_type,
hnbepabnbng: body.hnbepabnbng, dijgjpgfflg: body.dijgjpgfflg.clone(),
}) })
.await .await
.unwrap(); .unwrap();
@@ -155,13 +156,13 @@ pub async fn on_send_msg_cs_req(
session session
.send(RevcMsgScNotify { .send(RevcMsgScNotify {
msg_type: body.msg_type, message_type: body.message_type,
text: format!("Success change march to {march_type:#?}"), message_text: format!("Success change march to {march_type:#?}"),
emote: body.emote, extra_id: body.extra_id,
from_uid: SERVER_UID, source_uid: SERVER_UID,
to_uid: 25, target_uid: 25,
chat_type: body.chat_type, chat_type: body.chat_type,
hnbepabnbng: body.hnbepabnbng, dijgjpgfflg: body.dijgjpgfflg.clone(),
}) })
.await .await
.unwrap(); .unwrap();
+6 -7
View File
@@ -236,7 +236,7 @@ fn equip_relic(player: &mut FreesrData, req: &DressRelicAvatarCsReq) -> Option<P
let mut avatar_ids_to_sy = vec![]; let mut avatar_ids_to_sy = vec![];
let mut relic_index_to_sync = vec![]; let mut relic_index_to_sync = vec![];
for param in &req.param_list { for param in &req.switch_list {
let Some(target_relic_idx) = player let Some(target_relic_idx) = player
.relics .relics
.iter() .iter()
@@ -245,10 +245,9 @@ fn equip_relic(player: &mut FreesrData, req: &DressRelicAvatarCsReq) -> Option<P
continue; continue;
}; };
let cur_avatar_relic_idx = player let cur_avatar_relic_idx = player.relics.iter().position(|r| {
.relics r.equip_avatar == target_avatar.avatar_id && r.get_slot() == param.relic_type
.iter() });
.position(|r| r.equip_avatar == target_avatar.avatar_id && r.get_slot() == param.slot);
// jika avatar sekarang sedang pakai LC, kita tukar pemiliknya dengan pemilik dari LC target // jika avatar sekarang sedang pakai LC, kita tukar pemiliknya dengan pemilik dari LC target
if let Some(cur_avatar_relic_idx) = cur_avatar_relic_idx { if let Some(cur_avatar_relic_idx) = cur_avatar_relic_idx {
@@ -289,7 +288,7 @@ fn unequip_relic(player: &mut FreesrData, req: &TakeOffRelicCsReq) -> Option<Pla
let mut relic_index_to_sync = vec![]; let mut relic_index_to_sync = vec![];
for slot in &req.slot_list { for slot in &req.relic_type_list {
let relics = player let relics = player
.relics .relics
.iter() .iter()
@@ -328,7 +327,7 @@ fn build_sync(
.filter_map(|id| player.get_avatar_proto(*id)) .filter_map(|id| player.get_avatar_proto(*id))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
ret.avatar_sync = Some(AvatarSync { avatar_list }); ret.avatar_sync = Some(AvatarSync { avatar_list });
ret.multi_path_avatar_type_info_list = avatar_ids ret.multi_path_avatar_info_list = avatar_ids
.into_iter() .into_iter()
.filter_map(|id| player.get_avatar_multipath_proto(id)) .filter_map(|id| player.get_avatar_multipath_proto(id))
.collect(); .collect();
+5 -5
View File
@@ -76,7 +76,7 @@ pub async fn on_replace_lineup_cs_req(
let lineups = &mut player.lineups; let lineups = &mut player.lineups;
for (slot, avatar_id) in &mut *lineups { for (slot, avatar_id) in &mut *lineups {
if let Some(lineup) = req.slots.get(*slot as usize) { if let Some(lineup) = req.lineup_slot_list.get(*slot as usize) {
*avatar_id = lineup.id; *avatar_id = lineup.id;
} else { } else {
*avatar_id = 0; *avatar_id = 0;
@@ -131,15 +131,15 @@ async fn refresh_lineup(session: &mut PlayerSession) {
session session
.send(SceneGroupRefreshScNotify { .send(SceneGroupRefreshScNotify {
group_refresh_info: vec![SceneGroupRefreshInfo { group_refresh_list: vec![GroupRefreshInfo {
group_id: 0, group_id: 0,
state: 0, state: 0,
group_refresh_type: SceneGroupRefreshType::Loaded.into(), refresh_type: SceneGroupRefreshType::Loaded.into(),
refresh_entity: new_entities, refresh_entity: new_entities,
bccgjihncdn: Vec::with_capacity(0), ..Default::default()
}], }],
floor_id, floor_id,
gfhglffhfbd: 0, dimension_id: 0,
}) })
.await .await
.unwrap(); .unwrap();
+1 -1
View File
@@ -23,7 +23,7 @@ pub async fn on_get_mail_cs_req(
..Default::default() ..Default::default()
}], }],
}), }),
mail_type: MailType::Normal.into(), mail_type: 0,
template_id: 0, template_id: 0,
}]; }];
} }
+13 -13
View File
@@ -43,7 +43,7 @@ use proto::{
CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*, CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*,
CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*, CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*,
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*, CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*,
CmdPlotType::*, CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*, CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*,
CmdRechargeGiftType::*, CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*, CmdRechargeGiftType::*, CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*,
CmdRndOptionType::*, CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*, CmdRndOptionType::*, CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*,
CmdRogueTournType::*, CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*, CmdRogueTournType::*, CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*,
@@ -90,7 +90,7 @@ macro_rules! dummy {
dummy! { dummy! {
// SceneEntityMove, // SceneEntityMove,
GetLevelRewardTakenList, GetLevelRewardTakenList,
GetRogueScoreRewardInfo, // GetRogueScoreRewardInfo, // ?3.7.51
// GetGachaInfo, // GetGachaInfo,
QueryProductInfo, QueryProductInfo,
GetQuestData, GetQuestData,
@@ -98,33 +98,33 @@ dummy! {
// GetFriendListInfo, // GetFriendListInfo,
// GetFriendApplyListInfo, // GetFriendApplyListInfo,
GetCurAssist, GetCurAssist,
GetRogueHandbookData, // GetRogueHandbookData, // ?3.7.51
GetDailyActiveInfo, GetDailyActiveInfo,
GetFightActivityData, GetFightActivityData,
GetMultipleDropInfo, // GetMultipleDropInfo, // ?3.7.51
GetPlayerReturnMultiDropInfo, // GetPlayerReturnMultiDropInfo, // ?3.7.51
GetShareData, // GetShareData, // ?3.7.51
GetTreasureDungeonActivityData, // GetTreasureDungeonActivityData, // ?3.7.51
PlayerReturnInfoQuery, // PlayerReturnInfoQuery, // ?3.7.51
// GetBag, // GetBag,
GetPlayerBoardData, GetPlayerBoardData,
GetActivityScheduleConfig, GetActivityScheduleConfig,
GetMissionData, GetMissionData,
GetChallenge, GetChallenge,
GetCurChallenge, GetCurChallenge,
GetRogueInfo, // GetRogueInfo, // ?3.7.51
GetExpeditionData, GetExpeditionData,
// GetRogueDialogueEventData, // GetRogueDialogueEventData,
GetJukeboxData, GetJukeboxData,
SyncClientResVersion, SyncClientResVersion,
DailyFirstMeetPam, // DailyFirstMeetPam, // ?3.7.51
GetMuseumInfo, // GetMuseumInfo, // ?3.7.51
GetLoginActivity, GetLoginActivity,
GetRaidInfo, GetRaidInfo,
GetTrialActivityData, GetTrialActivityData,
GetBoxingClubInfo, // GetBoxingClubInfo, // ?3.7.51
GetNpcStatus, GetNpcStatus,
TextJoinQuery, // TextJoinQuery, // ?3.7.51
// GetSpringRecoverData, // Removed 2.7.51 // GetSpringRecoverData, // Removed 2.7.51
// GetChatFriendHistory, // GetChatFriendHistory,
GetSecretKeyInfo, GetSecretKeyInfo,
+3 -3
View File
@@ -32,14 +32,14 @@ pub async fn on_player_login_finish_cs_req(
) -> Result<()> { ) -> Result<()> {
session session
.send(ContentPackageSyncDataScNotify { .send(ContentPackageSyncDataScNotify {
data: Some(PackageData { data: Some(ContentPackageData {
info_list: [ content_package_list: [
200001, 200002, 200003, 200004, 200005, 200006, 200007, 200008, 150017, 150015, 200001, 200002, 200003, 200004, 200005, 200006, 200007, 200008, 150017, 150015,
150021, 150018, 130011, 130012, 130013, 150025, 140006, 150026, 130014, 150034, 150021, 150018, 130011, 130012, 130013, 150025, 140006, 150026, 130014, 150034,
150029, 150035, 150041, 150039, 150045, 150029, 150035, 150041, 150039, 150045,
] ]
.into_iter() .into_iter()
.map(|v| ContentInfo { .map(|v| ContentPackageInfo {
status: ContentPackageStatus::Finished.into(), status: ContentPackageStatus::Finished.into(),
content_id: v, content_id: v,
}) })
+33 -31
View File
@@ -46,7 +46,7 @@ pub async fn on_enter_scene_cs_req(
.await .await
.is_err() .is_err()
{ {
res.retcode = Retcode::RetSceneEntryIdNotMatch as u32; res.retcode = 2605;
}; };
} }
@@ -56,19 +56,19 @@ pub async fn on_get_scene_map_info_cs_req(
res: &mut GetSceneMapInfoScRsp, res: &mut GetSceneMapInfoScRsp,
) { ) {
for floor_id in &req.floor_id_list { for floor_id in &req.floor_id_list {
let mut map_info = MazeMapData { let mut map_info = SceneMapInfo {
retcode: 0, retcode: 0,
unlocked_chest_list: vec![ chest_list: vec![
MazeChest { ChestInfo {
map_info_chest_type: MapInfoChestType::Normal.into(), chest_type: 101,
..Default::default() ..Default::default()
}, },
MazeChest { ChestInfo {
map_info_chest_type: MapInfoChestType::Puzzle.into(), chest_type: 102,
..Default::default() ..Default::default()
}, },
MazeChest { ChestInfo {
map_info_chest_type: MapInfoChestType::Challenge.into(), chest_type: 104,
..Default::default() ..Default::default()
}, },
], ],
@@ -94,37 +94,39 @@ pub async fn on_get_scene_map_info_cs_req(
}); });
for teleport in group.teleports.keys() { for teleport in group.teleports.keys() {
map_info.unlocked_teleport_list.push(*teleport) map_info.unlock_teleport_list.push(*teleport)
} }
for prop in &group.props { for prop in &group.props {
map_info.maze_prop_list.push(MazeProp { map_info.maze_prop_list.push(MazePropState {
group_id: prop.group_id, group_id: prop.group_id,
state: prop.prop_state, state: prop.prop_state,
config_id: prop.inst_id, config_id: prop.inst_id,
}); });
map_info.maze_prop_extra_list.push(MazePropExtra { map_info
group_id: prop.group_id, .maze_prop_extra_state_list
state: prop.prop_state, .push(MazePropExtraState {
config_id: prop.inst_id, group_id: prop.group_id,
extra_info: Option::None, state: prop.prop_state,
}); config_id: prop.inst_id,
extra_info: Option::None,
});
} }
} }
map_info.lighten_section_list = floor_config.sections.clone(); map_info.lighten_section_list = floor_config.sections.clone();
map_info.floor_saved_data = floor_config.saved_values.clone(); map_info.floor_saved_data = floor_config.saved_values.clone();
// TODO! // #TODO!
map_info // map_info
.chest_unlock_progress_list // .chest_unlock_progress_list
.push(ChestUnlockProgress { // .push(ChestUnlockProgress {
r#type: 0, // r#type: 0,
total_chest_count: 25, // total_chest_count: 25,
unlocked_chest_count: 25, // unlocked_chest_count: 25,
}); // });
} }
res.map_list.push(map_info) res.scene_map_info.push(map_info)
} }
} }
@@ -170,7 +172,7 @@ pub async fn on_get_entered_scene_cs_req(
_req: &GetEnteredSceneCsReq, _req: &GetEnteredSceneCsReq,
res: &mut GetEnteredSceneScRsp, res: &mut GetEnteredSceneScRsp,
) { ) {
res.entered_scene_info = GAME_RES res.entered_scene_info_list = GAME_RES
.level_output_configs .level_output_configs
.iter() .iter()
.flat_map(|(_, v)| { .flat_map(|(_, v)| {
@@ -249,13 +251,13 @@ async fn load_scene(
scene.world_id scene.world_id
}, },
lighten_section_list: scene.sections.clone(), lighten_section_list: scene.sections.clone(),
chest_id_list: scene lddigmlcgdb: scene
.scenes .scenes
.values() .values()
.flat_map(|v| v.chests.clone()) .flat_map(|v| v.chests.clone())
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
scene_mission_info: Some(MissionStatusBySceneInfo { scene_mission_info: Some(MissionStatusBySceneInfo {
finished_mission_id_list: scene finished_main_mission_id_list: scene
.scenes .scenes
.values() .values()
.flat_map(|s| s.finished_main_missions.clone()) .flat_map(|s| s.finished_main_missions.clone())
@@ -392,7 +394,7 @@ async fn load_scene(
scene_info.entity_group_list.push(group_info); scene_info.entity_group_list.push(group_info);
scene_info.group_state_list.push(SceneGroupState { scene_info.clecmgljocl.push(SceneGroupState {
group_id: *group_id, group_id: *group_id,
is_default: true, is_default: true,
state: 0, state: 0,
@@ -403,7 +405,7 @@ async fn load_scene(
scene_info.entity_group_list.push(SceneEntityGroupInfo { scene_info.entity_group_list.push(SceneEntityGroupInfo {
state: 0, state: 0,
group_id: 0, group_id: 0,
hejamoojbcj: HashMap::with_capacity(0), jnajakchjdf: HashMap::with_capacity(0),
entity_list: json entity_list: json
.lineups .lineups
.iter() .iter()
+1 -1
View File
@@ -17,7 +17,7 @@ use proto::{
CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*, CmdMissionType::*, CmdMonopolyType::*, CmdMultiplayerType::*, CmdMultipleDropType::*,
CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*, CmdMuseumType::*, CmdOfferingType::*, CmdPamMissionType::*, CmdPhoneType::*,
CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*, CmdPlayerBoardType::*, CmdPlayerReturnType::*, CmdPlayerSync::*, CmdPlayerType::*,
CmdPlotType::*, CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*, CmdPunkLordType::*, CmdQuestType::*, CmdRaidCollectionType::*, CmdRaidType::*,
CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*, CmdRndOptionType::*, CmdRecommendType::*, CmdRedDotType::*, CmdReplayType::*, CmdRndOptionType::*,
CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*, CmdRogueTournType::*, CmdRogueCommonType::*, CmdRogueEndless::*, CmdRogueModifierType::*, CmdRogueTournType::*,
CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*, CmdServerPrefsType::*, CmdShopType::*, CmdRogueType::*, CmdRollShopType::*, CmdSceneType::*, CmdServerPrefsType::*, CmdShopType::*,
+8 -7
View File
@@ -10,7 +10,7 @@ use anyhow::Result;
use common::sr_tools::FreesrData; use common::sr_tools::FreesrData;
use mhy_kcp::Kcp; use mhy_kcp::Kcp;
use prost::Message; use prost::Message;
use proto::{AvatarSync, CmdID, CmdPlayerType, PlayerSyncScNotify}; use proto::{AvatarSync, CmdID, PlayerSyncScNotify};
use tokio::{ use tokio::{
io::AsyncWrite, io::AsyncWrite,
net::UdpSocket, net::UdpSocket,
@@ -70,11 +70,12 @@ impl PlayerSession {
drop(kcp); drop(kcp);
for packet in packets { for packet in packets {
if packet.cmd_type == CmdPlayerType::CmdPlayerLogoutCsReq as u16 { // #TODO
tracing::info!("Player logged out"); // if packet.cmd_type == CmdPlayerType::CmdPlayerLogoutCsReq as u16 {
let _ = self.shutdown_tx.send(()); // tracing::info!("Player logged out");
return Ok(()); // let _ = self.shutdown_tx.send(());
}; // return Ok(());
// };
Self::on_message(self, packet.cmd_type, packet.body).await?; Self::on_message(self, packet.cmd_type, packet.body).await?;
} }
@@ -140,7 +141,7 @@ impl PlayerSession {
.map(|avatar| avatar.to_avatar_proto(Option::None, vec![])) .map(|avatar| avatar.to_avatar_proto(Option::None, vec![]))
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
}), }),
multi_path_avatar_type_info_list: json.get_multi_path_info(), multi_path_avatar_info_list: json.get_multi_path_info(),
..Default::default() ..Default::default()
}) })
.await .await
+58889 -61327
View File
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::AppState; use crate::AppState;
use axum::extract::{Query, State}; use axum::extract::{Query, State};
use prost::Message; use prost::Message;
use proto::{DispatchRegionData, Gateserver, RegionEntry}; use proto::{Dispatch, Gateserver, RegionInfo};
use serde::Deserialize; use serde::Deserialize;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use tracing::instrument; use tracing::instrument;
@@ -13,12 +13,12 @@ pub const QUERY_GATEWAY_ENDPOINT: &str = "/query_gateway";
#[tracing::instrument] #[tracing::instrument]
pub async fn query_dispatch() -> String { pub async fn query_dispatch() -> String {
let rsp = DispatchRegionData { let rsp = Dispatch {
retcode: 0, retcode: 0,
region_list: vec![RegionEntry { region_list: vec![RegionInfo {
name: String::from("RobinSR"), name: String::from("RobinSR"),
title: String::from("RobinSR"), title: String::from("RobinSR"),
env_type: String::from("21"), env_type: String::from("9"),
dispatch_url: String::from("http://127.0.0.1:21000/query_gateway"), dispatch_url: String::from("http://127.0.0.1:21000/query_gateway"),
..Default::default() ..Default::default()
}], }],
@@ -48,23 +48,23 @@ pub async fn query_gateway(
.await; .await;
let rsp = Gateserver { let rsp = Gateserver {
retcode: 0,
ip: String::from("127.0.0.1"), ip: String::from("127.0.0.1"),
port: 23301, port: 23301,
asset_bundle_url: config.asset_bundle_url.clone(), asset_bundle_url: config.asset_bundle_url.clone(),
asset_bundle_url_android: config.asset_bundle_url.clone(),
ex_resource_url: config.ex_resource_url.clone(), ex_resource_url: config.ex_resource_url.clone(),
lua_url: config.lua_url.clone(), lua_url: config.lua_url.clone(),
ifix_version: String::from("0"), ifix_version: String::from("0"),
enable_design_data_version_update: true, unk1: true,
enable_version_update: true, unk2: true,
enable_upload_battle_log: true, unk3: true,
network_diagnostic: true, unk4: true,
close_redeem_code: true, unk5: true,
enable_android_middle_package: true, unk6: true,
enable_watermark: true, unk7: true,
event_tracking_open: true, unk8: true,
enable_cdn_ipv6: 1, unk9: true,
enable_save_replay_file: true, unk10: true,
..Default::default() ..Default::default()
}; };