decode the two battle commands

command type 1 is LogicDoSpellCommand - the card the player put on the
field. it carries the usual command header, the deck slot, an optional
LogicSpell and the drop position. type 2 is
LogicCompleteTutorialBattleCommand, which reads its global id before the
header the way the achievement command does.

both execute to Ignored for now: the home logic is stopped during the
battle, so nothing on the server acts on them yet. decoding them stops
EndClientTurnMessage from being thrown away whole, which is what the
"unknown command type 1" warnings were.
This commit is contained in:
WiseDev 2026-08-23 11:51:17 +03:00
parent 5bca19da50
commit 9d47484fe1
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,34 @@
use logic_derive::Command;
use titan::Payload;
use crate::battle::LogicVector2;
use crate::commands::command::{CommandOutcome, Execute};
use crate::commands::command_type;
use crate::commands::header::LogicCommandHeader;
use crate::data::LogicDataRef;
use crate::home::LogicHomeMode;
use crate::model::LogicSpell;
#[derive(Debug, Default, Payload, Command)]
#[command(id = command_type::DO_SPELL)]
pub struct LogicDoSpellCommand {
pub header: LogicCommandHeader,
#[codec(vint)]
pub deck_slot: i32,
pub spell: Option<LogicSpell>,
pub position: LogicVector2,
}
impl Execute for LogicDoSpellCommand {
fn execute(&self, _mode: &mut LogicHomeMode) -> CommandOutcome {
CommandOutcome::Ignored
}
}
#[derive(Debug, Default, Payload, Command)]
#[command(id = command_type::COMPLETE_TUTORIAL_BATTLE)]
pub struct LogicCompleteTutorialBattleCommand {
pub tutorial: LogicDataRef,
pub header: LogicCommandHeader,
}
impl Execute for LogicCompleteTutorialBattleCommand {
fn execute(&self, _mode: &mut LogicHomeMode) -> CommandOutcome {
CommandOutcome::Ignored
}
}

View file

@ -1,4 +1,5 @@
mod achievement; mod achievement;
mod battle;
mod chest; mod chest;
mod command; mod command;
mod deck; mod deck;
@ -13,6 +14,7 @@ pub use achievement::{
LogicClaimAchievementRewardCommand, COMMODITY_ACHIEVEMENT_CLAIMED, LogicClaimAchievementRewardCommand, COMMODITY_ACHIEVEMENT_CLAIMED,
COMMODITY_ACHIEVEMENT_PROGRESS, COMMODITY_ACHIEVEMENT_PROGRESS,
}; };
pub use battle::{LogicCompleteTutorialBattleCommand, LogicDoSpellCommand};
pub use chest::{ pub use chest::{
LogicClaimRewardCommand, LogicCollectFreeChestCommand, LogicCollectMultiWinChestCommand, LogicClaimRewardCommand, LogicCollectFreeChestCommand, LogicCollectMultiWinChestCommand,
LogicStartRewardClaimCommand, LogicStartRewardClaimCommand,
@ -33,6 +35,8 @@ pub use ui::{
LogicShopOpenedCommand, LogicShopOpenedCommand,
}; };
pub mod command_type { pub mod command_type {
pub const DO_SPELL: i32 = 1;
pub const COMPLETE_TUTORIAL_BATTLE: i32 = 2;
pub const DIAMONDS_ADDED: i32 = 202; pub const DIAMONDS_ADDED: i32 = 202;
pub const CLAIM_REWARD: i32 = 213; pub const CLAIM_REWARD: i32 = 213;
pub const ADD_CHEST: i32 = 214; pub const ADD_CHEST: i32 = 214;