1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add social server and implement all op codes up until chat room connection blocks further requests

This commit is contained in:
NGnius (Graham)
2025-02-23 16:10:21 -05:00
parent d8885d811f
commit 2907376722
76 changed files with 3052 additions and 7 deletions

View File

@@ -0,0 +1,14 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const IS_CUSTOM_PARAM_KEY: u8 = 130;
const AVATAR_ID_PARAM_KEY: u8 = 129;
pub(super) fn get_avatar_provider() -> SimpleFunc<110, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(IS_CUSTOM_PARAM_KEY, Typed::Bool(false.into()));
params.insert(AVATAR_ID_PARAM_KEY, Typed::Int(1));
Ok(params.into())
})
}

View File

@@ -0,0 +1,14 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const FREE_BALANCE_PARAM_KEY: u8 = 74;
const PAID_BALANCE_PARAM_KEY: u8 = 87;
pub(super) fn balance_wallet_provider() -> SimpleFunc<66, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(FREE_BALANCE_PARAM_KEY, Typed::Long(31337_000));
params.insert(PAID_BALANCE_PARAM_KEY, Typed::Long(1));
Ok(params.into())
})
}

View File

@@ -0,0 +1,17 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
const PARAM_KEY: u8 = 16;
pub(super) fn cube_inv_provider() -> SimpleFunc<16, 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::Dict(Dict {
key_ty: 105, // int
val_ty: 105, // int
items: vec![
(Typed::Int(0), Typed::Int(99)),
] }));
Ok(params.into())
})
}

View File

@@ -0,0 +1,13 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const RESPONSE_CODE_PARAM_KEY: u8 = 168;
//const CUSTOM_GAME_DATA_PARAM_KEY: u8 = 169;
pub(super) fn get_custom_session_provider() -> SimpleFunc<144, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(RESPONSE_CODE_PARAM_KEY, Typed::Int(0 /* Not in any session */));
Ok(params.into())
})
}

View File

@@ -0,0 +1,53 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict, Arr};
use crate::data::custom_games::*;
const MODE_MAP_PARAM_KEY: u8 = 170;
const MAP_NAMES_PARAM_KEY: u8 = 178;
pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(MODE_MAP_PARAM_KEY, Typed::Dict(Dict {
key_ty: 115, // str
val_ty: 121, // arr
items: vec![
(Typed::Str(GameMode::BattleArena.as_str().into()), Typed::Arr(Arr {
ty: 115, // str
items: 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(GameMode::TeamDeathmatch.as_str().into()), Typed::Arr(Arr {
ty: 115, // str
items: 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()),
]
})),
],
}));
params.insert(MAP_NAMES_PARAM_KEY, Typed::Dict(Dict {
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())),
],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,12 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 2;
pub(super) fn dev_message_provider() -> SimpleFunc<8, 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::Bytes(Vec::from("No jam was harmed in the reverse-engineering of this game".as_bytes()).into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,46 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Arr};
use crate::data::custom_games::*;
const MAP_NAMES_PARAM_KEY: u8 = 78;
const VISIBILITY_PARAM_KEY: u8 = 66;
const MODE_PARAM_KEY: u8 = 136;
const AUTO_HEAL_PARAM_KEY: u8 = 37;
const REMAINING_TICKS_PARAM_KEY: u8 = 145;
pub(super) fn event_system_params_provider() -> SimpleFunc<24, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
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()),
],
}));
params.insert(VISIBILITY_PARAM_KEY, Typed::Arr(Arr {
ty: 105, // int
items: vec![
Typed::Int(GameMode::BattleArena as _),
Typed::Int(GameMode::BattleArena as _),
],
}));
params.insert(MODE_PARAM_KEY, Typed::Arr(Arr {
ty: 105, // int
items: vec![
Typed::Int(MapVisibility::Good as _),
Typed::Int(MapVisibility::Bad as _),
],
}));
params.insert(AUTO_HEAL_PARAM_KEY, Typed::Arr(Arr {
ty: 111, // bool
items: vec![
Typed::Bool(true.into()),
Typed::Bool(false.into()),
],
}));
params.insert(REMAINING_TICKS_PARAM_KEY, Typed::Long(1_000_000));
Ok(params.into())
})
}

View File

