Modern press journal: promotion, advertising, credit, stadium

The season change notes a human club's promotion or relegation; the
confirmed commands note an advertising contract, a loan taken or paid
off and a planned stand expansion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 18:27:26 +01:00
1 parent 651d262546
commit 055b48697e
5 files changed
+60 -3

No files matched your search

+30
View File
@@ -9994,6 +9994,11 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
block_step(ui::StadiumRequestKind::expansion_confirm, slot, total, features);
if (ok && stadium_.block_expansion && stadium_.block_expansion->tip)
block_step(ui::StadiumRequestKind::expansion_answer_tip, slot, total, features, with_tip);
if (ok)
modern::note_press(g_, "stadium.expansion_planned", modern::ui_team_id(g_, team),
cli::Json::Object{{"team", modern::press_team(g_, team)},
{"stadium", modern::press_team(g_, team)},
{"block", std::string("block:") + char('a' + slot)}, {"seats", int64_t(total)}});
}
} else {
return refuse("stale_quote", "Es liegt kein Stadionangebot vor.");
@@ -10073,6 +10078,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
if (team < 0 || team >= league_clubs()) return refuse("no_club", "Am Schreibtisch des Bundestrainers gibt es keine Werbung.");
const ui::AdvertisingState a = ui::advertising_from_game(g_, manager, revision);
ui::AdvertisingRequest r;
cli::Json accepted_ad; // the press facts of an accepted offer
r.request_id = last_advertising_request_id_ + 1;
r.manager_slot = manager, r.runtime_club = team, r.revision = revision;
if (kind == "advertising.accept") {
@@ -10086,6 +10092,12 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
r.kind = ui::AdvertisingActionKind::accept_offer;
r.offer.manager = manager, r.offer.display_slot = display, r.offer.contract_slot = list.contract_slot;
r.offer.expected_contract = list.contract_bytes, r.offer.raw_slot = raw, r.offer.expected_offer = offer->bytes;
const auto& names = display == 15 ? a.television_sponsor_names : a.board_sponsor_names;
accepted_ad = cli::Json::Object{
{"team", modern::press_team(g_, team)},
{"company", offer->sponsor_id < names.size() ? cli::Json(cli::Json::Object{{"id", "sponsor:" + std::to_string(offer->sponsor_id)}, {"name", names[offer->sponsor_id]}}) : cli::Json(nullptr)},
{"amount", modern::ui_money(offer->monthly_amount)}, {"months", int(offer->months)},
{"place", display == 15 ? "tv" : display == 14 ? "shirt" : "boards"}};
} else {
const std::string id = ui_text(*payload, "budgetId");
const int index = id == "budget:merchandise" ? 0 : id == "budget:press" ? 1 : id == "budget:fans" ? 2 : -1;
@@ -10100,6 +10112,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
r.spending.expected_amount = view.current_amount, r.spending.expected_delivery_weeks = view.delivery_weeks;
}
if (!dispatch_advertising(r, revision, error)) { restore(); return refuse("advertising_refused", error); }
if (accepted_ad.object()) modern::note_press(g_, "advertising.signed", modern::ui_team_id(g_, team), std::move(accepted_ad));
revision = previous + 1;
answer = modern::ui_command_result(request_id, previous, revision, {"advertising", "desktop", "bank"},
kind == "advertising.accept" ? "Werbevertrag abgeschlossen." : "Budget gesetzt.");
@@ -10406,6 +10419,8 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
const std::string action = ui_text(*payload, "action");
ui::BankRequest r;
r.manager_slot = manager, r.runtime_club = g_.manager_teams[size_t(manager)], r.revision = revision;
int credit_lender = -1; // a credit booking: its lender (0 the bank), for the press
std::array<uint32_t, 6> credit_before{}; // and the loan before it
if (action == "deposit" || action == "withdraw") {
const cli::Json* amount = ui_field(*payload, "amount");
const std::string minor = amount ? ui_text(*amount, "minor") : std::string{};
@@ -10437,7 +10452,9 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
if (!credit.available) return refuse("credit_unavailable", "Kein Kredit möglich.");
r.kind = ui::BankRequestKind::bank_credit;
r.expected_credit = credit.saved;
credit_before = credit.saved;
r.credit_counterparty = counterparty;
credit_lender = counterparty;
const cli::Json* fees = ui_field(*payload, "acceptFees");
r.accept_credit_fees = fees && std::holds_alternative<bool>(fees->value) && std::get<bool>(fees->value);
if (const cli::Json* edits = ui_field(*payload, "edits"); edits && edits->array())
@@ -10451,6 +10468,19 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
return refuse("invalid_payload", "action ist deposit, withdraw, buy, sell oder credit.");
}
if (!dispatch_bank(r, revision, error)) { restore(); return refuse(error, "Bankauftrag abgelehnt: " + error); }
if (credit_lender >= 0) {
// the press: a loan taken (principal now) or paid off (none left)
const int team = g_.manager_teams[size_t(manager)];
const BankCreditContext now = modern::bank_credit_context(g_, exe_, manager, credit_lender);
const cli::Json lender = credit_lender == 0 ? cli::Json(cli::Json::Object{{"id", "bank"}, {"name", "Bank"}})
: cli::Json(cli::Json::Object{{"id", modern::ui_manager_id(g_, credit_lender - 1)}, {"name", nullptr}});
if (now.saved[0] > 0 && now.saved != credit_before)
modern::note_press(g_, "finance.loan_approved", modern::ui_team_id(g_, team),
cli::Json::Object{{"team", modern::press_team(g_, team)}, {"amount", modern::ui_money(now.saved[0])}, {"bank", lender}});
else if (now.saved[0] == 0 && credit_before[0] > 0)
modern::note_press(g_, "finance.loan_repaid", modern::ui_team_id(g_, team),
cli::Json::Object{{"team", modern::press_team(g_, team)}, {"amount", modern::ui_money(credit_before[0])}, {"bank", lender}});
}
revision = previous + 1;
answer = modern::ui_command_result(request_id, previous, revision, {"bank", "desktop"}, "Bankauftrag ausgeführt.");
} else if (kind == "lineup.commit") {