Compare commits

...

12 commits

11 changed files with 74 additions and 42 deletions

3
.gitignore vendored
View file

@ -2,5 +2,4 @@ target/
Cargo.lock Cargo.lock
proto/StarRail.proto proto/StarRail.proto
proto/nameTranslation.txt proto/nameTranslation.txt
/*.json ./.idea/
./.idea

View file

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/JadeSR-WithInventory.iml" filepath="$PROJECT_DIR$/.idea/JadeSR-WithInventory.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/JadeSR-fork.iml" filepath="$PROJECT_DIR$/.idea/JadeSR-fork.iml" />
</modules> </modules>
</component> </component>
</project> </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)
A Server emulator for the game [`Honkai: Star Rail`](https://hsr.hoyoverse.com/en-us/) ### A Server emulator for the game `Hon Aki: Railway Game`
![screenshot](https://git.xeondev.com/reversedrooms/JadeSR/raw/branch/master/screenshot.png) ### except, it's a fork with some more features. Namely...
1) RUNPS.bat (this builds the ps)
## Installation ## Installation
@ -13,6 +14,12 @@ A Server emulator for the game [`Honkai: Star Rail`](https://hsr.hoyoverse.com/e
#### Building #### Building
##### Using xtasks (use this if stupid)
```sh
cargo xtask run
```
##### Manually ##### Manually
```sh ```sh
@ -23,22 +30,16 @@ 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
cargo xtask watch cargo xtask watch
``` ```
### From Pre-built Binaries ### ~~From Pre-built Binaries~~
I haven't got prebuilt binaries. Build it yourself using above commands. Or, just use RUNPS.bat
Navigate to the [Releases](https://git.xeondev.com/reversedrooms/JadeSR/releases) ~~Navigate to the [Releases](https://git.xeondev.com/reversedrooms/JadeSR/releases)
page and download the latest release for your platform. page and download the latest release for your platform.~~
## Usage ## Usage

1
RUNPS.bat Normal file
View file

@ -0,0 +1 @@
cargo xtask run

22
dispatch.json Normal file
View file

@ -0,0 +1,22 @@
{
"http_port": 21041,
"game_servers": {
"jade_sr": {
"name": "JadeSR",
"title": "JadeSR",
"dispatch_url": "http://127.0.0.1:21041/query_gateway/jade_sr",
"env_type": "2",
"gateserver_ip": "127.0.0.1",
"gateserver_port": 23301,
"gateserver_protocol": "Tcp"
}
},
"versions": {
"OSBETAWin2.2.51": {
"asset_bundle_url": "https://autopatchos.starrails.com/asb/BetaLive/output_7037158_b67f5a6a68fb",
"ex_resource_url": "https://autopatchos.starrails.com/design_data/BetaLive/output_7033392_aaca9c1b456b",
"lua_url": "https://autopatchos.starrails.com/lua/BetaLive/output_7050564_f05a0f949b10",
"lua_version": "7050564"
}
}
}

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

@ -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

@ -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("inventory.json").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![],
} }
) )

10
globals.json Normal file
View file

@ -0,0 +1,10 @@
{
"lineup": [1314],
"hero_gender": "GenderWoman",
"hero_basic_type": "GirlShaman",
"monster_wave_list":
[
[3013010, 3013010],
[3024020]
]
}

4
sdkserver.json Normal file
View file

@ -0,0 +1,4 @@
{
"http_port": 21000,
"dispatch_endpoint": "http://127.0.0.1:21041"
}