Reduce the career's game options to the ones that matter; keep leagues in a running game
The game page of a Dreierpack career offers five options (winter postponements and their cap, indoor tournaments, the two transfer-news switches). The cells of the original's presentation, the multi-player and autosave cells and the switches that take leagues out of a running game are no longer shown, and settings.commit refuses them. The sound page and the marking automation are hidden in a career. A mailbox text cut inside a multi-byte character no longer breaks the news read. modern_live_dump can commit options and reports their effect. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d70a48be8
commit
1de09ba8a6
7 files changed
+135
-12
No files matched your search
@@ -26,6 +26,28 @@ int main(int argc, char **argv) {
|
||||
const bool live = std::getenv("MODERN_DUMP_LIVE") != nullptr, steps = std::getenv("MODERN_DUMP_STEPS") != nullptr,
|
||||
quiet = std::getenv("MODERN_DUMP_QUIET") != nullptr;
|
||||
Json expiry = Json::object();
|
||||
size_t postponed = 0;
|
||||
// MODERN_DUMP_SET="P5=0,J8=1": game options committed before the first kickoff
|
||||
if (const char *wanted_settings = std::getenv("MODERN_DUMP_SET")) {
|
||||
Json edits = Json::array();
|
||||
std::string text = wanted_settings;
|
||||
for (size_t at = 0; at < text.size();) {
|
||||
const size_t end = std::min(text.find(',', at), text.size());
|
||||
const std::string item = text.substr(at, end - at);
|
||||
const size_t eq = item.find('=');
|
||||
if (eq != std::string::npos) edits.push_back({{"code", item.substr(0, eq)}, {"value", std::stoi(item.substr(eq + 1))}});
|
||||
at = end + 1;
|
||||
}
|
||||
const auto bundle = link->snapshot();
|
||||
const auto &meta = bundle.at("desktop").at("meta");
|
||||
const Json commit = {{"messageType", "command"}, {"contractVersion", meta.at("contractVersion")}, {"requestId", "request:dump-settings"},
|
||||
{"careerId", meta.at("careerId")}, {"expectedRevision", meta.at("stateRevision")},
|
||||
{"owner", {{"managerId", meta.at("scope").at("managerId")}}},
|
||||
{"kind", "settings.commit"}, {"payload", {{"edits", edits}}}};
|
||||
const auto answer = link->command(commit);
|
||||
std::cout << "settings " << edits.dump() << ": " << answer.value("messageType", "?") << " " << answer.value("code", "")
|
||||
<< " " << (answer.contains("message") && answer.at("message").is_object() ? answer.at("message").value("text", std::string()) : std::string()) << std::endl;
|
||||
}
|
||||
for (int step = 0; step < 400 && found < wanted; ++step) {
|
||||
const auto bundle = link->snapshot();
|
||||
const auto &meta = bundle.at("desktop").at("meta");
|
||||
@@ -88,6 +110,11 @@ int main(int argc, char **argv) {
|
||||
std::cout << " | " << fixture.value("date", std::string()) << " " << m.at("home").at("name").get<std::string>() << " - "
|
||||
<< m.at("away").at("name").get<std::string>() << " (" << m.value("competition", std::string()) << ")";
|
||||
std::cout << std::endl;
|
||||
if (fixture.value("ok", false)) {
|
||||
// every match of the kickoff that was a replay of a postponed one
|
||||
const std::string all = fixture.dump();
|
||||
for (size_t at = all.find("Verlegte Spiele"); at != std::string::npos; at = all.find("Verlegte Spiele", at + 1)) ++postponed;
|
||||
}
|
||||
if (quiet) { if (fixture.value("ok", false)) ++found; continue; }
|
||||
|
||||
if (!fixture.value("ok", false)) continue;
|
||||
@@ -97,6 +124,20 @@ int main(int argc, char **argv) {
|
||||
write("lineup-" + tag + ".json", link->read({{"kind", "lineup"}}));
|
||||
write("tactics-" + tag + ".json", link->read({{"kind", "tactics"}}));
|
||||
}
|
||||
{
|
||||
const auto news = link->read({{"kind", "news"}});
|
||||
size_t messages = 0, transfers = 0;
|
||||
if (news.contains("data") && news.at("data").contains("messages"))
|
||||
for (const auto &m : news.at("data").at("messages")) {
|
||||
++messages;
|
||||
const std::string text = m.dump();
|
||||
if (text.find("Transfer") != std::string::npos || text.find("wechselt") != std::string::npos ||
|
||||
text.find("verpflichtet") != std::string::npos) ++transfers;
|
||||
}
|
||||
const auto desk = link->snapshot().at("desktop").at("meta");
|
||||
std::cout << "summary: date " << desk.at("date").get<std::string>() << ", mentions of replayed postponed matches " << postponed
|
||||
<< ", mailbox messages " << messages << ", of them about transfers " << transfers << std::endl;
|
||||
}
|
||||
std::cout << found << " recordings written\n";
|
||||
return found ? 0 : 1;
|
||||
} catch (const std::exception &e) { std::cerr << e.what() << "\n"; return 1; }
|
||||
|
||||
Reference in new issue
Block a user