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
proto/StarRail.proto
proto/nameTranslation.txt
/*.json
./.idea
./.idea/

View file

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<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>
</component>
</project>

View file

@ -1,7 +1,8 @@
# JadeSR
A Server emulator for the game [`Honkai: Star Rail`](https://hsr.hoyoverse.com/en-us/)
![screenshot](https://git.xeondev.com/reversedrooms/JadeSR/raw/branch/master/screenshot.png)
(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`
### except, it's a fork with some more features. Namely...
1) RUNPS.bat (this builds the ps)
## Installation
@ -13,6 +14,12 @@ A Server emulator for the game [`Honkai: Star Rail`](https://hsr.hoyoverse.com/e
#### Building
##### Using xtasks (use this if stupid)
```sh
cargo xtask run
```
##### Manually
```sh
@ -23,22 +30,16 @@ cargo build --bin dispatch
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
```sh
cargo xtask watch
```
### From Pre-built Binaries
Navigate to the [Releases](https://git.xeondev.com/reversedrooms/JadeSR/releases)
page and download the latest release for your platform.
### ~~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)
page and download the latest release for your platform.~~
## 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
sysinfo.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
tokio-util.workspace = true

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

@ -9,25 +9,16 @@ use std::fs;
use crate::{net::PlayerSession, util};
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");
// 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;
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 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 l2: u32 = json_value[1]["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 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
.send(
@ -38,9 +29,9 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
lgjeabihdpn: vec![],
retcode: 0,
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: t2, rank: r2, exp: 0, unique_id: 58, promotion: p2, level: l2, base_avatar_id: 0, is_protected: ip2, ..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: 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: 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()},

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"
}