From 9d47484fe1eaa6c89c3417de2e8adfad25be0dd9 Mon Sep 17 00:00:00 2001 From: WiseDev <83840010+wisedevik@users.noreply.github.com> Date: Sun, 23 Aug 2026 11:51:17 +0300 Subject: [PATCH] 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. --- crates/logic/src/commands/battle.rs | 34 +++++++++++++++++++++++++++++ crates/logic/src/commands/mod.rs | 4 ++++ 2 files changed, 38 insertions(+) create mode 100644 crates/logic/src/commands/battle.rs diff --git a/crates/logic/src/commands/battle.rs b/crates/logic/src/commands/battle.rs new file mode 100644 index 0000000..c8081f4 --- /dev/null +++ b/crates/logic/src/commands/battle.rs @@ -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, + 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 + } +} diff --git a/crates/logic/src/commands/mod.rs b/crates/logic/src/commands/mod.rs index 0343d5a..b016778 100644 --- a/crates/logic/src/commands/mod.rs +++ b/crates/logic/src/commands/mod.rs @@ -1,4 +1,5 @@ mod achievement; +mod battle; mod chest; mod command; mod deck; @@ -13,6 +14,7 @@ pub use achievement::{ LogicClaimAchievementRewardCommand, COMMODITY_ACHIEVEMENT_CLAIMED, COMMODITY_ACHIEVEMENT_PROGRESS, }; +pub use battle::{LogicCompleteTutorialBattleCommand, LogicDoSpellCommand}; pub use chest::{ LogicClaimRewardCommand, LogicCollectFreeChestCommand, LogicCollectMultiWinChestCommand, LogicStartRewardClaimCommand, @@ -33,6 +35,8 @@ pub use ui::{ LogicShopOpenedCommand, }; 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 CLAIM_REWARD: i32 = 213; pub const ADD_CHEST: i32 = 214;