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

Add server for game data (implement login sequence)

This commit is contained in:
NGnius (Graham)
2025-02-12 18:46:27 -05:00
parent ca4a0ce675
commit d8885d811f
52 changed files with 2734 additions and 5 deletions

View File

@@ -0,0 +1,64 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Arr};
use crate::data::customisation_info::CustomisationData;
const SKINS_KEY: u8 = 228;
const SPAWNS_KEY: u8 = 229;
const DEATHS_KEY: u8 = 230;
const OWNED_SKINS_KEY: u8 = 231;
const OWNED_SPAWNS_KEY: u8 = 232;
const OWNED_DEATHS_KEY: u8 = 233;
const OWNED_EMOTES_KEY: u8 = 76;
pub(super) fn all_customisations_provider() -> SimpleFunc<216, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(SKINS_KEY, Typed::Arr(Arr {
ty: 104, // hashtable
items: vec![
CustomisationData {
id: "skin0".to_string(),
localised_name: "Default".to_string(),
skin_scene_name: "TODO_skin".to_string(),
simulation_prefab: "TODO_sim_prefab".to_string(),
preview_image_name: "TODO_preview_img".to_string(),
is_default: true,
}.as_transmissible(),
],
}));
params.insert(SPAWNS_KEY, Typed::Arr(Arr {
ty: 104, // hashtable
items: vec![
CustomisationData {
id: "spawn0".to_string(),
localised_name: "Default".to_string(),
skin_scene_name: "TODO_skin".to_string(),
simulation_prefab: "TODO_sim_prefab".to_string(),
preview_image_name: "TODO_preview_img".to_string(),
is_default: true,
}.as_transmissible(),
],
}));
params.insert(DEATHS_KEY, Typed::Arr(Arr {
ty: 104, // hashtable
items: vec![
CustomisationData {
id: "death0".to_string(),
localised_name: "Default".to_string(),
skin_scene_name: "TODO_skin".to_string(),
simulation_prefab: "TODO_sim_prefab".to_string(),
preview_image_name: "TODO_preview_img".to_string(),
is_default: true,
}.as_transmissible(),
],
}));
params.insert(OWNED_SKINS_KEY, Typed::StrArr(vec![].into()));
params.insert(OWNED_SPAWNS_KEY, Typed::StrArr(vec![].into()));
params.insert(OWNED_DEATHS_KEY, Typed::StrArr(vec![].into()));
params.insert(OWNED_EMOTES_KEY, Typed::StrArr(vec![].into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,33 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::battle_arena_config::*;
const PARAM_KEY: u8 = 1;
pub(super) fn battle_arena_config_provider() -> SimpleFunc<53, 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, // obj
items: vec![
(Typed::Str("BattleArenaSettings".into()), BattleArenaData {
protonium_health: 1_000,
respawn_time_seconds: 10,
heal_over_time_per_tower: vec![10, 10, 10, 10],
base_machine_map: Vec::default(),
equalizer_model: Vec::default(),
equalizer_health: 1_000_000,
equalizer_trigger_time_seconds: vec![10, 10, 10, 10, 10],
equalizer_warning_seconds: 10,
equalizer_duration_seconds: vec![20, 20, 20, 20, 20],
capture_time_seconds_per_player: vec![30, 20, 10, 5, 1],
num_segments: 4,
heal_escalation_time_seconds: 5,
}.as_transmissible())
],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,31 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::client_config::*;
const PARAM_KEY: u8 = 36;
pub(super) fn client_config_provider() -> SimpleFunc<34, 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, // hashtable
items: vec![
(Typed::Str("GameplaySettings".into()), GameplaySettings {
show_tutorial_after_date: "2025-01-01".to_owned(),
health_threshold: 10.0,
microbot_sphere: 10.0,
misfire_angle: 20.0,
shield_dps: 100,
shield_hps: 2_000,
request_review_level: 10_000,
critical_ratio: 10.0,
cross_promo_image: "https://git.ngni.us/TODO".to_owned(), // TODO
cross_promo_link: "https://git.ngni.us/OpenJam/servers".to_owned(),
}.as_transmissible())
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,18 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::ParameterTable;
use crate::data::cosmetic_limits::CosmeticLimitsData;
const PARAM_KEY: u8 = 196;
pub(super) fn cosmetic_limits_config_provider() -> SimpleFunc<72, 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, CosmeticLimitsData {
others_max_holo_and_trails: 16,
others_max_headlamps: 8,
others_max_cosmetic_items_with_particles: 12,
}.as_transmissible());
Ok(params.into())
})
}

