Bind environment and advertising to confirmed engine actions (by Codex)
This commit is contained in:
1 parent
dcf42f2da7
commit
e9483048f4
19 files changed
+395
-23
No files matched your search
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
std::string App::render_environment() {
|
||||
const auto snapshot = snap();
|
||||
const auto snapshot = engine_mode_ ? Snapshot{input_revision(), world_, Json::object()} : snap();
|
||||
if (!snapshot.world) return "<p class=\"environment-unavailable\">Die Umfeldvorschau ist derzeit nicht verfügbar.</p>";
|
||||
const auto view = demo_environment_rows(snapshot.state, *snapshot.world);
|
||||
const auto view = engine_mode_ ? engine_environment_projection(engine_data_) : demo_environment_rows(snapshot.state, *snapshot.world);
|
||||
if (!view.value("ok", false)) return "<p class=\"environment-unavailable\">Die Umfeldvorschau ist derzeit nicht verfügbar.</p>";
|
||||
const auto funded = theme_ == "silver" ? "#805b18" : theme_ == "matchday" ? "#e1c68b" : "#e5cd8c";
|
||||
const auto unfunded = theme_ == "silver" ? "#526779" : theme_ == "matchday" ? "#b7b4b9" : "#6f8595";
|
||||
@@ -39,7 +39,7 @@ std::string App::render_environment() {
|
||||
"\" data-index=\"" + std::to_string(i) + "\" data-id=\"" + std::to_string(value) +
|
||||
"\" aria-pressed=\"" + (selected ? "true" : "false") + "\" aria-label=\"" +
|
||||
esc(name + ": " + std::to_string(value) + (value == 1 ? " Stern" : " Sterne")) +
|
||||
"\" title=\"" + (value ? std::to_string(value) + (value == 1 ? " Stern" : " Sterne") : "Budget auf null setzen") + "\"");
|
||||
"\" " + std::string(engine_mode_ && value > row.at("max").get<int>() ? "disabled " : "") + "title=\"" + (value ? std::to_string(value) + (value == 1 ? " Stern" : " Sterne") : "Budget auf null setzen") + "\"");
|
||||
}
|
||||
out += "</div><div class=\"environment-picture\" style=\"" + rect(18, 138, inner, panel.image_h) + "\">" +
|
||||
img("environment." + row.at("image").get<std::string>() + "." + std::to_string(row.at("cell").get<int>()),
|
||||
@@ -47,7 +47,7 @@ std::string App::render_environment() {
|
||||
"</div><div class=\"environment-caption\" style=\"top:" + scalar(152 + panel.image_h) + "dp;height:" +
|
||||
scalar(i < 3 ? 74.546875 : 60) + "dp;\"><span class=\"environment-cost\" id=\"environment-cost-" + std::to_string(i) +
|
||||
"\" aria-label=\"" + esc(name + " Monatskosten") + "\">" +
|
||||
esc(money(row.at("cost").get<int64_t>(), snapshot.world->manifest().value("currency", Json::object())) + " / Monat") + "</span>";
|
||||
esc(money(row.at("cost").get<int64_t>(), engine_mode_ ? Json{{"code", "EUR"}, {"minor_units", 2}} : snapshot.world->manifest().value("currency", Json::object())) + " / Monat") + "</span>";
|
||||
if (i < 3)
|
||||
out += "<span class=\"environment-standing\">" + std::to_string(row.at("rank").get<int>()) + ". / " +
|
||||
std::to_string(row.at("league").get<int>()) + ". Liga</span>";
|
||||
@@ -55,8 +55,8 @@ std::string App::render_environment() {
|
||||
}
|
||||
out += "<div class=\"environment-emblem\"><div class=\"environment-ball\">" +
|
||||
img("art.environment-ball-v1.png", 400, 400, false, false, 640) + "</div>";
|
||||
const auto &managers = snapshot.state.at("managers");
|
||||
const auto managed = managers.is_array() && !managers.empty() ? demo_career_manager(snapshot.state).value("club", "") : "";
|
||||
const bool demo_manager = !engine_mode_ && snapshot.state.at("managers").is_array() && !snapshot.state.at("managers").empty();
|
||||
const auto managed = engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId").get<std::string>() : demo_manager ? demo_career_manager(snapshot.state).value("club", "") : "";
|
||||
const auto *club = snapshot.world->find("clubs", managed);
|
||||
out += "<div class=\"environment-crest\" aria-label=\"" + esc(club ? snapshot.world->name(*club) : "Vereinswappen nicht verfügbar") + "\">" +
|
||||
(club ? img(club->value("crest", ""), 162, 162, true) : "<span>—</span>") + "</div></div></div>";
|
||||
|
||||
Reference in new issue
Block a user