This commit is contained in:
amizing25 2024-04-09 23:08:41 +07:00
parent ec8be0839c
commit a56d3e768f
14 changed files with 1532 additions and 8733 deletions

View File

@ -1,8 +1,9 @@
# Run the game by clicking run.bat file
# Supported Version: 2.1.53
Run the game by clicking run.bat file.
Tool website: [https://freesr-tools.pages.dev](https://freesr-tools.pages.dev)
Start battle by entering any calyx in the map, DON'T ATTACK THE ENEMIES, IT WON'T WORK
Start battle by entering any calyx in the map, DON'T ATTACK THE ENEMIES, IT WON'T WORK (maybe)
# RobinSR
Original: [https://git.xeondev.com/reversedrooms/RobinSR/](https://git.xeondev.com/reversedrooms/RobinSR/)

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@ pub async fn on_player_login_cs_req(
stamina: 240,
basic_info: Some(PlayerBasicInfo {
nickname: String::from("xeondev"),
level: 5,
level: 70,
world_level: 6,
stamina: 240,
..Default::default()
}),

View File

@ -1,3 +1,5 @@
use crate::net::tools::{JsonData, Lightcone};
use super::*;
static UNLOCKED_AVATARS: [u32; 54] = [
@ -11,6 +13,7 @@ pub async fn on_get_avatar_data_cs_req(
session: &mut PlayerSession,
body: &GetAvatarDataCsReq,
) -> Result<()> {
let json = JsonData::load().await;
session
.send(
CMD_GET_AVATAR_DATA_SC_RSP,
@ -19,13 +22,13 @@ pub async fn on_get_avatar_data_cs_req(
is_all: body.is_get_all,
avatar_list: UNLOCKED_AVATARS
.iter()
.map(|id| Avatar {
.map(|id| json.avatars.get(id).map(|v|v.to_avatar_proto(Option::<&Lightcone>::None, vec![])).unwrap_or(Avatar {
base_avatar_id: *id,
level: 80,
promotion: 6,
rank: 6,
..Default::default()
})
}))
.collect(),
..Default::default()
},

View File

@ -1,3 +1,5 @@
use rand::Rng;
use crate::net::tools::{self, BattleType, Monster};
use super::*;
@ -10,7 +12,7 @@ pub async fn on_start_cocoon_stage_cs_req(
let mut battle_info = SceneBattleInfo {
stage_id: player.battle_config.stage_id,
logic_random_seed: 4444,
logic_random_seed: rand::thread_rng().gen::<u32>(),
// battle_id: 1,
kimmjioaodn: player.battle_config.cycle_count,
..Default::default()
@ -167,3 +169,151 @@ pub async fn on_pve_battle_result_cs_req(
)
.await
}
// scene cast skill cs req
pub async fn on_mpemgbdkigg(session: &mut PlayerSession, request: &Mpemgbdkigg) -> Result<()> {
let player = tools::JsonData::load().await;
let mut battle_info = SceneBattleInfo {
stage_id: player.battle_config.stage_id,
logic_random_seed: rand::thread_rng().gen::<u32>(),
// battle_id: 1,
kimmjioaodn: player.battle_config.cycle_count,
..Default::default()
};
// avatars
for i in 0..4 {
let avatar_id = &player.lineups.get(&i).unwrap_or(&0);
if **avatar_id == 0 {
continue;
}
if let Some(avatar) = player.avatars.get(&avatar_id) {
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
i,
player
.lightcones
.iter()
.find(|v| v.equip_avatar == avatar.avatar_id),
player
.relics
.iter()
.filter(|v| v.equip_avatar == avatar.avatar_id)
.collect::<Vec<_>>(),
);
for tech in techs {
battle_info.buff_list.push(tech);
}
battle_info.battle_avatar_list.push(battle_avatar);
};
}
// custom stats for avatars
for stat in &player.battle_config.custom_stats {
for avatar in &mut battle_info.battle_avatar_list {
if avatar.relic_list.len() == 0 {
avatar.relic_list.push(BattleRelic {
id: 61011,
main_affix_id: 1,
level: 1,
..Default::default()
})
}
if let Some(sub_affix) = avatar.relic_list[0]
.sub_affix_list
.iter_mut()
.find(|v| v.affix_id == stat.sub_affix_id)
{
sub_affix.cnt = stat.count;
} else {
avatar.relic_list[0].sub_affix_list.push(RelicAffix {
affix_id: stat.sub_affix_id,
cnt: stat.count,
step: stat.step,
})
}
}
}
// blessings
for blessing in &player.battle_config.blessings {
let mut buffs = BattleBuff {
id: blessing.id,
level: blessing.level,
wave_flag: 0xffffffff,
owner_index: 0xffffffff,
..Default::default()
};
if let Some(dynamic_key) = &blessing.dynamic_key {
buffs
.dynamic_values
.insert(dynamic_key.key.clone(), dynamic_key.value as f32);
};
battle_info.buff_list.push(buffs);
}
// pf score object
if player.battle_config.battle_type == BattleType::PF {
let mut battle_target = Hbinjjdphdo::default();
battle_target.bgnpebhgelb.push(BattleTarget {
id: 10001,
progress: 0,
..Default::default()
});
battle_info.ichnbmifjdi.insert(1, battle_target);
for i in 2..=4 {
battle_info.ichnbmifjdi.insert(i, Hbinjjdphdo::default());
}
battle_info.ichnbmifjdi.insert(
5,
Hbinjjdphdo {
bgnpebhgelb: vec![
BattleTarget {
id: 2001,
progress: 0,
..Default::default()
},
BattleTarget {
id: 2002,
progress: 0,
..Default::default()
},
],
},
);
}
// SU
if player.battle_config.battle_type == BattleType::SU {
battle_info.mpobegkcikn.push(Npjnkmmjfdf {
chgdaadjepi: player.battle_config.path_resonance_id,
status: Some(Agpocmnmmdi {
sp: Some(AmountInfo {
cur_amount: 10_000,
max_amount: 10_000,
}),
}),
..Default::default()
})
}
// monsters
battle_info.monster_wave_list = Monster::to_scene_monster_waves(&player.battle_config.monsters);
let mut resp = Ifiohnjlehh {
elgjckaejld: request.elgjckaejld,
retcode: 0,
pbgpinglheg: vec![],
..Default::default()
};
if request.hjopkcdlmln.len() > 0 && request.oknicldeddl <= 4 {
resp.battle_info = Some(battle_info)
}
session.send(CMD_SCENE_CAST_SKILL_SC_RSP, resp).await?;
Ok(())
}

View File

@ -1,6 +1,6 @@
use super::*;
static FINISHED_MAIN_MISSIONS: [u32; 365] = [
static FINISHED_MAIN_MISSIONS: [u32; 1298] = [
1000101, 1000111, 1000112, 1000113, 1000114, 1000201, 1000202, 1000203, 1000204, 1000300,
1000301, 1000302, 1000303, 1000304, 1000400, 1000401, 1000402, 1000410, 1000500, 1000501,
1000502, 1000503, 1000504, 1000505, 1000510, 1000511, 1010001, 1010002, 1010101, 1010201,
@ -11,33 +11,126 @@ static FINISHED_MAIN_MISSIONS: [u32; 365] = [
1011503, 1020101, 1020201, 1020302, 1020301, 1020400, 1020401, 1020402, 1020403, 1020501,
1020601, 1020701, 1020702, 1020801, 1020901, 1021001, 1021101, 1021201, 1021301, 1021401,
1021501, 1021601, 1021702, 1021703, 1030101, 1030102, 1030201, 1030202, 1030301, 1030302,
1030303, 1030304, 1030401, 1030402, 1030403, 1030501, 1030601, 1030701, 1030702, 1030801,
2000001, 2000002, 2000003, 2000004, 2000100, 2000101, 2000131, 2000132, 2000133, 2000110,
2000111, 2000301, 2000103, 2000112, 2000108, 2000104, 2000102, 2000105, 2000106, 2000107,
2000313, 2000314, 2000109, 2000113, 2000116, 2000118, 2000119, 2000120, 2000122, 2000302,
2000303, 2000304, 2000305, 2000310, 2000311, 2000312, 2000320, 2000701, 2000702, 2000703,
2000704, 2000705, 2000706, 2000707, 2000801, 2000802, 2000803, 2000901, 2000902, 2000903,
2001001, 2001002, 2001003, 2010005, 2010301, 2010302, 2011103, 2011104, 2011409, 2010401,
2010402, 2010405, 2010502, 2010503, 2010701, 2010708, 2010709, 2010720, 2010730, 2010731,
2010732, 2010733, 2010734, 2010735, 2010904, 2011101, 2011102, 2011105, 2011301, 2011302,
2011303, 2011501, 2011502, 2010909, 2010910, 2011601, 2011701, 2011801, 2011901, 2011902,
2011903, 2011904, 2011905, 2011906, 2020301, 2020302, 2020304, 2020316, 2020317, 2020318,
2020319, 2020401, 2020402, 2020403, 2020404, 2020405, 2020406, 2020407, 2020303, 2020103,
2020104, 2020105, 2020106, 2020107, 2020108, 2020109, 2020110, 2020111, 2020201, 2020202,
2020203, 2020204, 2020205, 2000201, 2000202, 2000203, 2000204, 2000205, 2000206, 2000207,
2000208, 2000209, 2000211, 2000212, 2010201, 2010202, 2010203, 2010204, 2010205, 2010206,
2010500, 2010501, 2010705, 2010706, 2010901, 2010902, 2010903, 2010702, 2010703, 2011400,
2011401, 2011406, 2011402, 2011403, 2011404, 2011405, 2011407, 2011408, 2011410, 2011411,
2011412, 2011413, 2010905, 2010906, 2010907, 2010908, 2010911, 2010912, 2020305, 2020306,
2020309, 2020307, 2020308, 2020701, 2020702, 2020703, 2020313, 2020314, 2020315, 6020101,
6020201, 6020202, 2020501, 2020502, 2020503, 2020504, 2020505, 2020506, 2020507, 2020601,
2020602, 2020603, 2020604, 2020801, 2020802, 2020901, 2021001, 2021002, 2021009, 2021601,
2021602, 2021701, 2021702, 2021703, 2021704, 2021705, 2021801, 2021802, 2021803, 2030001,
2030002, 2030003, 2030101, 2030102, 2030201, 2030202, 2030203, 2030301, 2030302, 3000201,
3000202, 3000203, 3000211, 3000212, 3000213, 3000301, 3000302, 3000303, 3000522, 3000523,
3000524, 3000525, 3000526, 3000527, 3000601, 3000602, 3000603, 3000604, 3000701, 3000702,
3000703, 3000704, 3000705, 3000800, 3000801, 3000802, 3000803, 3010102, 3010103, 3010104,
3010105, 3010201, 3010202, 3010203, 3010204,
1030303, 1030304, 1030401, 1030402, 1030403, 1030501, 1030601, 1030701, 1030702, 1030703,
1030801, 1030901, 1031001, 1031002, 1031101, 1031201, 1031301, 1031401, 1031501, 1031601,
1031701, 1031801, 1031901, 1032001, 1032101, 1032201, 1032301, 1032302, 1032401, 1032501,
1032601, 1032602, 1032701, 1032702, 1032703, 1032704, 1032705, 1032801, 1032802, 1032901,
1032902, 1033001, 1033101, 1033102, 2000001, 2000002, 2000003, 2000004, 2000100, 2000101,
2000131, 2000132, 2000133, 2000110, 2000111, 2000301, 2000103, 2000112, 2000108, 2000104,
2000102, 2000105, 2000106, 2000107, 2000313, 2000314, 2000109, 2000113, 2000116, 2000118,
2000119, 2000120, 2000122, 2000302, 2000303, 2000304, 2000305, 2000310, 2000311, 2000312,
2000320, 2000701, 2000702, 2000703, 2000704, 2000705, 2000706, 2000707, 2000801, 2000802,
2000803, 2000901, 2000902, 2000903, 2001001, 2001002, 2001003, 2010005, 2010301, 2010302,
2011103, 2011104, 2011409, 2010401, 2010402, 2010405, 2010502, 2010503, 2010701, 2010708,
2010709, 2010720, 2010730, 2010731, 2010732, 2010733, 2010734, 2010735, 2010904, 2011101,
2011102, 2011105, 2011301, 2011302, 2011303, 2011501, 2011502, 2010909, 2010910, 2011601,
2011701, 2011801, 2011901, 2011902, 2011903, 2011904, 2011905, 2011906, 2020301, 2020302,
2020304, 2020316, 2020317, 2020318, 2020319, 2020401, 2020402, 2020403, 2020404, 2020405,
2020406, 2020407, 2020303, 2020103, 2020104, 2020105, 2020106, 2020107, 2020108, 2020109,
2020110, 2020111, 2020201, 2020202, 2020203, 2020204, 2020205, 2000201, 2000202, 2000203,
2000204, 2000205, 2000206, 2000207, 2000208, 2000209, 2000211, 2000212, 2010201, 2010202,
2010203, 2010204, 2010205, 2010206, 2010500, 2010501, 2010705, 2010706, 2010901, 2010902,
2010903, 2010702, 2010703, 2011400, 2011401, 2011406, 2011402, 2011403, 2011404, 2011405,
2011407, 2011408, 2011410, 2011411, 2011412, 2011413, 2010905, 2010906, 2010907, 2010908,
2010911, 2010912, 2020305, 2020306, 2020309, 2020307, 2020308, 2020701, 2020702, 2020703,
2020313, 2020314, 2020315, 6020101, 6020201, 6020202, 2020501, 2020502, 2020503, 2020504,
2020505, 2020506, 2020507, 2020601, 2020602, 2020603, 2020604, 2020801, 2020802, 2020901,
2021001, 2021002, 2021009, 2021601, 2021602, 2021701, 2021702, 2021703, 2021704, 2021705,
2021801, 2021802, 2021803, 2030001, 2030002, 2030003, 2030101, 2030102, 2030201, 2030202,
2030203, 2030301, 2030302, 2030401, 2030402, 3000201, 3000202, 3000203, 3000211, 3000212,
3000213, 3000301, 3000302, 3000303, 3000522, 3000523, 3000524, 3000525, 3000526, 3000527,
3000601, 3000602, 3000603, 3000604, 3000701, 3000702, 3000703, 3000704, 3000705, 3000800,
3000801, 3000802, 3000803, 3010102, 3010103, 3010104, 3010105, 3010201, 3010202, 3010203,
3010204, 3010205, 3011011, 3011012, 3011013, 3011014, 3011111, 3011112, 3011113, 3011114,
3011201, 3011202, 3011203, 3011204, 3011205, 3011206, 3011207, 3011208, 3011401, 3011402,
3011403, 3011404, 3011405, 3011406, 3011407, 3011408, 3011501, 3011502, 3011503, 3011504,
3011505, 3011601, 3011602, 3011603, 3011604, 3011605, 3011606, 3011607, 3011608, 3011609,
3011610, 3012001, 3020101, 3020102, 3020103, 3020104, 3020105, 3020106, 3020107, 3020108,
3020201, 3020202, 3020203, 3020204, 3020205, 3020206, 4020101, 4020102, 4020103, 4020104,
4020105, 4020106, 4020107, 4020108, 4020109, 4020110, 4020111, 4020112, 4020113, 4020114,
4010105, 4010106, 4010107, 4010112, 4010113, 4010131, 4010115, 4010116, 4010121, 4010122,
4010123, 4010124, 4010125, 4010126, 4010127, 4010128, 4010133, 4010134, 4010135, 4010130,
4010136, 4010137, 4010138, 4010140, 4010141, 4015101, 4015103, 4015102, 4015202, 4015203,
4015204, 4015301, 4015302, 4015303, 4015401, 4015402, 4015403, 4030001, 4030002, 4030003,
4030004, 4030006, 4030007, 4030009, 4030010, 4040001, 4040002, 4040003, 4040004, 4040005,
4040006, 4040052, 4040007, 4040008, 4040051, 4040009, 4040010, 4040011, 4040012, 4040053,
4040014, 4040015, 4040017, 4040018, 4040019, 4040020, 4040021, 4040022, 4040023, 4040024,
4040100, 4040189, 4040190, 4040101, 4040151, 4040154, 4040102, 4040103, 4040153, 4040104,
4040152, 4040105, 4040106, 4040155, 4040107, 4040108, 4040109, 4040156, 4040157, 4040110,
4040114, 4040115, 4040158, 4040159, 4040160, 4040161, 4040162, 4040116, 4040169, 4040163,
4040164, 4040165, 4040166, 4040167, 4040168, 4040170, 4040171, 4040172, 4040173, 4040174,
4040175, 4040176, 4040177, 4040178, 4040179, 4040180, 4040181, 4040182, 4040183, 4040184,
4040185, 4040186, 4040117, 4040118, 4040119, 4040187, 4040120, 4040188, 4040121, 4040122,
4040123, 4040124, 4040125, 4040126, 4040127, 4040128, 4040129, 4040130, 4140101, 4140102,
4140103, 4140104, 4140105, 4140106, 4140107, 4140108, 4140109, 4140110, 4140111, 4140112,
4140113, 4140114, 4140115, 4140116, 4140117, 4140118, 4140119, 4140120, 4140121, 4140122,
4140123, 4040201, 4040202, 4040203, 4040204, 4040205, 4040206, 4040207, 4040208, 4040290,
4040209, 4040210, 4040211, 4040212, 4040213, 4040214, 4040215, 4040216, 4040217, 4040218,
4040219, 4040220, 4040221, 4040222, 4040223, 4040224, 4040225, 4040226, 4040227, 4040228,
4040229, 4040230, 4040231, 4040240, 4040241, 4040242, 4040244, 4040245, 4040246, 4040247,
4040248, 4040249, 4040250, 4040251, 4040252, 4040253, 4040254, 4040255, 4040256, 4040257,
4040258, 4040259, 4040260, 4040261, 4040262, 4040263, 4040264, 4240301, 4240302, 4240304,
4240305, 4240306, 4240307, 4240308, 4240309, 4240310, 4240311, 4240312, 4240313, 4240314,
4240316, 4240317, 4240320, 4240321, 4240322, 4240323, 4240401, 4240402, 4240403, 4240404,
4340101, 4340102, 4340103, 4340104, 4340105, 4340106, 4340107, 4340108, 4340109, 4340110,
4340111, 4340112, 4340113, 4340114, 4340115, 4340116, 4340117, 4340118, 4340119, 4340150,
4340151, 4340152, 4340153, 4340154, 4340155, 4340156, 4340157, 4340158, 4340159, 4340160,
4340161, 4340162, 4340163, 4340164, 4340165, 4340166, 4340167, 4540101, 4540102, 4540103,
4540104, 4540105, 4540106, 4540107, 4540111, 4540112, 4540113, 4540114, 4540201, 4540202,
4540203, 4540204, 4540205, 4540206, 4540211, 4540212, 4540213, 4540214, 4540301, 4540302,
4540303, 4540304, 4540305, 4540306, 4540307, 4540311, 4540312, 4540313, 4540314, 4540315,
4540401, 4540402, 4540403, 4540404, 4540405, 4540406, 4540407, 4540408, 4540411, 4540412,
4540413, 4540414, 4540501, 4540502, 4040300, 4040302, 4040303, 4040304, 4040305, 4040306,
4040307, 4040308, 4040309, 4040310, 4040311, 4040312, 4040313, 4040314, 4040315, 4040316,
4040317, 4040318, 4040319, 4040320, 4040321, 4040322, 4040323, 4040324, 4040325, 4040326,
4040327, 4040328, 4040329, 4040330, 4040331, 4040332, 4040333, 4040334, 4040335, 4040336,
4040337, 4040338, 4040339, 4040340, 4040341, 4040342, 4050005, 4050007, 4050008, 4050009,
4050010, 4050011, 4050012, 4050013, 4050014, 4050015, 4050016, 4050017, 4050018, 4050019,
4050020, 4050021, 4050022, 4050023, 4050024, 4050025, 4050026, 4050027, 4050028, 4050029,
4050030, 4050031, 4050032, 4050033, 4050034, 4050035, 4050036, 4050037, 4050038, 4050039,
4072121, 4072122, 4072123, 4071311, 4071312, 4071313, 4071320, 4071321, 4071322, 4122101,
4122102, 4122103, 4072011, 4072012, 4072013, 4072021, 4072022, 4072023, 4072024, 4070011,
4070012, 4070013, 4081311, 4081312, 4081313, 4081314, 4081315, 4081316, 4081317, 4081318,
5030500, 8000001, 8000002, 8000101, 8000102, 8000104, 8000105, 8000131, 8000132, 8000133,
8000134, 8000135, 8000136, 8000137, 8000138, 8000139, 8000151, 8000152, 8000153, 8000154,
8000155, 8000156, 8000157, 8000158, 8000159, 8000161, 8000162, 8000170, 8000171, 8000172,
8000173, 8000174, 8000175, 8000177, 8000178, 8000180, 8000181, 8000183, 8000182, 8000185,
8000184, 8000186, 8000187, 8000188, 8000189, 8000201, 8000202, 8000203, 8000204, 8001201,
8001202, 8001203, 8001205, 8001206, 8001207, 8001208, 8001209, 8001211, 8001212, 8001213,
8001215, 8001216, 8001219, 8001220, 8001223, 8001224, 8001225, 8001226, 8001227, 8001204,
8001210, 8001214, 8001217, 8001218, 8001221, 8001222, 8001241, 8001242, 8001243, 8001244,
8001251, 8001252, 8001253, 8001254, 8001255, 8001261, 8001262, 8001263, 8001264, 8001265,
8001266, 8001267, 8001268, 8011401, 8002100, 8002101, 8002102, 8002106, 8002103, 8002104,
8002105, 8002107, 8002201, 8002202, 8002211, 8002212, 8002213, 8002214, 8002221, 8002222,
8002231, 8002232, 8002233, 8002234, 8003101, 8003102, 8003201, 8003202, 8003213, 8003214,
8003204, 8003220, 8003217, 8003203, 8003215, 8003205, 8003206, 8003207, 8003221, 8003218,
8003208, 8003216, 8003209, 8003210, 8003222, 8003219, 8003211, 8003212, 8003240, 8003241,
8003242, 8003243, 8003244, 8003245, 8003246, 8003247, 8003248, 8003249, 8003250, 8003251,
8003260, 8003261, 8003262, 8003263, 8003264, 8003265, 8003266, 8003267, 8003268, 8003269,
8003278, 8003279, 8003280, 8003281, 8003282, 8003283, 8003284, 8012101, 8012102, 8012103,
8012104, 8012105, 8012106, 8012107, 8012401, 8013101, 8013102, 8013103, 8013104, 8013105,
8013106, 8013107, 8013108, 8013109, 8013110, 8014101, 8014102, 8014103, 8014104, 8014105,
8014106, 8014108, 8014112, 8014121, 8014122, 8014123, 8014124, 8014125, 8014126, 8014127,
8014128, 8014129, 8014130, 8014131, 8014132, 8014133, 8014134, 8014135, 8014136, 8014137,
8014138, 8014139, 8014140, 8014141, 8014142, 8014143, 8014144, 8014145, 8014146, 8014147,
8014148, 8014149, 8014150, 8014161, 8014162, 8014163, 8014164, 8014165, 8014166, 8014167,
8014168, 8015191, 8015101, 8015111, 8015192, 8015102, 8015112, 8015193, 8015103, 8015113,
8015123, 8015194, 8015104, 8015114, 8015195, 8015196, 8015197, 8015198, 8015150, 8015151,
8015152, 8015153, 8015154, 8015155, 8015156, 8015157, 8015158, 8015159, 8015161, 8015162,
8015163, 8015164, 8015165, 8015171, 8015172, 8015173, 8015180, 8015201, 8015202, 8015203,
8016101, 8016102, 8016103, 8016104, 8016105, 8016106, 8016201, 8016202, 8016203, 8016204,
8016205, 8016206, 8016207, 8016208, 8016209, 8016210, 8016211, 8016212, 8016213, 8016301,
8016302, 8016303, 8016304, 8016305, 8017101, 8017102, 8020101, 8020102, 8020103, 8020104,
8020105, 8020106, 8020107, 8020108, 8020201, 8020202, 8020203, 8020204, 8020205, 8020206,
8020207, 8020208, 8020209, 8020210, 8020211, 8020212, 8020213, 8020214, 8020215, 8020216,
8020217, 8020218, 8020219, 8020220, 8020221, 8020222, 8020223, 8020224, 8020231, 8020232,
8020233, 8020234, 8020236, 8020300, 8020301, 8020302, 8020303, 8020304, 8020305, 8021100,
8021101, 8021102, 8021103, 8021104, 8021105, 8021106, 8021121, 8021122, 8021123, 8021124,
8021130, 8021131, 8021132, 8021201, 8021202, 8021203, 8021301, 8021302, 8021303, 8021401,
8021402, 8021403, 8021404, 8021501, 8021502, 8021503, 8021504, 8021505, 8021506, 8022101,
8022102, 8022103, 8022104, 8022105, 8022106, 8022107, 8022108, 8022109, 8022110, 8022111,
8022112, 8022113, 8022114, 8022115, 8022120, 8022121, 8022122, 8022123, 8022124, 8022125,
8022126, 8022127, 8022201, 8022202, 8022301, 8022302, 8022401, 8022402,
];
pub async fn on_get_mission_status_cs_req(

View File

@ -3,14 +3,18 @@ use prost::Message;
use rand::Rng;
use tokio::sync::Mutex;
use crate::{net::{tools::{AvatarJson, JsonData}, tools_res::PropState}, util};
use crate::{
net::{
tools::{ AvatarJson, JsonData},
tools_res::{PropState, GAME_RESOURCES},
},
util,
};
use super::*;
#[derive(Message)]
struct Dummy {
}
pub struct Dummy {}
pub async fn on_get_cur_scene_info_cs_req(
session: &mut PlayerSession,
@ -63,8 +67,14 @@ pub async fn on_lckgkdehclb(session: &mut PlayerSession, request: &Lckgkdehclb)
.send(CMD_ENTER_SCENE_SC_RSP, Dummy::default())
.await?;
let _ = load_scene(session, &mut player, request.entry_id, true, Some(request.maplanefddc)).await;
let _ = load_scene(
session,
&mut player,
request.entry_id,
true,
Some(request.maplanefddc),
)
.await;
Ok(())
}
@ -101,10 +111,7 @@ pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe)
..Default::default()
};
if let Some((level, enterance, _)) = player
.get_level_group(request.dmkkkfnkofh[0])
.await
{
if let Some((level, enterance, _)) = player.get_level_group(request.dmkkkfnkofh[0]).await {
// add teleports
for teleport in &level.teleports {
map_info.ojlnmnehgai.push(*teleport.0)
@ -133,15 +140,16 @@ pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe)
map_info.entry_id = enterance.id;
}
sesison.send(
CMD_GET_SCENE_MAP_INFO_SC_RSP,
Cegeebldbke {
retcode: 0,
mhefdgcamjl: vec![map_info],
..Default::default()
},
)
.await?;
sesison
.send(
CMD_GET_SCENE_MAP_INFO_SC_RSP,
Cegeebldbke {
retcode: 0,
mhefdgcamjl: vec![map_info],
..Default::default()
},
)
.await?;
Ok(())
}
@ -150,21 +158,24 @@ lazy_static! {
static ref NEXT_SCENE_SAVE: Mutex<u64> = Mutex::new(0);
}
pub async fn on_scene_entity_move_cs_req(session: &mut PlayerSession, request: &SceneEntityMoveCsReq) -> Result<()> {
pub async fn on_scene_entity_move_cs_req(
session: &mut PlayerSession,
request: &SceneEntityMoveCsReq,
) -> Result<()> {
let mut player = JsonData::load().await;
let mut timestamp = NEXT_SCENE_SAVE.lock().await;
if util::cur_timestamp_ms() <= *timestamp {
session
.send(CMD_SCENE_ENTITY_MOVE_SC_RSP, Dummy::default())
.await?;
.send(CMD_SCENE_ENTITY_MOVE_SC_RSP, Dummy::default())
.await?;
return Ok(());
}
// save every 5 minute
// save every 5 sec
*timestamp = util::cur_timestamp_ms() + (5 * 1000);
for entity in &request.entity_motion_list {
if entity.entity_id != 0 {
continue;
@ -190,6 +201,33 @@ pub async fn on_scene_entity_move_cs_req(session: &mut PlayerSession, request: &
Ok(())
}
pub type GetEnteredSceneCsReq = Dummy;
pub async fn on_get_entered_scene_cs_req(session: &mut PlayerSession, _: &GetEnteredSceneCsReq) -> Result<()> {
let scenes = GAME_RESOURCES
.map_entrance
.iter()
.filter(|(_, v)| {
v.finish_main_mission_list.len() > 0 || v.finish_sub_mission_list.len() > 0
})
.map(|(_, v)| Lpllljogfeh {
floor_id: v.floor_id,
plane_id: v.plane_id,
})
.collect::<Vec<_>>();
session.send(CMD_GET_ENTERED_SCENE_SC_RSP, Mkgidalegbd {
lejonbbgdnn: scenes,
retcode: 0
}).await?;
Ok(())
}
// getunlockteleportcsreq
pub async fn on_kkbapmgmmcb(_session: &mut PlayerSession, _request: &Kkbapmgmmcb) -> Result<()> {
Ok(())
}
async fn load_scene(
session: &mut PlayerSession,
json: &mut JsonData,
@ -197,7 +235,7 @@ async fn load_scene(
_save: bool,
teleport_id: Option<u32>,
) -> Result<SceneInfo> {
if let Some((level, enterance, plane)) = json.get_level_group( entry_id).await {
if let Some((level, enterance, plane)) = json.get_level_group(entry_id).await {
let mut position = json.position.clone();
if let Some(teleport_id) = teleport_id {
if let Some(teleport) = level.teleports.get(&teleport_id) {
@ -217,7 +255,7 @@ async fn load_scene(
.map(|v| v.plane_type)
.unwrap_or(enterance.entrance_type) as u32,
// world_id: plane.map(|v| v.world_id).unwrap_or_default(),
pbfgagecpcd: plane.map(|v| v.world_id).unwrap_or_default(),
..Default::default()
};
@ -225,7 +263,7 @@ async fn load_scene(
let player_pos = MotionInfo {
// rot
eiaoiankefd: Some(Vector {
baimdminomk:0,
baimdminomk: 0,
bemlopmcgch: position.rot_y,
bagloppgnpb: 0,
}),
@ -279,10 +317,6 @@ async fn load_scene(
..Default::default()
};
// only add check
// if prop_state == 8 {
// group_info.entity_list.push(info);
// }
if let Some(group) = scene_info
.chhmmbdhjpg
.iter_mut()
@ -352,7 +386,42 @@ async fn load_scene(
scene_info.chhmmbdhjpg.push(group_info);
}
}
// load player entity
let mut player_group = Dhkacjhaoid {
state: 0,
group_id: 0,
..Default::default()
};
for (slot, avatar_id) in &json.lineups {
player_group.entity_list.push(SceneEntityInfo {
inst_id: 0,
entity_id: (*slot) + 1,
motion: Some(MotionInfo {
// pos
aomilajjmii: Some(Vector {
baimdminomk: json.position.x ,
bemlopmcgch: json.position.y ,
bagloppgnpb: json.position.z ,
}),
// rot
eiaoiankefd: Some(Vector {
baimdminomk: 0,
bemlopmcgch: json.position.rot_y,
bagloppgnpb: 0,
}),
}),
actor: Some(SceneActorInfo {
avatar_type: AvatarType::AvatarFormalType.into(),
base_avatar_id: *avatar_id,
map_layer: 0,
uid: 0
}),
..Default::default()
})
}
scene_info.chhmmbdhjpg.push(player_group);
if _save {
session
.send(

View File

@ -1,10 +1,59 @@
use super::*;
static TUTORIAL_IDS: [u32; 55] = [
1001, 1002, 1003, 1004, 1005, 1007, 1008, 1010, 1011, 2001, 2002, 2003, 2004, 2005, 2008, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 3001, 3002, 3003, 3004, 3005, 3006, 4002, 4003, 4004, 4005,
4006, 4007, 4008, 4009, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012,
7001, 9001, 9002, 9003, 9004, 9005, 9006,
static TUTORIAL_IDS: [u32; 455] = [
1001, 1002, 1003, 1004, 1005, 1007, 1008, 1010, 2000, 2001, 2002, 2003, 2004, 2008, 2010, 2011,
2012, 2013, 3001, 3002, 3003, 3004, 3005, 3006, 3008, 3009, 3010, 3011, 3012, 3202, 4002, 4003,
4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019,
4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4036,
4037, 4038, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014,
5015, 5016, 5017, 5018, 5019, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031,
5032, 5033, 5034, 5035, 5036, 5038, 5039, 5041, 5044, 5045, 5046, 5047, 5048, 5049, 5050, 5051,
5052, 5053, 5054, 5055, 5056, 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065, 5070, 5071,
5072, 5073, 5074, 5075, 5077, 5078, 5079, 5081, 5082, 5083, 5084, 5085, 5086, 5087, 5088, 5089,
5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100, 5101, 5102, 5103, 5104, 5105,
5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5130, 5131, 5132, 5133, 5134,
5135, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157,
5158, 5159, 5160, 5161, 5162, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182,
5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198,
5199, 5200, 5201, 5202, 5301, 5302, 5303, 5304, 5305, 5306, 5308, 5309, 5310, 5322, 5326, 5312,
5311, 5313, 5307, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5323, 5324, 5325, 5350, 5387,
5352, 5388, 5355, 5360, 5361, 5356, 5357, 5358, 5359, 5351, 5365, 5366, 5367, 5368, 5375, 5376,
5377, 5389, 5374, 5369, 5370, 5371, 5372, 5373, 5390, 5380, 5381, 5400, 5382, 5383, 5392, 5378,
5384, 5393, 5408, 5394, 5395, 5391, 5385, 5397, 5398, 5399, 5386, 5401, 5402, 5403, 5404, 5405,
5406, 5407, 7001, 7002, 7003, 7004, 7005, 7007, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008,
9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016, 9017, 9018, 9019, 9020, 9021, 9022, 9023, 9024,
9025, 9026, 9027, 9028, 9029, 9030, 9031, 9032, 9033, 9034, 9035, 9036, 9037, 9038, 9039, 9040,
9041, 9042, 9043, 9044, 9045, 9046, 9047, 9048, 9049, 9050, 9051, 9052, 9053, 9201, 9202, 9203,
9204, 9205, 9206, 9207, 9208, 9209, 9210, 9211, 9212, 9213, 9214, 9301, 9302, 9303, 9304, 9305,
9306, 9307, 9308, 9309, 9310, 9311, 9313, 9314, 9315, 9316, 9317, 9318, 9319, 9321, 9322, 9323,
9324, 9325, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 9811, 9812, 9813, 9814,
9816, 9817, 9818, 9819, 9815, 9820, 9901, 9903, 9904, 9905, 9906, 9907, 9908, 9610, 9611, 9612,
9613, 9614, 9615, 9616, 9617, 9618, 9619, 9620, 9621, 9622, 9623, 9624, 9625, 9626, 9627, 9628,
9629, 9630, 9631, 9701, 9702, 9703, 9704,
];
static GUIDE_IDS: [u32; 322] = [
1101, 1102, 1103, 1104, 1105, 1108, 1109, 1116, 1117, 1118, 2006, 2007, 2008, 2105, 2106, 2107,
2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2213, 2200, 2209, 2210, 2211, 2212, 2214, 2215,
2216, 2217, 2218, 2219, 2220, 3007, 3105, 3106, 3107, 3108, 3109, 3201, 3202, 3203, 3207, 3204,
3205, 3206, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 4001, 4101, 4102, 4103, 4104, 4105,
4106, 4107, 4109, 4110, 5101, 5102, 5103, 5104, 5105, 5106, 6001, 6002, 6003, 6004, 6008, 6009,
6010, 6011, 6012, 6014, 6015, 6018, 6020, 6021, 6023, 6024, 6025, 6027, 6028, 6029, 6030, 6031,
6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047,
6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 7091, 7092,
6062, 6063, 6076, 6064, 6065, 6066, 6071, 6067, 6068, 6069, 6070, 6072, 6073, 6074, 6075, 6077,
6078, 6079, 6080, 6081, 6082, 7090, 6083, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093,
6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6109, 6110,
6111, 6108, 8001, 8002, 8003, 8004, 8006, 8007, 8008, 8010, 8011, 8012, 8013, 8014, 8015, 8016,
8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8038, 8039, 8047, 8050, 8051, 8052, 8055,
8056, 8057, 8028, 8026, 8027, 8064, 8065, 8058, 8061, 8059, 8062, 8063, 8066, 8067, 8069, 8070,
8072, 8073, 8074, 8075, 8076, 8078, 8079, 8080, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8100,
8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8111, 8112, 8113, 8110, 8122, 8123, 8124,
8140, 8141, 8142, 8143, 8144, 8145, 8146, 9101, 9102, 9103, 9104, 9105, 9107, 9108, 9109, 9110,
9111, 9112, 9113, 9114, 9115, 9116, 9117, 9118, 9119, 9120, 9201, 9202, 9203, 9204, 9205, 9206,
9207, 9208, 9209, 9210, 9211, 9212, 9301, 9303, 9304, 9305, 31001, 31102, 31103, 31105, 31106,
31109, 31204, 31206, 7501, 7502, 7503, 7504, 7506, 7507, 7508, 7509, 7511, 7514, 7515, 9601,
9602, 9603, 9604, 9605,
];
pub async fn on_get_tutorial_cs_req(
@ -37,7 +86,13 @@ pub async fn on_get_tutorial_guide_cs_req(
CMD_GET_TUTORIAL_GUIDE_SC_RSP,
GetTutorialGuideScRsp {
retcode: 0,
tutorial_guide_list: vec![],
tutorial_guide_list: GUIDE_IDS
.iter()
.map(|id| TutorialGuide {
id: *id,
status: TutorialStatus::TutorialFinish.into(),
})
.collect(),
},
)
.await

View File

@ -1196,7 +1196,7 @@ trait_handler! {
// ScenePlaneEventScNotify 1484;
// LastSpringRefreshTimeNotify 1439;
// UpdateFloorSavedValueNotify 1420;
// GetEnteredSceneCsReq 1427;
GetEnteredSceneCsReq 1427; // getenteredscenecsreq
// StartTimedCocoonStageCsReq 1426;
// RecoverAllLineupCsReq 1424;
// StartTimedFarmElementCsReq 1436;
@ -1205,7 +1205,7 @@ trait_handler! {
// UnlockedAreaMapScNotify 1457;
// StartTimedCocoonStageScRsp 1423;
// ActivateFarmElementScRsp 1455;
// GetUnlockTeleportCsReq 1440;
Kkbapmgmmcb 1440; //getunlockteleportcsreq
// DeactivateFarmElementCsReq 1490;
// RefreshTriggerByClientCsReq 1432;
// SetGroupCustomSaveDataCsReq 1449;
@ -1239,7 +1239,7 @@ trait_handler! {
// GroupStateChangeScRsp 1421;
// SpringRecoverCsReq 1444;
// SetCurInteractEntityScRsp 1497;
// SceneCastSkillCsReq 1402;
Mpemgbdkigg 1402; // scenecastskillcsreq
StartCocoonStageCsReq 1408;
Fkjoeabiioe 1470; //getscenemapinfocsreq
// SceneEntityMoveScRsp 1448;

View File

@ -1,7 +1,7 @@
use proto::*;
use proto::{Avatar, AvatarSkillTree, BattleAvatar};
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use proto::*;
use super::tools_res::{MapEntrance, MazePlane, SimpleLevelGroup, GAME_RESOURCES};
@ -33,11 +33,7 @@ pub struct AvatarData {
#[allow(dead_code)]
impl AvatarJson {
pub fn to_avatar_proto(
&self,
lightcone: Option<&Lightcone>,
relics: Vec<&Relic>,
) -> Avatar {
pub fn to_avatar_proto(&self, lightcone: Option<&Lightcone>, relics: Vec<&Relic>) -> Avatar {
Avatar {
base_avatar_id: self.avatar_id,
exp: 0,
@ -134,16 +130,20 @@ impl AvatarJson {
}
}
pub fn to_lineup_avatars(
player: &JsonData,
) -> Vec<LineupAvatar> {
let avatar_ids = player.avatars.iter().map(|(_, v)| &v.avatar_id).collect::<Vec<_>>();
pub fn to_lineup_avatars(player: &JsonData) -> Vec<LineupAvatar> {
let avatar_ids = player
.avatars
.iter()
.map(|(_, v)| &v.avatar_id)
.collect::<Vec<_>>();
player.lineups
player
.lineups
.iter()
.filter(|(_slot, v)| v > &&0 && avatar_ids.contains(v))
.map(|(slot, avatar_id)| {
player.avatars
player
.avatars
.get(avatar_id)
.unwrap()
.to_lineup_avatar_proto(*slot)
@ -182,7 +182,6 @@ impl AvatarJson {
}
}
// LIGHTCONE
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Lightcone {
@ -223,7 +222,6 @@ impl Lightcone {
}
}
// RELIC
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Relic {
@ -270,7 +268,7 @@ impl Relic {
step: v.step,
})
.collect::<Vec<_>>(),
..Default::default()
..Default::default()
}
}
@ -289,7 +287,7 @@ impl Relic {
step: v.step,
})
.collect::<Vec<_>>(),
..Default::default()
..Default::default()
}
}
@ -301,7 +299,6 @@ impl Relic {
}
}
// MONSTER
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct Monster {
@ -330,8 +327,9 @@ impl Monster {
SceneMonsterWave {
iilhbcalikm: wave_index, // wave indexx??
ejahmdkklbn: Some(Holldlkceof { // monster param
ejahmdkklbn: Some(Holldlkceof {
// monster param
level: monsters.iter().map(|v| v.level).max().unwrap_or(95),
..Default::default()
}),
@ -353,7 +351,6 @@ impl Monster {
}
}
// BATTLE CONFIG
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct BattleConfig {
@ -430,7 +427,7 @@ impl BattleBuffJson {
}
}
// SCENE
// SCENE
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Scene {
pub plane_id: u32,
@ -449,7 +446,6 @@ impl Default for Scene {
}
// Position
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct Position {
pub x: i32,
@ -481,7 +477,6 @@ impl Position {
}
}
// FREESR-DATA.json
#[derive(Debug, Serialize, Deserialize)]
pub struct JsonData {
@ -522,15 +517,14 @@ impl Default for JsonData2 {
lineups.insert(3, 0);
Self {
lineups ,
lineups,
position: Default::default(),
main_character: Default::default(),
scene: Default::default()
scene: Default::default(),
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Copy)]
pub enum MainCharacter {
MalePyhsical = 8001,
@ -544,13 +538,13 @@ pub enum MainCharacter {
impl MainCharacter {
// pub fn to_vec() -> Vec<MainCharacter> {
// return vec![
// MainCharacter::MalePyhsical,
// MainCharacter::FemalePhysical,
// MainCharacter::MalePreservation,
// MainCharacter::FemalePreservation,
// MainCharacter::MaleHarmony,
// MainCharacter::MalePyhsical,
// MainCharacter::FemalePhysical,
// MainCharacter::MalePreservation,
// MainCharacter::FemalePreservation,
// MainCharacter::MaleHarmony,
// MainCharacter::FemaleHarmony
// ]
// }
@ -583,16 +577,19 @@ impl Default for MainCharacter {
impl JsonData {
pub async fn load() -> Self {
let mut json: JsonData = tokio::fs::read_to_string("freesr-data.json")
.await
.map(|v| serde_json::from_str(&v))
.expect("freesr-data.json is broken, pls redownload")
.expect("freesr-data.json is broken, pls redownload");
let mut json: JsonData = match serde_json::from_str(&tokio::fs::read_to_string("freesr-data.json").await.unwrap_or_default()) {
Ok(db) => db,
Err(err) => {
println!("{:#?}", err);
Self::create_dummy().await
}
};
let json2: JsonData2 = serde_json::from_str(
&tokio::fs::read_to_string("persistent")
.await
.unwrap_or_default(),
)
.unwrap_or_default();
let json2: JsonData2 = serde_json::from_str(&tokio::fs::read_to_string("persistent").await.unwrap_or_default()).unwrap_or_default();
json.lineups = json2.lineups;
json.position = json2.position;
json.scene = json2.scene;
@ -605,7 +602,7 @@ impl JsonData {
async fn verify_lineup(&mut self) {
if self.lineups.len() == 0 {
self.lineups = BTreeMap::<u32, u32>::from([(0, 8006), (1, 0), (2, 0),(3, 0)])
self.lineups = BTreeMap::<u32, u32>::from([(0, 8006), (1, 0), (2, 0), (3, 0)])
} else if self.lineups.len() < 4 {
for i in self.lineups.len()..4 {
self.lineups.insert(i as u32, 0);
@ -614,47 +611,6 @@ impl JsonData {
self.save().await;
}
async fn create_dummy() -> Self {
let mut db = Self {
lightcones: vec![],
relics: vec![],
avatars: BTreeMap::<u32, AvatarJson>::new(),
lineups: BTreeMap::<u32, u32>::from([(0, 8006), (1, 0), (2, 0),(3, 0)]),
scene: Default::default(),
position: Default::default(),
battle_config: Default::default(),
main_character: Default::default(),
};
db.avatars.insert(
8006,
AvatarJson {
avatar_id: 8006,
level: 80,
promotion: 6,
sp_max: Some(10_000),
sp_value: Some(10_000),
owner_uid: 0,
techniques: vec![],
data: AvatarData {
rank: 6,
skills: BTreeMap::from([
(800601, 6),
(800602, 10),
(800603, 10),
(800604, 10),
(800605, 1),
]),
},
},
);
db.lineups.insert(0, 8006);
db.save().await;
db
}
pub async fn save_lineup(&self) {
self.save().await;
}
@ -662,14 +618,20 @@ impl JsonData {
pub async fn save(&self) {
let json = serde_json::to_string_pretty(&self).unwrap();
let _ = tokio::fs::write("freesr-data.json", json.as_bytes()).await;
let _ = tokio::fs::write("persistent", serde_json::to_string_pretty(&JsonData2 {
lineups: self.lineups.clone(),
main_character: self.main_character,
position: self.position.clone(),
scene: self.scene.clone()
}).unwrap().as_bytes()).await;
let _ = tokio::fs::write(
"persistent",
serde_json::to_string_pretty(&JsonData2 {
lineups: self.lineups.clone(),
main_character: self.main_character,
position: self.position.clone(),
scene: self.scene.clone(),
})
.unwrap()
.as_bytes(),
)
.await;
}
pub async fn get_level_group(
&self,
entry_id: u32,
@ -683,11 +645,10 @@ impl JsonData {
.level_group
.get(&format!("P{}_F{}", enterance.plane_id, enterance.floor_id))
{
// TODO: use reference somehow, not cloning
return Some((level.clone(), enterance.clone(), plane.cloned()));
};
}
None
}
}
}

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@ -200,7 +200,6 @@ impl Default for PlaneType {
}
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MazeProp {
@ -254,14 +253,13 @@ pub enum PropState {
pub type IntMap<T> = HashMap<u32, T>;
pub type StringMap<T> = HashMap<String, T>;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct SimpleLevelGroup {
pub teleports: IntMap<LevelProp>,
pub props: Vec<LevelProp>,
pub npcs: Vec<LevelNPC>,
pub monsters: Vec<LevelMonster>,
// pub level_group: IntMap<LevelGroup>,
pub group_ids: Vec<u32>,
}
#[derive(Debug, Serialize, Deserialize)]
@ -275,14 +273,14 @@ pub struct GameResources {
impl GameResources {
pub fn new() -> Self {
let str = std::fs::read_to_string("./resources.json").unwrap();
let res: Self = serde_json::from_str(&str).unwrap();
let str = std::fs::read_to_string("./resources.json")
.expect("resources.json is broken, pls redownload");
let res: Self =
serde_json::from_str(&str).expect("resources.json is broken, pls redownload");
res
}
}
lazy_static! {
pub static ref GAME_RESOURCES: GameResources = {
GameResources::new()
};
}
pub static ref GAME_RESOURCES: GameResources = GameResources::new();
}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
use axum::Json;
use serde_json::json;
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/:product_name/mdk/shield/api/login/";
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/:product_name/mdk/shield/api/login";
pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/:product_name/mdk/shield/api/verify";
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = "/:product_name/combo/granter/login/v2/login";
pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check";

View File

@ -31,13 +31,13 @@ pub async fn query_gateway() -> String {
ip: String::from("127.0.0.1"),
port: 23301,
asset_bundle_url: String::from(
"https://autopatchcn.bhsr.com/asb/BetaLive/output_6744505_89b2f5dc973e",
"https://autopatchcn.bhsr.com/asb/BetaLive/output_6828321_72f2df86102b",
),
lua_url: String::from(
"https://autopatchcn.bhsr.com/lua/BetaLive/output_6755976_3c46d7c46e2c",
"https://autopatchcn.bhsr.com/lua/BetaLive/output_6828764_f749b48347fd",
),
ex_resource_url: String::from(
"https://autopatchcn.bhsr.com/design_data/BetaLive/output_6759713_b4e0e740f0da",
"https://autopatchcn.bhsr.com/design_data/BetaLive/output_6834225_44836493b261",
),
ifix_version: String::from("0"),
lua_version: String::from("6755976"),