View File

@@ -0,0 +1,20 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::ParameterTable;
use crate::data::cpu_limits::CpuLimitsData;
const PARAM_KEY: u8 = 194;
pub(super) fn cpu_config_provider() -> SimpleFunc<75, 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, CpuLimitsData {
premium_for_life_cosmetic_gpu: 12,
premium_cosmetic_cpu: 6,
no_premium_cosmetic_cpu: 3,
max_regular_health: 2_000_000,
max_megabot_health: 200_000_000,
}.as_transmissible());
Ok(params.into())
})
}

View File

@@ -0,0 +1,18 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::ParameterTable;
use crate::data::crf_config::*;
const PARAM_KEY: u8 = 110;
pub(super) fn crf_config_provider() -> SimpleFunc<92, 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, RobotShopConfig {
cpu_ranges: vec![100, 500, 1_000, 2_000],
submission_mult: 1.0,
earnings_mult: 1.0,
}.as_transmissible());
Ok(params.into())
})
}

View File

@@ -0,0 +1,43 @@
use std::collections::HashMap;
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::cube_list::*;
const PARAM_KEY: u8 = 1;
pub(super) fn cube_list_provider() -> SimpleFunc<2, 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, // hashtable
items: vec![
//(u32 in base16 aka hex, hashtable)
(Typed::Str("DEADBEEF".into()), CubeInfo {
cpu: 1,
health: 1,
health_boost: 1.0,
grey_out_in_tutorial: false,
visibility: VisibilityMode::All,
indestructible: true,
category: 1,
placements: 63,
protonium: false,
unlocked_by_league: false,
league_unlock_index: 1,
stats: HashMap::default(),
description: "This is a very descriptive description".to_string(),
size: ItemTier::NoTier,
type_: ItemType::NoFunction,
ranking: 1,
cosmetic: false,
variant_of: "0".to_string(),
ignore_in_weapon_list: true,
}.as_transmissible())
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,26 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::damage_boost::*;
const PARAM_KEY: u8 = 192;
pub(super) fn damage_boost_provider() -> SimpleFunc<163, 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: 42, // obj
items: vec![
(Typed::Str("damageBoost".into()), DamageBoostData {
damage_map: vec![
(100, 1000.0),
(1000, 100.0),
(2000, 1.0),
],
}.as_transmissible())
],
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,23 @@
use polariton_server::operations::{Operation, OperationCode};
pub struct EacChallengeIgnorer;
impl Operation for EacChallengeIgnorer {
type State = ();
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
polariton::operation::OperationResponse {
code: 161, // skip the challenge (hopefully)
return_code: 0,
message: polariton::operation::Typed::Null,
params,
}
}
}
impl OperationCode for EacChallengeIgnorer {
fn op_code() -> u8 {
160
}
}

View File

