The lounge and four buildings of the periphery can be extended in stages
Once it stands, the V.I.P. lounge goes up to four stages, the shopping centre and the clubhouse to three, the car park to four, the restaurant to two. A stage costs money and months of building and then brings a monthly income by league. The stadium page lists them under "Ausbaustufen". Engine: expansions.hpp, stadium read expansions, command stadium.expand; saved in state/modern.json. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
57b8b0f371
commit
8be27f8e57
19 files changed
+391
-3
No files matched your search
@@ -32,6 +32,8 @@ Json engine_ticket_command(const Json &bundle, int euros, const std::string &req
|
||||
|
||||
Json engine_environment_projection(const Json &bundle);
|
||||
Json engine_environment_command(const Json &bundle, const std::string &item, int level, const std::string &request_id);
|
||||
// The next stage of the lounge or of a building of the periphery (read "stadium", expansions).
|
||||
Json engine_expansion_command(const Json &bundle, const std::string &expansion, const std::string &request_id);
|
||||
// A player of the squad gets the shirt number 1-99.
|
||||
Json engine_shirt_number_command(const Json &bundle, const std::string &player, int number, const std::string &request_id);
|
||||
// The monthly budget for international marketing (read "advertising", internationalMarketing).
|
||||
|
||||
@@ -481,6 +481,27 @@ void App::engine_event(Rml::Event &event) {
|
||||
const auto action = node->GetAttribute<Rml::String>("data-action", ""), id = node->GetAttribute<Rml::String>("data-id", "");
|
||||
if (!popup_.empty()) {
|
||||
if(action=="balance-discard"){engine_balance_action(action,node);return;}
|
||||
if (action == "expansion-start") {
|
||||
const std::string expansion = id;
|
||||
std::string name, terms;
|
||||
try {
|
||||
for (const auto &row : engine_data_.at("stadium").at("data").at("expansions"))
|
||||
if (row.value("id", std::string()) == expansion && !row.at("nextPrice").is_null()) {
|
||||
name = row.value("name", std::string());
|
||||
terms = engine_price(row.at("nextPrice")) + ", " + std::to_string(row.value("nextMonths", 0)) + " Monate Bauzeit";
|
||||
}
|
||||
} catch (const std::exception &) {}
|
||||
popup_.clear(); reset_popup(); confirm_ = {}; dirty_ = true;
|
||||
if (name.empty()) return;
|
||||
confirmation(name + " um eine Stufe ausbauen? (" + terms + ")", [this, expansion] {
|
||||
try {
|
||||
engine_finance_submit(engine_expansion_command(engine_data_, expansion, editor::new_id("request:ui-")));
|
||||
} catch (const std::exception &e) { message(e.what()); }
|
||||
});
|
||||
popup_title_ = "Ausbau";
|
||||
popup_accept_ = "Ausbauen";
|
||||
return;
|
||||
}
|
||||
if (action == "naming-accept") {
|
||||
const std::string offer = id;
|
||||
std::string name, terms;
|
||||
|
||||
@@ -514,6 +514,9 @@ Json engine_environment_projection(const Json &bundle) {
|
||||
}
|
||||
return {{"ok", true}, {"rows", rows}};
|
||||
}
|
||||
Json engine_expansion_command(const Json &bundle, const std::string &expansion, const std::string &request_id) {
|
||||
return sports_command(bundle, "stadium.expand", {{"expansionId", expansion}, {"confirmed", true}}, request_id);
|
||||
}
|
||||
Json engine_shirt_number_command(const Json &bundle, const std::string &player, int number, const std::string &request_id) {
|
||||
return sports_command(bundle, "lineup.setNumber", {{"playerId", player}, {"number", number}}, request_id);
|
||||
}
|
||||
|
||||
@@ -217,6 +217,30 @@ bool App::engine_stadium_action(const std::string &action, Rml::Element *target)
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
if (action == "stadium-expansions" && engine_fresh_ && !engine_busy_) {
|
||||
// the further stages of the lounge and of four buildings: where each stands and what the next costs
|
||||
Json rows;
|
||||
try { rows = engine_data_.at("stadium").at("data").at("expansions"); } catch (const std::exception &) { return true; }
|
||||
std::string body = "<div class=\"po-offers\">";
|
||||
for (const auto &row : rows) {
|
||||
const std::string id = row.value("id", std::string());
|
||||
const int stage = row.value("stage", 0), most = row.value("maxStage", 1), left = row.value("monthsLeft", 0);
|
||||
std::string state = stage == 0 ? "noch nicht gebaut" : "Stufe " + std::to_string(stage) + " von " + std::to_string(most);
|
||||
if (stage > 1) state += " · bringt " + engine_price(row.at("monthlyIncome")) + " im Monat";
|
||||
const std::string next = left > 0 ? "Die nächste Stufe ist in " + std::to_string(left) + (left == 1 ? " Monat fertig" : " Monaten fertig")
|
||||
: stage == 0 ? std::string("Erst bauen, dann ausbauen")
|
||||
: row.at("nextPrice").is_null() ? std::string("Fertig ausgebaut")
|
||||
: "Nächste Stufe: " + engine_price(row.at("nextPrice")) + " · " + std::to_string(row.value("nextMonths", 0)) + " Monate Bauzeit";
|
||||
body += "<div class=\"po-offer\"><div class=\"po-text\"><strong>" + esc(row.value("name", std::string())) + "</strong><span>" + esc(state) + "</span><span>" + esc(next) + "</span></div>" +
|
||||
pg_button("expansion-start", "Ausbauen", "primary", "id=\"expansion-start-" + esc(id) + "\" data-id=\"" + esc(id) + "\" " + std::string(row.value("available", false) ? "" : "disabled=\"disabled\"")) + "</div>";
|
||||
}
|
||||
body += "</div>";
|
||||
message("Die Lounge und vier Gebäude der Peripherie lassen sich in Stufen ausbauen. Jede weitere Stufe kostet Geld und Bauzeit und bringt danach jeden Monat Einnahmen.");
|
||||
popup_title_ = "Ausbaustufen";
|
||||
popup_close_ = "Schließen";
|
||||
popup_body_ = body;
|
||||
return true;
|
||||
}
|
||||
if (action == "stadium-rename" && engine_fresh_ && !engine_busy_) {
|
||||
Json data;
|
||||
try { data = engine_data_.at("stadium").at("data"); } catch (const std::exception &) { return true; }
|
||||
|
||||
@@ -205,6 +205,7 @@ std::string App::render_stadium() {
|
||||
out+=btn("stadium-future","<span>"+std::string(i?"Zukunft":"Aktuell")+"</span>",std::string(i?"":"first ")+(on?"on":""),on?std::string("style=\"pointer-events:none;\" aria-pressed=\"true\""):std::string("id=\"stadium-future\" aria-pressed=\"false\""));
|
||||
}
|
||||
out+="</div>"+pg_button("stadium-data","Stadion-Daten","","id=\"stadium-data\"");
|
||||
if(engine_mode_)out+=pg_button("stadium-expansions","Ausbaustufen","","id=\"stadium-expansions\"");
|
||||
// the name is the manager's to choose until he sells it to a sponsor
|
||||
if(engine_mode_)out+=pg_button("stadium-rename","Stadion umbenennen","","id=\"stadium-rename\" "+std::string(overview.value("name_editable",false)?"":"disabled=\"disabled\" title=\"Der Name ist an einen Sponsor verkauft\""));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user