537 only tells the client's ui to start searching, the handshake after it was missing: server sends 24106 StopHomeLogic, client answers 14105, server sends 21903. that last step now builds the same snapshot the npc mission does, using npcs row 0 as the opponent. battle type stays 1 so it runs on the client's offline path. a real pvp battle is type 0 and needs the udp sector channel, which does not exist here. 14107 CancelMatchmake now answers 24125 instead of being ignored.
48 lines
1.6 KiB
Rust
48 lines
1.6 KiB
Rust
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::MatchmakeStarted
|
|
}
|
|
}
|