From 2106613f622b34fde535a69dd704f84747cb38bf Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sun, 23 Feb 2025 20:17:46 -0500 Subject: [PATCH] Implement minimal chat service, fix some implement bugs --- rc_chat/src/cli.rs | 4 +- rc_chat/src/main.rs | 2 +- rc_chat_room/src/cli.rs | 2 +- rc_chat_room/src/data/clan_invite.rs | 23 --- rc_chat_room/src/data/friend.rs | 19 --- rc_chat_room/src/data/mod.rs | 2 - rc_chat_room/src/main.rs | 2 +- rc_chat_room/src/operations/chat_ignores.rs | 17 +++ rc_chat_room/src/operations/clan_invite.rs | 26 ---- rc_chat_room/src/operations/friend_list.rs | 29 ---- rc_chat_room/src/operations/mod.rs | 14 +- .../src/operations/pending_sanctions.rs | 12 ++ rc_chat_room/src/operations/platoon_invite.rs | 20 --- rc_chat_room/src/operations/settings.rs | 16 --- rc_services_room/src/data/cube_list.rs | 2 +- rc_services_room/src/data/garage_bay.rs | 27 +++- rc_services_room/src/data/weapon_list.rs | 34 ++--- rc_services_room/src/operations/cube_list.rs | 131 +++++++++++++++++- .../src/operations/custom_games_maps.rs | 20 ++- .../src/operations/dev_message.rs | 6 +- .../src/operations/garage_slots.rs | 13 +- 21 files changed, 227 insertions(+), 194 deletions(-) delete mode 100644 rc_chat_room/src/data/clan_invite.rs delete mode 100644 rc_chat_room/src/data/friend.rs create mode 100644 rc_chat_room/src/operations/chat_ignores.rs delete mode 100644 rc_chat_room/src/operations/clan_invite.rs delete mode 100644 rc_chat_room/src/operations/friend_list.rs create mode 100644 rc_chat_room/src/operations/pending_sanctions.rs delete mode 100644 rc_chat_room/src/operations/platoon_invite.rs delete mode 100644 rc_chat_room/src/operations/settings.rs diff --git a/rc_chat/src/cli.rs b/rc_chat/src/cli.rs index 47cc79d..afdd4df 100644 --- a/rc_chat/src/cli.rs +++ b/rc_chat/src/cli.rs @@ -4,7 +4,7 @@ use clap::Parser; #[command(version, about, long_about = None)] pub struct CliArgs { /// TCP port on which to accept connections - #[arg(short, long, default_value_t = 4534)] + #[arg(short, long, default_value_t = 4536)] pub port: u16, /// IP Address on which to accept connections @@ -16,7 +16,7 @@ pub struct CliArgs { pub retries: usize, /// Domain and port of the game server to send new connections - #[arg(long, default_value_t = {"127.0.0.1:4535".to_string()})] + #[arg(long, default_value_t = {"127.0.0.1:4537".to_string()})] pub redirect: String, /// Name of game server to send new connections diff --git a/rc_chat/src/main.rs b/rc_chat/src/main.rs index 2d221af..b130943 100644 --- a/rc_chat/src/main.rs +++ b/rc_chat/src/main.rs @@ -146,7 +146,7 @@ async fn send_packet(packet: Packet, buf: &mut Vec, socket: &mut net::TcpStr Ok(()) } -const APP_ID: &str = "SocialServer"; +const APP_ID: &str = "ChatServer"; struct AuthImpl; diff --git a/rc_chat_room/src/cli.rs b/rc_chat_room/src/cli.rs index 11819ce..9d9a4c0 100644 --- a/rc_chat_room/src/cli.rs +++ b/rc_chat_room/src/cli.rs @@ -4,7 +4,7 @@ use clap::Parser; #[command(version, about, long_about = None)] pub struct CliArgs { /// TCP port on which to accept connections - #[arg(short, long, default_value_t = 4535)] + #[arg(short, long, default_value_t = 4537)] pub port: u16, /// IP Address on which to accept connections diff --git a/rc_chat_room/src/data/clan_invite.rs b/rc_chat_room/src/data/clan_invite.rs deleted file mode 100644 index abbed9d..0000000 --- a/rc_chat_room/src/data/clan_invite.rs +++ /dev/null @@ -1,23 +0,0 @@ -use polariton::operation::Typed; - -pub struct ClanInviteInfo { - pub username: String, - pub display_name: String, - pub clan_name: String, - pub clan_size: i32, - pub use_custom_avatar: bool, - pub avatar_id: i32, -} - -impl ClanInviteInfo { - pub fn as_transmissible(&self) -> Typed { - Typed::HashMap(vec![ - (Typed::Str("userName".into()), Typed::Str(self.username.clone().into())), - (Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())), - (Typed::Str("clanName".into()), Typed::Str(self.clan_name.clone().into())), - (Typed::Str("clanSize".into()), Typed::Int(self.clan_size)), - (Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar.into())), - (Typed::Str("avatarId".into()), Typed::Int(self.avatar_id)), - ].into()) - } -} diff --git a/rc_chat_room/src/data/friend.rs b/rc_chat_room/src/data/friend.rs deleted file mode 100644 index 724116e..0000000 --- a/rc_chat_room/src/data/friend.rs +++ /dev/null @@ -1,19 +0,0 @@ -use polariton::operation::Typed; - -pub struct AvatarInfo { - pub name: String, - pub use_custom_avatar: bool, - pub avatar_id: i32, -} - -impl AvatarInfo { - pub fn as_transmissible(&self) -> Typed { - Typed::HashMap(vec![ - (Typed::Str("name".into()), Typed::Str(self.name.clone().into())), - (Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar.into())), - (Typed::Str("avatarId".into()), Typed::Int(self.avatar_id)), - ].into()) - } -} - -// TODO pub struct FriendInfo {} diff --git a/rc_chat_room/src/data/mod.rs b/rc_chat_room/src/data/mod.rs index 4de3fde..e69de29 100644 --- a/rc_chat_room/src/data/mod.rs +++ b/rc_chat_room/src/data/mod.rs @@ -1,2 +0,0 @@ -pub mod friend; -pub mod clan_invite; diff --git a/rc_chat_room/src/main.rs b/rc_chat_room/src/main.rs index dcddc27..7bb3b70 100644 --- a/rc_chat_room/src/main.rs +++ b/rc_chat_room/src/main.rs @@ -191,7 +191,7 @@ async fn send_packet(packet: Packet, buf: &mut Vec, socket: &mut net::TcpStr Ok(()) } -const APP_ID: &str = "SocialServer"; +const APP_ID: &str = "ChatServer"; struct AuthImpl; diff --git a/rc_chat_room/src/operations/chat_ignores.rs b/rc_chat_room/src/operations/chat_ignores.rs new file mode 100644 index 0000000..e704114 --- /dev/null +++ b/rc_chat_room/src/operations/chat_ignores.rs @@ -0,0 +1,17 @@ +use polariton_server::operations::SimpleFunc; +use polariton::operation::{ParameterTable, Typed, Arr}; + +const PARAM_KEY: u8 = 15; + +pub(super) fn ignores_provider() -> SimpleFunc<8, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { + SimpleFunc::new(|params, _| { + let mut params = params.to_dict(); + params.insert(PARAM_KEY, Typed::Arr(Arr { + ty: 115, // str + items: vec![ + Typed::Str("Pluto".into()), + ], + })); + Ok(params.into()) + }) +} diff --git a/rc_chat_room/src/operations/clan_invite.rs b/rc_chat_room/src/operations/clan_invite.rs deleted file mode 100644 index f779b9c..0000000 --- a/rc_chat_room/src/operations/clan_invite.rs +++ /dev/null @@ -1,26 +0,0 @@ -use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Arr}; - -use crate::data::clan_invite::*; - -const PARAM_KEY: u8 = 42; - -pub(super) fn clan_invites_provider() -> SimpleFunc<39, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { - SimpleFunc::new(|params, _| { - let mut params = params.to_dict(); - params.insert(PARAM_KEY, Typed::Arr(Arr { - ty: 104, // hashmap - items: vec![ - ClanInviteInfo { - username: "RE_user1".to_owned(), - display_name: "RE_user1".to_owned(), - clan_name: "RE_clan1".to_owned(), - clan_size: 42, - use_custom_avatar: false, - avatar_id: 0, - }.as_transmissible() - ], - })); - Ok(params.into()) - }) -} diff --git a/rc_chat_room/src/operations/friend_list.rs b/rc_chat_room/src/operations/friend_list.rs deleted file mode 100644 index 2669c8a..0000000 --- a/rc_chat_room/src/operations/friend_list.rs +++ /dev/null @@ -1,29 +0,0 @@ -use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Arr}; - -use crate::data::friend::*; - -const FRIENDS_PARAM_KEY: u8 = 5; -const AVATAR_PARAM_KEY: u8 = 76; - -pub(super) fn friends_provider() -> SimpleFunc<4, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { - SimpleFunc::new(|params, _| { - let mut params = params.to_dict(); - params.insert(FRIENDS_PARAM_KEY, Typed::Arr(Arr { - ty: 99, // custom - items: vec![Typed::Custom(vec![ // FIXME don't manually serialize - 0u8, // byte custom type - 0u8, 5u8, // short custom object size - 3u8, 0u8, 0u8, 0u8, 0u8, // content - ].into())] })); - params.insert(AVATAR_PARAM_KEY, Typed::Arr(Arr { - ty: 104, // hashmap - items: vec![AvatarInfo { - name: "".to_string(), - use_custom_avatar: false, - avatar_id: 1, - }.as_transmissible()], - })); - Ok(params.into()) - }) -} diff --git a/rc_chat_room/src/operations/mod.rs b/rc_chat_room/src/operations/mod.rs index 47bd1d3..08557ef 100644 --- a/rc_chat_room/src/operations/mod.rs +++ b/rc_chat_room/src/operations/mod.rs @@ -1,17 +1,13 @@ mod more_auth; -mod friend_list; -mod settings; -mod clan_invite; +mod chat_ignores; +mod pending_sanctions; use polariton_server::operations::OperationsHandler; pub fn handler() -> OperationsHandler { OperationsHandler::new() .without_state(more_auth::MoreLobbyAuth) - .without_state(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan) - .without_state(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788 - .without_state(settings::settings_provider()) // TODO save settings persistently - .without_state(polariton_server::operations::Ack::<43, _>::default()) // get my clan info (this is equivalent to not being in a clan) - .without_state(clan_invite::clan_invites_provider()) - .without_state(polariton_server::operations::Ack::<19, _>::default()) // get pending platoon invite (this is equivalent to having no pending invite) + .without_state(chat_ignores::ignores_provider()) + .without_state(pending_sanctions::pending_sanctions_checker()) + //.without_state(polariton_server::operations::Ack::<00000, _>::default()) } diff --git a/rc_chat_room/src/operations/pending_sanctions.rs b/rc_chat_room/src/operations/pending_sanctions.rs new file mode 100644 index 0000000..c8ee98f --- /dev/null +++ b/rc_chat_room/src/operations/pending_sanctions.rs @@ -0,0 +1,12 @@ +use polariton_server::operations::SimpleFunc; +use polariton::operation::{ParameterTable, Typed}; + +const PARAM_KEY: u8 = 28; + +pub(super) fn pending_sanctions_checker() -> SimpleFunc<15, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { + SimpleFunc::new(|params, _| { + let mut params = params.to_dict(); + params.insert(PARAM_KEY, Typed::Bool(false.into())); + Ok(params.into()) + }) +} diff --git a/rc_chat_room/src/operations/platoon_invite.rs b/rc_chat_room/src/operations/platoon_invite.rs deleted file mode 100644 index 8a6664d..0000000 --- a/rc_chat_room/src/operations/platoon_invite.rs +++ /dev/null @@ -1,20 +0,0 @@ -use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Arr}; - -use crate::data::friend::*; - -const INVITER_NAME_PARAM_KEY: u8 = 19; -const INVITER_DISPLAY_NAME_PARAM_KEY: u8 = 75; -const INVITER_CUSTOM_AVATAR_NAME_PARAM_KEY: u8 = 13; -const INVITER_AVATAR_ID_NAME_PARAM_KEY: u8 = 14; - -pub(super) fn platoon_pending_provider() -> SimpleFunc<19, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { - SimpleFunc::new(|params, _| { - let mut params = params.to_dict(); - params.insert(INVITER_NAME_PARAM_KEY, Typed::Str("RE_platoon_inviter".into()))); - params.insert(INVITER_DISPLAY_NAME_PARAM_KEY, Typed::Str("RE_platoon_inviter_display".into()))); - params.insert(INVITER_CUSTOM_AVATAR_NAME_PARAM_KEY, Typed::Bool(false.into()))); - params.insert(INVITER_AVATAR_ID_NAME_PARAM_KEY, Typed::Int(1))); - Ok(params.into()) - }) -} diff --git a/rc_chat_room/src/operations/settings.rs b/rc_chat_room/src/operations/settings.rs deleted file mode 100644 index 469d81d..0000000 --- a/rc_chat_room/src/operations/settings.rs +++ /dev/null @@ -1,16 +0,0 @@ -use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Dict}; - -const PARAM_KEY: u8 = 30; - -pub(super) fn settings_provider() -> SimpleFunc<24, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { - SimpleFunc::new(|params, _| { - let mut params = params.to_dict(); - params.insert(PARAM_KEY, Typed::Dict(Dict { - key_ty: 115, - val_ty: 42, - items: Vec::default(), - })); - Ok(params.into()) - }) -} diff --git a/rc_services_room/src/data/cube_list.rs b/rc_services_room/src/data/cube_list.rs index 2c12e17..73dfa4b 100644 --- a/rc_services_room/src/data/cube_list.rs +++ b/rc_services_room/src/data/cube_list.rs @@ -9,7 +9,7 @@ pub struct CubeInfo { pub grey_out_in_tutorial: bool, pub visibility: VisibilityMode, pub indestructible: bool, - pub category: u32, + pub category: super::weapon_list::ItemCategory, pub placements: u32, // default 63 pub protonium: bool, pub unlocked_by_league: bool, diff --git a/rc_services_room/src/data/garage_bay.rs b/rc_services_room/src/data/garage_bay.rs index 3a68723..a457c92 100644 --- a/rc_services_room/src/data/garage_bay.rs +++ b/rc_services_room/src/data/garage_bay.rs @@ -48,8 +48,8 @@ pub struct GarageSlotInfo { pub bay_cpu: u32, pub tutorial_robot: bool, // assumed to be false (when omitted) pub starter_robot_index: i32, // assumed to be -1 (whem omitted) - pub control_type: i32, // enum??? - pub control_options: Vec, + pub control_type: ControlType, + pub control_options: ControlOptions, pub mastery_level: i32, pub bay_skin_id: String, pub weapon_order: Vec, @@ -75,10 +75,14 @@ impl GarageSlotInfo { (Typed::Str("bayCpu".into()), Typed::Int(self.bay_cpu as i32)), (Typed::Str("tutorialRobot".into()), Typed::Bool(self.tutorial_robot.into())), (Typed::Str("starterRobotIndex".into()), Typed::Int(self.starter_robot_index)), - (Typed::Str("controlType".into()), Typed::Int(self.control_type)), + (Typed::Str("controlType".into()), Typed::Int(self.control_type as i32)), (Typed::Str("controlOptions".into()), Typed::Arr(Arr { ty: 111, // bool - items: self.control_options.iter().map(|&x| Typed::Bool(x.into())).collect(), + items: vec![ + Typed::Bool(self.control_options.vertical_strafing.into()), + Typed::Bool(self.control_options.sideways_driving.into()), + Typed::Bool(self.control_options.tracks_turn_on_spot.into()), + ], })), (Typed::Str("masteryLevel".into()), Typed::Int(self.mastery_level)), (Typed::Str("baySkinId".into()), Typed::Str(self.bay_skin_id.clone().into())), @@ -90,4 +94,19 @@ impl GarageSlotInfo { } } +#[allow(dead_code)] +#[repr(i32)] +#[derive(Copy, Clone)] +pub enum ControlType { + Camera = 0, + Keyboard = 1, + Count = 2, +} + +pub struct ControlOptions { + pub vertical_strafing: bool, + pub sideways_driving: bool, + pub tracks_turn_on_spot: bool, +} + diff --git a/rc_services_room/src/data/weapon_list.rs b/rc_services_room/src/data/weapon_list.rs index cbe4a90..b166a10 100644 --- a/rc_services_room/src/data/weapon_list.rs +++ b/rc_services_room/src/data/weapon_list.rs @@ -145,19 +145,19 @@ impl WeaponData { #[repr(u32)] #[derive(Clone, Copy)] pub enum ItemCategory { - NoFunction, - Wheel, - Hover, - Wing, - Rudder, - Thruster, - InsectLeg, - MechLeg, - Ski, - TankTrack, - Rotor, - SrpinterLeg, - Propeller, + NoFunction = 0, + Wheel = 1, + Hover = 2, + Wing = 3, + Rudder = 4, + Thruster = 5, + InsectLeg = 6, + MechLeg = 7, + Ski = 8, + TankTrack = 9, + Rotor = 10, + SrpinterLeg = 11, + Propeller = 12, Laser = 100, Plasma = 200, Mortar = 250, @@ -169,10 +169,10 @@ pub enum ItemCategory { Seeker = 701, Chaingun = 750, ShieldModule = 800, - GhostModule, - BlinkModule, - EmpModule, - WindowmakerModule, + GhostModule = 801, + BlinkModule = 802, + EmpModule = 803, + WindowmakerModule = 804, EnergyModule = 900, } diff --git a/rc_services_room/src/operations/cube_list.rs b/rc_services_room/src/operations/cube_list.rs index 8ac4a24..49671f7 100644 --- a/rc_services_room/src/operations/cube_list.rs +++ b/rc_services_room/src/operations/cube_list.rs @@ -6,6 +6,7 @@ use polariton::operation::{ParameterTable, Typed, Dict}; use crate::data::cube_list::*; const PARAM_KEY: u8 = 1; +// const DEFAULT_CUBE_ID: u32 = 227205318; pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { SimpleFunc::new(|params, _| { @@ -22,7 +23,7 @@ pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(Para grey_out_in_tutorial: false, visibility: VisibilityMode::All, indestructible: true, - category: 1, + category: crate::data::weapon_list::ItemCategory::NoFunction, placements: 63, protonium: false, unlocked_by_league: false, @@ -35,7 +36,133 @@ pub(super) fn cube_list_provider() -> SimpleFunc<2, crate::UserTy, impl (Fn(Para cosmetic: false, variant_of: "0".to_string(), ignore_in_weapon_list: true, - }.as_transmissible()) + }.as_transmissible()), + (Typed::Str("0".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T0, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), + (Typed::Str("1".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T1, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), + (Typed::Str("2".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T2, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), + (Typed::Str("3".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T3, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), + (Typed::Str("4".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T4, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), + (Typed::Str("5".into()), CubeInfo { + cpu: 1, + health: 1, + health_boost: 1.0, + grey_out_in_tutorial: false, + visibility: VisibilityMode::All, + indestructible: true, + category: crate::data::weapon_list::ItemCategory::Laser, + 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::T5, + type_: ItemType::Weapon, + ranking: 1, + cosmetic: false, + variant_of: "0".to_string(), + ignore_in_weapon_list: true, + }.as_transmissible()), ].into(), })); Ok(params.into()) diff --git a/rc_services_room/src/operations/custom_games_maps.rs b/rc_services_room/src/operations/custom_games_maps.rs index b2e30cf..8944d82 100644 --- a/rc_services_room/src/operations/custom_games_maps.rs +++ b/rc_services_room/src/operations/custom_games_maps.rs @@ -1,5 +1,5 @@ use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Dict, Arr}; +use polariton::operation::{ParameterTable, Typed, Dict}; use crate::data::custom_games::*; @@ -11,26 +11,22 @@ pub(super) fn allowed_maps_provider() -> SimpleFunc<146, crate::UserTy, impl (Fn let mut params = params.to_dict(); params.insert(MODE_MAP_PARAM_KEY, Typed::Dict(Dict { key_ty: 115, // str - val_ty: 121, // arr + val_ty: 122, // obj arr items: vec![ - (Typed::Str(GameMode::BattleArena.as_str().into()), Typed::Arr(Arr { - ty: 115, // str - items: vec![ + (Typed::Str(GameMode::BattleArena.as_str().into()), Typed::ObjArr(vec![ Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_02_BA".into()), Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_03_BA".into()), Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_02_BA".into()), Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_02_BA".into()), Typed::Str("Assets/Scenes/Planet_Earth/RC_Planet_Earth_01_BA".into()), Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_03_BA".into()), - ] - })), - (Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::Arr(Arr { - ty: 115, // str - items: vec![ + ].into()) + ), + (Typed::Str(GameMode::TeamDeathmatch.as_str().into()), Typed::ObjArr(vec![ Typed::Str("Assets/Scenes/Planet_Neptune/RC_Planet_Neptune_01_CTF".into()), Typed::Str("Assets/Scenes/Planet_Mars/RC_Planet_Mars_01_CTF".into()), - ] - })), + ].into()) + ), ], })); params.insert(MAP_NAMES_PARAM_KEY, Typed::Dict(Dict { diff --git a/rc_services_room/src/operations/dev_message.rs b/rc_services_room/src/operations/dev_message.rs index c87898b..a9b6419 100644 --- a/rc_services_room/src/operations/dev_message.rs +++ b/rc_services_room/src/operations/dev_message.rs @@ -1,12 +1,14 @@ use polariton_server::operations::SimpleFunc; use polariton::operation::{ParameterTable, Typed}; -const PARAM_KEY: u8 = 2; +const MESSAGE_PARAM_KEY: u8 = 2; +const DISPLAY_TIME_PARAM_KEY: u8 = 15; pub(super) fn dev_message_provider() -> SimpleFunc<8, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result) + Sync + Sync> { SimpleFunc::new(|params, _| { let mut params = params.to_dict(); - params.insert(PARAM_KEY, Typed::Bytes(Vec::from("No jam was harmed in the reverse-engineering of this game".as_bytes()).into())); + params.insert(MESSAGE_PARAM_KEY, Typed::Bytes(Vec::from("No jam was harmed in the reverse-engineering of this game".as_bytes()).into())); + params.insert(DISPLAY_TIME_PARAM_KEY, Typed::Int(60 /* seconds??? */)); Ok(params.into()) }) } diff --git a/rc_services_room/src/operations/garage_slots.rs b/rc_services_room/src/operations/garage_slots.rs index 9309a8c..f9d5ff3 100644 --- a/rc_services_room/src/operations/garage_slots.rs +++ b/rc_services_room/src/operations/garage_slots.rs @@ -1,5 +1,5 @@ use polariton_server::operations::SimpleFunc; -use polariton::operation::{ParameterTable, Typed, Dict, Arr}; +use polariton::operation::{ParameterTable, Typed, Dict}; use crate::data::garage_bay::*; @@ -28,8 +28,8 @@ pub(super) fn garage_slot_provider() -> SimpleFunc<40, crate::UserTy, impl (Fn(P bay_cpu: 2_000, tutorial_robot: false, starter_robot_index: -1, - control_type: 0, - control_options: vec![false, false], + control_type: ControlType::Camera, + control_options: ControlOptions { vertical_strafing: false, sideways_driving: false, tracks_turn_on_spot: false, }, mastery_level: 1, bay_skin_id: "".to_owned(), // TODO weapon_order: vec![0], @@ -37,10 +37,9 @@ pub(super) fn garage_slot_provider() -> SimpleFunc<40, crate::UserTy, impl (Fn(P ], })); params.insert(SELECTED_SLOT_PARAM_KEY, Typed::Int(0)); - params.insert(SLOT_ORDER_PARAM_KEY, Typed::Arr(Arr { - ty: 105, // int - items: vec![Typed::Int(0)], - })); + params.insert(SLOT_ORDER_PARAM_KEY, Typed::ObjArr(vec![ + Typed::Int(0), + ].into())); Ok(params.into()) }) }