mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Complete bare minimum to seem logged in
This commit is contained in:
@@ -50,3 +50,21 @@ pub enum ClanType {
|
||||
Open = 1,
|
||||
Closed = 2,
|
||||
}
|
||||
|
||||
pub struct ClanInfo {
|
||||
pub clan_name: String,
|
||||
pub clan_description: String,
|
||||
pub clan_type: ClanType,
|
||||
pub clan_size: i32,
|
||||
}
|
||||
|
||||
impl ClanInfo {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("clanName".into()), Typed::Str(self.clan_name.clone().into())),
|
||||
(Typed::Str("clanDescription".into()), Typed::Str(self.clan_description.clone().into())),
|
||||
(Typed::Str("clanType".into()), Typed::Int(self.clan_type as i32)),
|
||||
(Typed::Str("clanSize".into()), Typed::Int(self.clan_size)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ mod friend_list;
|
||||
mod settings;
|
||||
mod clan_invite;
|
||||
mod clan_info;
|
||||
mod search_clan;
|
||||
mod season_rewards;
|
||||
mod previous_battle_rewards;
|
||||
mod platoon_data;
|
||||
|
||||
use polariton_server::operations::OperationsHandler;
|
||||
|
||||
@@ -16,4 +20,9 @@ pub fn handler() -> OperationsHandler<crate::UserTy> {
|
||||
.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())
|
||||
}
|
||||
|
||||
15
rc_social_room/src/operations/platoon_data.rs
Normal file
15
rc_social_room/src/operations/platoon_data.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::ParameterTable;
|
||||
|
||||
//const PLATOON_ID_PARAM_KEY: u8 = 16;
|
||||
//const PLATOON_LEADER_PARAM_KEY: u8 = 17;
|
||||
//const USER_LIST_PARAM_KEY: u8 = 7;
|
||||
|
||||
pub(super) fn platoon_provider() -> SimpleFunc<18, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
//let mut params = params.to_dict();
|
||||
// if platoon ID is not provided, you're not in a platoon
|
||||
//Ok(params.into())
|
||||
Ok(params)
|
||||
})
|
||||
}
|
||||
13
rc_social_room/src/operations/previous_battle_rewards.rs
Normal file
13
rc_social_room/src/operations/previous_battle_rewards.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed};
|
||||
|
||||
const PARAM_KEY: u8 = 60;
|
||||
//const USER_PARAM_KEY: u8 = 1; // str (username)
|
||||
|
||||
pub(super) fn pending_battle_rewards_provider() -> SimpleFunc<54, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, Typed::Bool(false.into()));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
37
rc_social_room/src/operations/search_clan.rs
Normal file
37
rc_social_room/src/operations/search_clan.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed, Arr};
|
||||
|
||||
use crate::data::clan::*;
|
||||
|
||||
// params in TODO
|
||||
const STRING_PARAM_KEY: u8 = 39;
|
||||
/*const DAYS_SINCE_ACTIVE_PARAM_KEY: u8 = 40;
|
||||
const START_RANGE_PARAM_KEY: u8 = 41;
|
||||
const END_RANGE_PARAM_KEY: u8 = 43;
|
||||
const TYPES_PARAM_KEY: u8 = 34;*/
|
||||
|
||||
// params out
|
||||
const RESULTS_PARAM_KEY: u8 = 42;
|
||||
|
||||
pub(super) fn search_clans_provider() -> SimpleFunc<32, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
if let Some(Typed::Str(s)) = params.get(&STRING_PARAM_KEY) {
|
||||
if !s.string.is_empty() {
|
||||
log::debug!("Got clan search string `{}`", s.string);
|
||||
}
|
||||
}
|
||||
params.insert(RESULTS_PARAM_KEY, Typed::Arr(Arr {
|
||||
ty: 104, // hashmap
|
||||
items: vec![
|
||||
ClanInfo {
|
||||
clan_name: "".to_owned(),
|
||||
clan_description: "".to_owned(),
|
||||
clan_type: ClanType::Closed,
|
||||
clan_size: 1,
|
||||
}.as_transmissible(),
|
||||
],
|
||||
}));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
26
rc_social_room/src/operations/season_rewards.rs
Normal file
26
rc_social_room/src/operations/season_rewards.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use polariton_server::operations::SimpleFunc;
|
||||
use polariton::operation::{ParameterTable, Typed};
|
||||
|
||||
const MONTH_PARAM_KEY: u8 = 49;
|
||||
const YEAR_PARAM_KEY: u8 = 63;
|
||||
const ROBITS_PARAM_KEY: u8 = 47;
|
||||
const IS_CLAIMED_PARAM_KEY: u8 = 46;
|
||||
const CLAN_AVERAGE_PARAM_KEY: u8 = 54;
|
||||
const CLAN_TOTAL_PARAM_KEY: u8 = 55;
|
||||
const CLAN_NAME_PARAM_KEY: u8 = 31;
|
||||
const PLAYER_XP_PARAM_KEY: u8 = 57;
|
||||
|
||||
pub(super) fn season_rewards_provider() -> SimpleFunc<50, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(MONTH_PARAM_KEY, Typed::Int(02));
|
||||
params.insert(YEAR_PARAM_KEY, Typed::Int(2025));
|
||||
params.insert(ROBITS_PARAM_KEY, Typed::Int(42));
|
||||
params.insert(IS_CLAIMED_PARAM_KEY, Typed::Bool(true.into()));
|
||||
params.insert(CLAN_AVERAGE_PARAM_KEY, Typed::Int(67));
|
||||
params.insert(CLAN_TOTAL_PARAM_KEY, Typed::Int(42_123));
|
||||
params.insert(CLAN_NAME_PARAM_KEY, Typed::Str("RE_clan_name_rewards".into()));
|
||||
params.insert(PLAYER_XP_PARAM_KEY, Typed::Int(10_000));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user