@@ -0,0 +1,82 @@
use std::collections::HashMap;
use polariton::operation::{Typed, ParameterTable, OperationResponse, Dict};
use polariton_server::operations::{Operation, OperationCode};
pub struct QualityConfigTeller;
impl Operation for QualityConfigTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: ParameterTable, _: &mut Self::State, _: &Self::User) -> OperationResponse {
let quality_levels = Typed::HashMap(vec![
(Typed::Str("extremLow".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("Level".into()), Typed::Long(0)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("low".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("Level".into()), Typed::Long(1)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("normal".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("Level".into()), Typed::Long(2)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("beautiful".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("Level".into()), Typed::Long(3)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("fantastic".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("Level".into()), Typed::Long(4)),
(Typed::Str("default".into()), Typed::Float(f32::MAX)),
],
})),
].into());
let mem_thresholds = Typed::HashMap(vec![
(Typed::Str("low".into()), Typed::Int(69)),
(Typed::Str("extremeLow".into()), Typed::Int(42)),
].into());
let mut resp_params = HashMap::new();
resp_params.insert(1 /* dict<string, hashtable> */, Typed::Dict(
Dict {
key_ty: 115, // str
val_ty: 104, // hash table
items: vec![
(Typed::Str("qualityLevels".into()), quality_levels),
(Typed::Str("systemMemoryThresholds".into()), mem_thresholds),
],
}));
OperationResponse {
code: 104,
return_code: 0,
message: Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for QualityConfigTeller {
fn op_code() -> u8 {
104
}
}

View File

@@ -0,0 +1,34 @@
use polariton::operation::Dict;
use polariton_server::operations::{Operation, OperationCode};
pub struct NoAnalytics;
impl NoAnalytics {
const ANALYTICS_DICT_KEY: u8 = 83;
}
impl Operation for NoAnalytics {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::ANALYTICS_DICT_KEY, polariton::operation::Typed::Dict(Dict {
key_ty: 115, // str
val_ty: 115, // str
items: Vec::new(),
}));
polariton::operation::OperationResponse {
code: 70,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for NoAnalytics {
fn op_code() -> u8 {
70
}
}

View File

@@ -0,0 +1,45 @@
use polariton_server::operations::{Operation, OperationCode};
pub struct UserFlagsTeller;
impl UserFlagsTeller {
const REMOVE_OBSOLETE_CUBES_KEY: u8 = 113;
const REMOVE_UNOWNED_CUBES_KEY: u8 = 114;
const REWARD_TITLE_KEY: u8 = 115;
const REWARD_BODY_KEY: u8 = 116;
const REFUND_OBSOLETE_CUBES_KEY: u8 = 117;
const CUBES_ARE_REPLACED_KEY: u8 = 118;
const NEW_USER_KEY: u8 = 119;
const AB_TEST_KEY: u8 = 166;
const AB_GROUP_KEY: u8 = 167;
}
impl Operation for UserFlagsTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::REMOVE_OBSOLETE_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::REMOVE_UNOWNED_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::REWARD_TITLE_KEY, polariton::operation::Typed::Str("Yay a reward!".into()));
resp_params.insert(Self::REWARD_BODY_KEY, polariton::operation::Typed::Str("I love you very much so here's nothing as a reward.".into()));
resp_params.insert(Self::REFUND_OBSOLETE_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::CUBES_ARE_REPLACED_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::NEW_USER_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::AB_TEST_KEY, polariton::operation::Typed::Str("".into()));
resp_params.insert(Self::AB_GROUP_KEY, polariton::operation::Typed::Str("".into()));
polariton::operation::OperationResponse {
code: 105,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for UserFlagsTeller {
fn op_code() -> u8 {
105
}
}

View File

@@ -0,0 +1,28 @@
use std::collections::HashMap;
use polariton_server::operations::{Operation, OperationCode};
pub struct MaintenanceModeTeller;
impl Operation for MaintenanceModeTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
let mut resp_params = HashMap::new();
resp_params.insert(20 /* is in maintenance mode? */, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(19 /* maintenace mode message */, polariton::operation::Typed::Str("OpenJam's servers are currently undergoing maintenance".into()));
polariton::operation::OperationResponse {
code: 20,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for MaintenanceModeTeller {
fn op_code() -> u8 {
20
}
}

View File

@@ -0,0 +1,57 @@
mod eac;
mod more_auth;
mod versioner;
mod maintenancer;
mod game_quality;
mod login_flags;
mod load_analytics;
mod platform_config;
mod tier_banding;
mod cube_list;
mod special_items;
mod premium_config;
mod palette_town;
mod client_config;
mod crf_config;
mod weapon_stats;
mod movement_stats;
mod power_bar_stats;
mod damage_boost_stats;
mod battle_arena_config;
mod cpu_limits_config;
mod cosmetic_config;
mod taunts_config;
mod all_customisations_info;
use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy> {
OperationsHandler::new()
.without_state(eac::EacChallengeIgnorer)
.without_state(more_auth::MoreLobbyAuth)
.without_state(versioner::VersionTeller)
.without_state(maintenancer::MaintenanceModeTeller)
.without_state(game_quality::QualityConfigTeller)
.without_state(login_flags::UserFlagsTeller)
.without_state(polariton_server::operations::Ack::<132, _>::default()) // verify user level
.without_state(load_analytics::NoAnalytics)
.without_state(polariton_server::operations::Ack::<131, _>::default()) // analytics updated notification
.without_state(platform_config::platform_config_provider())
.without_state(tier_banding::tiers_banding_provider())
.without_state(cube_list::cube_list_provider())
.without_state(special_items::special_item_list_provider())
.without_state(premium_config::premium_config_provider())
.without_state(palette_town::kanto())
.without_state(client_config::client_config_provider())
.without_state(crf_config::crf_config_provider())
.without_state(weapon_stats::weapon_config_provider())
.without_state(movement_stats::movement_config_provider())
.without_state(power_bar_stats::power_bar_provider())
.without_state(damage_boost_stats::damage_boost_provider())
.without_state(battle_arena_config::battle_arena_config_provider())
.without_state(cpu_limits_config::cpu_config_provider())
.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(polariton_server::operations::Ack::<70, _>::default())
}

View File

@@ -0,0 +1,42 @@
use polariton::operation::Typed;
use polariton_server::operations::{Operation, OperationCode};
pub struct MoreLobbyAuth;
impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl Operation for MoreLobbyAuth {
type State = ();
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
let mut write_lock = user.write().unwrap();
if write_lock.update_with_auth(&auth_payload.string) {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::AUTH_PAYLOAD_KEY, polariton::operation::Typed::Byte(0));
return polariton::operation::OperationResponse {
code: 230,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
polariton::operation::OperationResponse {
code: 230,
return_code: 120,
message: polariton::operation::Typed::Null,
params: std::collections::HashMap::new().into(),
}
}
}
impl OperationCode for MoreLobbyAuth {
fn op_code() -> u8 {
230
}
}

View File

@@ -0,0 +1,142 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::movement_list::*;
use crate::data::cube_list::ItemTier;
use crate::data::weapon_list::ItemCategory;
const PARAM_KEY: u8 = 1;
pub(super) fn movement_config_provider() -> SimpleFunc<62, 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, // hashtable
items: vec![
(Typed::Str("Global".into()), Typed::HashMap(vec![
(Typed::Str("lerpValue".into()), Typed::Float(10.0)),
].into())),
(Typed::Str("Movements".into()), Typed::HashMap(vec![
(Typed::Str(ItemCategory::Wheel.as_str().into()), MovementCategoryData {
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementCategorySpecificData::Wheel,
stats: vec![
(ItemTier::T0, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
(ItemTier::T1, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
(ItemTier::T2, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
(ItemTier::T3, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
(ItemTier::T4, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
(ItemTier::T5, MovementData {
speed_boost: Some(1.0),
max_carry_mass: Some(1.0),
horizontal_top_speed: Some(1.0),
vertical_top_speed: Some(1.0),
specifics: MovementSpecificData::Wheel(WheelData {
steering_speed_light: 1.0,
steering_speed_heavy: 1.0,
steering_force_multiplier_light: 1.0,
steering_force_multiplier_heavy: 1.0,
lateral_acceleration_light: 1.0,
lateral_acceleration_heavy: 1.0,
time_to_max_acceleration_light: 1.0,
time_to_max_acceleration_heavy: 1.0,
brake_force_light: 1.0,
brake_force_heavy: 1.0,
}),
}),
],
..Default::default()
}.as_transmissible()),
].into())),
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,61 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
use crate::data::palette::*;
const PALETTE_KEY: u8 = 34;
const ORDER_KEY: u8 = 149;
pub(super) fn kanto() -> SimpleFunc<31, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(PALETTE_KEY, Typed::Bytes({
let mut buf = Vec::new();
Colour::write_many(vec![
// Red
Colour {
index: 0,
diffuse: ColourValue { r: 255, g: 0, b: 0, a: u8::MAX },
specular: ColourValue { r: 255, g: 0, b: 0, a: u8::MAX },
overlay: ColourValue { r: 255, g: 0, b: 0, a: u8::MAX },
premium: false,
},
// Blue
Colour {
index: 1,
diffuse: ColourValue { r: 0, g: 0, b: 255, a: u8::MAX },
specular: ColourValue { r: 0, g: 0, b: 255, a: u8::MAX },
overlay: ColourValue { r: 0, g: 0, b: 255, a: u8::MAX },
premium: false,
},
// Green
Colour {
index: 2,
diffuse: ColourValue { r: 0, g: 255, b: 0, a: u8::MAX },
specular: ColourValue { r: 0, g: 255, b: 0, a: u8::MAX },
overlay: ColourValue { r: 0, g: 255, b: 0, a: u8::MAX },
premium: false,
},
// Black
Colour {
index: 3,
diffuse: ColourValue { r: 0, g: 0, b: 0, a: u8::MAX },
specular: ColourValue { r: 0, g: 0, b: 0, a: u8::MAX },
overlay: ColourValue { r: 0, g: 0, b: 0, a: u8::MAX },
premium: false,
},
// White
Colour {
index: 4,
diffuse: ColourValue { r: 255, g: 255, b: 255, a: u8::MAX },
specular: ColourValue { r: 255, g: 255, b: 255, a: u8::MAX },
overlay: ColourValue { r: 255, g: 255, b: 255, a: u8::MAX },
premium: false,
},
].as_slice(), &mut buf).unwrap_or_default();
buf.into()
}));
params.insert(ORDER_KEY, Typed::Bytes(vec![0u8, 1, 2, 3, 4].into()));
Ok(params.into())
})
}

View File

@@ -0,0 +1,29 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
const PLATFORM_CONFIG_KEY: u8 = 197;
pub(super) fn platform_config_provider() -> SimpleFunc<165, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(PLATFORM_CONFIG_KEY, Typed::Dict(Dict {
key_ty: 42, // obj
val_ty: 42, // obj
items: vec![
(Typed::Str("BuyPremiumAvailable".into()), Typed::Bool(false.into())),
(Typed::Str("MainShopButtonAvailable".into()), Typed::Bool(false.into())),
(Typed::Str("RoboPassButtonAvailable".into()), Typed::Bool(false.into())),
(Typed::Str("LanguageSelectionAvailable".into()), Typed::Bool(false.into())),
(Typed::Str("AutoJoinPublicChatRoom".into()), Typed::Bool(false.into())), // TODO maybe?
(Typed::Str("CanCreateChatRooms".into()), Typed::Bool(false.into())), // TODO
(Typed::Str("CurseVoiceEnabled".into()), Typed::Bool(false.into())),
(Typed::Str("DeltaDNAEnabled".into()), Typed::Bool(false.into())),
(Typed::Str("UseDecimalSystem".into()), Typed::Bool(false.into())),
(Typed::Str("FeedbackURL".into()), Typed::Str("https://mstdn.ca/@ngram".into())),
(Typed::Str("SupportURL".into()), Typed::Str("https://git.ngni.us/OpenJam/servers".into())),
(Typed::Str("WikiURL".into()), Typed::Str("https://docs.rs/libfj/latest/libfj/".into())),
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,16 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
const PARAM_KEY: u8 = 61;
pub(super) fn power_bar_provider() -> SimpleFunc<51, 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("refillRatePerSecond".into()), Typed::Float(1.0)),
(Typed::Str("powerForAllRobots".into()), Typed::Int(1_000 /* converted to u32 */)),
].into()
));
Ok(params.into())
})
}

View File

@@ -0,0 +1,22 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::ParameterTable;
use crate::data::premium_config::*;
const PARAM_KEY: u8 = 1;
pub(super) fn premium_config_provider() -> SimpleFunc<5, 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, PremiumEffects {
factor: PremiumFactor {
factor: 100,
party_bonus: 100,
},
multiplayer: PremiumMultiplayer {
tier_multiplier: 2.0,
}
}.as_transmissible());
Ok(params.into())
})
}

View File

@@ -0,0 +1,25 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::special_item::*;
const PARAM_KEY: u8 = 1;
pub(super) fn special_item_list_provider() -> SimpleFunc<6, 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, // hashtable
items: vec![
//(u32 in base16 aka hex, hashtable)
(Typed::Str("DEADBEEF".into()), SpecialItem {
name: "cool".to_string(),
sprite: "chair".to_string(),
size: 1,
}.as_transmissible())
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,43 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
use crate::data::taunts_config::*;
const PARAM_KEY: u8 = 195;
pub(super) fn taunts_config_provider() -> SimpleFunc<164, 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(polariton::operation::Dict {
key_ty: 115,
val_ty: 42,
items: vec![
(Typed::Str("taunts".into()), TauntsData {
taunts: vec![
TauntData {
group_name: "totally_real_group_name".to_string(),
assets: AssetData {
idle_effect: "tbd".to_string(),
active_effect: "something".to_string(),
sound_effect: "3rd thing here".to_string(),
},
animation_offset_x: 0.0,
animation_offset_y: 0.0,
animation_offset_z: 0.0,
cubes: vec![
CubeData {
cube_id: 1,
position_x: 0,
position_y: 0,
position_z: 0,
rotation: 0,
}
]
}
]
}.as_transmissible())
]
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,21 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
const PARAM_KEY: u8 = 1;
pub(super) fn tiers_banding_provider() -> SimpleFunc<7, 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: 42, // obj
items: vec![
(Typed::Str("tiersbands".into()), Typed::IntArr(vec![
1
].into())),
(Typed::Str("maximumRobotRankingARobotCanObtain".into()), Typed::Int(1)),
].into(),
}));
Ok(params.into())
})
}

