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:
1 parent
651d262546
commit
055b48697e
5 files changed
+60
-3
No files matched your search
@@ -35,7 +35,7 @@ Revision kommt vom Aufrufer (Konsole bzw. AppController), der Read ändert nicht
|
||||
| `advertising` | 14 Banden (`ad:board/<n>`), Trikot (`ad:shirt`), TV-Rechte (`ad:tv`) je mit Vertrag (Sponsor, Monatsbetrag, Restmonate, Verlängerung, Option) und den offenen Angeboten (`offer:ad-<Platz>-<Nr.>`, Sponsor, Betrag, Banden, Monate, `allowed`); die drei Budgets (Merchandising, Presse, Fanarbeit) mit Stand, Höchstbetrag, Lieferwochen; die Finanzvorschau des Originals |
|
||||
| `stadium` | Umfeld (14 Objekte mit Namen und Bautagen; Verkehrsanbindung mit `stage` und `maxStage`: Classic 3, Modern-Welt 4; sonst `built`), die acht Anlagen (Stufe, Höchststufe, Bauwochen, ob ausbaubar), die acht Tribünenblöcke (Plätze, Höchstplätze, Sitzplätze, Dach, Bauwochen, Plätze nach dem Bau), Eintrittspreis (8–25 €); das offene Angebot des Stadion-Dialogs (`quote`: Umfeld mit Preis, oder Anlage mit Zielstufe, Preis, Bauwochen und dem Trinkgeld-Bereich 6–14 %) |
|
||||
| `transfer` | die Transferliste (`listing:<n>`: Spieler, Alter, Position, Stärke, Verkäufer, Ablöseforderung, Gehaltsreferenz pro Jahr, Gehaltsforderung in %, Zahl der Angebote, eigene Listung, eigenes Gebot), der eigene Kader (gelistet oder nicht), Kontostand, Kreditrahmen |
|
||||
| `news` | Presseereignisse eines Teams (`teamId`, Vorgabe das Team am Schreibtisch), `from`/`until` (ISO, Vorgabe bis heute), `limit` (Vorgabe 50, die neuesten): `events` je `{id, type, date, scope, data, variant: null}` nach [Pressevertrag](../new_ui/integration/PRESS.md), `total`. Quelle ist der Almanach, darum gleich bei jedem Lesen und mit stabiler ID (`press-event:<Typ>:<Vorkommnis>:<Team>`). Typen: `match.result`, `cup.round_result`, `cup.final_result`, `cup.extra_time`, `cup.penalties`, `player.sent_off`, `player.injury`, `run.wins` (3/5/8/10/15), `run.unbeaten` (5/10/15/20/30), `run.winless` (5/8/10/15), `run.losses` (3/5/8/10), `league.position`, `league.champion`, `cup.won`, `indoor.won`. Fakten: `team`, `opponent`, `competition` (mit `kind`, `season`), `matchId`, `score {for, against}` aus Sicht des Teams, `venue`, `trailed`, `minute` (das entscheidende Tor), `outcome`, `round`, `shootout`, `player`, `matches`, `position`, `points`. Dazu Geschäftsereignisse aus dem Pressejournal im Spielstand (`state/modern.json`, `press`): beim Anstoß aus dem Kadervergleich der menschlichen Vereine `transfer.signed` (`fromClub`), `transfer.free`, `transfer.sold` (`toClub`; auch ein freigegebener Spieler, der im selben Anstoß woanders unterschreibt), `contract.ended`; `toto.win`/`toto.loss` (`amount`); `career.season_finished`/`career.season_started`; aus bestätigten Befehlen `contract.extended` (`years`, `wage`) und `career.manager_resigned`. Ablösen kennt der Kadervergleich nicht (`fee: null`). Ohne Welt-IDs (Classic-Daten) heißt ein Verein `team:<Laufzeitnummer>`, die sich zum Saisonstart ändern kann. Noch nicht: Derby, Auf-/Abstieg, Finanzen, Stadion, Werbung |
|
||||
| `news` | Presseereignisse eines Teams (`teamId`, Vorgabe das Team am Schreibtisch), `from`/`until` (ISO, Vorgabe bis heute), `limit` (Vorgabe 50, die neuesten): `events` je `{id, type, date, scope, data, variant: null}` nach [Pressevertrag](../new_ui/integration/PRESS.md), `total`. Quelle ist der Almanach, darum gleich bei jedem Lesen und mit stabiler ID (`press-event:<Typ>:<Vorkommnis>:<Team>`). Typen: `match.result`, `cup.round_result`, `cup.final_result`, `cup.extra_time`, `cup.penalties`, `player.sent_off`, `player.injury`, `run.wins` (3/5/8/10/15), `run.unbeaten` (5/10/15/20/30), `run.winless` (5/8/10/15), `run.losses` (3/5/8/10), `league.position`, `league.champion`, `cup.won`, `indoor.won`. Fakten: `team`, `opponent`, `competition` (mit `kind`, `season`), `matchId`, `score {for, against}` aus Sicht des Teams, `venue`, `trailed`, `minute` (das entscheidende Tor), `outcome`, `round`, `shootout`, `player`, `matches`, `position`, `points`. Dazu Geschäftsereignisse aus dem Pressejournal im Spielstand (`state/modern.json`, `press`): beim Anstoß aus dem Kadervergleich der menschlichen Vereine `transfer.signed` (`fromClub`), `transfer.free`, `transfer.sold` (`toClub`; auch ein freigegebener Spieler, der im selben Anstoß woanders unterschreibt), `contract.ended`; `toto.win`/`toto.loss` (`amount`); `career.season_finished`/`career.season_started`; beim Saisonwechsel `league.promoted`/`league.relegated` (`competition` die neue, `from` die alte Liga); aus bestätigten Befehlen `contract.extended` (`years`, `wage`), `advertising.signed` (`company`, `amount` monatlich, `months`, `place` boards/shirt/tv), `finance.loan_approved`/`finance.loan_repaid` (`amount`, `bank`), `stadium.expansion_planned` (`block`, `seats` Ziel insgesamt) und `career.manager_resigned`. Ablösen kennt der Kadervergleich nicht (`fee: null`). Ohne Welt-IDs (Classic-Daten) heißt ein Verein `team:<Laufzeitnummer>`, die sich zum Saisonstart ändern kann. Noch nicht: Derby, Monatsbilanz (`finance.profit`/`finance.loss`), fertiger Stadionausbau, Aktien |
|
||||
| `calendar` | der Saisonkalender des Teams am Schreibtisch, `from`/`until` (ISO, Vorgabe der laufende Monat): `days` (Datum, `seasonDay`, `today`, `eventKinds`: `league`, `cup:<n>`, `replay`, `indoor`, `special`, `national`, `friendly`; `fixtureIds`) und `fixtures` (die eigenen Ligaspiele: `fixture:league-<Liga>-<Runde>-<Nr.>`, Wettbewerb, Runde, `originalDate`, `scheduledDate`, Heim/Gast, `status` `scheduled`/`played`/`rescheduled`/`postponed`, `result`). Verlegte und im Winter ausgefallene Spiele stehen am Nachholtag. Pokalspiele nur als `eventKinds`; Fehler `invalid_range` |
|
||||
| `scheduling` | die verlegbaren eigenen Ligaspiele (`move:<Tag>-<Liga>-<Runde>-<Nr.>`, Datum, Runde, Heim/Gast, mögliche Zieldaten) und die verlegten, die sich zurücknehmen lassen |
|
||||
| `friendly` | mit `opponentId`, optional `home`: das Angebot für ein Freundschaftsspiel (Heim/Gast, Kosten, Zahler, ob der Gegner einen menschlichen Manager hat) und die freien Daten der Saison; kein Zufall. Am Schreibtisch des Bundestrainers ein Länderspiel (`national: true`, Gegner ein anderes Nationalteam, dazu `ratings` beider Teams): das Original zieht für die Bewertung Zufall; der Read rechnet auf einer Kopie des Generators, die Buchung zieht dieselben Zahlen |
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <variant>
|
||||
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/schedule.hpp"
|
||||
#include "game/state.hpp"
|
||||
#include "modern/content/ui_contract.hpp"
|
||||
#include "modern/game/almanac.hpp"
|
||||
@@ -148,6 +149,23 @@ void journal_advance(ModernState& g, const ModernState& before) {
|
||||
else if (b.paid > 0) note_press(g, "toto.loss", id, O{{"team", press_team(g, team)}, {"amount", ui_money(b.paid)}});
|
||||
}
|
||||
// a new season
|
||||
// promotion and relegation: a human club's league at the new season (a lower index is the
|
||||
// higher league)
|
||||
const auto league_entity = [&](int league) {
|
||||
const std::string id = size_t(league) < g.world_league_id.size() && !g.world_league_id[size_t(league)].empty()
|
||||
? g.world_league_id[size_t(league)] : "league:" + std::to_string(league);
|
||||
const std::string name = size_t(league) < g.world_league_name.size() && !g.world_league_name[size_t(league)].empty()
|
||||
? g.world_league_name[size_t(league)] : "Liga " + std::to_string(league + 1);
|
||||
return J(O{{"id", id}, {"name", name}, {"kind", "league"}, {"season", season_text(g)}});
|
||||
};
|
||||
if (g.season != before.season)
|
||||
for (const std::string& club : clubs) {
|
||||
const int was_team = team_of_identity(before, club), team = team_of_identity(g, club);
|
||||
const int from = team_league(was_team), to = team_league(team);
|
||||
if (from == to || from >= kLeagueCount || to >= kLeagueCount) continue;
|
||||
note_press(g, to < from ? "league.promoted" : "league.relegated", ui_team_id(g, team),
|
||||
O{{"team", press_team(g, team)}, {"competition", league_entity(to)}, {"from", league_entity(from)}, {"season", season_text(g)}});
|
||||
}
|
||||
if (g.season != before.season)
|
||||
for (const std::string& club : human_clubs(g)) {
|
||||
const int team = team_of_identity(g, club);
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
// - a kickoff (session.advance, also live): the squads of the human clubs before and after
|
||||
// give transfer.signed (with fromClub, or transfer.free from the pool), transfer.sold
|
||||
// (toClub) and contract.ended (to the pool); a new toto settlement gives toto.win /
|
||||
// toto.loss; a season change career.season_finished and career.season_started;
|
||||
// - confirmed commands: contract.extended (contract.offer), career.manager_resigned.
|
||||
// toto.loss; a season change career.season_finished and career.season_started, and a human
|
||||
// club in another league league.promoted / league.relegated;
|
||||
// - confirmed commands: contract.extended (contract.offer), advertising.signed
|
||||
// (advertising.accept), finance.loan_approved / finance.loan_repaid (bank.commit credit),
|
||||
// stadium.expansion_planned (a stand block, stadium.commit), career.manager_resigned.
|
||||
// Fees are not known from the squads: the transfer events carry no fee (the renderer's
|
||||
// fee-undisclosed variants).
|
||||
|
||||
|
||||
@@ -725,6 +725,12 @@ int main(int argc, char** argv) {
|
||||
std::string all;
|
||||
for (const auto& [t, n] : journal) all += t + " " + std::to_string(n) + ", ";
|
||||
std::printf("(journal: %s)\n", all.c_str());
|
||||
// the confirmed commands above: an advertising contract, a bank credit
|
||||
const auto noted = [&](const std::string& type) {
|
||||
for (const auto& e : std::as_const(session).state().press) if (e.type == type) return true;
|
||||
return false;
|
||||
};
|
||||
check(noted("advertising.signed") && noted("finance.loan_approved"), "journal: advertising and credit noted");
|
||||
}
|
||||
// the journal: the new season (noted at the kickoff that changed it)
|
||||
check(types["career.season_started"] > 0, "business events from the journal");
|
||||
|
||||
Reference in new issue
Block a user