Compare commits

..

2 commits

Author SHA1 Message Date
948b7b560d merge 2 2024-05-10 23:00:04 +01:00
0606053be4 h 2024-05-10 22:58:29 +01:00
8 changed files with 124 additions and 111 deletions

5
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

16
.idea/JadeSR-fork.iml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/common/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/dispatch/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gameserver/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/proto/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/sdkserver/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/xtask/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/JadeSR-fork.iml" filepath="$PROJECT_DIR$/.idea/JadeSR-fork.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -1,7 +1,8 @@
# JadeSR # JadeSR
(i want to protect this from search indexing please don't mention the animegame or company (i want to protect this from search indexing please don't mention the animegame or company)
### A Server emulator for the game `Hon Aki: Railway Game` ### A Server emulator for the game `Hon Aki: Railway Game`
### except, it's a fork with some more features ### except, it's a fork with some more features. Namely...
1) RUNPS.bat (this builds the ps)
## Installation ## Installation
@ -13,6 +14,12 @@
#### Building #### Building
##### Using xtasks (use this if stupid)
```sh
cargo xtask run
```
##### Manually ##### Manually
```sh ```sh
@ -23,12 +30,6 @@ cargo build --bin dispatch
cargo build --bin sdkserver cargo build --bin sdkserver
``` ```
##### Using xtasks (use this if stupid)
```sh
cargo xtask run
```
##### To run it with automatic recompilation when any Rust files are changed ##### To run it with automatic recompilation when any Rust files are changed
```sh ```sh

View file

@ -21,8 +21,8 @@ paste.workspace = true
rbase64.workspace = true rbase64.workspace = true
sysinfo.workspace = true sysinfo.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true tokio.workspace = true
tokio-util.workspace = true tokio-util.workspace = true

View file

@ -1,90 +1,76 @@
use anyhow::Result;
use proto::*;
use super::*; use super::*;
use crate::game::globals; use crate::game::globals;
use serde_json::json;
use serde_json::Value;
use std::fs;
pub async fn on_start_cocoon_stage_cs_req( use crate::{net::PlayerSession, util};
session: &PlayerSession,
body: &StartCocoonStageCsReq,
) -> Result<()> {
let player_info = session.player_info();
let rsp = StartCocoonStageScRsp { pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Result<()> {
retcode: 0, let json_data = fs::read_to_string("PATH HERE").expect("Failed to read inventory.json");
prop_entity_id: body.prop_entity_id, let json_value: Value = serde_json::from_str(&json_data).expect("Failed to parse JSON data");
cocoon_id: body.cocoon_id,
wave: body.wave,
battle_info: Some(SceneBattleInfo {
stage_id: 201012311,
logic_random_seed: 4444,
battle_id: 1,
battle_avatar_list: player_info
.lineup
.avatar_list
.iter()
.map(|avatar| BattleAvatar {
index: avatar.slot,
id: avatar.id,
level: 80,
promotion: 6,
rank: 6,
hp: 10000,
avatar_type: 3,
sp: Some(AmountInfo {
cur_amount: 10000,
max_amount: 10000,
}),
..Default::default()
})
.collect(),
monster_wave_list: globals
.monster_wave_list
.iter()
.map(|monster_list| SceneMonsterWave {
monster_list: monster_list
.iter()
.map(|id| SceneMonsterData {
monster_id: *id,
..Default::default()
})
.collect(),
..Default::default()
})
.collect(),
..Default::default()
}),
};
session.send(CMD_START_COCOON_STAGE_SC_RSP, rsp).await // Extract ranks
} let r1: u32 = json_value[0]["rank"].as_i64().expect("Failed to get rank for Equipment1") as u32;
let r2: u32 = json_value[1]["rank"].as_i64().expect("Failed to get rank for Equipment2") as u32;
pub async fn on_get_cur_battle_info_cs_req( let t1: u32 = json_value[0]["tid"].as_i64().expect("Failed") as u32;
session: &PlayerSession, let t2: u32 = json_value[1]["tid"].as_i64().expect("Failed") as u32;
_body: &GetCurBattleInfoCsReq, let l1: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
) -> Result<()> { let l2: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
//let e_rank3: u32 = json_value[2]["rank"].as_i64().expect("Failed to get rank for Equipment3") as u32;
session session
.send( .send(
CMD_GET_CUR_BATTLE_INFO_SC_RSP, CMD_GET_BAG_SC_RSP,
GetCurBattleInfoScRsp { GetBagScRsp {
battle_info: Some(SceneBattleInfo::default()), kkdobdmaipc: vec![],
ffbpkghgmjm: Some(Fjojkdhlonn::default()), fllcfpejibd: vec![],
..Default::default() lgjeabihdpn: vec![],
},
)
.await
}
pub async fn on_pve_battle_result_cs_req(
session: &PlayerSession,
body: &PveBattleResultCsReq,
) -> Result<()> {
session
.send(
CMD_P_V_E_BATTLE_RESULT_SC_RSP,
PveBattleResultScRsp {
retcode: 0, retcode: 0,
end_status: body.end_status, equipment_list: vec![
battle_id: body.battle_id, Equipment {tid: t1, rank: r1, exp: 0, unique_id: 57, promotion: 6, level: l1, base_avatar_id: 0, is_protected: true, ..Default::default()},
..Default::default() Equipment {tid: t2, rank: r2, exp: 0, unique_id: 58, promotion: 6, level: l2, base_avatar_id: 0, is_protected: true, ..Default::default()},
}, Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 59, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 60, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 61, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 62, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 63, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 64, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 65, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 66, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 1, exp: 0, unique_id: 67, promotion: 0, level: 1, base_avatar_id: 0, is_protected: true, ..Default::default()},
//Equipment {tid: 1, rank: 1, exp: 0, unique_id: 59, promotion: 6, level: 1, base_avatar_id: 0, is_protected: true, ..Default::default()}
],
mbedbdbmekj: 0,
relic_list: vec![
Relic {
unique_id: 1488,
base_avatar_id: 1315, // avatar id
tid: 61202,
level: 15, is_protected: true,
main_affix_id: 1,
sub_affix_list: vec![ RelicAffix { affix_id: 7, cnt: 830, step: 20 }], ..Default::default() }
],
odeefdlejgg: vec![],
niemagjlpdl: vec![],
gddpphikjae: vec![],
macfjibhfad: vec![],
clkjaanbfpp: vec![ 101 ],
// .iter()
// .map(|id| {
// // {
// // tid: *id,
// // num: 500
// // }
// })
// .collect(),
biahmcppikj: vec![],
}
) )
.await .await
// let rsp = GetBagScRsp {
//
// }
} }

