clear ep3 server state on 6F

This commit is contained in:
Martin Michelsen
2024-02-10 09:37:47 -08:00
parent c3d56f630e
commit c79e5017ad
2 changed files with 23 additions and 17 deletions
+6 -7
View File
@@ -2743,13 +2743,12 @@ struct C_VerifyLicense_BB_DB {
pstring<TextEncoding::ASCII, 0x30> game_tag; // "psopc2"
} __packed__;
// DC: Player menu state (Episode 3)
// No arguments. It seems the client expects the server to respond with another
// DC command, the contents and flag of which are ignored entirely - all it does
// is set a global flag on the client. This could be the mechanism for waiting
// until all players are at the counter, like how AC (quest barrier) works. I
// haven't spent any time investigating what this actually does; newserv just
// immediately responds to any DC from an Episode 3 client.
// DC: Set battle in progress flag (Episode 3)
// No arguments except header.flag when sent by the client. When header.flag is
// 1, the game should be locked - no players should be allowed to join. In this
// case, the client waits for the server to respond with another DC command
// before proceeding with battle setup. When header.flag is 0, the game should
// be unlocked, and the client does not wait for a response from the server.
// DC: Guild card data (BB)
+17 -10
View File
@@ -1643,13 +1643,6 @@ static void on_CA_Ep3(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
}
if (s->ep3_behavior_flags & Episode3::BehaviorFlag::ENABLE_RECORDING) {
if (l->battle_record) {
for (const auto& c : l->clients) {
if (c) {
c->ep3_prev_battle_record = l->battle_record;
}
}
}
l->battle_record = make_shared<Episode3::BattleRecord>(s->ep3_behavior_flags);
for (auto existing_c : l->clients) {
if (existing_c) {
@@ -1666,9 +1659,6 @@ static void on_CA_Ep3(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
}
}
if (s->ep3_behavior_flags & Episode3::BehaviorFlag::ENABLE_STATUS_MESSAGES) {
if (c->ep3_prev_battle_record) {
send_text_message(l, "$C6Recording complete");
}
send_text_message(l, "$C6Recording enabled");
}
}
@@ -4433,6 +4423,23 @@ static void on_6F(shared_ptr<Client> c, uint16_t command, uint32_t, string& data
}
}
if (l->ep3_server && l->ep3_server->battle_finished) {
auto s = l->require_server_state();
l->log.info("Deleting Episode 3 server state");
l->ep3_server.reset();
if (l->battle_record) {
for (const auto& c : l->clients) {
if (c) {
c->ep3_prev_battle_record = l->battle_record;
if ((s->ep3_behavior_flags & Episode3::BehaviorFlag::ENABLE_STATUS_MESSAGES)) {
send_text_message(l, "$C6Recording complete");
}
}
}
l->battle_record.reset();
}
}
send_server_time(c);
if (c->config.check_flag(Client::Flag::DEBUG_ENABLED)) {
string variations_str;