Make some data more real, not that it matters

This commit is contained in:
NGnius (Graham) committed 2025-02-25 22:26:53 -05:00
1 parent 1df3e31bb6
commit fe30e783ad
6 files changed
+126 -6

No files matched your search

@@ -0,0 +1,61 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed, Arr};
use crate::data::clan::*;
const CLAN_NAME_PARAM_KEY: u8 = 31; // in and out
const MEMBERS_PARAM_KEY: u8 = 36; // out only
const ROBITS_CONVERSION_PARAM_KEY: u8 = 51; // out only
const CLAN_DESCRIPTION_PARAM_KEY: u8 = 32; // out only
const CLAN_TYPE_PARAM_KEY: u8 = 32; // out only
pub(super) fn clan_info_provider() -> SimpleFunc<33, 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(clan_name)) = params.get(&CLAN_NAME_PARAM_KEY) {
log::debug!("Requested info on clan {}", clan_name.string);
params.insert(MEMBERS_PARAM_KEY, Typed::Arr(Arr {
ty: 104, // hashmap
items: vec![
ClanMember {
username: "RE_clan_user_idk0".to_owned(),
display_name: "RE_clan_user_idk0".to_owned(),
member_state: ClanMemberState::Idk0,
use_custom_avatar: false,
avatar_id: 1,
rank: ClanMemberRank::Leader,
is_online: true,
season_xp: 42_000,
}.as_transmissible(),
ClanMember {
username: "RE_clan_user_idk1".to_owned(),
display_name: "RE_clan_user_idk1".to_owned(),
member_state: ClanMemberState::Idk1,
use_custom_avatar: false,
avatar_id: 1,
rank: ClanMemberRank::Leader,
is_online: true,
season_xp: 42_001,
}.as_transmissible(),
ClanMember {
username: "RE_clan_user_idk2".to_owned(),
display_name: "RE_clan_user_idk2".to_owned(),
member_state: ClanMemberState::Idk2,
use_custom_avatar: false,
avatar_id: 1,
rank: ClanMemberRank::Leader,
is_online: true,
season_xp: 42_002,
}.as_transmissible(),
],
}));
params.insert(ROBITS_CONVERSION_PARAM_KEY, Typed::Float(0.5));
params.insert(CLAN_DESCRIPTION_PARAM_KEY, Typed::Str("RE_clan_description".into()));
params.insert(CLAN_TYPE_PARAM_KEY, Typed::Int(ClanType::Closed as _));
} else {
log::debug!("Requested info on own clan (returning no info)");
}
Ok(params.into())
})
}
+3 -1
View File
@@ -2,16 +2,18 @@ mod more_auth;
mod friend_list;
mod settings;
mod clan_invite;
mod clan_info;
use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy> {
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(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())
}