Compare commits

..

3 commits

12 changed files with 321 additions and 2511 deletions

View file

@ -32,7 +32,7 @@ prost-build = "0.12.3"
paste = "1.0.14" paste = "1.0.14"
sysinfo = "0.30.7" sysinfo = "0.30.7"
strum = { version = "0.26.2", features = ["derive", "strum_macros"] }
hex = "0.4.3" hex = "0.4.3"
serde = { version = "1.0.197", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }

View file

@ -1,5 +1,7 @@
{ {
"lineup": [1314], "lineup": [1314],
"hero_gender": "GenderWoman",
"hero_basic_type": "GirlShaman",
"monster_wave_list": "monster_wave_list":
[ [
[3013010, 3013010], [3013010, 3013010],

View file

@ -15,5 +15,7 @@ lazy_static! {
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct Globals { pub struct Globals {
pub lineup: Vec<u32>, pub lineup: Vec<u32>,
pub hero_gender: String,
pub hero_basic_type: String,
pub monster_wave_list: Vec<Vec<u32>>, pub monster_wave_list: Vec<Vec<u32>>,
} }

View file

@ -7,6 +7,8 @@ use proto::*;
pub struct PlayerInfo { pub struct PlayerInfo {
pub uid: u32, pub uid: u32,
pub lineup: LineupInfo, pub lineup: LineupInfo,
pub gender: Gender,
pub hero_basic_type: HeroBasicType,
} }
impl PlayerInfo { impl PlayerInfo {
@ -14,6 +16,9 @@ impl PlayerInfo {
Self { Self {
uid: 1337, uid: 1337,
lineup: default_lineup(), lineup: default_lineup(),
gender: Gender::from_str_name(globals.hero_gender.as_str()).unwrap(),
hero_basic_type: HeroBasicType::from_str_name(globals.hero_basic_type.as_str())
.unwrap(),
} }
} }

View file

@ -1,10 +1,10 @@
use super::*; use super::*;
static UNLOCKED_AVATARS: [u32; 50] = [ static UNLOCKED_AVATARS: [u32; 51] = [
1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, 1013, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1001, 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, 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, 1310, 1312, 1212, 1213, 1214, 1215, 1217, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1312,
1314, 1315, 1314, 1315, 8001,
]; ];
pub async fn on_get_avatar_data_cs_req( pub async fn on_get_avatar_data_cs_req(

View file

@ -22,7 +22,11 @@ pub async fn on_start_cocoon_stage_cs_req(
.iter() .iter()
.map(|avatar| BattleAvatar { .map(|avatar| BattleAvatar {
index: avatar.slot, index: avatar.slot,
id: avatar.id, id: if avatar.id == 8001 {
player_info.hero_basic_type as u32
} else {
avatar.id
},
level: 80, level: 80,
promotion: 6, promotion: 6,
rank: 6, rank: 6,

View file

@ -22,15 +22,17 @@ pub async fn on_get_hero_basic_type_info_cs_req(
session: &PlayerSession, session: &PlayerSession,
_body: &GetHeroBasicTypeInfoCsReq, _body: &GetHeroBasicTypeInfoCsReq,
) -> Result<()> { ) -> Result<()> {
let player_info = session.player_info();
session session
.send( .send(
CMD_GET_HERO_BASIC_TYPE_INFO_SC_RSP, CMD_GET_HERO_BASIC_TYPE_INFO_SC_RSP,
GetHeroBasicTypeInfoScRsp { GetHeroBasicTypeInfoScRsp {
retcode: 0, retcode: 0,
gender: Gender::Man.into(), gender: player_info.gender.into(),
cur_basic_type: HeroBasicType::BoyWarrior.into(), cur_basic_type: player_info.hero_basic_type.into(),
basic_type_info_list: vec![HeroBasicTypeInfo { basic_type_info_list: vec![HeroBasicTypeInfo {
basic_type: HeroBasicType::BoyWarrior.into(), basic_type: HeroBasicType::GirlShaman.into(),
..Default::default() ..Default::default()
}], }],
..Default::default() ..Default::default()

View file

@ -22,10 +22,6 @@ pub async fn on_enter_scene_cs_req(session: &PlayerSession, body: &EnterSceneCsR
floor_id: entrance_config.floor_id, floor_id: entrance_config.floor_id,
entry_id: entrance_config.id, entry_id: entrance_config.id,
game_mode_type: 1, // TODO: EntranceType -> enum repr(u32) game_mode_type: 1, // TODO: EntranceType -> enum repr(u32)
// TODO: thing above is probably not gm type
nnfgkelcban: 1,
lgflfajffjl: 1,
pjbjelcgkof: 1,
..Default::default() ..Default::default()
}), }),
}; };
@ -49,10 +45,33 @@ pub async fn on_get_cur_scene_info_cs_req(
floor_id: 20101001, floor_id: 20101001,
entry_id: 2010101, entry_id: 2010101,
game_mode_type: 1, game_mode_type: 1,
nnfgkelcban: 1, leader_entity_id: 1,
lgflfajffjl: 1, scene_group_list: vec![
pjbjelcgkof: 1, SceneGroupInfo {
scene_group_list: vec![SceneGroupInfo { state: 1,
group_id: 0,
entity_list: vec![SceneEntityInfo {
group_id: 0,
inst_id: 0,
entity_id: 1,
actor: Some(SceneActorInfo {
avatar_type: 3,
base_avatar_id: 1314,
map_layer: 2,
uid: session.player_uid(),
}),
motion: Some(MotionInfo {
pos: Some(Vector {
x: -550,
y: 19364,
z: 4480,
}),
rot: Some(Vector::default()),
}),
..Default::default()
}],
},
SceneGroupInfo {
state: 1, state: 1,
group_id: 19, group_id: 19,
entity_list: vec![SceneEntityInfo { entity_list: vec![SceneEntityInfo {
@ -66,15 +85,16 @@ pub async fn on_get_cur_scene_info_cs_req(
}), }),
motion: Some(MotionInfo { motion: Some(MotionInfo {
pos: Some(Vector { pos: Some(Vector {
z: 4480,
y: 19364,
x: -570, x: -570,
y: 19364,
z: 4480,
}), }),
rot: Some(Vector::default()), rot: Some(Vector::default()),
}), }),
..Default::default() ..Default::default()
}], }],
}], },
],
..Default::default() ..Default::default()
}), }),
}, },

View file

@ -7,6 +7,7 @@ version.workspace = true
prost.workspace = true prost.workspace = true
prost-types.workspace = true prost-types.workspace = true
serde.workspace = true serde.workspace = true
strum.workspace = true
[build-dependencies] [build-dependencies]
prost-build.workspace = true prost-build.workspace = true

View file

@ -5,7 +5,7 @@ pub fn main() {
prost_build::Config::new() prost_build::Config::new()
.out_dir("out/") .out_dir("out/")
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") .enum_attribute(".", "#[derive(EnumString)]")
.compile_protos(&[proto_file], &["."]) .compile_protos(&[proto_file], &["."])
.unwrap(); .unwrap();
} }

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,6 @@
mod cmd_types; mod cmd_types;
pub use cmd_types::*; pub use cmd_types::*;
use strum::EnumString;
include!("../out/_.rs"); include!("../out/_.rs");