This repository has been archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
group cfgs, add scene cfg, edit readme
- Loading branch information
Showing
26 changed files
with
232 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,36 @@ | ||
# sr | ||
# QingqueSR | ||
|
||
epic gamer code | ||
Ever wanted a private server that is quick to update when the game updates, but doesn't sacrifice too much features? | ||
|
||
A server that's modular enough and feature complete-ish for battle simulation? | ||
|
||
You're in the right place! | ||
|
||
## Tutorial | ||
|
||
This tutorial assumes you have basic knowledge of a terminal and traffic redirection with a proxy. | ||
|
||
Also, if config files are missing, the server will fallback to default config. This means you can delete all files in `_config` folder. | ||
|
||
You only have to worry about `config.json` because that's the config file for battle. It's obtainable from https://srtools.pages.dev/ | ||
|
||
### From Prebuilt (Windows only) | ||
|
||
1. Download the prebuilt that matches your SR version in https://github.com/f2pqingque/sr/releases | ||
2. Extract the zip | ||
5. Edit config files in `_config` if necessary (check the README in that folder) | ||
4. Run `net-game.exe` and `net-sdk.exe` | ||
|
||
### From Source | ||
|
||
1. Install Rust | ||
2. Clone this repository | ||
3. `cd` into `main` | ||
4. Put your proto & cmdid file in `net-msg` | ||
5. Edit config files in `_config` if necessary (check the README in that folder) | ||
6. `cargo run --release --bin net-game` | ||
7. `cargo run --release --bin net-sdk` | ||
|
||
## Credits | ||
- Yulian: QingqueSR Developer | ||
- amizing25: SrTools Author |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
`avatar.toml` -> configuration for lineup, march/trailblazer path, and owned avatar | ||
|
||
`config.json` -> configuration for battle, obtainable from https://srtools.pages.dev/ | ||
|
||
`hotfix.json` -> configuration for hotfix links. | ||
|
||
hotfix is not needed if you play on production client, as you can obtain the update by logging into the official server. | ||
|
||
`scene.toml` -> configuration for player position, calyx position, and map. | ||
|
||
`server.toml` -> configuration for where the servers should bind to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[scene_config] | ||
plane_id = 20101 | ||
|
||
[scene_config.player] | ||
x = 4480 | ||
y = 19364 | ||
z = -550 | ||
# i'm not sure if base_avatar_id actually does anything | ||
base_avatar_id = 1201 | ||
map_layer = 2 | ||
|
||
[scene_config.calyx] | ||
x = 4480 | ||
y = 18354 | ||
z = -570 | ||
group_id = 19 | ||
inst_id = 300001 | ||
entity_id = 228 | ||
prop_id = 808 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod address; | ||
pub mod avatar; | ||
pub mod hotfix; | ||
pub mod scene; | ||
pub mod srtools; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
use net_msg::pb::scene_entity_info::EntityCase::{Actor, Prop}; | ||
use net_msg::pb::{ | ||
AvatarType, MotionInfo, SceneActorInfo, SceneEntityGroupInfo, SceneEntityInfo, SceneInfo, | ||
ScenePropInfo, Vector, | ||
}; | ||
use serde::Deserialize; | ||
use std::fs; | ||
|
||
#[derive(Deserialize)] | ||
pub struct SceneConfig { | ||
pub plane_id: u32, | ||
pub player: PlayerScene, | ||
pub calyx: CalyxScene, | ||
} | ||
|
||
impl Default for SceneConfig { | ||
fn default() -> Self { | ||
Self { | ||
plane_id: 20101, | ||
player: PlayerScene { | ||
x: 4480, | ||
y: 19364, | ||
z: -550, | ||
base_avatar_id: 1201, | ||
map_layer: 2, | ||
}, | ||
calyx: CalyxScene { | ||
x: 4480, | ||
y: 18354, | ||
z: -570, | ||
group_id: 19, | ||
inst_id: 300001, | ||
entity_id: 228, | ||
prop_id: 808, | ||
}, | ||
} | ||
} | ||
} | ||
|
||
impl SceneConfig { | ||
pub fn from_file(file_path: &str) -> Self { | ||
let scene_toml_data = fs::read_to_string(file_path); | ||
match scene_toml_data { | ||
Ok(data) => toml::from_str(&data).unwrap_or_default(), | ||
Err(_) => Self::default(), | ||
} | ||
} | ||
|
||
pub fn get_scene_info(&self) -> SceneInfo { | ||
SceneInfo { | ||
plane_id: self.plane_id, | ||
floor_id: (self.plane_id * 1000) + 1, | ||
entry_id: (self.plane_id * 100) + 1, | ||
game_mode_type: 2, | ||
entity_group_list: vec![ | ||
SceneEntityGroupInfo { | ||
state: 1, | ||
group_id: 0, | ||
entity_list: vec![SceneEntityInfo { | ||
group_id: 0, | ||
inst_id: 0, | ||
entity_id: 0, | ||
entity_case: Some(Actor(SceneActorInfo { | ||
avatar_type: AvatarType::AvatarFormalType.into(), | ||
base_avatar_id: self.player.base_avatar_id, | ||
map_layer: self.player.map_layer, | ||
uid: 1, | ||
})), | ||
motion: Some(MotionInfo { | ||
pos: Some(Vector { | ||
x: self.player.x, | ||
y: self.player.y, | ||
z: self.player.z, | ||
}), | ||
rot: Some(Vector { x: 0, y: 0, z: 0 }), | ||
}), | ||
}], | ||
..Default::default() | ||
}, | ||
SceneEntityGroupInfo { | ||
state: 1, | ||
group_id: self.calyx.group_id, | ||
entity_list: vec![SceneEntityInfo { | ||
group_id: self.calyx.group_id, | ||
inst_id: self.calyx.inst_id, | ||
entity_id: self.calyx.entity_id, | ||
entity_case: Some(Prop(ScenePropInfo { | ||
prop_id: self.calyx.prop_id, | ||
prop_state: 1, | ||
..Default::default() | ||
})), | ||
motion: Some(MotionInfo { | ||
pos: Some(Vector { | ||
x: self.calyx.x, | ||
y: self.calyx.y, | ||
z: self.calyx.z, | ||
}), | ||
rot: Some(Vector { x: 0, y: 0, z: 0 }), | ||
}), | ||
}], | ||
..Default::default() | ||
}, | ||
], | ||
..Default::default() | ||
} | ||
} | ||
} | ||
|
||
#[derive(Deserialize)] | ||
pub struct PlayerScene { | ||
pub x: i32, | ||
pub y: i32, | ||
pub z: i32, | ||
pub base_avatar_id: u32, | ||
pub map_layer: u32, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
pub struct CalyxScene { | ||
pub x: i32, | ||
pub y: i32, | ||
pub z: i32, | ||
pub group_id: u32, | ||
pub inst_id: u32, | ||
pub entity_id: u32, | ||
pub prop_id: u32, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub async fn handle(_req: &[u8]) -> Vec<u8> { | ||
pub async fn handle(_: &[u8]) -> Vec<u8> { | ||
Vec::with_capacity(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use net_msg::pb::PlayerLoginFinishScRsp; | ||
use net_msg::Trait; | ||
|
||
pub async fn handle(_req: &[u8]) -> Vec<u8> { | ||
pub async fn handle(_: &[u8]) -> Vec<u8> { | ||
PlayerLoginFinishScRsp { retcode: 0 }.encode_to_vec() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.