Add server for game data (implement login sequence)

This commit is contained in:
NGnius (Graham) committed 2025-02-12 18:46:27 -05:00
1 parent ca4a0ce675
commit d8885d811f
52 files changed
+2734 -5

No files matched your search

@@ -0,0 +1,45 @@
use polariton_server::operations::{Operation, OperationCode};
pub struct UserFlagsTeller;
impl UserFlagsTeller {
const REMOVE_OBSOLETE_CUBES_KEY: u8 = 113;
const REMOVE_UNOWNED_CUBES_KEY: u8 = 114;
const REWARD_TITLE_KEY: u8 = 115;
const REWARD_BODY_KEY: u8 = 116;
const REFUND_OBSOLETE_CUBES_KEY: u8 = 117;
const CUBES_ARE_REPLACED_KEY: u8 = 118;
const NEW_USER_KEY: u8 = 119;
const AB_TEST_KEY: u8 = 166;
const AB_GROUP_KEY: u8 = 167;
}
impl Operation for UserFlagsTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: polariton::operation::ParameterTable, _: &mut Self::State, _: &Self::User) -> polariton::operation::OperationResponse {
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()));
resp_params.insert(Self::REWARD_TITLE_KEY, polariton::operation::Typed::Str("Yay a reward!".into()));
resp_params.insert(Self::REWARD_BODY_KEY, polariton::operation::Typed::Str("I love you very much so here's nothing as a reward.".into()));
resp_params.insert(Self::REFUND_OBSOLETE_CUBES_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::CUBES_ARE_REPLACED_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::NEW_USER_KEY, polariton::operation::Typed::Bool(false.into()));
resp_params.insert(Self::AB_TEST_KEY, polariton::operation::Typed::Str("".into()));
resp_params.insert(Self::AB_GROUP_KEY, polariton::operation::Typed::Str("".into()));
polariton::operation::OperationResponse {
code: 105,
return_code: 0,
message: polariton::operation::Typed::Null,
params: resp_params.into(),
}
}
}
impl OperationCode for UserFlagsTeller {
fn op_code() -> u8 {
105
}
}