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

Remove external state for op handlers

This commit is contained in:
NGnius (Graham)
2025-04-06 11:00:37 -04:00
parent b99bbe67e4
commit 4d2ddaeafb
19 changed files with 150 additions and 163 deletions

1
Cargo.lock generated
View File

@@ -1607,6 +1607,7 @@ dependencies = [
name = "polariton_server"
version = "0.2.0"
dependencies = [
"async-trait",
"log",
"polariton",
"tokio",

View File

@@ -7,10 +7,10 @@ use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy> {
OperationsHandler::new()
.without_state(more_auth::MoreLobbyAuth)
.without_state(chat_ignores::ignores_provider())
.without_state(pending_sanctions::pending_sanctions_checker())
.without_state(all_joined_channels::all_channels_provider())
.without_state(polariton_server::operations::Ack::<12, _>::default())
//.without_state(polariton_server::operations::Ack::<00000, _>::default())
.add(more_auth::MoreLobbyAuth)
.add(chat_ignores::ignores_provider())
.add(pending_sanctions::pending_sanctions_checker())
.add(all_joined_channels::all_channels_provider())
.add(polariton_server::operations::Ack::<12, _>::default())
//.add(polariton_server::operations::Ack::<00000, _>::default())
}

View File

@@ -7,11 +7,10 @@ impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl <C> Operation<C> for MoreLobbyAuth {
type State = ();
impl <C: Send + 'static> Operation<C> for MoreLobbyAuth {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, user: &Self::User) -> polariton::operation::OperationResponse<C> {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
if user.update_with_auth(&auth_payload.string) {

View File

@@ -8,11 +8,10 @@ pub struct CubeInventoryProvider {
cube_ids: Vec<u32>,
}
impl <C> Operation<C> for CubeInventoryProvider {
type State = ();
impl <C: Send + 'static> Operation<C> for CubeInventoryProvider {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut params = params.to_dict();
params.insert(PARAM_KEY, Typed::Dict(Dict {
key_ty: TypePrefix::Int, // int

View File

@@ -9,11 +9,10 @@ pub struct DevMessageProvider<C: Clone> {
messages: rc_core::persist::config::DevMessageProvider<C>,
}
impl <C: Clone + Send + Sync> Operation<C> for DevMessageProvider<C> {
type State = ();
impl <C: Clone + Send + Sync + 'static> Operation<C> for DevMessageProvider<C> {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut params = params.to_dict();
let index = rand::rng().random::<u32>();
let dev_msg = self.messages.get(index as _);
@@ -30,7 +29,7 @@ impl <C: Clone + Send + Sync> Operation<C> for DevMessageProvider<C> {
impl <C: Clone> OperationCode for DevMessageProvider<C> {
fn op_code() -> u8 {
16
8
}
}

View File

@@ -2,11 +2,10 @@ use polariton_server::operations::{Operation, OperationCode};
pub struct EacChallengeIgnorer;
impl <C> Operation<C> for EacChallengeIgnorer {
type State = ();
impl <C: Send + 'static> Operation<C> for EacChallengeIgnorer {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
polariton::operation::OperationResponse {
code: 161, // skip the challenge (hopefully)
return_code: 0,

View File

@@ -5,11 +5,10 @@ use polariton_server::operations::{Operation, OperationCode};
pub struct QualityConfigTeller;
impl <C> Operation<C> for QualityConfigTeller {
type State = ();
impl <C: Send + 'static> Operation<C> for QualityConfigTeller {
type User = crate::UserTy;
fn handle(&self, _: ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> OperationResponse<C> {
fn handle(&self, _: ParameterTable<C>, _: &Self::User) -> OperationResponse<C> {
let quality_levels = Typed::HashMap(vec![
(Typed::Str("extremLow".into()), Typed::Dict(Dict {
key_ty: TypePrefix::Str,

View File

@@ -7,11 +7,10 @@ impl NoAnalytics {
const ANALYTICS_DICT_KEY: u8 = 83;
}
impl <C> Operation<C> for NoAnalytics {
type State = ();
impl <C: Send + 'static> Operation<C> for NoAnalytics {
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::ANALYTICS_DICT_KEY, polariton::operation::Typed::Dict(Dict {
key_ty: TypePrefix::Str, // str

View File

@@ -14,11 +14,10 @@ impl UserFlagsTeller {
const AB_GROUP_KEY: u8 = 167;
}
impl <C> Operation<C> for UserFlagsTeller {
type State = ();
impl <C: Send + 'static> Operation<C> for UserFlagsTeller {
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::REMOVE_OBSOLETE_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::REMOVE_UNOWNED_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));

View File

@@ -4,11 +4,10 @@ use polariton_server::operations::{Operation, OperationCode};
pub struct MaintenanceModeTeller;
impl <C> Operation<C> for MaintenanceModeTeller {
type State = ();
impl <C: Send + 'static> Operation<C> for MaintenanceModeTeller {
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut resp_params = HashMap::new();
resp_params.insert(20 /* is in maintenance mode? */, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(19 /* maintenace mode message */, polariton::operation::Typed::Str("OpenJam's servers are currently undergoing maintenance".into()));

View File

@@ -85,100 +85,100 @@ use polariton_server::operations::OperationsHandler;
pub fn handler(init_ctx: &crate::InitConfig) -> OperationsHandler<crate::UserTy> {
OperationsHandler::new()
.without_state(eac::EacChallengeIgnorer)
.without_state(more_auth::MoreLobbyAuth)
.without_state(versioner::VersionTeller)
.without_state(maintenancer::MaintenanceModeTeller)
.without_state(game_quality::QualityConfigTeller)
.without_state(login_flags::UserFlagsTeller)
.without_state(polariton_server::operations::Ack::<132, _>::default()) // verify user level
.without_state(load_analytics::NoAnalytics)
.without_state(polariton_server::operations::Ack::<131, _>::default()) // analytics updated notification
.without_state(platform_config::platform_config_provider())
.without_state(tier_banding::tiers_banding_provider())
.without_state(cube_list::cube_list_provider(&init_ctx.cubes))
.without_state(special_items::special_item_list_provider())
.without_state(premium_config::premium_config_provider())
.without_state(palette_town::kanto())
.without_state(client_config::client_config_provider(&init_ctx.cubes))
.without_state(crf_config::crf_config_provider())
.without_state(weapon_stats::weapon_config_provider(&init_ctx.cubes))
.without_state(movement_stats::movement_config_provider(&init_ctx.cubes))
.without_state(power_bar_stats::power_bar_provider())
.without_state(damage_boost_stats::damage_boost_provider())
.without_state(battle_arena_config::battle_arena_config_provider())
.without_state(cpu_limits_config::cpu_config_provider())
.without_state(cosmetic_config::cosmetic_limits_config_provider())
.without_state(taunts_config::taunts_config_provider())
.without_state(all_customisations_info::all_customisations_provider())
.without_state(tech_points::tech_points_provider())
.without_state(cube_inventory::cube_inv_provider(&init_ctx.cubes))
.without_state(player_level::player_level_info_provider())
.without_state(balance_info::balance_wallet_provider())
.without_state(premium_duration::premium_remaining_provider())
.without_state(tutorial_status::tutorial_info_provider())
.without_state(user_perms::user_rights_provider())
.without_state(garage_slots::garage_slot_provider())
.without_state(robopass_season::robopass_season_provider())
.without_state(owned_cosmetics::owned_cosmetics_provider())
.without_state(owned_cosmetics::selected_cosmetics_provider())
.without_state(dev_message::dev_message_provider(&init_ctx.cubes))
.without_state(custom_games_maps::allowed_maps_provider())
.without_state(avatar_info::get_avatar_provider())
.without_state(custom_game_session::get_custom_session_provider())
.without_state(user_xp::get_user_xp_provider())
.without_state(garage_upgrades::garage_upgrades_provider())
.without_state(game_event_params::event_system_params_provider())
.without_state(garage_bay_uuid::garage_id_provider())
.without_state(tech_tree_data::tech_tree_layout_provider(&init_ctx.cubes))
.without_state(item_shop_bundles::item_bundle_provider())
.without_state(robot_customisations::bay_customisations_provider())
.without_state(player_data::player_data_provider())
.without_state(player_robopass::player_robopass_season_provider())
.without_state(weapon_upgrades::weapons_upgrade_provider(&init_ctx.cubes))
.without_state(polariton_server::operations::Ack::<172, _>::default()) // custom game change robot tier (param 67 is tier)
.without_state(player_rank::rank_provider())
.without_state(player_rank::rank_static_provider())
.without_state(ab_test_group::test_group_provider())
.without_state(league_limits::league_battle_parameters_provider())
.without_state(crf_limits::robot_shop_submission_infos_provider())
.without_state(robot_mastery_settings::robot_mastery_settings_provider())
.without_state(player_started_purchase::started_purchase_provider())
.without_state(custom_games_team::team_setup_provider())
.without_state(polariton_server::operations::Ack::<152, _>::default()) // custom game player state changed (188 is desired state)
.without_state(custom_games_invite::pending_invite_provider())
.without_state(chat_settings::chat_settings_provider())
.without_state(prebuilt_robots::garage_robot_data_provider())
.without_state(prebuilt_colours::garage_colour_combo_provider())
.without_state(robopass_preview_items::robopass_preview_provider())
.without_state(singleplayer_campaigns::singleplayer_campaigns_provider(&init_ctx.cubes))
.without_state(purchases::pending_purchases_provider())
.without_state(building_xp_config::building_xp_config_provider())
.without_state(weapon_rating_static::weapon_rating_provider())
.without_state(weapon_xp_static::weapon_xp_provider())
.without_state(machine::garage_machine_provider())
.without_state(machine_colour::garage_machine_colour_provider())
.without_state(last_completed_campaign::completed_campaign_provider())
.without_state(daily_quests::player_daily_quests_provider())
.without_state(tech_points::tech_points_awards_provider())
.without_state(cube_awards::cube_awards_provider())
.without_state(robot_sanction::robot_sanction_provider())
.without_state(building_xp::building_xp_save_provider())
.without_state(robot_sanction::all_robot_sanctions_provider())
.without_state(reconnect_game::available_reconnect_provider())
.without_state(machine::garage_machine_save_provider())
.without_state(polariton_server::operations::Ack::<32, _>::default()) // TODO handle SaveMachineColorRequest instead of ignoring it
.without_state(polariton_server::operations::Ack::<45, _>::default()) // TODO handle UpdateThumbnailVersionRequest instead of ignoring it
.without_state(weapon_order::weapon_order_provider(&init_ctx.cubes))
.without_state(regen_config::auto_regen_config_provider(&init_ctx.cubes))
.without_state(pageantry::after_battle_vote_thresholds_provider(&init_ctx.cubes))
.without_state(signup_time::user_signup_date_provider())
.without_state(validate_machine::validate_robot_provider())
.without_state(game_mode_config::game_mode_config_provider(&init_ctx.cubes))
.without_state(score_multipliers_config::tdm_ai_score_config_provider())
.without_state(player_robot_rank::player_robot_rank_provider())
.without_state(validate_machine::validate_campaign_robot_provider())
.without_state(singleplayer_campaigns::singleplayer_complete_campaign_provider(&init_ctx.cubes))
.without_state(polariton_server::operations::Ack::<78, _>::default()) // TODO handle SaveCampaignGameAwardsRequest instead of ignoring it
.without_state(singleplayer_campaigns::singleplayer_save_complete_campaign_provider()) // TODO handle UpdatePlayerCompletedCampaignWaveRequest saving
.add(eac::EacChallengeIgnorer)
.add(more_auth::MoreLobbyAuth)
.add(versioner::VersionTeller)
.add(maintenancer::MaintenanceModeTeller)
.add(game_quality::QualityConfigTeller)
.add(login_flags::UserFlagsTeller)
.add(polariton_server::operations::Ack::<132, _>::default()) // verify user level
.add(load_analytics::NoAnalytics)
.add(polariton_server::operations::Ack::<131, _>::default()) // analytics updated notification
.add(platform_config::platform_config_provider())
.add(tier_banding::tiers_banding_provider())
.add(cube_list::cube_list_provider(&init_ctx.cubes))
.add(special_items::special_item_list_provider())
.add(premium_config::premium_config_provider())
.add(palette_town::kanto())
.add(client_config::client_config_provider(&init_ctx.cubes))
.add(crf_config::crf_config_provider())
.add(weapon_stats::weapon_config_provider(&init_ctx.cubes))
.add(movement_stats::movement_config_provider(&init_ctx.cubes))
.add(power_bar_stats::power_bar_provider())
.add(damage_boost_stats::damage_boost_provider())
.add(battle_arena_config::battle_arena_config_provider())
.add(cpu_limits_config::cpu_config_provider())
.add(cosmetic_config::cosmetic_limits_config_provider())
.add(taunts_config::taunts_config_provider())
.add(all_customisations_info::all_customisations_provider())
.add(tech_points::tech_points_provider())
.add(cube_inventory::cube_inv_provider(&init_ctx.cubes))
.add(player_level::player_level_info_provider())
.add(balance_info::balance_wallet_provider())
.add(premium_duration::premium_remaining_provider())
.add(tutorial_status::tutorial_info_provider())
.add(user_perms::user_rights_provider())
.add(garage_slots::garage_slot_provider())
.add(robopass_season::robopass_season_provider())
.add(owned_cosmetics::owned_cosmetics_provider())
.add(owned_cosmetics::selected_cosmetics_provider())
.add(dev_message::dev_message_provider(&init_ctx.cubes))
.add(custom_games_maps::allowed_maps_provider())
.add(avatar_info::get_avatar_provider())
.add(custom_game_session::get_custom_session_provider())
.add(user_xp::get_user_xp_provider())
.add(garage_upgrades::garage_upgrades_provider())
.add(game_event_params::event_system_params_provider())
.add(garage_bay_uuid::garage_id_provider())
.add(tech_tree_data::tech_tree_layout_provider(&init_ctx.cubes))
.add(item_shop_bundles::item_bundle_provider())
.add(robot_customisations::bay_customisations_provider())
.add(player_data::player_data_provider())
.add(player_robopass::player_robopass_season_provider())
.add(weapon_upgrades::weapons_upgrade_provider(&init_ctx.cubes))
.add(polariton_server::operations::Ack::<172, _>::default()) // custom game change robot tier (param 67 is tier)
.add(player_rank::rank_provider())
.add(player_rank::rank_static_provider())
.add(ab_test_group::test_group_provider())
.add(league_limits::league_battle_parameters_provider())
.add(crf_limits::robot_shop_submission_infos_provider())
.add(robot_mastery_settings::robot_mastery_settings_provider())
.add(player_started_purchase::started_purchase_provider())
.add(custom_games_team::team_setup_provider())
.add(polariton_server::operations::Ack::<152, _>::default()) // custom game player state changed (188 is desired state)
.add(custom_games_invite::pending_invite_provider())
.add(chat_settings::chat_settings_provider())
.add(prebuilt_robots::garage_robot_data_provider())
.add(prebuilt_colours::garage_colour_combo_provider())
.add(robopass_preview_items::robopass_preview_provider())
.add(singleplayer_campaigns::singleplayer_campaigns_provider(&init_ctx.cubes))
.add(purchases::pending_purchases_provider())
.add(building_xp_config::building_xp_config_provider())
.add(weapon_rating_static::weapon_rating_provider())
.add(weapon_xp_static::weapon_xp_provider())
.add(machine::garage_machine_provider())
.add(machine_colour::garage_machine_colour_provider())
.add(last_completed_campaign::completed_campaign_provider())
.add(daily_quests::player_daily_quests_provider())
.add(tech_points::tech_points_awards_provider())
.add(cube_awards::cube_awards_provider())
.add(robot_sanction::robot_sanction_provider())
.add(building_xp::building_xp_save_provider())
.add(robot_sanction::all_robot_sanctions_provider())
.add(reconnect_game::available_reconnect_provider())
.add(machine::garage_machine_save_provider())
.add(polariton_server::operations::Ack::<32, _>::default()) // TODO handle SaveMachineColorRequest instead of ignoring it
.add(polariton_server::operations::Ack::<45, _>::default()) // TODO handle UpdateThumbnailVersionRequest instead of ignoring it
.add(weapon_order::weapon_order_provider(&init_ctx.cubes))
.add(regen_config::auto_regen_config_provider(&init_ctx.cubes))
.add(pageantry::after_battle_vote_thresholds_provider(&init_ctx.cubes))
.add(signup_time::user_signup_date_provider())
.add(validate_machine::validate_robot_provider())
.add(game_mode_config::game_mode_config_provider(&init_ctx.cubes))
.add(score_multipliers_config::tdm_ai_score_config_provider())
.add(player_robot_rank::player_robot_rank_provider())
.add(validate_machine::validate_campaign_robot_provider())
.add(singleplayer_campaigns::singleplayer_complete_campaign_provider(&init_ctx.cubes))
.add(polariton_server::operations::Ack::<78, _>::default()) // TODO handle SaveCampaignGameAwardsRequest instead of ignoring it
.add(singleplayer_campaigns::singleplayer_save_complete_campaign_provider()) // TODO handle UpdatePlayerCompletedCampaignWaveRequest saving
}

View File

@@ -7,11 +7,10 @@ impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl <C> Operation<C> for MoreLobbyAuth {
type State = ();
impl <C: Send + 'static> Operation<C> for MoreLobbyAuth {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, user: &Self::User) -> polariton::operation::OperationResponse<C> {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
//let mut write_lock = user.write().unwrap();

View File

@@ -34,11 +34,10 @@ pub struct SingleplayerCompleteCampaignProvider {
campaign_details: rc_core::persist::config::CompleteCampaignProvider,
}
impl <C> Operation<C> for SingleplayerCompleteCampaignProvider {
type State = ();
impl <C: Send + 'static> Operation<C> for SingleplayerCompleteCampaignProvider {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, _user: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut params = params.to_dict();
if let Some(Typed::Str(campaign_id)) = params.get(&CAMPAIGN_ID_PARAM_KEY) {
if let Some(Typed::Int(campaign_difficulty)) = params.get(&CAMPAIGN_DIFFICULTY_PARAM_KEY) {
@@ -70,7 +69,7 @@ impl <C> Operation<C> for SingleplayerCompleteCampaignProvider {
impl OperationCode for SingleplayerCompleteCampaignProvider {
fn op_code() -> u8 {
16
64
}
}

View File

@@ -7,11 +7,10 @@ impl VersionTeller {
const LATEST_VERSION: i32 = 2855;
}
impl <C> Operation<C> for VersionTeller {
type State = ();
impl <C: Send + 'static> Operation<C> for VersionTeller {
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, _: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
let mut resp_params = std::collections::HashMap::new();
resp_params.insert(Self::VERSION_NUMBER_KEY, polariton::operation::Typed::Int(Self::LATEST_VERSION));
polariton::operation::OperationResponse {

View File

@@ -2,11 +2,10 @@ use polariton_server::operations::{Operation, OperationCode};
pub struct EacChallengeIgnorer;
impl <C> Operation<C> for EacChallengeIgnorer {
type State = ();
impl <C: Send + 'static> Operation<C> for EacChallengeIgnorer {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &Self::User) -> polariton::operation::OperationResponse<C> {
polariton::operation::OperationResponse {
code: 5, // skip the challenge (hopefully)
return_code: 0,

View File

@@ -6,8 +6,8 @@ use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy> {
OperationsHandler::<crate::UserTy>::new()
.without_state(more_auth::MoreLobbyAuth)
.without_state(eac::EacChallengeIgnorer)
.without_state(load_ai_robots::tdm_machines_provider())
//.without_state(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
.add(more_auth::MoreLobbyAuth)
.add(eac::EacChallengeIgnorer)
.add(load_ai_robots::tdm_machines_provider())
//.add(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
}

View File

@@ -7,11 +7,10 @@ impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl <C> Operation<C> for MoreLobbyAuth {
type State = ();
impl <C: Send + 'static> Operation<C> for MoreLobbyAuth {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, user: &Self::User) -> polariton::operation::OperationResponse<C> {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
//let mut write_lock = user.write().unwrap();

View File

@@ -12,17 +12,17 @@ use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy, crate::data::custom::CustomType> {
OperationsHandler::<crate::UserTy, crate::data::custom::CustomType>::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(clan_info::clan_info_provider())
.without_state(search_clan::search_clans_provider())
.without_state(polariton_server::operations::Ack::<52, _>::default()) // validate pending season rewards (this just always needs to be ack-ed)
.without_state(season_rewards::season_rewards_provider())
.without_state(previous_battle_rewards::pending_battle_rewards_provider())
.without_state(platoon_data::platoon_provider())
.add(more_auth::MoreLobbyAuth)
//.add(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
.add(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788
.add(settings::settings_provider()) // TODO save settings persistently
.add(polariton_server::operations::Ack::<43, _>::default()) // get my clan info (this is equivalent to not being in a clan)
.add(clan_invite::clan_invites_provider())
.add(polariton_server::operations::Ack::<19, _>::default()) // get pending platoon invite (this is equivalent to having no pending invite)
.add(clan_info::clan_info_provider())
.add(search_clan::search_clans_provider())
.add(polariton_server::operations::Ack::<52, _>::default()) // validate pending season rewards (this just always needs to be ack-ed)
.add(season_rewards::season_rewards_provider())
.add(previous_battle_rewards::pending_battle_rewards_provider())
.add(platoon_data::platoon_provider())
}

View File

@@ -7,11 +7,10 @@ impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl <C> Operation<C> for MoreLobbyAuth {
type State = ();
impl <C: Send + 'static> Operation<C> for MoreLobbyAuth {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, user: &Self::User) -> polariton::operation::OperationResponse<C> {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
if user.update_with_auth(&auth_payload.string) {