View File

@@ -0,0 +1,30 @@
use polariton_server::operations::{Operation, OperationCode};
pub struct VersionTeller;
impl VersionTeller {
const VERSION_NUMBER_KEY: u8 = 112;
const LATEST_VERSION: i32 = 2855;
}
impl Operation for VersionTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::VERSION_NUMBER_KEY, polariton::operation::Typed::Int(Self::LATEST_VERSION));
polariton::operation::OperationResponse {
code: 103,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for VersionTeller {
fn op_code() -> u8 {
103
}
}

View File

@@ -0,0 +1,47 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Dict};
use crate::data::weapon_list::*;
use crate::data::cube_list::ItemTier;
const PARAM_KEY: u8 = 57;
pub(super) fn weapon_config_provider() -> SimpleFunc<47, 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, // hashtable
items: vec![
// (Item category, map<tier, weapon stats>)
(Typed::Str(ItemCategory::Laser.as_str().into()), Typed::HashMap(vec![
(Typed::Str(ItemTier::T0.as_str().into()), WeaponData {
damage_inflicted: Some(42),
..Default::default()
}.as_transmissible()),
(Typed::Str(ItemTier::T1.as_str().into()), WeaponData {
damage_inflicted: Some(420),
..Default::default()
}.as_transmissible()),
(Typed::Str(ItemTier::T2.as_str().into()), WeaponData {
damage_inflicted: Some(4200),
..Default::default()
}.as_transmissible()),
(Typed::Str(ItemTier::T3.as_str().into()), WeaponData {
damage_inflicted: Some(42000),
..Default::default()
}.as_transmissible()),
(Typed::Str(ItemTier::T4.as_str().into()), WeaponData {
damage_inflicted: Some(420000),
..Default::default()
}.as_transmissible()),
(Typed::Str(ItemTier::T5.as_str().into()), WeaponData {
damage_inflicted: Some(4200000),
..Default::default()
}.as_transmissible()),
].into()))
].into(),
}));
Ok(params.into())
})
}