Trailblazer configuration in globals.json (gender and path)

This commit is contained in:
xeon 2024-05-09 19:52:34 +03:00
parent 7d8c967952
commit b98a3e230c
11 changed files with 268 additions and 7 deletions

View file

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

View file

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

View file

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

View file

@ -7,6 +7,8 @@ use proto::*;
pub struct PlayerInfo {
pub uid: u32,
pub lineup: LineupInfo,
pub gender: Gender,
pub hero_basic_type: HeroBasicType,
}
impl PlayerInfo {
@ -14,6 +16,9 @@ impl PlayerInfo {
Self {
uid: 1337,
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::*;
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,
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,
1314, 1315,
1314, 1315, 8001,
];
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()
.map(|avatar| BattleAvatar {
index: avatar.slot,
id: avatar.id,
id: if avatar.id == 8001 {
player_info.hero_basic_type as u32
} else {
avatar.id
},
level: 80,
promotion: 6,
rank: 6,

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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