@@ -0,0 +1,12 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 54;
pub(super) fn garage_id_provider() -> SimpleFunc<177, 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::Str(format!("{}_{}", 12345, 54321).into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,46 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict, Arr};
use crate::data::garage_bay::*;
const SLOTS_PARAM_KEY: u8 = 44;
const SELECTED_SLOT_PARAM_KEY: u8 = 43;
const SLOT_ORDER_PARAM_KEY: u8 = 58;
pub(super) fn garage_slot_provider() -> SimpleFunc<40, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(SLOTS_PARAM_KEY, Typed::Dict(Dict {
key_ty: 105, // int
val_ty: 104, // hashmap
items: vec![
(Typed::Int(0), GarageSlotInfo {
name: "Reverse-engineer great success!".to_owned(),
cubes: 1,
crf_id: 0,
was_rated: false,
movement_categories: vec![MovementCategory::Wheel],
uuid: (2,4),
thumbnail_version: 0,
total_robot_cpu: 1,
total_cosmetic_cpu: 0,
total_robot_ranking: 1,
bay_cpu: 2_000,
tutorial_robot: false,
starter_robot_index: -1,
control_type: 0,
control_options: vec![false, false],
mastery_level: 1,
bay_skin_id: "".to_owned(), // TODO
weapon_order: vec![0],
}.as_transmissible())
],
}));
params.insert(SELECTED_SLOT_PARAM_KEY, Typed::Int(0));
params.insert(SLOT_ORDER_PARAM_KEY, Typed::Arr(Arr {
ty: 105, // int
items: vec![Typed::Int(0)],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,25 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
const PARAM_KEY: u8 = 1;
pub(super) fn garage_upgrades_provider() -> SimpleFunc<1, 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::HashMap(vec![
(Typed::Str("cpuIncreaseCost".into()), Typed::Dict(Dict {
key_ty: 110, // int
val_ty: 110, // int
items: vec![
// (CPU limit, upgrade cost)
(Typed::Int(100), Typed::Int(100)),
(Typed::Int(200), Typed::Int(200)),
(Typed::Int(1_000), Typed::Int(1_000)),
(Typed::Int(2_000), Typed::Int(2_000)), // max regular bot CPU
(Typed::Int(10_000), Typed::Int(10_000)), // max mega bot cpu
],
}))
].into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,29 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::ParameterTable;
use crate::data::item_shop_bundle::*;
const PARAM_KEY: u8 = 65;
pub(super) fn item_bundle_provider() -> SimpleFunc<188, 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, ItemShopBundle::as_transmissible_vec(vec![
ItemShopBundle {
sku: "12345".to_owned(),
bundle_name_key: "RE_todo_item_shop_bundle_name_key".to_owned(),
sprite: "RE_todo_item_shop_sprite_name".to_owned(),
is_sprite_full_size: true,
category: ItemShopCategory::Cube,
currency: CurrencyType::Robits,
price: 10_000,
discount_time: 1,
discount_price: 5_000,
recurrence: ItemShopRecurrence::Daily,
owns_required_cube: true,
is_limited_edition: true,
}
]));
Ok(params.into())
})
}

View File

@@ -22,6 +22,27 @@ mod cpu_limits_config;
mod cosmetic_config;
mod taunts_config;
mod all_customisations_info;
// some social requests must complete here
mod tech_points;
mod cube_inventory;
mod player_level;
mod balance_info;
mod premium_duration;
mod tutorial_status;
mod user_perms;
mod garage_slots;
mod robopass_season;
mod owned_cosmetics;
mod dev_message;
mod custom_games_maps;
mod avatar_info;
mod custom_game_session;
mod user_xp;
mod garage_upgrades;
mod game_event_params;
mod garage_bay_uuid;
mod tech_tree_data;
mod item_shop_bundles;
use polariton_server::operations::OperationsHandler;
@@ -53,5 +74,26 @@ pub fn handler() -> OperationsHandler<crate::UserTy> {
.without_state(cosmetic_config::cosmetic_limits_config_provider())
.without_state(taunts_config::taunts_config_provider())
.without_state(all_customisations_info::all_customisations_provider())
.without_state(tech_points::tech_points_provider())
.without_state(cube_inventory::cube_inv_provider())
.without_state(player_level::player_level_info_provider())
.without_state(balance_info::balance_wallet_provider())
.without_state(premium_duration::premium_remaining_provider())
.without_state(tutorial_status::tutorial_info_provider())
.without_state(user_perms::user_rights_provider())
.without_state(garage_slots::garage_slot_provider())
.without_state(robopass_season::robopass_season_provider())
.without_state(owned_cosmetics::owned_cosmetics_provider())
.without_state(owned_cosmetics::selected_cosmetics_provider())
.without_state(dev_message::dev_message_provider())
.without_state(custom_games_maps::allowed_maps_provider())
.without_state(avatar_info::get_avatar_provider())
.without_state(custom_game_session::get_custom_session_provider())
.without_state(user_xp::get_user_xp_provider())
.without_state(garage_upgrades::garage_upgrades_provider())
.without_state(game_event_params::event_system_params_provider())
.without_state(garage_bay_uuid::garage_id_provider())
.without_state(tech_tree_data::tech_tree_layout_provider())
.without_state(item_shop_bundles::item_bundle_provider())
//.without_state(polariton_server::operations::Ack::<70, _>::default())
}

