mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Update to work with polariton v0.2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
pub struct DamageBoostData {
|
||||
pub damage_map: Vec<(u32, f32)>, // (cpu, boost)
|
||||
@@ -7,8 +8,8 @@ pub struct DamageBoostData {
|
||||
impl DamageBoostData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // obj
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: self.damage_map.iter()
|
||||
.map(|(cpu, boost)| (Typed::Str(cpu.to_string().into()), Typed::Float(*boost)))
|
||||
.collect(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use polariton::operation::{Typed, Arr};
|
||||
use polariton::{operation::{Arr, Typed}, serdes::TypePrefix};
|
||||
|
||||
use super::weapon_list::ItemCategory;
|
||||
|
||||
@@ -31,7 +31,7 @@ impl GarageSlotInfo {
|
||||
(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
|
||||
ty: TypePrefix::Int, // 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)),
|
||||
@@ -48,7 +48,7 @@ impl GarageSlotInfo {
|
||||
(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
|
||||
ty: TypePrefix::Int, // int
|
||||
items: self.weapon_order.iter().map(|x| Typed::Int(*x)).collect(),
|
||||
})),
|
||||
].into())
|
||||
@@ -73,7 +73,7 @@ pub struct ControlOptions {
|
||||
impl ControlOptions {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Arr(Arr {
|
||||
ty: 111, // bool
|
||||
ty: TypePrefix::Bool, // bool
|
||||
items: vec![
|
||||
Typed::Bool(self.vertical_strafing.into()),
|
||||
Typed::Bool(self.sideways_driving.into()),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
use super::cube_list::ItemTier;
|
||||
|
||||
@@ -32,8 +33,8 @@ impl MovementCategoryData {
|
||||
out.push((Typed::Str(tier.as_str().into()), mov_data.as_transmissible()));
|
||||
}
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // any
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: out.into(),
|
||||
})
|
||||
}
|
||||
@@ -141,8 +142,8 @@ impl MovementData {
|
||||
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
|
||||
key_ty: TypePrefix::Str, // str
|
||||
val_ty: TypePrefix::Any, // any
|
||||
items: out.into(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use polariton::operation::{Typed, Dict, Arr};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
pub struct PlayerRankStaticInfo {
|
||||
pub sub_rank_thresholds: Vec<i32>,
|
||||
@@ -7,12 +8,12 @@ pub struct PlayerRankStaticInfo {
|
||||
impl PlayerRankStaticInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // obj
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("subRankCount".into()), Typed::Int(self.sub_rank_thresholds.len() as i32)),
|
||||
(Typed::Str("subRankThresholds".into()), Typed::Arr(Arr {
|
||||
ty: 105, // int
|
||||
ty: TypePrefix::Int, // int
|
||||
items: self.sub_rank_thresholds.iter().map(|x| Typed::Int(*x)).collect(),
|
||||
})),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
pub struct PlayerRoboPassSeasonInfo {
|
||||
pub delta_xp_to_show: i32,
|
||||
@@ -11,8 +12,8 @@ pub struct PlayerRoboPassSeasonInfo {
|
||||
impl PlayerRoboPassSeasonInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // obj
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("deltaXpToShow".into()), Typed::Int(self.delta_xp_to_show)),
|
||||
(Typed::Str("grade".into()), Typed::Int(self.grade)),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::{operation::{Dict, Typed}, serdes::TypePrefix};
|
||||
|
||||
pub struct PremiumEffects {
|
||||
pub factor: PremiumFactor,
|
||||
@@ -8,8 +8,8 @@ pub struct PremiumEffects {
|
||||
impl PremiumEffects {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 104, // hashtable
|
||||
key_ty: TypePrefix::Str, // str
|
||||
val_ty: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
(Typed::Str("PremiumFactor".into()), self.factor.as_transmissible()),
|
||||
(Typed::Str("TieredMultiplayer".into()), self.multiplayer.as_transmissible()),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::{operation::{Dict, Typed}, serdes::TypePrefix};
|
||||
|
||||
pub struct TauntsData {
|
||||
pub taunts: Vec<TauntData>,
|
||||
@@ -7,8 +7,8 @@ pub struct TauntsData {
|
||||
impl TauntsData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: self.taunts.iter().map(|t| (Typed::Str(t.group_name.clone().into()), t.as_transmissible())).collect(),
|
||||
})
|
||||
}
|
||||
@@ -31,15 +31,15 @@ impl TauntData {
|
||||
(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,
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
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,
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items,
|
||||
})
|
||||
}
|
||||
@@ -72,8 +72,8 @@ pub struct CubeData {
|
||||
impl CubeData {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115,
|
||||
val_ty: 42,
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
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)),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use polariton::operation::{Typed, Arr};
|
||||
use polariton::{operation::{Arr, Typed}, serdes::TypePrefix};
|
||||
|
||||
pub struct TechTreeNode {
|
||||
pub main_cube_id: i32, // hex
|
||||
@@ -20,7 +20,7 @@ impl TechTreeNode {
|
||||
(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
|
||||
ty: TypePrefix::Str, // str
|
||||
items: self.neighbours.iter().map(|cube_id| Typed::Str(hex::encode(cube_id.to_be_bytes()).into())).collect(),
|
||||
})),
|
||||
].into())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use polariton::operation::{Typed, Dict};
|
||||
use polariton::{operation::{Dict, Typed}, serdes::TypePrefix};
|
||||
|
||||
use super::{cube_list::ItemTier, weapon_list::ItemCategory};
|
||||
|
||||
@@ -14,8 +14,8 @@ pub struct WeaponUpgradeInfo {
|
||||
impl WeaponUpgradeInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: 115, // str
|
||||
val_ty: 42, // obj
|
||||
key_ty: TypePrefix::Str, // str
|
||||
val_ty: TypePrefix::Any, // obj
|
||||
items: vec![
|
||||
(Typed::Str("weaponSize".into()), Typed::Int(self.tier as _)),
|
||||
(Typed::Str("weaponType".into()), Typed::Int(self.type_ as _)),
|
||||
|
||||
Reference in New Issue
Block a user