Modern UI contract: the end of the game
Resigning as the only or last human ends the game as the end of the set duration does: the highscore hook updates and shows the table. The end's reason and date are saved; the session read follows the contract's Session schema (archived managers, termination reason, ownership, mode), managers become archived (resigned or retired) and their employments end with the career. The resign answer carries the ownership change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6570384642
commit
d6d31f939d
10 files changed
+99
-20
No files matched your search
@@ -9353,6 +9353,7 @@ cli::Json ModernSession::finish_live(const std::string& request_id, uint64_t pre
|
||||
{"session", "desktop", "squad", "lineup", "tactics", "training", "camps", "bank", "statistics", "almanac", "live", "postmatch"},
|
||||
result.kind == TurnDeskKind::SeasonEndDesk ? "Saisonende." : result.kind == TurnDeskKind::CareerComplete
|
||||
? "Die Karriere ist zu Ende." : "Abpfiff. Weiter zum nächsten Termin.");
|
||||
if (result.kind == TurnDeskKind::CareerComplete) g_.career_end_reason = "career_completed", g_.career_end_date = g_.date;
|
||||
if (result.kind == TurnDeskKind::CareerComplete) std::get<cli::Json::Object>(answer.value)["outcome"] = "career_ended";
|
||||
return answer;
|
||||
}
|
||||
@@ -9858,6 +9859,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
answer = modern::ui_command_result(request_id, previous, revision,
|
||||
{"session", "desktop", "squad", "lineup", "tactics", "training", "camps", "bank",
|
||||
"statistics", "almanac"}, what);
|
||||
if (r.kind == TurnDeskKind::CareerComplete) g_.career_end_reason = "career_completed", g_.career_end_date = g_.date;
|
||||
if (r.kind == TurnDeskKind::CareerComplete)
|
||||
std::get<cli::Json::Object>(answer.value)["outcome"] = "career_ended";
|
||||
} else if ((kind == "quote.request" && (ui_text(*payload, "kind") == "periphery" || ui_text(*payload, "kind") == "facility" ||
|
||||
@@ -10362,11 +10364,26 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
if (const int club = g_.manager_teams[size_t(manager)]; club >= 0)
|
||||
modern::note_press(g_, "career.manager_resigned", modern::ui_team_id(g_, club),
|
||||
cli::Json::Object{{"team", modern::press_team(g_, club)}, {"manager", modern::ui_manager_id(g_, manager)}});
|
||||
// the end is that of the set duration: the highscore table is brought up to date and shown
|
||||
// (season_end_steps: update, then the final display), the session ends
|
||||
if (turn_driver_.season_highscore) {
|
||||
turn_driver_.season_highscore(g_, false);
|
||||
turn_driver_.season_highscore(g_, true);
|
||||
}
|
||||
turn_driver_.stage = TurnDriver::Stage::CareerComplete;
|
||||
g_.career_end_reason = "last_human_resigned", g_.career_end_date = g_.date;
|
||||
revision = previous + 1;
|
||||
answer = modern::ui_command_result(request_id, previous, revision, {"session", "desktop"},
|
||||
answer = modern::ui_command_result(request_id, previous, revision, {"session", "manager_menu", "desktop"},
|
||||
"Sie haben aufgegeben. Die Karriere ist beendet.");
|
||||
std::get<cli::Json::Object>(answer.value)["outcome"] = "career_ended";
|
||||
auto& o = std::get<cli::Json::Object>(answer.value);
|
||||
o["outcome"] = "career_ended";
|
||||
const int club = g_.manager_teams[size_t(manager)];
|
||||
o["ownershipChange"] = cli::Json::Object{
|
||||
{"kind", "ownership_change"}, {"managerId", modern::ui_manager_id(g_, manager)},
|
||||
{"archivedIdentity", modern::ui_manager(g_, manager)},
|
||||
{"teamId", club >= 0 ? cli::Json(modern::ui_team_id(g_, club)) : cli::Json(nullptr)}, {"aiHandover", false},
|
||||
{"activeManagerId", nullptr}, {"humanOwnership", cli::Json::Array{}}, {"sessionState", "ended"},
|
||||
{"terminationReason", "last_human_resigned"}};
|
||||
} else if (kind == "toto.submit") {
|
||||
// payload {stake: Money per column, columns: [[11 tips: 1 home, 0 draw, 2 away], ... up to 6]}
|
||||
const cli::Json* stake = ui_field(*payload, "stake");
|
||||
|
||||
Reference in new issue
Block a user