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:
44
rc_services_room/src/data/battle_arena_config.rs
Normal file
44
rc_services_room/src/data/battle_arena_config.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
use polariton::operation::Typed;
|
||||
use base64::{Engine, engine::general_purpose::STANDARD};
|
||||
|
||||
pub struct BattleArenaData {
|
||||
pub protonium_health: i64,
|
||||
pub respawn_time_seconds: i64,
|
||||
pub heal_over_time_per_tower: Vec<u64>,
|
||||
pub base_machine_map: Vec<u8>, // aka team base model, converted into base64
|
||||
pub equalizer_model: Vec<u8>, // converted into base64
|
||||
pub equalizer_health: i64,
|
||||
pub equalizer_trigger_time_seconds: Vec<u64>,
|
||||
pub equalizer_warning_seconds: i64,
|
||||
pub equalizer_duration_seconds: Vec<u64>,
|
||||
pub capture_time_seconds_per_player: Vec<i64>,
|
||||
pub num_segments: i32,
|
||||
pub heal_escalation_time_seconds: i64,
|
||||
}
|
||||
|
||||
fn to_obj_arr_u(slice: &[u64]) -> Typed {
|
||||
Typed::ObjArr(slice.iter().map(|x| Typed::Long(*x as i64)).collect::<Vec<Typed>>().into())
|
||||
}
|
||||
|
||||
fn to_obj_arr_i(slice: &[i64]) -> Typed {
|
||||
Typed::ObjArr(slice.iter().map(|x| Typed::Long(*x)).collect::<Vec<Typed>>().into())
|
||||
}
|
||||
|
||||
impl BattleArenaData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("protoniumHealth".into()), Typed::Long(self.protonium_health)),
|
||||
(Typed::Str("respawnTimeSeconds".into()), Typed::Long(self.respawn_time_seconds)),
|
||||
(Typed::Str("healOverTimePerTower".into()), to_obj_arr_u(&self.heal_over_time_per_tower)),
|
||||
(Typed::Str("baseMachineMap".into()), Typed::Str(STANDARD.encode(&self.base_machine_map).into())),
|
||||
(Typed::Str("equalizerModel".into()), Typed::Str(STANDARD.encode(&self.equalizer_model).into())),
|
||||
(Typed::Str("equalizerHealth".into()), Typed::Long(self.equalizer_health)),
|
||||
(Typed::Str("equalizerTriggerTimeSeconds".into()), to_obj_arr_u(&self.equalizer_trigger_time_seconds)),
|
||||
(Typed::Str("equalizerWarningSeconds".into()), Typed::Long(self.equalizer_warning_seconds)),
|
||||
(Typed::Str("equalizerDurationSeconds".into()), to_obj_arr_u(&self.equalizer_duration_seconds)),
|
||||
(Typed::Str("captureTimeSecondsPerPlayer".into()), to_obj_arr_i(&self.capture_time_seconds_per_player)),
|
||||
(Typed::Str("numSegments".into()), Typed::Int(self.num_segments)),
|
||||
(Typed::Str("healEscalationTimeSeconds".into()), Typed::Long(self.heal_escalation_time_seconds)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
32
rc_services_room/src/data/client_config.rs
Normal file
32
rc_services_room/src/data/client_config.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct GameplaySettings {
|
||||
pub show_tutorial_after_date: String,
|
||||
pub health_threshold: f32, // percent
|
||||
pub microbot_sphere: f32, // radius
|
||||
pub misfire_angle: f32, // degrees?
|
||||
pub shield_dps: i32,
|
||||
pub shield_hps: u32,
|
||||
pub request_review_level: u32,
|
||||
pub critical_ratio: f32,
|
||||
pub cross_promo_image: String, // url
|
||||
pub cross_promo_link: String, // url
|
||||
}
|
||||
|
||||
impl GameplaySettings {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
// TODO
|
||||
(Typed::Str("showTutorialAfterDate".into()), Typed::Str(self.show_tutorial_after_date.clone().into())),
|
||||
(Typed::Str("healthTresholdPercent".into()), Typed::Float(self.health_threshold)),
|
||||
(Typed::Str("microbotSphereRadius".into()), Typed::Float(self.microbot_sphere)),
|
||||
(Typed::Str("smartRotationMisfireAngle".into()), Typed::Float(self.misfire_angle)),
|
||||
(Typed::Str("fusionShieldDPS".into()), Typed::Int(self.shield_dps)),
|
||||
(Typed::Str("fusionShieldHPS".into()), Typed::Int(self.shield_hps as i32)),
|
||||
(Typed::Str("requestReviewAtLevel".into()), Typed::Int(self.request_review_level as i32)),
|
||||
(Typed::Str("criticalRatio".into()), Typed::Float(self.critical_ratio)),
|
||||
(Typed::Str("crossPromotionAdImageUrl".into()), Typed::Str(self.cross_promo_image.clone().into())),
|
||||
(Typed::Str("crossPromotionAdLinkUrl".into()), Typed::Str(self.cross_promo_link.clone().into())),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
18
rc_services_room/src/data/cosmetic_limits.rs
Normal file
18
rc_services_room/src/data/cosmetic_limits.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct CosmeticLimitsData {
|
||||
pub others_max_holo_and_trails: u32,
|
||||
pub others_max_headlamps: u32,
|
||||
pub others_max_cosmetic_items_with_particles: u32,
|
||||
}
|
||||
|
||||
impl CosmeticLimitsData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("OthersMaxNumberHoloAndTrails".into()), Typed::Int(self.others_max_holo_and_trails as i32)),
|
||||
(Typed::Str("OthersMaxNumberHeadlamps".into()), Typed::Int(self.others_max_headlamps as i32)),
|
||||
(Typed::Str("OthersMaxCosmeticItemsWithParticleSystem".into()), Typed::Int(self.others_max_cosmetic_items_with_particles as i32)),
|
||||
].into()
|
||||
)
|
||||
}
|
||||
}
|
||||
22
rc_services_room/src/data/cpu_limits.rs
Normal file
22
rc_services_room/src/data/cpu_limits.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct CpuLimitsData {
|
||||
pub premium_for_life_cosmetic_gpu: i32,
|
||||
pub premium_cosmetic_cpu: i32,
|
||||
pub no_premium_cosmetic_cpu: i32,
|
||||
pub max_regular_health: i32,
|
||||
pub max_megabot_health: i32,
|
||||
}
|
||||
|
||||
impl CpuLimitsData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("PremiumForLifeCosmeticCPU".into()), Typed::Int(self.premium_for_life_cosmetic_gpu)),
|
||||
(Typed::Str("PremiumCosmeticCPU".into()), Typed::Int(self.premium_cosmetic_cpu)),
|
||||
(Typed::Str("NoPremiumCosmeticCPU".into()), Typed::Int(self.no_premium_cosmetic_cpu)),
|
||||
(Typed::Str("MaxRegularHealth".into()), Typed::Int(self.max_regular_health)),
|
||||
(Typed::Str("MaxMegabotHealth".into()), Typed::Int(self.max_megabot_health)),
|
||||
].into()
|
||||
)
|
||||
}
|
||||
}
|
||||
17
rc_services_room/src/data/crf_config.rs
Normal file
17
rc_services_room/src/data/crf_config.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct RobotShopConfig {
|
||||
pub cpu_ranges: Vec<i32>,
|
||||
pub submission_mult: f32,
|
||||
pub earnings_mult: f32,
|
||||
}
|
||||
|
||||
impl RobotShopConfig {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("robotShopPriceRanges".into()), Typed::IntArr(self.cpu_ranges.clone().into())),
|
||||
(Typed::Str("submissionMultiplier".into()), Typed::Float(self.submission_mult)),
|
||||
(Typed::Str("earningsMultiplier".into()), Typed::Float(self.earnings_mult)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
120
rc_services_room/src/data/cube_list.rs
Normal file
120
rc_services_room/src/data/cube_list.rs
Normal file
@@ -0,0 +1,120 @@
|
||||
#![allow(dead_code)]
|
||||
use std::collections::HashMap;
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct CubeInfo {
|
||||
pub cpu: u32,
|
||||
pub health: u32,
|
||||
pub health_boost: f32,
|
||||
pub grey_out_in_tutorial: bool,
|
||||
pub visibility: VisibilityMode,
|
||||
pub indestructible: bool,
|
||||
pub category: u32,
|
||||
pub placements: u32, // default 63
|
||||
pub protonium: bool,
|
||||
pub unlocked_by_league: bool,
|
||||
pub league_unlock_index: i32,
|
||||
pub stats: HashMap<String, Typed>,
|
||||
pub description: String,
|
||||
pub size: ItemTier,
|
||||
pub type_: ItemType,
|
||||
pub ranking: i32,
|
||||
pub cosmetic: bool,
|
||||
pub variant_of: String, // cube id (in hex)
|
||||
pub ignore_in_weapon_list: bool,
|
||||
}
|
||||
|
||||
impl CubeInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("cpuRating".into()), Typed::Int(self.cpu as i32)),
|
||||
(Typed::Str("health".into()), Typed::Int(self.health as i32)),
|
||||
(Typed::Str("healthBoost".into()), Typed::Float(self.health_boost)),
|
||||
(Typed::Str("GreyOutInTutorial".into()), Typed::Bool(self.grey_out_in_tutorial.into())),
|
||||
(Typed::Str("buildVisibility".into()), Typed::Str(self.visibility.as_str().into())),
|
||||
(Typed::Str("isIndestructible".into()), Typed::Bool(self.indestructible.into())),
|
||||
(Typed::Str("ItemCategory".into()), Typed::Int(self.category as i32)),
|
||||
(Typed::Str("PlacementFaces".into()), Typed::Int(self.placements as i32)),
|
||||
(Typed::Str("protoniumCrystal".into()), Typed::Bool(self.protonium.into())),
|
||||
(Typed::Str("UnlockedByLeague".into()), Typed::Bool(self.unlocked_by_league.into())),
|
||||
(Typed::Str("LeagueUnlockIndex".into()), Typed::Int(self.league_unlock_index)),
|
||||
(Typed::Str("DisplayStats".into()), {
|
||||
let items: Vec<(Typed, Typed)> = self.stats.iter().map(|(key, val)| (Typed::Str(key.into()), val.to_owned())).collect();
|
||||
Typed::HashMap(items.into())
|
||||
}),
|
||||
(Typed::Str("Description".into()), Typed::Str(self.description.clone().into())),
|
||||
(Typed::Str("ItemSize".into()), Typed::Int(self.size as i32)),
|
||||
(Typed::Str("ItemType".into()), Typed::Str(self.type_.as_str().into())),
|
||||
(Typed::Str("robotRanking".into()), Typed::Int(self.ranking)),
|
||||
(Typed::Str("isCosmetic".into()), Typed::Bool(self.cosmetic.into())),
|
||||
(Typed::Str("variantOf".into()), Typed::Str(self.variant_of.clone().into())),
|
||||
(Typed::Str("ignoreInWeaponsList".into()), Typed::Bool(self.ignore_in_weapon_list.into())), // optional
|
||||
].into())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum VisibilityMode {
|
||||
Mothership,
|
||||
All,
|
||||
Tutorial,
|
||||
None,
|
||||
}
|
||||
|
||||
impl VisibilityMode {
|
||||
fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Mothership => "Mothership",
|
||||
Self::All => "All",
|
||||
Self::Tutorial => "Tutorial",
|
||||
Self::None => "None",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ItemTier {
|
||||
NoTier = 0,
|
||||
T0 = 100,
|
||||
T1 = 200,
|
||||
T2 = 300,
|
||||
T3 = 400,
|
||||
T4 = 500,
|
||||
T5 = 600,
|
||||
}
|
||||
|
||||
impl ItemTier {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
ItemTier::NoTier => "NotAWeapon",
|
||||
ItemTier::T0 => "T0",
|
||||
ItemTier::T1 => "T1",
|
||||
ItemTier::T2 => "T2",
|
||||
ItemTier::T3 => "T3",
|
||||
ItemTier::T4 => "T4",
|
||||
ItemTier::T5 => "T5",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ItemType {
|
||||
NoFunction,
|
||||
Weapon,
|
||||
Module,
|
||||
Movement,
|
||||
Cosmetic,
|
||||
}
|
||||
|
||||
impl ItemType {
|
||||
fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::NoFunction => "NotAFunctionalItem",
|
||||
Self::Weapon => "Weapon",
|
||||
Self::Module => "Module",
|
||||
Self::Movement => "Movement",
|
||||
Self::Cosmetic => "Cosmetic",
|
||||
}
|
||||
}
|
||||
}
|
||||
23
rc_services_room/src/data/customisation_info.rs
Normal file
23
rc_services_room/src/data/customisation_info.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct CustomisationData {
|
||||
pub id: String,
|
||||
pub localised_name: String,
|
||||
pub skin_scene_name: String,
|
||||
pub simulation_prefab: String,
|
||||
pub preview_image_name: String,
|
||||
pub is_default: bool,
|
||||
}
|
||||
|
||||
impl CustomisationData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("id".into()), Typed::Str(self.id.clone().into())),
|
||||
(Typed::Str("localisedName".into()), Typed::Str(self.localised_name.clone().into())),
|
||||
(Typed::Str("skinsceneName".into()), Typed::Str(self.skin_scene_name.clone().into())),
|
||||
(Typed::Str("simulationPrefab".into()), Typed::Str(self.simulation_prefab.clone().into())),
|
||||
(Typed::Str("previewImageName".into()), Typed::Str(self.preview_image_name.clone().into())),
|
||||
(Typed::Str("isDefault".into()), Typed::Bool(self.is_default.into())),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
17
rc_services_room/src/data/damage_boost.rs
Normal file
17
rc_services_room/src/data/damage_boost.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
|
||||
pub struct DamageBoostData {
|
||||
pub damage_map: Vec<(u32, f32)>, // (cpu, boost)
|
||||
}
|
||||
|
||||
impl DamageBoostData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // obj
|
||||
items: self.damage_map.iter()
|
||||
.map(|(cpu, boost)| (Typed::Str(cpu.to_string().into()), Typed::Float(*boost)))
|
||||
.collect(),
|
||||
})
|
||||
}
|
||||
}
|
||||
14
rc_services_room/src/data/mod.rs
Normal file
14
rc_services_room/src/data/mod.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
pub mod cube_list;
|
||||
pub mod special_item;
|
||||
pub mod premium_config;
|
||||
pub mod palette;
|
||||
pub mod client_config;
|
||||
pub mod crf_config;
|
||||
pub mod weapon_list;
|
||||
pub mod movement_list;
|
||||
pub mod damage_boost;
|
||||
pub mod battle_arena_config;
|
||||
pub mod cpu_limits;
|
||||
pub mod cosmetic_limits;
|
||||
pub mod taunts_config;
|
||||
pub mod customisation_info;
|
||||
450
rc_services_room/src/data/movement_list.rs
Normal file
450
rc_services_room/src/data/movement_list.rs
Normal file
@@ -0,0 +1,450 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polariton::operation::{Typed, Dict};
|
||||
|
||||
use super::cube_list::ItemTier;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MovementCategoryData {
|
||||
pub horizontal_top_speed: Option<f32>,
|
||||
pub vertical_top_speed: Option<f32>,
|
||||
pub min_required_items: Option<i32>,
|
||||
pub min_item_modifier: Option<f32>,
|
||||
pub max_hover_height: Option<f32>,
|
||||
pub light_machine_mass: Option<f32>,
|
||||
pub heavy_machine_mass: Option<f32>,
|
||||
pub specifics: MovementCategorySpecificData,
|
||||
pub stats: Vec<(ItemTier, MovementData)>,
|
||||
}
|
||||
|
||||
impl MovementCategoryData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
let mut out = Vec::new();
|
||||
self.horizontal_top_speed.map(|x| out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))));
|
||||
self.vertical_top_speed.map(|x| out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))));
|
||||
self.min_required_items.map(|x| out.push((Typed::Str("minRequiredItems".into()), Typed::Int(x))));
|
||||
self.min_item_modifier.map(|x| out.push((Typed::Str("minItemsModifier".into()), Typed::Float(x))));
|
||||
self.max_hover_height.map(|x| out.push((Typed::Str("maxHoverHeight".into()), Typed::Float(x))));
|
||||
self.light_machine_mass.map(|x| out.push((Typed::Str("lightMachineMass".into()), Typed::Float(x))));
|
||||
self.heavy_machine_mass.map(|x| out.push((Typed::Str("heavyMachineMass".into()), Typed::Float(x))));
|
||||
out.append(&mut self.specifics.as_transmissible());
|
||||
for (tier, mov_data) in self.stats.iter() {
|
||||
out.push((Typed::Str(tier.as_str().into()), mov_data.as_transmissible()));
|
||||
}
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // any
|
||||
items: out.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum MovementCategorySpecificData {
|
||||
#[default]
|
||||
Wheel,
|
||||
Hover(HoverCategoryData),
|
||||
Wing,
|
||||
Rudder, // same as wing
|
||||
Thruster,
|
||||
Propeller, // same as thruster
|
||||
InsectLeg,
|
||||
MechLeg(MechLegCategoryData),
|
||||
SprinterLeg(MechLegCategoryData), // same as mech leg
|
||||
TankTrack,
|
||||
Rotor(RotorCategoryData),
|
||||
}
|
||||
|
||||
impl MovementCategorySpecificData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
match self {
|
||||
Self::Wheel => Vec::default(),
|
||||
Self::Hover(x) => x.as_transmissible(),
|
||||
Self::Wing => Vec::default(),
|
||||
Self::Rudder => Vec::default(),
|
||||
Self::Thruster => Vec::default(),
|
||||
Self::Propeller => Vec::default(),
|
||||
Self::InsectLeg => Vec::default(),
|
||||
Self::MechLeg(x) => x.as_transmissible(),
|
||||
Self::SprinterLeg(x) => x.as_transmissible(),
|
||||
Self::TankTrack => Vec::default(),
|
||||
Self::Rotor(x) => x.as_transmissible(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct HoverCategoryData {
|
||||
pub height_tolerance: f32,
|
||||
pub force_y_offset: f32,
|
||||
pub turning_scale: f32,
|
||||
pub small_angle_turning_scale: f32,
|
||||
pub max_vertical_velocity: f32,
|
||||
pub hover_damping: f32,
|
||||
pub angular_damping: f32,
|
||||
pub deceleration_multiplier: f32,
|
||||
}
|
||||
|
||||
impl HoverCategoryData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("heightTolerance".into()), Typed::Float(self.height_tolerance)),
|
||||
(Typed::Str("forceYOffset".into()), Typed::Float(self.force_y_offset)),
|
||||
(Typed::Str("turningScale".into()), Typed::Float(self.turning_scale)),
|
||||
(Typed::Str("smallAngleTurningScale".into()), Typed::Float(self.small_angle_turning_scale)),
|
||||
(Typed::Str("verticalTopSpeed".into()), Typed::Float(self.max_vertical_velocity)),
|
||||
(Typed::Str("hoverDamping".into()), Typed::Float(self.hover_damping)),
|
||||
(Typed::Str("angularDamping".into()), Typed::Float(self.angular_damping)),
|
||||
(Typed::Str("decelerationMultiplier".into()), Typed::Float(self.deceleration_multiplier)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MechLegCategoryData {
|
||||
pub deceleration_multiplier: f32,
|
||||
}
|
||||
|
||||
impl MechLegCategoryData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("decelerationMultiplier".into()), Typed::Float(self.deceleration_multiplier)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RotorCategoryData {
|
||||
pub max_turn_rate: f32,
|
||||
}
|
||||
|
||||
|
||||
impl RotorCategoryData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("maxTurnRate".into()), Typed::Float(self.max_turn_rate)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MovementData {
|
||||
pub speed_boost: Option<f32>,
|
||||
pub max_carry_mass: Option<f32>,
|
||||
pub horizontal_top_speed: Option<f32>,
|
||||
pub vertical_top_speed: Option<f32>,
|
||||
pub specifics: MovementSpecificData,
|
||||
}
|
||||
|
||||
impl MovementData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
let mut out = Vec::new();
|
||||
self.speed_boost.map(|x| out.push((Typed::Str("speedBoost".into()), Typed::Float(x))));
|
||||
self.max_carry_mass.map(|x| out.push((Typed::Str("maxCarryMass".into()), Typed::Float(x))));
|
||||
self.horizontal_top_speed.map(|x| out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))));
|
||||
self.vertical_top_speed.map(|x| out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))));
|
||||
out.append(&mut self.specifics.as_transmissible());
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // any
|
||||
items: out.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub enum MovementSpecificData {
|
||||
Wheel(WheelData),
|
||||
Hover(HoverData),
|
||||
Wing(AerofoilData),
|
||||
Rudder(AerofoilData), // same as wing
|
||||
Thruster(ThrusterData),
|
||||
Propeller(ThrusterData), // same as thruster
|
||||
InsectLeg(InsectLegData),
|
||||
MechLeg(MechLegData),
|
||||
SprinterLeg(MechLegData), // same as mech leg
|
||||
TankTrack(TankTrackData),
|
||||
Rotor(RotorData),
|
||||
}
|
||||
|
||||
impl MovementSpecificData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
match self {
|
||||
Self::Wheel(x) => x.as_transmissible(),
|
||||
Self::Hover(x) => x.as_transmissible(),
|
||||
Self::Wing(x) => x.as_transmissible(),
|
||||
Self::Rudder(x) => x.as_transmissible(),
|
||||
Self::Thruster(x) => x.as_transmissible(),
|
||||
Self::Propeller(x) => x.as_transmissible(),
|
||||
Self::InsectLeg(x) => x.as_transmissible(),
|
||||
Self::MechLeg(x) => x.as_transmissible(),
|
||||
Self::SprinterLeg(x) => x.as_transmissible(),
|
||||
Self::TankTrack(x) => x.as_transmissible(),
|
||||
Self::Rotor(x) => x.as_transmissible(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WheelData {
|
||||
pub steering_speed_light: f32,
|
||||
pub steering_speed_heavy: f32,
|
||||
pub steering_force_multiplier_light: f32,
|
||||
pub steering_force_multiplier_heavy: f32,
|
||||
pub lateral_acceleration_light: f32,
|
||||
pub lateral_acceleration_heavy: f32,
|
||||
pub time_to_max_acceleration_light: f32,
|
||||
pub time_to_max_acceleration_heavy: f32,
|
||||
pub brake_force_light: f32,
|
||||
pub brake_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl WheelData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("steeringSpeedLight".into()), Typed::Float(self.steering_speed_light)),
|
||||
(Typed::Str("steeringSpeedHeavy".into()), Typed::Float(self.steering_speed_heavy)),
|
||||
(Typed::Str("steeringForceMultiplierLight".into()), Typed::Float(self.steering_force_multiplier_light)),
|
||||
(Typed::Str("steeringForceMultiplierHeavy".into()), Typed::Float(self.steering_force_multiplier_heavy)),
|
||||
(Typed::Str("lateralAccelerationLight".into()), Typed::Float(self.lateral_acceleration_light)),
|
||||
(Typed::Str("lateralAccelerationHeavy".into()), Typed::Float(self.lateral_acceleration_heavy)),
|
||||
(Typed::Str("timeToMaxAccelerationLight".into()), Typed::Float(self.time_to_max_acceleration_light)),
|
||||
(Typed::Str("timeToMaxAccelerationHeavy".into()), Typed::Float(self.time_to_max_acceleration_heavy)),
|
||||
(Typed::Str("brakeForceLight".into()), Typed::Float(self.brake_force_light)),
|
||||
(Typed::Str("brakeForceHeavy".into()), Typed::Float(self.brake_force_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct HoverData {
|
||||
pub max_hover_height_light: f32,
|
||||
pub max_hover_height_heaver: f32,
|
||||
pub height_change_speed_light: f32,
|
||||
pub height_change_speed_heavy: f32,
|
||||
pub turn_torque_light: f32,
|
||||
pub turn_torque_heavy: f32,
|
||||
pub acceleration_light: f32,
|
||||
pub acceleration_heavy: f32,
|
||||
pub max_angular_velocity_light: f32,
|
||||
pub max_angular_velocity_heavy: f32,
|
||||
pub lateral_damping_light: f32,
|
||||
pub lateral_damping_heavy: f32,
|
||||
}
|
||||
|
||||
impl HoverData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("maxHoverHeightLight".into()), Typed::Float(self.max_hover_height_light)),
|
||||
(Typed::Str("maxHoverHeightHeavy".into()), Typed::Float(self.max_hover_height_heaver)),
|
||||
(Typed::Str("heightChangeSpeedLight".into()), Typed::Float(self.height_change_speed_light)),
|
||||
(Typed::Str("heightChangeSpeedHeavy".into()), Typed::Float(self.height_change_speed_heavy)),
|
||||
(Typed::Str("turnTorqueLight".into()), Typed::Float(self.turn_torque_light)),
|
||||
(Typed::Str("turnTorqueHeavy".into()), Typed::Float(self.turn_torque_heavy)),
|
||||
(Typed::Str("accelerationLight".into()), Typed::Float(self.acceleration_light)),
|
||||
(Typed::Str("accelerationHeavy".into()), Typed::Float(self.acceleration_heavy)),
|
||||
(Typed::Str("maxAngularVelocityLight".into()), Typed::Float(self.max_angular_velocity_light)),
|
||||
(Typed::Str("maxAngularVelocityHeavy".into()), Typed::Float(self.max_angular_velocity_heavy)),
|
||||
(Typed::Str("lateralDampingLight".into()), Typed::Float(self.lateral_damping_light)),
|
||||
(Typed::Str("lateralDampingHeavy".into()), Typed::Float(self.lateral_damping_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AerofoilData {
|
||||
pub barrel_speed_light: f32,
|
||||
pub barrel_speed_heavy: f32,
|
||||
pub bank_speed_light: f32,
|
||||
pub bank_speed_heavy: f32,
|
||||
pub elevation_speed_light: f32,
|
||||
pub elevation_speed_heavy: f32,
|
||||
pub rudder_speed_light: f32,
|
||||
pub rudder_speed_heavy: f32,
|
||||
pub thrust_light: f32,
|
||||
pub thrust_heavy: f32,
|
||||
pub vtol_velocity_light: f32,
|
||||
pub vtol_velocity_heavy: f32,
|
||||
}
|
||||
|
||||
impl AerofoilData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("barrelSpeedLight".into()), Typed::Float(self.barrel_speed_light)),
|
||||
(Typed::Str("barrelSpeedHeavy".into()), Typed::Float(self.barrel_speed_heavy)),
|
||||
(Typed::Str("bankSpeedLight".into()), Typed::Float(self.bank_speed_light)),
|
||||
(Typed::Str("bankSpeedHeavy".into()), Typed::Float(self.bank_speed_heavy)),
|
||||
(Typed::Str("elevationSpeedLight".into()), Typed::Float(self.elevation_speed_light)),
|
||||
(Typed::Str("elevationSpeedHeavy".into()), Typed::Float(self.elevation_speed_heavy)),
|
||||
(Typed::Str("rudderSpeedLight".into()), Typed::Float(self.rudder_speed_light)),
|
||||
(Typed::Str("rudderSpeedHeavy".into()), Typed::Float(self.rudder_speed_heavy)),
|
||||
(Typed::Str("thrustLight".into()), Typed::Float(self.thrust_light)),
|
||||
(Typed::Str("thrustHeavy".into()), Typed::Float(self.thrust_heavy)),
|
||||
(Typed::Str("vtolVelocityLight".into()), Typed::Float(self.vtol_velocity_light)),
|
||||
(Typed::Str("vtolVelocityHeavy".into()), Typed::Float(self.vtol_velocity_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThrusterData {
|
||||
pub acceleration_delay_light: f32,
|
||||
pub acceleration_delay_heavy: f32,
|
||||
}
|
||||
|
||||
impl ThrusterData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("accelerationDelayLight".into()), Typed::Float(self.acceleration_delay_light)),
|
||||
(Typed::Str("accelerationDelayHeavy".into()), Typed::Float(self.acceleration_delay_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InsectLegData {
|
||||
pub ideal_height_light: f32,
|
||||
pub ideal_height_heavy: f32,
|
||||
pub ideal_crouching_height_light: f32,
|
||||
pub ideal_crouching_height_heavy: f32,
|
||||
pub ideal_height_range_light: f32,
|
||||
pub ideal_height_range_heavy: f32,
|
||||
pub jump_height_light: f32,
|
||||
pub jump_height_heavy: f32,
|
||||
pub max_upwards_force_light: f32,
|
||||
pub max_upwards_force_heavy: f32,
|
||||
pub max_lateral_force_light: f32,
|
||||
pub max_lateral_force_heavy: f32,
|
||||
pub max_turning_force_light: f32,
|
||||
pub max_turning_force_heavy: f32,
|
||||
pub max_damping_force_light: f32,
|
||||
pub max_damping_force_heavy: f32,
|
||||
pub max_stopped_force_light: f32,
|
||||
pub max_stopped_force_heavy: f32,
|
||||
pub max_new_stopped_force_light: f32,
|
||||
pub max_new_stopped_force_heavy: f32,
|
||||
pub upwards_damping_force_light: f32,
|
||||
pub upwards_damping_force_heavy: f32,
|
||||
pub lateral_damp_force_light: f32,
|
||||
pub lateral_damp_force_heavy: f32,
|
||||
pub swagger_force_light: f32,
|
||||
pub swagger_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl InsectLegData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("idealHeightLight".into()), Typed::Float(self.ideal_height_light)),
|
||||
(Typed::Str("idealHeightHeavy".into()), Typed::Float(self.ideal_height_heavy)),
|
||||
(Typed::Str("idealCrouchingHeightLight".into()), Typed::Float(self.ideal_crouching_height_light)),
|
||||
(Typed::Str("idealCrouchingHeightHeavy".into()), Typed::Float(self.ideal_crouching_height_heavy)),
|
||||
(Typed::Str("idealHeightRangeLight".into()), Typed::Float(self.ideal_height_range_light)),
|
||||
(Typed::Str("idealHeightRangeHeavy".into()), Typed::Float(self.ideal_height_range_heavy)),
|
||||
(Typed::Str("jumpHeightLight".into()), Typed::Float(self.jump_height_light)),
|
||||
(Typed::Str("jumpHeightHeavy".into()), Typed::Float(self.jump_height_heavy)),
|
||||
(Typed::Str("maxUpwardsForceLight".into()), Typed::Float(self.max_upwards_force_light)),
|
||||
(Typed::Str("maxUpwardsForceHeavy".into()), Typed::Float(self.max_upwards_force_heavy)),
|
||||
(Typed::Str("maxLateralForceLight".into()), Typed::Float(self.max_lateral_force_light)),
|
||||
(Typed::Str("maxLateralForceHeavy".into()), Typed::Float(self.max_lateral_force_heavy)),
|
||||
(Typed::Str("maxTurningForceLight".into()), Typed::Float(self.max_turning_force_light)),
|
||||
(Typed::Str("maxTurningForceHeavy".into()), Typed::Float(self.max_turning_force_heavy)),
|
||||
(Typed::Str("maxDampingForceLight".into()), Typed::Float(self.max_damping_force_light)),
|
||||
(Typed::Str("maxDampingForceHeavy".into()), Typed::Float(self.max_damping_force_heavy)),
|
||||
(Typed::Str("maxStoppedForceLight".into()), Typed::Float(self.max_stopped_force_light)),
|
||||
(Typed::Str("maxStoppedForceHeavy".into()), Typed::Float(self.max_stopped_force_heavy)),
|
||||
(Typed::Str("maxNewStoppedForceLight".into()), Typed::Float(self.max_new_stopped_force_light)),
|
||||
(Typed::Str("maxNewStoppedForceHeavy".into()), Typed::Float(self.max_new_stopped_force_heavy)),
|
||||
(Typed::Str("upwardsDampingForceLight".into()), Typed::Float(self.upwards_damping_force_light)),
|
||||
(Typed::Str("upwardsDampingForceHeavy".into()), Typed::Float(self.upwards_damping_force_heavy)),
|
||||
(Typed::Str("lateralDampForceLight".into()), Typed::Float(self.lateral_damp_force_light)),
|
||||
(Typed::Str("lateralDampForceHeavy".into()), Typed::Float(self.lateral_damp_force_heavy)),
|
||||
(Typed::Str("swaggerForceLight".into()), Typed::Float(self.swagger_force_light)),
|
||||
(Typed::Str("swaggerForceHeavy".into()), Typed::Float(self.swagger_force_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MechLegData {
|
||||
pub time_grounded_after_jump_light: f32,
|
||||
pub time_grounded_after_jump_heavy: f32,
|
||||
pub jump_height_light: f32,
|
||||
pub jump_height_heavy: f32,
|
||||
pub turn_acceleration_light: f32,
|
||||
pub turn_acceleration_heavy: f32,
|
||||
pub legacy_turn_acceleration_light: f32,
|
||||
pub legacy_turn_acceleration_heavy: f32,
|
||||
pub long_jump_speec_scale_light: f32,
|
||||
pub long_jump_speec_scale_heavy: f32,
|
||||
pub max_lateral_force_light: f32,
|
||||
pub max_lateral_force_heavy: f32,
|
||||
pub max_damping_force_light: f32,
|
||||
pub max_damping_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl MechLegData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("timeGroundedAfterJumpLight".into()), Typed::Float(self.time_grounded_after_jump_light)),
|
||||
(Typed::Str("timeGroundedAfterJumpHeavy".into()), Typed::Float(self.time_grounded_after_jump_heavy)),
|
||||
(Typed::Str("jumpHeightLight".into()), Typed::Float(self.jump_height_light)),
|
||||
(Typed::Str("jumpHeightHeavy".into()), Typed::Float(self.jump_height_heavy)),
|
||||
(Typed::Str("turnAccelerationLight".into()), Typed::Float(self.turn_acceleration_light)),
|
||||
(Typed::Str("turnAccelerationHeavy".into()), Typed::Float(self.turn_acceleration_heavy)),
|
||||
(Typed::Str("legacyTurnAccelerationLight".into()), Typed::Float(self.legacy_turn_acceleration_light)),
|
||||
(Typed::Str("legacyTurnAccelerationHeavy".into()), Typed::Float(self.legacy_turn_acceleration_heavy)),
|
||||
(Typed::Str("longJumpSpeedScaleLight".into()), Typed::Float(self.long_jump_speec_scale_light)),
|
||||
(Typed::Str("longJumpSpeedScaleHeavy".into()), Typed::Float(self.long_jump_speec_scale_heavy)),
|
||||
(Typed::Str("maxLateralForceLight".into()), Typed::Float(self.max_lateral_force_light)),
|
||||
(Typed::Str("maxLateralForceHeavy".into()), Typed::Float(self.max_lateral_force_heavy)),
|
||||
(Typed::Str("maxDampingForceLight".into()), Typed::Float(self.max_damping_force_light)),
|
||||
(Typed::Str("maxDampingForceHeavy".into()), Typed::Float(self.max_damping_force_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TankTrackData {
|
||||
pub max_turn_rate_moving_light: f32,
|
||||
pub max_turn_rate_moving_heavy: f32,
|
||||
pub max_turn_rate_stopped_light: f32,
|
||||
pub max_turn_rate_stopped_heavy: f32,
|
||||
pub turn_acceleration_light: f32,
|
||||
pub turn_acceleration_heavy: f32,
|
||||
pub lateral_acceleration_light: f32,
|
||||
pub lateral_acceleration_heavy: f32,
|
||||
}
|
||||
|
||||
impl TankTrackData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("maxTurnRateMovingLight".into()), Typed::Float(self.max_turn_rate_moving_light)),
|
||||
(Typed::Str("maxTurnRateMovingHeavy".into()), Typed::Float(self.max_turn_rate_moving_heavy)),
|
||||
(Typed::Str("maxTurnRateStoppedLight".into()), Typed::Float(self.max_turn_rate_stopped_light)),
|
||||
(Typed::Str("maxTurnRateStoppedHeavy".into()), Typed::Float(self.max_turn_rate_stopped_heavy)),
|
||||
(Typed::Str("turnAccelerationLight".into()), Typed::Float(self.turn_acceleration_light)),
|
||||
(Typed::Str("turnAccelerationHeavy".into()), Typed::Float(self.turn_acceleration_heavy)),
|
||||
(Typed::Str("lateralAccelerationLight".into()), Typed::Float(self.lateral_acceleration_light)),
|
||||
(Typed::Str("lateralAccelerationHeavy".into()), Typed::Float(self.lateral_acceleration_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RotorData {
|
||||
pub height_acceleration_light: f32,
|
||||
pub height_acceleration_heavy: f32,
|
||||
pub strafe_acceleration_light: f32,
|
||||
pub strafe_acceleration_heavy: f32,
|
||||
pub turn_acceleration_light: f32,
|
||||
pub turn_acceleration_heavy: f32,
|
||||
pub height_max_change_speed_light: f32,
|
||||
pub height_max_change_speed_heavy: f32,
|
||||
pub level_acceleration_light: f32,
|
||||
pub level_acceleration_heavy: f32,
|
||||
}
|
||||
|
||||
|
||||
impl RotorData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("heightAccelerationLight".into()), Typed::Float(self.height_acceleration_light)),
|
||||
(Typed::Str("heightAccelerationHeavy".into()), Typed::Float(self.height_acceleration_heavy)),
|
||||
(Typed::Str("strafeAccelerationLight".into()), Typed::Float(self.strafe_acceleration_light)),
|
||||
(Typed::Str("strafeAccelerationHeavy".into()), Typed::Float(self.strafe_acceleration_heavy)),
|
||||
(Typed::Str("turnAccelerationLight".into()), Typed::Float(self.turn_acceleration_light)),
|
||||
(Typed::Str("turnAccelerationHeavy".into()), Typed::Float(self.turn_acceleration_heavy)),
|
||||
(Typed::Str("heightMaxChangeSpeedLight".into()), Typed::Float(self.height_max_change_speed_light)),
|
||||
(Typed::Str("heightMaxChangeSpeedHeavy".into()), Typed::Float(self.height_max_change_speed_heavy)),
|
||||
(Typed::Str("levelAccelerationLight".into()), Typed::Float(self.level_acceleration_light)),
|
||||
(Typed::Str("levelAccelerationHeavy".into()), Typed::Float(self.level_acceleration_heavy)),
|
||||
]
|
||||
}
|
||||
}
|
||||
76
rc_services_room/src/data/palette.rs
Normal file
76
rc_services_room/src/data/palette.rs
Normal file
@@ -0,0 +1,76 @@
|
||||
#![allow(dead_code)]
|
||||
pub struct ColourValue {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
pub a: u8,
|
||||
}
|
||||
|
||||
impl ColourValue {
|
||||
fn read_no_alpha<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
|
||||
let mut buf = [0u8; 1];
|
||||
reader.read(&mut buf)?;
|
||||
let r = buf[0];
|
||||
reader.read(&mut buf)?;
|
||||
let g = buf[0];
|
||||
reader.read(&mut buf)?;
|
||||
let b = buf[0];
|
||||
Ok(Self {
|
||||
r, g, b, a: u8::MAX,
|
||||
})
|
||||
}
|
||||
|
||||
fn write_no_alpha<W: std::io::Write>(&self, writer: &mut W) -> std::io::Result<usize> {
|
||||
writer.write(&[self.r, self.g, self.b])
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Colour {
|
||||
pub index: u8,
|
||||
pub diffuse: ColourValue,
|
||||
pub specular: ColourValue,
|
||||
pub overlay: ColourValue,
|
||||
pub premium: bool,
|
||||
}
|
||||
|
||||
impl Colour {
|
||||
fn read_with_index<R: std::io::Read>(index: u8, reader: &mut R) -> std::io::Result<Self> {
|
||||
let diffuse = ColourValue::read_no_alpha(reader)?;
|
||||
let specular = ColourValue::read_no_alpha(reader)?;
|
||||
let overlay = ColourValue::read_no_alpha(reader)?;
|
||||
let mut buf = [0u8; 1];
|
||||
reader.read(&mut buf)?;
|
||||
let premium = buf[0] != 0;
|
||||
Ok(Self {
|
||||
index, diffuse, specular, overlay, premium,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn read_many<R: std::io::Read>(reader: &mut R) -> std::io::Result<Vec<Self>> {
|
||||
let mut buf = [0u8; 4];
|
||||
reader.read(&mut buf)?;
|
||||
let count = i32::from_le_bytes(buf);
|
||||
let mut results = Vec::with_capacity(count as _);
|
||||
for i in 0..count {
|
||||
results.push(Self::read_with_index(i as u8, reader)?);
|
||||
}
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
pub fn write<W: std::io::Write>(&self, writer: &mut W) -> std::io::Result<usize> {
|
||||
let mut total = 0;
|
||||
total += self.diffuse.write_no_alpha(writer)?;
|
||||
total += self.specular.write_no_alpha(writer)?;
|
||||
total += self.overlay.write_no_alpha(writer)?;
|
||||
total += writer.write(&[self.premium as u8])?;
|
||||
Ok(total)
|
||||
}
|
||||
|
||||
pub fn write_many<W: std::io::Write>(items: &[Self], writer: &mut W) -> std::io::Result<usize> {
|
||||
let mut total = writer.write(&(items.len() as i32).to_le_bytes())?;
|
||||
for item in items.iter() {
|
||||
total += item.write(writer)?;
|
||||
}
|
||||
Ok(total)
|
||||
}
|
||||
}
|
||||
45
rc_services_room/src/data/premium_config.rs
Normal file
45
rc_services_room/src/data/premium_config.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
|
||||
pub struct PremiumEffects {
|
||||
pub factor: PremiumFactor,
|
||||
pub multiplayer: PremiumMultiplayer,
|
||||
}
|
||||
|
||||
impl PremiumEffects {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 104, // hashtable
|
||||
items: vec![
|
||||
(Typed::Str("PremiumFactor".into()), self.factor.as_transmissible()),
|
||||
(Typed::Str("TieredMultiplayer".into()), self.multiplayer.as_transmissible()),
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PremiumFactor {
|
||||
pub factor: i32, // percent
|
||||
pub party_bonus: i32, // percent
|
||||
}
|
||||
|
||||
impl PremiumFactor {
|
||||
fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("Factor".into()), Typed::Int(self.factor)),
|
||||
(Typed::Str("PartyBonusPercentagePerPlayer".into()), Typed::Int(self.party_bonus)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PremiumMultiplayer {
|
||||
pub tier_multiplier: f64,
|
||||
}
|
||||
|
||||
impl PremiumMultiplayer {
|
||||
fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("BonusPerTierMultiplier".into()), Typed::Double(self.tier_multiplier)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
17
rc_services_room/src/data/special_item.rs
Normal file
17
rc_services_room/src/data/special_item.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use polariton::operation::Typed;
|
||||
|
||||
pub struct SpecialItem {
|
||||
pub name: String,
|
||||
pub sprite: String,
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
impl SpecialItem {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||
(Typed::Str("spriteName".into()), Typed::Str(self.sprite.clone().into())),
|
||||
(Typed::Str("mothershipSize".into()), Typed::Int(self.size as i32)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
86
rc_services_room/src/data/taunts_config.rs
Normal file
86
rc_services_room/src/data/taunts_config.rs
Normal file
@@ -0,0 +1,86 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
|
||||
pub struct TauntsData {
|
||||
pub taunts: Vec<TauntData>,
|
||||
}
|
||||
|
||||
impl TauntsData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
items: self.taunts.iter().map(|t| (Typed::Str(t.group_name.clone().into()), t.as_transmissible())).collect(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TauntData {
|
||||
pub group_name: String, // parent key
|
||||
// Dict<str, obj>
|
||||
pub assets: AssetData,
|
||||
pub animation_offset_x: f32,
|
||||
pub animation_offset_y: f32,
|
||||
pub animation_offset_z: f32,
|
||||
pub cubes: Vec<CubeData>,
|
||||
}
|
||||
|
||||
impl TauntData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
let mut items = vec![
|
||||
(Typed::Str("defaultAnimOffsetx".into()), Typed::Float(self.animation_offset_x)),
|
||||
(Typed::Str("defaultAnimOffsety".into()), Typed::Float(self.animation_offset_y)),
|
||||
(Typed::Str("defaultAnimOffsetz".into()), Typed::Float(self.animation_offset_z)),
|
||||
(Typed::Str("cubes".into()), Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
items: self.cubes.iter().enumerate().map(|(i, cube)| (Typed::Str(i.to_string().into()), cube.as_transmissible())).collect(),
|
||||
})),
|
||||
];
|
||||
items.append(&mut self.assets.as_transmissible());
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
items,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AssetData {
|
||||
pub idle_effect: String,
|
||||
pub active_effect: String,
|
||||
pub sound_effect: String,
|
||||
}
|
||||
|
||||
impl AssetData {
|
||||
pub fn as_transmissible(&self) -> Vec<(Typed, Typed)> {
|
||||
vec![
|
||||
(Typed::Str("idleEffect".into()), Typed::Str(self.idle_effect.clone().into())),
|
||||
(Typed::Str("tauntEffect".into()), Typed::Str(self.active_effect.clone().into())),
|
||||
(Typed::Str("tauntSoundEffect".into()), Typed::Str(self.sound_effect.clone().into())),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CubeData {
|
||||
pub cube_id: u32, // hex
|
||||
pub position_x: i32,
|
||||
pub position_y: i32,
|
||||
pub position_z: i32,
|
||||
pub rotation: u8,
|
||||
}
|
||||
|
||||
impl CubeData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
items: vec![
|
||||
(Typed::Str("cubeid".into()), Typed::Str(hex::encode((self.cube_id as i32).to_le_bytes()).into())),
|
||||
(Typed::Str("positionx".into()), Typed::Int(self.position_x)),
|
||||
(Typed::Str("positiony".into()), Typed::Int(self.position_y)),
|
||||
(Typed::Str("positionz".into()), Typed::Int(self.position_z)),
|
||||
(Typed::Str("rotation".into()), Typed::Byte(self.rotation)),
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
213
rc_services_room/src/data/weapon_list.rs
Normal file
213
rc_services_room/src/data/weapon_list.rs
Normal file
@@ -0,0 +1,213 @@
|
||||
#![allow(dead_code)]
|
||||
use polariton::operation::Typed;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct WeaponData {
|
||||
pub damage_inflicted: Option<i32>,
|
||||
pub protonium_damage_scale: Option<f32>,
|
||||
pub projectile_speed: Option<f32>,
|
||||
pub projectile_range: Option<f32>,
|
||||
pub base_inaccuracy: Option<f32>,
|
||||
pub base_air_inaccuracy: Option<f32>,
|
||||
pub movement_inaccuracy: Option<f32>,
|
||||
pub movement_max_speed: Option<f32>,
|
||||
pub movement_min_speed: Option<f32>,
|
||||
pub gun_rotation_slow: Option<f32>,
|
||||
pub movement_inaccuracy_decay: Option<f32>,
|
||||
pub slow_rotation_decay: Option<f32>,
|
||||
pub quick_rotation_decay: Option<f32>,
|
||||
pub movement_inaccuracy_recovery: Option<f32>,
|
||||
pub repeat_fire_inaccuracy_total_degrees: Option<f32>,
|
||||
pub repeat_fire_inaccuracy_decay: Option<f32>,
|
||||
pub repeat_fire_innaccuracy_recovery: Option<f32>,
|
||||
pub fire_instant_accuracy_decay: Option<f32>, // degrees
|
||||
pub accuracy_non_recover_time: Option<f32>,
|
||||
pub accuracy_decay: Option<f32>,
|
||||
pub damage_radius: Option<f32>,
|
||||
pub plasma_time_to_full_damage: Option<f32>,
|
||||
pub plasma_starting_radius_scale: Option<f32>,
|
||||
pub nano_dps: Option<f32>,
|
||||
pub nano_hps: Option<f32>,
|
||||
pub tesla_damage: Option<f32>,
|
||||
pub tesla_charges: Option<f32>,
|
||||
pub aeroflak_proximity_damage: Option<f32>,
|
||||
pub aeroflak_damage_radius: Option<f32>,
|
||||
pub aeroflak_explosion_radius: Option<f32>,
|
||||
pub aeroflak_ground_clearance: Option<f32>,
|
||||
pub aeroflak_max_stacks: Option<i32>,
|
||||
pub aeroflak_damage_per_stack: Option<i32>,
|
||||
pub aeroflak_stack_expire: Option<f32>,
|
||||
pub shot_cooldown: Option<f32>,
|
||||
pub smart_rotation_cooldown: Option<f32>,
|
||||
pub smart_rotation_cooldown_extra: Option<f32>,
|
||||
pub smart_rotation_max_stacks: Option<f32>,
|
||||
pub spin_up_time: Option<f32>,
|
||||
pub spin_down_time: Option<f32>,
|
||||
pub spin_initial_cooldown: Option<f32>,
|
||||
pub group_fire_scales: Vec<f32>,
|
||||
pub mana_cost: Option<f32>,
|
||||
pub lock_time: Option<f32>,
|
||||
pub full_lock_release: Option<f32>,
|
||||
pub change_lock_time: Option<f32>,
|
||||
pub max_rotation_speed: Option<f32>,
|
||||
pub initial_rotation_speed: Option<f32>,
|
||||
pub rotation_acceleration: Option<f32>,
|
||||
pub nano_healing_priority_time: Option<f32>,
|
||||
pub module_range: Option<f32>,
|
||||
pub shield_lifetime: Option<f32>,
|
||||
pub teleport_time: Option<f32>,
|
||||
pub camera_time: Option<f32>,
|
||||
pub camera_delay: Option<f32>,
|
||||
pub to_invisible_speed: Option<f32>,
|
||||
pub to_invisible_duration: Option<f32>,
|
||||
pub to_visible_duration: Option<f32>,
|
||||
pub countdown_time: Option<f32>,
|
||||
pub stun_time: Option<f32>,
|
||||
pub stun_radius: Option<f32>,
|
||||
pub effect_duration: Option<f32>,
|
||||
}
|
||||
|
||||
impl WeaponData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
let mut out = Vec::new();
|
||||
|
||||
self.damage_inflicted.map(|x| out.push((Typed::Str("damageInflicted".into()), Typed::Int(x))));
|
||||
self.protonium_damage_scale.map(|x| out.push((Typed::Str("protoniumDamageScale".into()), Typed::Float(x))));
|
||||
self.projectile_speed.map(|x| out.push((Typed::Str("projectileSpeed".into()), Typed::Float(x))));
|
||||
self.projectile_range.map(|x| out.push((Typed::Str("projectileRange".into()), Typed::Float(x))));
|
||||
self.base_inaccuracy.map(|x| out.push((Typed::Str("baseInaccuracy".into()), Typed::Float(x))));
|
||||
self.base_air_inaccuracy.map(|x| out.push((Typed::Str("baseAirInaccuracy".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy.map(|x| out.push((Typed::Str("movementInaccuracy".into()), Typed::Float(x))));
|
||||
self.movement_max_speed.map(|x| out.push((Typed::Str("movementMaxThresholdSpeed".into()), Typed::Float(x))));
|
||||
self.movement_min_speed.map(|x| out.push((Typed::Str("movementMinThresholdSpeed".into()), Typed::Float(x))));
|
||||
self.gun_rotation_slow.map(|x| out.push((Typed::Str("gunRotationThresholdSlow".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy_decay.map(|x| out.push((Typed::Str("movementInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.slow_rotation_decay.map(|x| out.push((Typed::Str("slowRotationInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.quick_rotation_decay.map(|x| out.push((Typed::Str("quickRotationInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy_recovery.map(|x| out.push((Typed::Str("movementInaccuracyRecoveryTime".into()), Typed::Float(x))));
|
||||
self.repeat_fire_inaccuracy_total_degrees.map(|x| out.push((Typed::Str("repeatFireInaccuracyTotalDegrees".into()), Typed::Float(x))));
|
||||
self.repeat_fire_inaccuracy_decay.map(|x| out.push((Typed::Str("repeatFireInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.repeat_fire_innaccuracy_recovery.map(|x| out.push((Typed::Str("repeatFireInaccuracyRecoveryTime".into()), Typed::Float(x))));
|
||||
self.fire_instant_accuracy_decay.map(|x| out.push((Typed::Str("fireInstantAccuracyDecayDegrees".into()), Typed::Float(x)))); // degrees
|
||||
self.accuracy_non_recover_time.map(|x| out.push((Typed::Str("accuracyNonRecoverTime".into()), Typed::Float(x))));
|
||||
self.accuracy_decay.map(|x| out.push((Typed::Str("accuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.damage_radius.map(|x| out.push((Typed::Str("damageRadius".into()), Typed::Float(x))));
|
||||
self.plasma_time_to_full_damage.map(|x| out.push((Typed::Str("plasmaTimeToFullDamage".into()), Typed::Float(x))));
|
||||
self.plasma_starting_radius_scale.map(|x| out.push((Typed::Str("plasmaStartingRadiusScale".into()), Typed::Float(x))));
|
||||
self.nano_dps.map(|x| out.push((Typed::Str("nanoDPS".into()), Typed::Float(x))));
|
||||
self.nano_hps.map(|x| out.push((Typed::Str("nanoHPS".into()), Typed::Float(x))));
|
||||
self.tesla_damage.map(|x| out.push((Typed::Str("teslaDamage".into()), Typed::Float(x))));
|
||||
self.tesla_charges.map(|x| out.push((Typed::Str("teslaCharges".into()), Typed::Float(x))));
|
||||
self.aeroflak_proximity_damage.map(|x| out.push((Typed::Str("aeroflakProximityDamage".into()), Typed::Float(x))));
|
||||
self.aeroflak_damage_radius.map(|x| out.push((Typed::Str("aeroflakDamageRadius".into()), Typed::Float(x))));
|
||||
self.aeroflak_explosion_radius.map(|x| out.push((Typed::Str("aeroflakExplosionRadius".into()), Typed::Float(x))));
|
||||
self.aeroflak_ground_clearance.map(|x| out.push((Typed::Str("aeroflakGroundClearance".into()), Typed::Float(x))));
|
||||
self.aeroflak_max_stacks.map(|x| out.push((Typed::Str("aeroflakBuffMaxStacks".into()), Typed::Int(x))));
|
||||
self.aeroflak_damage_per_stack.map(|x| out.push((Typed::Str("aeroflakBuffDamagePerStack".into()), Typed::Int(x))));
|
||||
self.aeroflak_stack_expire.map(|x| out.push((Typed::Str("aeroflakBuffTimeToExpire".into()), Typed::Float(x))));
|
||||
self.shot_cooldown.map(|x| out.push((Typed::Str("cooldownBetweenShots".into()), Typed::Float(x))));
|
||||
self.smart_rotation_cooldown.map(|x| out.push((Typed::Str("smartRotationCooldown".into()), Typed::Float(x))));
|
||||
self.smart_rotation_cooldown_extra.map(|x| out.push((Typed::Str("smartRotationExtraCooldownTime".into()), Typed::Float(x))));
|
||||
self.smart_rotation_max_stacks.map(|x| out.push((Typed::Str("smartRotationMaxStacks".into()), Typed::Float(x))));
|
||||
self.spin_up_time.map(|x| out.push((Typed::Str("spinUpTime".into()), Typed::Float(x))));
|
||||
self.spin_down_time.map(|x| out.push((Typed::Str("spinDownTime".into()), Typed::Float(x))));
|
||||
self.spin_initial_cooldown.map(|x| out.push((Typed::Str("spinInitialCooldown".into()), Typed::Float(x))));
|
||||
|
||||
if !self.group_fire_scales.is_empty() {
|
||||
let typed_arr: Vec<Typed> = self.group_fire_scales.iter().map(|x| Typed::Float(*x)).collect();
|
||||
out.push((Typed::Str("groupFireScales".into()), Typed::ObjArr(typed_arr.into())));
|
||||
}
|
||||
|
||||
self.mana_cost.map(|x| out.push((Typed::Str("manaCost".into()), Typed::Float(x))));
|
||||
self.lock_time.map(|x| out.push((Typed::Str("lockTime".into()), Typed::Float(x))));
|
||||
self.full_lock_release.map(|x| out.push((Typed::Str("fullLockRelease".into()), Typed::Float(x))));
|
||||
self.change_lock_time.map(|x| out.push((Typed::Str("changeLockTime".into()), Typed::Float(x))));
|
||||
self.max_rotation_speed.map(|x| out.push((Typed::Str("maxRotationSpeed".into()), Typed::Float(x))));
|
||||
self.initial_rotation_speed.map(|x| out.push((Typed::Str("initialRotationSpeed".into()), Typed::Float(x))));
|
||||
self.rotation_acceleration.map(|x| out.push((Typed::Str("rotationAcceleration".into()), Typed::Float(x))));
|
||||
self.nano_healing_priority_time.map(|x| out.push((Typed::Str("nanoHealingPriorityTime".into()), Typed::Float(x))));
|
||||
self.module_range.map(|x| out.push((Typed::Str("moduleRange".into()), Typed::Float(x))));
|
||||
self.shield_lifetime.map(|x| out.push((Typed::Str("shieldLifetime".into()), Typed::Float(x))));
|
||||
self.teleport_time.map(|x| out.push((Typed::Str("teleportTime".into()), Typed::Float(x))));
|
||||
self.camera_time.map(|x| out.push((Typed::Str("cameraTime".into()), Typed::Float(x))));
|
||||
self.camera_delay.map(|x| out.push((Typed::Str("cameraDelay".into()), Typed::Float(x))));
|
||||
self.to_invisible_speed.map(|x| out.push((Typed::Str("toInvisibleSpeed".into()), Typed::Float(x))));
|
||||
self.to_invisible_duration.map(|x| out.push((Typed::Str("toInvisibleDuration".into()), Typed::Float(x))));
|
||||
self.to_visible_duration.map(|x| out.push((Typed::Str("toVisibleDuration".into()), Typed::Float(x))));
|
||||
self.countdown_time.map(|x| out.push((Typed::Str("countdownTime".into()), Typed::Float(x))));
|
||||
self.stun_time.map(|x| out.push((Typed::Str("stunTime".into()), Typed::Float(x))));
|
||||
self.stun_radius.map(|x| out.push((Typed::Str("stunRadius".into()), Typed::Float(x))));
|
||||
self.effect_duration.map(|x| out.push((Typed::Str("effectDuration".into()), Typed::Float(x))));
|
||||
Typed::HashMap(out.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ItemCategory {
|
||||
NoFunction,
|
||||
Wheel,
|
||||
Hover,
|
||||
Wing,
|
||||
Rudder,
|
||||
Thruster,
|
||||
InsectLeg,
|
||||
MechLeg,
|
||||
Ski,
|
||||
TankTrack,
|
||||
Rotor,
|
||||
SrpinterLeg,
|
||||
Propeller,
|
||||
Laser = 100,
|
||||
Plasma = 200,
|
||||
Mortar = 250,
|
||||
Rail = 300,
|
||||
Nano = 400,
|
||||
Tesla = 500,
|
||||
Aeroflak = 600,
|
||||
Ion = 650,
|
||||
Seeker = 701,
|
||||
Chaingun = 750,
|
||||
ShieldModule = 800,
|
||||
GhostModule,
|
||||
BlinkModule,
|
||||
EmpModule,
|
||||
WindowmakerModule,
|
||||
EnergyModule = 900,
|
||||
}
|
||||
|
||||
impl ItemCategory {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
ItemCategory::NoFunction => "NotAFunctionalItem",
|
||||
ItemCategory::Wheel => "Wheel",
|
||||
ItemCategory::Hover => "Hover",
|
||||
ItemCategory::Wing => "Wing",
|
||||
ItemCategory::Rudder => "Rudder",
|
||||
ItemCategory::Thruster => "Thruster",
|
||||
ItemCategory::InsectLeg => "InsectLeg",
|
||||
ItemCategory::MechLeg => "MechLeg",
|
||||
ItemCategory::Ski => "Ski",
|
||||
ItemCategory::TankTrack => "TankTrack",
|
||||
ItemCategory::Rotor => "Rotor",
|
||||
ItemCategory::SrpinterLeg => "SrpinterLeg",
|
||||
ItemCategory::Propeller => "Propeller",
|
||||
ItemCategory::Laser => "Laser",
|
||||
ItemCategory::Plasma => "Plasma",
|
||||
ItemCategory::Mortar => "Mortar",
|
||||
ItemCategory::Rail => "Rail",
|
||||
ItemCategory::Nano => "Nano",
|
||||
ItemCategory::Tesla => "Tesla",
|
||||
ItemCategory::Aeroflak => "Aeroflak",
|
||||
ItemCategory::Ion => "Ion",
|
||||
ItemCategory::Seeker => "Seeker",
|
||||
ItemCategory::Chaingun => "Chaingun",
|
||||
ItemCategory::ShieldModule => "ShieldModule",
|
||||
ItemCategory::GhostModule => "GhostModule",
|
||||
ItemCategory::BlinkModule => "BlinkModule",
|
||||
ItemCategory::EmpModule => "EmpModule",
|
||||
ItemCategory::WindowmakerModule => "WindowmakerModule",
|
||||
ItemCategory::EnergyModule => "EnergyModule",
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user