View File

@@ -0,0 +1,26 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Arr};
const PARAM_KEY: u8 = 50;
pub(super) fn owned_cosmetics_provider() -> SimpleFunc<23, 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::Arr(Arr {
ty: 115, // str
items: vec![Typed::Str("1".into())],
}));
Ok(params.into())
})
}
pub(super) fn selected_cosmetics_provider() -> SimpleFunc<21, 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::Arr(Arr {
ty: 115, // str
items: vec![Typed::Str("1".into())],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,18 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
const PARAM_KEY: u8 = 1;
pub(super) fn player_level_info_provider() -> SimpleFunc<3, 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::Dict(Dict {
key_ty: 105, // int
val_ty: 105, // int
items: vec![
(Typed::Int(0), Typed::Int(99)),
(Typed::Int(10_000), Typed::Int(99_000)),
] }));
Ok(params.into())
})
}

View File

@@ -0,0 +1,20 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const DAYS_PARAM_KEY: u8 = 8;
const HOURS_PARAM_KEY: u8 = 13;
const MINUTES_PARAM_KEY: u8 = 14;
const SECONDS_PARAM_KEY: u8 = 15;
const LIFETIME_PARAM_KEY: u8 = 150;
pub(super) fn premium_remaining_provider() -> SimpleFunc<15, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(DAYS_PARAM_KEY, Typed::Int(0));
params.insert(HOURS_PARAM_KEY, Typed::Int(0));
params.insert(MINUTES_PARAM_KEY, Typed::Int(0));
params.insert(SECONDS_PARAM_KEY, Typed::Int(0));
params.insert(LIFETIME_PARAM_KEY, Typed::Bool(false.into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,12 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 1;
pub(super) fn robopass_season_provider() -> SimpleFunc<108, 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::Null);
Ok(params.into())
})
}

View File

@@ -0,0 +1,12 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 214;
pub(super) fn tech_points_provider() -> SimpleFunc<187, 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::Int(1337));
Ok(params.into())
})
}

View File

@@ -0,0 +1,28 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::tech_tree::*;
const PARAM_KEY: u8 = 210;
pub(super) fn tech_tree_layout_provider() -> SimpleFunc<183, 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::Dict(Dict {
key_ty: 115, // str
val_ty: 104, // hashmap
items: vec![
(Typed::Str("1".into()), TechTreeNode {
main_cube_id: 1,
position_x: 0,
position_y: 0,
is_unlocked: true,
is_unlockable: true,
tech_points: 1,
neighbours: Vec::default(),
}.as_transmissible())
],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,16 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const IN_PROGRESS_PARAM_KEY: u8 = 140;
const COMPLETED_PARAM_KEY: u8 = 141;
const SKIPPED_PARAM_KEY: u8 = 142;
pub(super) fn tutorial_info_provider() -> SimpleFunc<122, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(IN_PROGRESS_PARAM_KEY, Typed::Bool(false.into()));
params.insert(COMPLETED_PARAM_KEY, Typed::Bool(true.into()));
params.insert(SKIPPED_PARAM_KEY, Typed::Bool(true.into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,16 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const MOD_PARAM_KEY: u8 = 10;
const DEV_PARAM_KEY: u8 = 11;
const ADM_PARAM_KEY: u8 = 12;
pub(super) fn user_rights_provider() -> SimpleFunc<14, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(MOD_PARAM_KEY, Typed::Bool(false.into()));
params.insert(DEV_PARAM_KEY, Typed::Bool(false.into()));
params.insert(ADM_PARAM_KEY, Typed::Bool(false.into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,12 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 8;
pub(super) fn get_user_xp_provider() -> SimpleFunc<83, 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::Int(31337));
Ok(params.into())
})
}