mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -1781,6 +1781,16 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rc_microtransactions"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"libfj",
|
||||
"log",
|
||||
"rocket",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rc_services"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -8,7 +8,7 @@ members = [
|
||||
"auth",
|
||||
"polariton_auth",
|
||||
"rc_services", "rc_services_room",
|
||||
"rc_static_data",
|
||||
"rc_static_data", "rc_microtransactions",
|
||||
"rc_social", "rc_social_room",
|
||||
"rc_chat", "rc_chat_room"
|
||||
]
|
||||
|
||||
10
rc_microtransactions/Cargo.toml
Normal file
10
rc_microtransactions/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "rc_microtransactions"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rocket.workspace = true
|
||||
libfj.workspace = true
|
||||
log.workspace = true
|
||||
env_logger.workspace = true
|
||||
12
rc_microtransactions/Rocket.toml
Normal file
12
rc_microtransactions/Rocket.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
## defaults for _all_ profiles
|
||||
[default]
|
||||
address = "127.0.0.1"
|
||||
port = 8011
|
||||
|
||||
## set only when compiled in debug mode, i.e, `cargo build`
|
||||
[debug]
|
||||
port = 8011
|
||||
|
||||
## set only when compiled in release mode, i.e, `cargo build --release`
|
||||
[release]
|
||||
address = "0.0.0.0"
|
||||
3
rc_microtransactions/build_arm64.sh
Executable file
3
rc_microtransactions/build_arm64.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
cargo build --release --target aarch64-unknown-linux-musl
|
||||
3
rc_microtransactions/run_debug.sh
Executable file
3
rc_microtransactions/run_debug.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
#cargo build
|
||||
RUST_LOG=debug cargo run
|
||||
14
rc_microtransactions/src/main.rs
Normal file
14
rc_microtransactions/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
mod robocraft;
|
||||
|
||||
#[rocket::get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
fn rocket() -> _ {
|
||||
env_logger::init();
|
||||
rocket::build().mount("/", rocket::routes![index])
|
||||
.attach(robocraft::stage())
|
||||
}
|
||||
|
||||
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod store;
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("JSON", |rocket| async {
|
||||
rocket.attach(store::stage())
|
||||
})
|
||||
}
|
||||
17
rc_microtransactions/src/robocraft/store.rs
Normal file
17
rc_microtransactions/src/robocraft/store.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use rocket::{post, routes, serde::json::{json, Value}};
|
||||
|
||||
#[post("/robopay/store")]
|
||||
pub fn robopay_store() -> Value {
|
||||
// TODO authentication (Authorization header is "Robocraft {JWT token from auth}")
|
||||
json!({
|
||||
"response": {
|
||||
"data": []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("Robocraft store info", |rocket| async {
|
||||
rocket.mount("/", routes![robopay_store])
|
||||
})
|
||||
}
|
||||
@@ -14,17 +14,17 @@ pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn
|
||||
val_ty: 122, // obj arr
|
||||
items: vec![
|
||||
(Typed::Str(GameMode::BattleArena.as_str().into()), Typed::ObjArr(vec![
|
||||
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_02_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_03_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_02_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_02_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_01_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_03_BA".into()),
|
||||
Typed::Str("RC_Planet_Neptune_02_BA".into()),
|
||||
Typed::Str("RC_Planet_Mars_03_BA".into()),
|
||||
Typed::Str("RC_Planet_Mars_02_BA".into()),
|
||||
Typed::Str("RC_Planet_Earth_02_BA".into()),
|
||||
Typed::Str("RC_Planet_Earth_01_BA".into()),
|
||||
Typed::Str("RC_Planet_Neptune_03_BA".into()),
|
||||
].into())
|
||||
),
|
||||
(Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::ObjArr(vec![
|
||||
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_01_CTF".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_01_CTF".into()),
|
||||
Typed::Str("RC_Planet_Neptune_01_CTF".into()),
|
||||
Typed::Str("RC_Planet_Mars_01_CTF".into()),
|
||||
].into())
|
||||
),
|
||||
],
|
||||
@@ -33,15 +33,15 @@ pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn
|
||||
key_ty: 115, // str
|
||||
val_ty: 115, // str
|
||||
items: vec![
|
||||
(Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_02_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_01_CTF".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_01_CTF".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_03_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_03_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_02_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_01_CTF".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_01_CTF".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Earth_02_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_01_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Earth_01_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_03_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_03_BA".into())),
|
||||
(Typed::Str("Assets/Scenes/Planet_Test/TestRobot".into()), Typed::Str("TestRobot".into())),
|
||||
(Typed::Str("RC_Planet_Neptune_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_02_BA".into())),
|
||||
(Typed::Str("RC_Planet_Neptune_01_CTF".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_01_CTF".into())),
|
||||
(Typed::Str("RC_Planet_Mars_03_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_03_BA".into())),
|
||||
(Typed::Str("RC_Planet_Mars_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_02_BA".into())),
|
||||
(Typed::Str("RC_Planet_Mars_01_CTF".into()), Typed::Str("strCustomGameMapNameRC_Planet_Mars_01_CTF".into())),
|
||||
(Typed::Str("RC_Planet_Earth_02_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Earth_02_BA".into())),
|
||||
(Typed::Str("RC_Planet_Earth_01_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Earth_01_BA".into())),
|
||||
(Typed::Str("RC_Planet_Neptune_03_BA".into()), Typed::Str("strCustomGameMapNameRC_Planet_Neptune_03_BA".into())),
|
||||
(Typed::Str("TestRobot".into()), Typed::Str("TestRobot".into())),
|
||||
],
|
||||
}));
|
||||
Ok(params.into())
|
||||
|
||||
@@ -15,8 +15,8 @@ pub(super) fn event_system_params_provider() -> SimpleFunc<24, crate::UserTy, im
|
||||
params.insert(MAP_NAMES_PARAM_KEY, Typed::Arr(Arr {
|
||||
ty: 115, // str
|
||||
items: vec![
|
||||
Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_03_BA".into()),
|
||||
Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_01_BA".into()),
|
||||
Typed::Str("RC_Planet_Neptune_03_BA".into()),
|
||||
Typed::Str("RC_Planet_Earth_01_BA".into()),
|
||||
],
|
||||
}));
|
||||
params.insert(VISIBILITY_PARAM_KEY, Typed::Arr(Arr {
|
||||
|
||||
@@ -71,6 +71,7 @@ mod daily_quests;
|
||||
mod cube_awards;
|
||||
mod robot_sanction;
|
||||
mod building_xp;
|
||||
mod reconnect_game;
|
||||
|
||||
use polariton_server::operations::OperationsHandler;
|
||||
|
||||
@@ -155,5 +156,7 @@ pub fn handler() -> OperationsHandler<crate::UserTy> {
|
||||
.without_state(cube_awards::cube_awards_provider())
|
||||
.without_state(robot_sanction::robot_sanction_provider())
|
||||
.without_state(building_xp::building_xp_save_provider())
|
||||
.without_state(robot_sanction::all_robot_sanctions_provider())
|
||||
.without_state(reconnect_game::available_reconnect_provider())
|
||||
//.without_state(polariton_server::operations::Ack::<70, _>::default())
|
||||
}
|
||||
|
||||
12
rc_services_room/src/operations/reconnect_game.rs
Normal file
12
rc_services_room/src/operations/reconnect_game.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed};
|
||||
|
||||
const PARAM_KEY: u8 = 207;
|
||||
|
||||
pub(super) fn available_reconnect_provider() -> SimpleFunc<171, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, Typed::Bool(false.into()));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
@@ -17,3 +17,14 @@ pub(super) fn robot_sanction_provider() -> SimpleFunc<174, crate::UserTy, impl (
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn all_robot_sanctions_provider() -> SimpleFunc<176, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(SANCTION_JSONS_PARAM_KEY, Typed::Arr(Arr {
|
||||
ty: 115, // str
|
||||
items: Vec::default(),
|
||||
}));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ pub fn static_live_data() -> Json<libfj::robocraft::StaticDataRaw> {
|
||||
ErrorLogAddress: "logs.freejamgames.com:4561".into(),
|
||||
ServerErrorLogAddress: "logs.freejamgames.com:4562".into(),
|
||||
authUrl: "http://127.0.0.1:8001/".into(), // originally "https://auth-backend.freejamgames.com/"
|
||||
paymentUrl: "https://pay.robocraftgame.com/".into(),
|
||||
paymentUrl: "http://127.0.0.1:8011/".into(),
|
||||
enterBattleLogGenerationTimeout: "60".into(),
|
||||
GameServerConnectionTestTimeout: 10,
|
||||
AvatarCdnUrl: "https://rc-cdn-images.robocraftgame.com/customavatar/Live/".into(),
|
||||
|
||||
Reference in New Issue
Block a user