decode the four types the client kept sending
14303 AskForJoinableAlliancesList and 14107 CancelMatchmake are both genuinely empty payloads. 516 UpdateLastShownLevelUp is header only, 537 StartMatchmake carries a vint and a bool. none of them move the home checksum. that clears the unknown type warnings out of the log.
This commit is contained in:
parent
c0713b50d7
commit
68e2b87a0a
4 changed files with 63 additions and 2 deletions
48
crates/logic/src/commands/matchmake.rs
Normal file
48
crates/logic/src/commands/matchmake.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
use logic_derive::Command;
|
||||
use titan::Payload;
|
||||
use crate::commands::command::{CommandOutcome, Execute};
|
||||
use crate::commands::command_type;
|
||||
use crate::commands::header::LogicCommandHeader;
|
||||
use crate::home::LogicHomeMode;
|
||||
#[derive(Debug, Default, Payload, Command)]
|
||||
#[command(id = command_type::UPDATE_LAST_SHOWN_LEVEL_UP)]
|
||||
pub struct LogicUpdateLastShownLevelUpCommand {
|
||||
pub header: LogicCommandHeader,
|
||||
}
|
||||
impl Execute for LogicUpdateLastShownLevelUpCommand {
|
||||
fn execute(&self, mode: &mut LogicHomeMode) -> CommandOutcome {
|
||||
let level = mode.avatar().exp_level;
|
||||
let shown = mode.home().last_shown_level_up;
|
||||
if level <= shown {
|
||||
return CommandOutcome::Rejected("that level up was already shown");
|
||||
}
|
||||
mode.home_mut().last_shown_level_up = if shown > 1 { shown + 1 } else { 2 };
|
||||
CommandOutcome::Applied
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Default, Payload, Command)]
|
||||
#[command(id = command_type::START_MATCHMAKE)]
|
||||
pub struct LogicStartMatchmakeCommand {
|
||||
pub header: LogicCommandHeader,
|
||||
#[codec(vint)]
|
||||
pub matchmake_slot: i32,
|
||||
#[codec(bool)]
|
||||
pub notify: bool,
|
||||
}
|
||||
impl Execute for LogicStartMatchmakeCommand {
|
||||
fn execute(&self, mode: &mut LogicHomeMode) -> CommandOutcome {
|
||||
if mode
|
||||
.avatar()
|
||||
.arena
|
||||
.as_arena()
|
||||
.map(|arena| arena.is_training_camp())
|
||||
.unwrap_or(true)
|
||||
{
|
||||
return CommandOutcome::Rejected("the training camp cannot matchmake");
|
||||
}
|
||||
if mode.is_claiming_reward() {
|
||||
return CommandOutcome::Rejected("a reward claim is in progress");
|
||||
}
|
||||
CommandOutcome::Ignored
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ mod command;
|
|||
mod deck;
|
||||
mod header;
|
||||
mod manager;
|
||||
mod matchmake;
|
||||
mod reward;
|
||||
mod shop;
|
||||
mod spells;
|
||||
|
|
@ -20,6 +21,7 @@ pub use command::{CommandMeta, CommandOutcome, CommandRegistryEntry, Execute, Lo
|
|||
pub use deck::{LogicMoveSpellCommand, LogicSwapSpellsCommand};
|
||||
pub use header::LogicCommandHeader;
|
||||
pub use manager::LogicCommandManager;
|
||||
pub use matchmake::{LogicStartMatchmakeCommand, LogicUpdateLastShownLevelUpCommand};
|
||||
pub use reward::LogicReward;
|
||||
pub use shop::{
|
||||
LogicBuyCardCommand, LogicBuyChestCommand, LogicBuyResourcePackCommand,
|
||||
|
|
@ -44,6 +46,7 @@ pub mod command_type {
|
|||
pub const SELL_CHEST: i32 = 507;
|
||||
pub const UPDATE_LAST_SHOWN_LEVEL_UP: i32 = 516;
|
||||
pub const CANCEL_CHEST_OPEN: i32 = 517;
|
||||
pub const START_MATCHMAKE: i32 = 537;
|
||||
pub const COLLECT_FREE_CHEST: i32 = 518;
|
||||
pub const SORT_COLLECTION: i32 = 520;
|
||||
pub const MOVE_SPELL: i32 = 521;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ pub use commands::{
|
|||
LogicCommand, LogicCommandHeader, LogicCommandManager, LogicFuseSpellsCommand,
|
||||
LogicHelpOpenedCommand, LogicMoveSpellCommand, LogicPageOpenedCommand,
|
||||
LogicRefreshAchievementsCommand, LogicReward, LogicShopOpenedCommand,
|
||||
LogicShopSeedChangedCommand, LogicSortCollectionCommand, LogicStartRewardClaimCommand,
|
||||
LogicSwapSpellsCommand,
|
||||
LogicShopSeedChangedCommand, LogicSortCollectionCommand, LogicStartMatchmakeCommand,
|
||||
LogicStartRewardClaimCommand, LogicSwapSpellsCommand, LogicUpdateLastShownLevelUpCommand,
|
||||
};
|
||||
pub use data::{
|
||||
table, DataError, LogicArenaData, LogicData, LogicDataRef, LogicDataTable,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@ pub struct AskForPlayingFacebookFriendsMessage {
|
|||
pub facebook_ids: Option<Vec<Option<String>>>,
|
||||
}
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Message)]
|
||||
#[message(id = 14107, direction = "client", name = "CancelMatchmakeMessage")]
|
||||
pub struct CancelMatchmakeMessage {}
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Message)]
|
||||
#[message(
|
||||
id = 14303,
|
||||
direction = "client",
|
||||
name = "AskForJoinableAlliancesListMessage"
|
||||
)]
|
||||
pub struct AskForJoinableAlliancesListMessage {}
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Message)]
|
||||
#[message(id = 14402, direction = "client", name = "AskForTVContentMessage")]
|
||||
pub struct AskForTVContentMessage {}
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Message)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue