add CA commands into Ep3 battle record format

This commit is contained in:
Martin Michelsen
2024-03-16 18:48:27 -07:00
parent dace165ef2
commit 7ca2012bc4
3 changed files with 12 additions and 0 deletions
+6
View File
@@ -32,6 +32,7 @@ BattleRecord::Event::Event(StringReader& r) {
case Event::Type::GAME_COMMAND:
case Event::Type::BATTLE_COMMAND:
case Event::Type::EP3_GAME_COMMAND:
case Event::Type::SERVER_DATA_COMMAND:
this->data = r.read(r.get_u16l());
break;
default:
@@ -64,6 +65,7 @@ void BattleRecord::Event::serialize(StringWriter& w) const {
case Event::Type::GAME_COMMAND:
case Event::Type::BATTLE_COMMAND:
case Event::Type::EP3_GAME_COMMAND:
case Event::Type::SERVER_DATA_COMMAND:
w.put_u16l(this->data.size());
w.write(this->data);
break;
@@ -356,6 +358,10 @@ void BattleRecordPlayer::schedule_events() {
case BattleRecord::Event::Type::CHAT_MESSAGE:
send_prepared_chat_message(l, ev.guild_card_number, ev.data);
break;
case BattleRecord::Event::Type::SERVER_DATA_COMMAND:
// These are not replayed, since the battle record also contains
// the results of these commands.
break;
}
this->event_it++;
+1
View File
@@ -35,6 +35,7 @@ public:
GAME_COMMAND = 4,
EP3_GAME_COMMAND = 5,
CHAT_MESSAGE = 6,
SERVER_DATA_COMMAND = 7,
};
// Fields used for all events
+5
View File
@@ -1837,6 +1837,11 @@ void Server::on_server_data_input(shared_ptr<Client> sender_c, const string& dat
throw runtime_error("unknown CAx subsubcommand");
}
auto l = this->lobby.lock();
if (l && l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command(BattleRecord::Event::Type::SERVER_DATA_COMMAND, data.data(), data.size());
}
if ((sender_c->version() == Version::GC_EP3_NTE) || !header.mask_key) {
(this->*handler)(sender_c, data);
} else {