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:
33
rc_services_room/src/data/custom_games.rs
Normal file
33
rc_services_room/src/data/custom_games.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum GameMode {
|
||||
BattleArena = 0,
|
||||
SuddenDeath = 1,
|
||||
Pit = 2,
|
||||
TestMode = 3,
|
||||
SinglePlayer = 4,
|
||||
TeamDeathmatch = 5,
|
||||
Campaign = 6,
|
||||
}
|
||||
|
||||
impl GameMode {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
GameMode::BattleArena => "BattleArena",
|
||||
GameMode::SuddenDeath => "SuddenDeath",
|
||||
GameMode::Pit => "Pit",
|
||||
GameMode::TestMode => "TestMode",
|
||||
GameMode::SinglePlayer => "SinglePlayerTDM",
|
||||
GameMode::TeamDeathmatch => "TeamDeathmatch",
|
||||
GameMode::Campaign => "Campaign",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum MapVisibility {
|
||||
Good = 0,
|
||||
Poor = 1,
|
||||
Bad = 2, // VeryPoor
|
||||
}
|
||||
93
rc_services_room/src/data/garage_bay.rs
Normal file
93
rc_services_room/src/data/garage_bay.rs
Normal file
@@ -0,0 +1,93 @@
|
||||
use polariton::operation::{Typed, Arr};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum MovementCategory {
|
||||
NotAFunctionalItem = 0,
|
||||
Wheel = 1,
|
||||
Hover = 2,
|
||||
Wing = 3,
|
||||
Rudder = 4,
|
||||
Thruster = 5,
|
||||
InsectLeg = 6,
|
||||
MechLeg = 7,
|
||||
Ski = 8,
|
||||
TankTrack = 9,
|
||||
Rotor = 10,
|
||||
SprinterLeg = 11,
|
||||
Propeller = 12,
|
||||
Laser = 100,
|
||||
Plasma = 200,
|
||||
Mortar = 250,
|
||||
Rail = 300,
|
||||
Nano = 400,
|
||||
Tesla = 500,
|
||||
Aeroflak = 600,
|
||||
Ion = 650,
|
||||
Seeker = 701,
|
||||
Chaingun = 750,
|
||||
ShieldModule = 800,
|
||||
GhostModule = 801,
|
||||
BlinkModule = 802,
|
||||
EmpModule = 803,
|
||||
WindowmakerModule = 804,
|
||||
EnergyModule = 900,
|
||||
}
|
||||
|
||||
pub struct GarageSlotInfo {
|
||||
pub name: String,
|
||||
pub cubes: u32,
|
||||
pub crf_id: u32, // 0 means not uploaded
|
||||
pub was_rated: bool, // ignored when not on CRF
|
||||
pub movement_categories: Vec<MovementCategory>,
|
||||
pub uuid: (u32, u32),
|
||||
pub thumbnail_version: u32,
|
||||
pub total_robot_cpu: u32,
|
||||
pub total_cosmetic_cpu: u32,
|
||||
pub total_robot_ranking: u32,
|
||||
pub bay_cpu: u32,
|
||||
pub tutorial_robot: bool, // assumed to be false (when omitted)
|
||||
pub starter_robot_index: i32, // assumed to be -1 (whem omitted)
|
||||
pub control_type: i32, // enum???
|
||||
pub control_options: Vec<bool>,
|
||||
pub mastery_level: i32,
|
||||
pub bay_skin_id: String,
|
||||
pub weapon_order: Vec<i32>,
|
||||
}
|
||||
|
||||
impl GarageSlotInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||
(Typed::Str("numberCubes".into()), Typed::Int(self.cubes as i32)),
|
||||
(Typed::Str("crfId".into()), Typed::Int(self.crf_id as i32)),
|
||||
(Typed::Str("wasRated".into()), Typed::Bool(self.was_rated.into())),
|
||||
(Typed::Str("movementCategories".into()), Typed::Arr(Arr {
|
||||
ty: 105, // int
|
||||
items: self.movement_categories.iter().map(|x| Typed::Int((*x as i32) * 100_000)).collect(),
|
||||
})),
|
||||
(Typed::Str("uniqueId1".into()), Typed::Int(self.uuid.0 as i32)),
|
||||
(Typed::Str("uniqueId2".into()), Typed::Int(self.uuid.1 as i32)),
|
||||
(Typed::Str("thumbnailVersion".into()), Typed::Int(self.thumbnail_version as i32)),
|
||||
(Typed::Str("totalRobotCPU".into()), Typed::Int(self.total_robot_cpu as i32)),
|
||||
(Typed::Str("totalCosmeticCPU".into()), Typed::Int(self.total_cosmetic_cpu as i32)),
|
||||
(Typed::Str("totalRobotRanking".into()), Typed::Int(self.total_robot_ranking as i32)),
|
||||
(Typed::Str("bayCpu".into()), Typed::Int(self.bay_cpu as i32)),
|
||||
(Typed::Str("tutorialRobot".into()), Typed::Bool(self.tutorial_robot.into())),
|
||||
(Typed::Str("starterRobotIndex".into()), Typed::Int(self.starter_robot_index)),
|
||||
(Typed::Str("controlType".into()), Typed::Int(self.control_type)),
|
||||
(Typed::Str("controlOptions".into()), Typed::Arr(Arr {
|
||||
ty: 111, // bool
|
||||
items: self.control_options.iter().map(|&x| Typed::Bool(x.into())).collect(),
|
||||
})),
|
||||
(Typed::Str("masteryLevel".into()), Typed::Int(self.mastery_level)),
|
||||
(Typed::Str("baySkinId".into()), Typed::Str(self.bay_skin_id.clone().into())),
|
||||
(Typed::Str("weaponOrder".into()), Typed::Arr(Arr {
|
||||
ty: 105, // int
|
||||
items: self.weapon_order.iter().map(|x| Typed::Int(*x)).collect(),
|
||||
})),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
124
rc_services_room/src/data/item_shop_bundle.rs
Normal file
124
rc_services_room/src/data/item_shop_bundle.rs
Normal file
@@ -0,0 +1,124 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::io::Write;
|
||||
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct ItemShopBundle {
|
||||
pub sku: String,
|
||||
pub bundle_name_key: String,
|
||||
pub sprite: String,
|
||||
pub is_sprite_full_size: bool,
|
||||
pub category: ItemShopCategory,
|
||||
pub currency: CurrencyType, // str
|
||||
pub price: i32,
|
||||
pub discount_time: i64, // seconds since unix epoch
|
||||
pub discount_price: i32,
|
||||
pub recurrence: ItemShopRecurrence,
|
||||
pub owns_required_cube: bool,
|
||||
//pub is_discounted: bool,
|
||||
pub is_limited_edition: bool,
|
||||
}
|
||||
|
||||
impl ItemShopBundle {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
let mut buf = Vec::new();
|
||||
let mut writer = std::io::Cursor::new(&mut buf);
|
||||
self.dump(&mut writer).unwrap();
|
||||
Typed::Bytes(buf.into())
|
||||
}
|
||||
|
||||
fn dump(&self, writer: &mut dyn Write) -> std::io::Result<usize> {
|
||||
let sku_bytes = self.sku.as_bytes();
|
||||
let mut total_len = writer.write(&encode_7_bit_i32(sku_bytes.len() as i32))?;
|
||||
total_len += writer.write(sku_bytes)?;
|
||||
|
||||
let bundle_name_key_bytes = self.bundle_name_key.as_bytes();
|
||||
total_len += writer.write(&encode_7_bit_i32(bundle_name_key_bytes.len() as i32))?;
|
||||
total_len += writer.write(bundle_name_key_bytes)?;
|
||||
|
||||
let sprite_bytes = self.sprite.as_bytes();
|
||||
total_len += writer.write(&encode_7_bit_i32(sprite_bytes.len() as i32))?;
|
||||
total_len += writer.write(sprite_bytes)?;
|
||||
|
||||
total_len += writer.write(&[self.is_sprite_full_size as u8])?;
|
||||
|
||||
let currency_bytes = self.currency.as_str().as_bytes();
|
||||
total_len += writer.write(&encode_7_bit_i32(currency_bytes.len() as i32))?;
|
||||
total_len += writer.write(currency_bytes)?;
|
||||
|
||||
total_len += writer.write(&self.price.to_le_bytes())?;
|
||||
|
||||
total_len += writer.write(&self.discount_time.to_le_bytes())?;
|
||||
|
||||
total_len += writer.write(&self.discount_price.to_le_bytes())?;
|
||||
|
||||
total_len += writer.write(&(self.recurrence as i32).to_le_bytes())?;
|
||||
|
||||
total_len += writer.write(&[self.owns_required_cube as u8])?;
|
||||
|
||||
total_len += writer.write(&(self.category as i32).to_le_bytes())?;
|
||||
|
||||
total_len += writer.write(&[self.is_limited_edition as u8])?;
|
||||
|
||||
Ok(total_len)
|
||||
}
|
||||
|
||||
pub fn as_transmissible_vec(items: Vec<Self>) -> Typed {
|
||||
let mut buf = Vec::new();
|
||||
let mut writer = std::io::Cursor::new(&mut buf);
|
||||
writer.write(&(items.len() as i32).to_le_bytes()).unwrap();
|
||||
for item in items.iter() {
|
||||
item.dump(&mut writer).unwrap();
|
||||
}
|
||||
Typed::Bytes(buf.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ItemShopCategory {
|
||||
Cube = 0,
|
||||
GarageBaySkin = 1,
|
||||
Bundle = 2,
|
||||
DeathEffect = 3,
|
||||
SpawnEffect = 4,
|
||||
Emotigram = 5,
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ItemShopRecurrence {
|
||||
Daily = 0,
|
||||
Weekly = 1,
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum CurrencyType {
|
||||
Robits = 0,
|
||||
CosmeticCredits = 1,
|
||||
}
|
||||
|
||||
impl CurrencyType {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Robits => "Robits",
|
||||
Self::CosmeticCredits => "CosmeticCredits",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_7_bit_i32(mut src: i32) -> Vec<u8> {
|
||||
let mut out = Vec::with_capacity(5);
|
||||
while src != 0 {
|
||||
let last_7 = (src & 0x7F) as u8;
|
||||
src = src >> 7;
|
||||
if src != 0 {
|
||||
out.push(last_7 | 0x80);
|
||||
} else {
|
||||
out.push(last_7);
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -12,3 +12,7 @@ pub mod cpu_limits;
|
||||
pub mod cosmetic_limits;
|
||||
pub mod taunts_config;
|
||||
pub mod customisation_info;
|
||||
pub mod garage_bay;
|
||||
pub mod custom_games;
|
||||
pub mod tech_tree;
|
||||
pub mod item_shop_bundle;
|
||||
|
||||
28
rc_services_room/src/data/tech_tree.rs
Normal file
28
rc_services_room/src/data/tech_tree.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use polariton::operation::{Typed, Arr};
|
||||
|
||||
pub struct TechTreeNode {
|
||||
pub main_cube_id: i32, // hex
|
||||
pub position_x: i32,
|
||||
pub position_y: i32,
|
||||
pub is_unlocked: bool,
|
||||
pub is_unlockable: bool,
|
||||
pub tech_points: u32,
|
||||
pub neighbours: Vec<i32>, // cube IDs, hex
|
||||
}
|
||||
|
||||
impl TechTreeNode {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("mainCubeId".into()), Typed::Str(hex::encode(self.main_cube_id.to_le_bytes()).into())),
|
||||
(Typed::Str("positionX".into()), Typed::Int(self.position_x)),
|
||||
(Typed::Str("positionY".into()), Typed::Int(self.position_y)),
|
||||
(Typed::Str("isUnlocked".into()), Typed::Bool(self.is_unlocked.into())),
|
||||
(Typed::Str("isUnlockable".into()), Typed::Bool(self.is_unlockable.into())),
|
||||
(Typed::Str("tp".into()), Typed::Int(self.tech_points as i32)),
|
||||
(Typed::Str("neighbours".into()), Typed::Arr(Arr {
|
||||
ty: 115, // str
|
||||
items: self.neighbours.iter().map(|cube_id| Typed::Str(hex::encode(cube_id.to_le_bytes()).into())).collect(),
|
||||
})),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,9 @@ async fn process_socket(mut socket: net::TcpStream, address: std::net::SocketAdd
|
||||
match packet {
|
||||
Packet::Ping(ping) => {
|
||||
handle_ping(ping, &mut write_buf, &mut socket).await;
|
||||
for _ in 0..5 {
|
||||
read_buf.remove(0);
|
||||
}
|
||||
},
|
||||
Packet::Packet(packet) => {
|
||||
// remove packet's advertised size from the buffer
|
||||
|
||||
14
rc_services_room/src/operations/avatar_info.rs
Normal file
14
rc_services_room/src/operations/avatar_info.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
14
rc_services_room/src/operations/balance_info.rs
Normal file
14
rc_services_room/src/operations/balance_info.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
17
rc_services_room/src/operations/cube_inventory.rs
Normal file
17
rc_services_room/src/operations/cube_inventory.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
13
rc_services_room/src/operations/custom_game_session.rs
Normal file
13
rc_services_room/src/operations/custom_game_session.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
53
rc_services_room/src/operations/custom_games_maps.rs
Normal file
53
rc_services_room/src/operations/custom_games_maps.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
12
rc_services_room/src/operations/dev_message.rs
Normal file
12
rc_services_room/src/operations/dev_message.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
46
rc_services_room/src/operations/game_event_params.rs
Normal file
46
rc_services_room/src/operations/game_event_params.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
12
rc_services_room/src/operations/garage_bay_uuid.rs
Normal file
12
rc_services_room/src/operations/garage_bay_uuid.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
46
rc_services_room/src/operations/garage_slots.rs
Normal file
46
rc_services_room/src/operations/garage_slots.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
25
rc_services_room/src/operations/garage_upgrades.rs
Normal file
25
rc_services_room/src/operations/garage_upgrades.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
29
rc_services_room/src/operations/item_shop_bundles.rs
Normal file
29
rc_services_room/src/operations/item_shop_bundles.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
26
rc_services_room/src/operations/owned_cosmetics.rs
Normal file
26
rc_services_room/src/operations/owned_cosmetics.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
18
rc_services_room/src/operations/player_level.rs
Normal file
18
rc_services_room/src/operations/player_level.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
20
rc_services_room/src/operations/premium_duration.rs
Normal file
20
rc_services_room/src/operations/premium_duration.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
12
rc_services_room/src/operations/robopass_season.rs
Normal file
12
rc_services_room/src/operations/robopass_season.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
12
rc_services_room/src/operations/tech_points.rs
Normal file
12
rc_services_room/src/operations/tech_points.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
28
rc_services_room/src/operations/tech_tree_data.rs
Normal file
28
rc_services_room/src/operations/tech_tree_data.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
16
rc_services_room/src/operations/tutorial_status.rs
Normal file
16
rc_services_room/src/operations/tutorial_status.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
16
rc_services_room/src/operations/user_perms.rs
Normal file
16
rc_services_room/src/operations/user_perms.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
12
rc_services_room/src/operations/user_xp.rs
Normal file
12
rc_services_room/src/operations/user_xp.rs
Normal 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())
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user