mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Configure all death, spawn, and garage bay skins for #3
This commit is contained in:
@@ -12,150 +12,200 @@ const OWNED_SPAWNS_KEY: u8 = 232;
|
||||
const OWNED_DEATHS_KEY: u8 = 233;
|
||||
const OWNED_EMOTES_KEY: u8 = 76;
|
||||
|
||||
fn all_skins() -> Vec<CustomisationData> {
|
||||
vec![
|
||||
/*CustomisationData { // level ???
|
||||
id: "RC_MothershipSkin_Premium_01".to_string(),
|
||||
localised_name: "strMothershipSkinPremium".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "TODO_preview_img".to_string(),
|
||||
is_default: false,
|
||||
},*/
|
||||
CustomisationData { // level13
|
||||
id: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
localised_name: "strMothershipSkinNeptune01".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "MothershipSkin_Neptune_BG".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData { // level 11
|
||||
id: "RC_MothershipSkin_Earth_01".to_string(),
|
||||
localised_name: "strMothershipSkinEarth01".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Earth_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "MothershipSkin_Earth_BG".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData { // level12
|
||||
id: "RC_MothershipSkin_Mars_01".to_string(),
|
||||
localised_name: "strMothershipSkinMars01".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Mars_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "MothershipSkin_Mars_BG".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData { // level14
|
||||
id: "RC_MothershipSkin_Retro_01".to_string(),
|
||||
localised_name: "strMothershipSkinRetro01".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Retro_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "MothershipSkin_Retro_BG".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData { // level2 (the is_default one seems to be special)
|
||||
id: "RC_Mothership".to_string(),
|
||||
localised_name: "strMothershipSkinDefault".to_string(),
|
||||
skin_scene_name: "RC_Mothership".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "Mothership_Premium_BG".to_string(), // FIXME
|
||||
is_default: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn all_spawns() -> Vec<CustomisationData> {
|
||||
vec![
|
||||
CustomisationData {
|
||||
id: "Spawn".to_string(),
|
||||
localised_name: "strSpawnEffectDefault".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn".to_string(),
|
||||
preview_image_name: "a".to_string(),
|
||||
is_default: true,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_BlackHole".to_string(),
|
||||
localised_name: "strSpawnFXBlackHole".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_BlackHole".to_string(),
|
||||
preview_image_name: "Mothership_Premium_BG".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_Lander".to_string(),
|
||||
localised_name: "strSpawnFXRoyaleLander".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Lander".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_Lootcrate".to_string(),
|
||||
localised_name: "strSpawnFXLootCrate".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Lootcrate".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_Warp".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Warp".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_Present".to_string(),
|
||||
localised_name: "strSpawnFXPresent".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Present".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Spawn_EasterEgg".to_string(),
|
||||
localised_name: "strSpawnFXHatch".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_EasterEgg".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn all_deaths() -> Vec<CustomisationData> {
|
||||
vec![
|
||||
CustomisationData {
|
||||
id: "Explosion".to_string(),
|
||||
localised_name: "strDeathEffectDefault".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion".to_string(),
|
||||
preview_image_name: "a".to_string(),
|
||||
is_default: true,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_Toon".to_string(),
|
||||
localised_name: "strDeathFXCartoonExplosion".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Toon".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_Feathers_Rainbow".to_string(),
|
||||
localised_name: "strDeathFXFeatherExplosion".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Feathers_Rainbow".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_Nuclear".to_string(),
|
||||
localised_name: "strDeathFXNuclearExplosion".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Nuclear".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_Warp".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Warp".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_BlackHole".to_string(),
|
||||
localised_name: "strDeathFXBlackHole".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_BlackHole".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
CustomisationData {
|
||||
id: "Explosion_Firework".to_string(),
|
||||
localised_name: "strDeathFXFireworkExplosion".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Firework".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: false,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
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: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
CustomisationData {
|
||||
id: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
localised_name: "strNeptune".to_string(),
|
||||
skin_scene_name: "RC_MothershipSkin_Neptune_01".to_string(),
|
||||
simulation_prefab: "TODO_sim_prefab".to_string(),
|
||||
preview_image_name: "TODO_preview_img".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
items: all_skins().into_iter().map(|x| x.as_transmissible()).collect(),
|
||||
}));
|
||||
params.insert(SPAWNS_KEY, Typed::Arr(Arr {
|
||||
ty: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
// TODO set these up with the correct values (IDs are correct)
|
||||
CustomisationData {
|
||||
id: "Spawn".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_BlackHole".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_BlackHole".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Lander".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Lander".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Lootcrate".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Lootcrate".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Warp".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Warp".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_Present".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_Present".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Spawn_EasterEgg".to_string(),
|
||||
localised_name: "strSpawnFXWarpIn".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Spawn_EasterEgg".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
items: all_spawns().into_iter().map(|x| x.as_transmissible()).collect(),
|
||||
}));
|
||||
params.insert(DEATHS_KEY, Typed::Arr(Arr {
|
||||
ty: TypePrefix::HashMap, // hashtable
|
||||
items: vec![
|
||||
// TODO set these up with the correct values (IDs are correct)
|
||||
CustomisationData {
|
||||
id: "Explosion".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Toon".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Toon".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Feathers_Rainbow".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Feathers_Rainbow".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Nuclear".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Nuclear".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Warp".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Warp".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_BlackHole".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_BlackHole".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
CustomisationData {
|
||||
id: "Explosion_Firework".to_string(),
|
||||
localised_name: "strDeathFXEmergencyWarp".to_string(),
|
||||
skin_scene_name: "Splash_Loading_Screen".to_string(),
|
||||
simulation_prefab: "Explosion_Firework".to_string(),
|
||||
preview_image_name: "RC_Splash_Screen_01_Japanese".to_string(),
|
||||
is_default: true,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
items: all_deaths().into_iter().map(|x| x.as_transmissible()).collect(),
|
||||
}));
|
||||
|
||||
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_SKINS_KEY, Typed::StrArr(all_skins().into_iter().map(|x| x.id.into()).collect::<Vec<_>>().into()));
|
||||
params.insert(OWNED_SPAWNS_KEY, Typed::StrArr(all_spawns().into_iter().map(|x| x.id.into()).collect::<Vec<_>>().into()));
|
||||
params.insert(OWNED_DEATHS_KEY, Typed::StrArr(all_deaths().into_iter().map(|x| x.id.into()).collect::<Vec<_>>().into()));
|
||||
params.insert(OWNED_EMOTES_KEY, Typed::StrArr(vec![].into()));
|
||||
Ok(params.into())
|
||||
})
|
||||
|
||||
58
rc_services_room/src/operations/garage_slot_controls.rs
Normal file
58
rc_services_room/src/operations/garage_slot_controls.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
use polariton::operation::{ParameterTable, Typed, OperationResponse};
|
||||
|
||||
const CODE: u8 = 115;
|
||||
|
||||
const INDEX_PARAM_KEY: u8 = 45; // int; in
|
||||
const CONTROL_TY_PARAM_KEY: u8 = 59; // int (enum); in
|
||||
const CONTROL_OPTIONS_PARAM_KEY: u8 = 60; // arr of bool (3); in
|
||||
|
||||
pub(super) fn garage_slot_controls_provider() -> GarageSlotControlsSaveProvider {
|
||||
GarageSlotControlsSaveProvider
|
||||
}
|
||||
|
||||
async fn do_handling(params: ParameterTable<()>, user: &crate::UserTy) -> Result<ParameterTable, i16> {
|
||||
let mut params = params.to_dict();
|
||||
if let Some(Typed::Int(index)) = params.remove(&INDEX_PARAM_KEY) {
|
||||
if let Some(Typed::Int(control_ty)) = params.remove(&CONTROL_TY_PARAM_KEY) {
|
||||
if let Some(Typed::Arr(control_options)) = params.remove(&CONTROL_OPTIONS_PARAM_KEY) {
|
||||
let mut controls = rc_core::persist::user::ControlData {
|
||||
slot: index,
|
||||
control_ty: rc_core::persist::user::ControlType::from_i32(control_ty)?,
|
||||
vertical_strafing: false,
|
||||
sideways_driving: false,
|
||||
tracks_turn_on_spot: false,
|
||||
};
|
||||
for (i, val) in control_options.items.iter().enumerate() {
|
||||
if let Typed::Bool(val) = val {
|
||||
match i {
|
||||
0 => controls.vertical_strafing = *val,
|
||||
1 => controls.sideways_driving = *val,
|
||||
2 => controls.tracks_turn_on_spot = *val,
|
||||
_ => log::warn!("Got too many options for setting garage slot controls"),
|
||||
}
|
||||
}
|
||||
}
|
||||
let user_info = user.user()?;
|
||||
user_info.save_slot_controls(controls).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(params.into())
|
||||
}
|
||||
|
||||
pub struct GarageSlotControlsSaveProvider;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl polariton_server::operations::Operation<()> for GarageSlotControlsSaveProvider {
|
||||
type User = crate::UserTy;
|
||||
|
||||
async fn handle_async(&self, params: ParameterTable<()>, user: &Self::User) -> OperationResponse<()> {
|
||||
polariton_server::operations::result_to_op_resp::<CODE, ()>(do_handling(params, user).await)
|
||||
}
|
||||
}
|
||||
|
||||
impl polariton_server::operations::OperationCode for GarageSlotControlsSaveProvider {
|
||||
fn op_code() -> u8 {
|
||||
CODE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
use polariton::operation::{ParameterTable, Typed, OperationResponse};
|
||||
|
||||
const CODE: u8 = 217;
|
||||
|
||||
const UUID_PARAM_KEY: u8 = 54; // str; in
|
||||
const BAY_SKIN_PARAM_KEY: u8 = 234; // str; in
|
||||
const SPAWN_SKIN_PARAM_KEY: u8 = 235; // str; in
|
||||
const DEATH_SKIN_PARAM_KEY: u8 = 236; // str; in
|
||||
|
||||
pub(super) fn garage_slot_customisation_provider() -> GarageSlotCustomisationSaveProvider {
|
||||
GarageSlotCustomisationSaveProvider
|
||||
}
|
||||
|
||||
async fn do_handling(params: ParameterTable<()>, user: &crate::UserTy) -> Result<ParameterTable, i16> {
|
||||
let mut params = params.to_dict();
|
||||
if let Some(Typed::Str(uuid)) = params.remove(&UUID_PARAM_KEY) {
|
||||
if let Some(Typed::Str(bay_skin)) = params.remove(&BAY_SKIN_PARAM_KEY) {
|
||||
if let Some(Typed::Str(spawn)) = params.remove(&SPAWN_SKIN_PARAM_KEY) {
|
||||
if let Some(Typed::Str(death)) = params.remove(&DEATH_SKIN_PARAM_KEY) {
|
||||
let user_info = user.user()?;
|
||||
user_info.save_slot_customisations(rc_core::persist::user::CustomisationData {
|
||||
uuid: uuid.string,
|
||||
bay: bay_skin.string,
|
||||
spawn: spawn.string,
|
||||
death: death.string,
|
||||
}).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(params.into())
|
||||
}
|
||||
|
||||
pub struct GarageSlotCustomisationSaveProvider;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl polariton_server::operations::Operation<()> for GarageSlotCustomisationSaveProvider {
|
||||
type User = crate::UserTy;
|
||||
|
||||
async fn handle_async(&self, params: ParameterTable<()>, user: &Self::User) -> OperationResponse<()> {
|
||||
polariton_server::operations::result_to_op_resp::<CODE, ()>(do_handling(params, user).await)
|
||||
}
|
||||
}
|
||||
|
||||
impl polariton_server::operations::OperationCode for GarageSlotCustomisationSaveProvider {
|
||||
fn op_code() -> u8 {
|
||||
CODE
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,8 @@ mod crf_purchase;
|
||||
mod crf_upload;
|
||||
mod avatar_set_custom;
|
||||
mod avatar_set;
|
||||
mod garage_slot_controls;
|
||||
mod garage_slot_set_customisations;
|
||||
|
||||
use polariton_server::operations::OperationsHandler;
|
||||
|
||||
@@ -208,4 +210,6 @@ pub fn handler(init_ctx: &crate::InitConfig) -> OperationsHandler<crate::UserTy>
|
||||
.add(crf_upload::crf_upload_provider(&init_ctx.factory))
|
||||
.add(avatar_set_custom::custom_avatar_upload_handler())
|
||||
.add(avatar_set::avatar_set_provider())
|
||||
.add(garage_slot_controls::garage_slot_controls_provider())
|
||||
.add(garage_slot_set_customisations::garage_slot_customisation_provider())
|
||||
}
|
||||
|
||||
@@ -1,17 +1,42 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed};
|
||||
use polariton::operation::{ParameterTable, Typed, OperationResponse};
|
||||
|
||||
//const BAY_ID_KEY: u8 = 54; // in
|
||||
const CODE: u8 = 218;
|
||||
|
||||
const UUID_KEY: u8 = 54; // str; in
|
||||
const BAY_SKIN_KEY: u8 = 234;
|
||||
const SPAWN_EFFECT_KEY: u8 = 235;
|
||||
const DEATH_EFFECT_KEY: u8 = 236;
|
||||
|
||||
pub(super) fn bay_customisations_provider() -> SimpleFunc<218, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(BAY_SKIN_KEY, Typed::Str("RC_MothershipSkin_Neptune_01".into()));
|
||||
params.insert(SPAWN_EFFECT_KEY, Typed::Str("Spawn_Warp".into()));
|
||||
params.insert(DEATH_EFFECT_KEY, Typed::Str("Explosion_Warp".into()));
|
||||
Ok(params.into())
|
||||
})
|
||||
pub(super) fn bay_customisations_provider() -> GarageSlotCustomisationProvider {
|
||||
GarageSlotCustomisationProvider
|
||||
}
|
||||
|
||||
async fn do_handling(params: ParameterTable<()>, user: &crate::UserTy) -> Result<ParameterTable, i16> {
|
||||
let mut params = params.to_dict();
|
||||
if let Some(Typed::Str(uuid)) = params.remove(&UUID_KEY) {
|
||||
let user_info = user.user()?;
|
||||
let customs = user_info.get_slot_customisations(&uuid.string).await?;
|
||||
params.insert(BAY_SKIN_KEY, customs.bay);
|
||||
params.insert(SPAWN_EFFECT_KEY, customs.spawn);
|
||||
params.insert(DEATH_EFFECT_KEY, customs.death);
|
||||
}
|
||||
|
||||
Ok(params.into())
|
||||
}
|
||||
|
||||
pub(super) struct GarageSlotCustomisationProvider;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl polariton_server::operations::Operation<()> for GarageSlotCustomisationProvider {
|
||||
type User = crate::UserTy;
|
||||
|
||||
async fn handle_async(&self, params: ParameterTable<()>, user: &Self::User) -> OperationResponse<()> {
|
||||
polariton_server::operations::result_to_op_resp::<CODE, ()>(do_handling(params, user).await)
|
||||
}
|
||||
}
|
||||
|
||||
impl polariton_server::operations::OperationCode for GarageSlotCustomisationProvider {
|
||||
fn op_code() -> u8 {
|
||||
CODE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user