View file

@ -9,25 +9,16 @@ use std::fs;
use crate::{net::PlayerSession, util}; use crate::{net::PlayerSession, util};
pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Result<()> { pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Result<()> {
let json_data = fs::read_to_string("C:/Users/Al-Shebli/Downloads/HSR 2.3 beta/JadeSR-masters/jadesr/gameserver/src/net/handlers/inventory.json").expect("Failed to read inventory.json"); let json_data = fs::read_to_string("PATH HERE").expect("Failed to read inventory.json");
let json_value: Value = serde_json::from_str(&json_data).expect("Failed to parse JSON data"); let json_value: Value = serde_json::from_str(&json_data).expect("Failed to parse JSON data");
// Extract ranks // Extract ranks
let r1: u32 = json_value[0]["rank"].as_i64().expect("Failed to get rank for Equipment1") as u32; let r1: u32 = json_value[0]["rank"].as_i64().expect("Failed to get rank for Equipment1") as u32;
let r2: u32 = json_value[1]["rank"].as_i64().expect("Failed to get rank for Equipment2") as u32; let r2: u32 = json_value[1]["rank"].as_i64().expect("Failed to get rank for Equipment2") as u32;
let r3: u32 = json_value[2]["rank"].as_i64().expect("Failed to get rank for Equipment2") as u32;
let t1: u32 = json_value[0]["tid"].as_i64().expect("Failed") as u32; let t1: u32 = json_value[0]["tid"].as_i64().expect("Failed") as u32;
let t2: u32 = json_value[1]["tid"].as_i64().expect("Failed") as u32; let t2: u32 = json_value[1]["tid"].as_i64().expect("Failed") as u32;
let t3: u32 = json_value[2]["tid"].as_i64().expect("Failed") as u32;
let l1: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32; let l1: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
let l2: u32 = json_value[1]["level"].as_i64().expect("Failed") as u32; let l2: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
let l3: u32 = json_value[2]["level"].as_i64().expect("Failed") as u32;
let ip1: u32 = json_value[0]["is_protected"].as_i64().expect("Failed") as u32;
let ip2: u32 = json_value[1]["is_protected"].as_i64().expect("Failed") as u32;
let ip3: u32 = json_value[2]["is_protected"].as_i64().expect("Failed") as u32;
let p1: u32 = json_value[0]["promotion"].as_i64().expect("Failed") as u32;
let p2: u32 = json_value[1]["promotion"].as_i64().expect("Failed") as u32;
let p3: u32 = json_value[2]["promotion"].as_i64().expect("Failed") as u32;
//let e_rank3: u32 = json_value[2]["rank"].as_i64().expect("Failed to get rank for Equipment3") as u32; //let e_rank3: u32 = json_value[2]["rank"].as_i64().expect("Failed to get rank for Equipment3") as u32;
session session
.send( .send(
@ -38,9 +29,9 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
lgjeabihdpn: vec![], lgjeabihdpn: vec![],
retcode: 0, retcode: 0,
equipment_list: vec![ equipment_list: vec![
Equipment {tid: t1, rank: r1, exp: 0, unique_id: 57, promotion: p1, level: l1, base_avatar_id: 0, is_protected: ip1, ..Default::default()}, Equipment {tid: t1, rank: r1, exp: 0, unique_id: 57, promotion: 6, level: l1, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: t2, rank: r2, exp: 0, unique_id: 58, promotion: p2, level: l2, base_avatar_id: 0, is_protected: ip2, ..Default::default()}, Equipment {tid: t2, rank: r2, exp: 0, unique_id: 58, promotion: 6, level: l2, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: t3, rank: r3, exp: 0, unique_id: 59, promotion: p3, level: l3, base_avatar_id: 0, is_protected: ip3, ..Default::default()}, Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 59, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 60, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()}, Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 60, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 61, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()}, Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 61, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 62, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()}, Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 62, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
@ -66,14 +57,14 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
gddpphikjae: vec![], gddpphikjae: vec![],
macfjibhfad: vec![], macfjibhfad: vec![],
clkjaanbfpp: vec![ 101 ], clkjaanbfpp: vec![ 101 ],
// .iter() // .iter()
// .map(|id| { // .map(|id| {
// // { // // {
// // tid: *id, // // tid: *id,
// // num: 500 // // num: 500
// // } // // }
// }) // })
// .collect(), // .collect(),
biahmcppikj: vec![], biahmcppikj: vec![],
} }
) )