diff --git a/docs/new_engine/ui-anbindung.md b/docs/new_engine/ui-anbindung.md index 943e89b..d53aaf8 100644 --- a/docs/new_engine/ui-anbindung.md +++ b/docs/new_engine/ui-anbindung.md @@ -106,6 +106,7 @@ Die UI ruft diese über `DataSource::read_almanac` und `read_statistics` direkt | `news.update` | `messageId`, `action` `read`/`unread`/`archive`/`trash`/`restore` | eine Nachricht des eigenen Postfachs: gelesen und Papierkorb sind Markierungen der Oberfläche (im Spielstand, `news_marks` je Manager; die Nachricht bleibt im Postfach des Originals, `restore` holt sie zurück), `archive` ist das „Behalten“ des Originals (eine behaltene Nachricht wird bei vollem Postfach nicht verdrängt), `restore` gibt sie wieder frei. Endgültiges Löschen bietet die Schnittstelle nicht an. Unverändert: `no_change`; Fehler `unknown_message` | | `lineup.commit` | `order`: Spieler-IDs in der gewünschten Reihenfolge | öffnet die Aufstellung wie am Schreibtisch und tauscht die Zeilen; Fehler `unknown_player`, `lineup_refused` (z. B. Verletzte, Ausländerregel) | | `session.advance` (Zusatz) | `transferOffers {playerId: {accept: 0–3} \| {action: "decline"}}` | die Antwort des Verkäufers auf die Gebote für einen Spieler, den er auf die Transferliste gesetzt hat (Stichtag der Woche). Gefragt wird nur, wer das Feld sendet (auch leer); ohne das Feld läuft der Anstoß wie bisher und alle Gebote an menschliche Verkäufer verfallen. Ohne Antwort wird der Lauf zurückgenommen und `decision_pending` mit `args {decision: "transfer_offers", playerId, name, sellerManagerId, askingFee, offers [{index, teamId, fee, monthlySalary, months, loan, eligible}]}` gemeldet; die Oberfläche fragt und sendet den Anstoß erneut | +| `transfer.submit` (Abwerben) | `action: "poach"`, `playerId` · `action: "poachOffer"`, `fee`, `monthlySalary`, `years` 1–4 · `action: "poachCancel"` | zweistufig wie im Original: `poach` prüft, fragt den Verein und zählt den Versuch (fünf je Saison); kann geboten werden, bleibt der Angebotseditor offen und die Antwort trägt `outcome: "poach_open"` und `poach {playerId, name, sellerId, askingFee, askingMonthlySalary, fee, monthlySalary, feeRange {min, max}, salaryRange {min, max}, years, attemptsLeft}`, sonst `poach_refused` mit der Begründung. `poachOffer` wird sofort entschieden (`poach_accepted`, `poach_rejected`; ein zu niedriges Gebot lässt den Editor offen: `poach_open`), `poachCancel` schließt ohne Gebot. Solange der Editor offen ist, verweigern andere Befehle; Fehler `poach_open`, `no_poach`, `unknown_player`, `transfer_refused` | | `lineup.setOrder` | `playerId`, `aspect` 0–3, `value` 2–40 | eine der vier Anweisungen eines aufgestellten Spielers (die vier Pfeile der Originalansicht; der Read `lineup` nennt sie je Feldspieler unter `positions[].orders`); Fehler `invalid_payload`, `unknown_player`, `lineup_refused` | | `lineup.setPiece` | `piece` `freeKick`/`penalty`/`corner` und `playerId`, oder `auto: true` | trägt einen Schützen ein (aufgestellt oder auf der Bank, einsatzfähig) bzw. gibt alle drei an den Assistenten zurück; der Read `lineup` nennt sie unter `setPieces` (`null` = Assistent); Fehler `invalid_payload`, `unknown_player`, `lineup_refused` | | `tactics.commit` | `values`: die acht Werte | jede geänderte Einstellung über die Prüfung der Taktiktafel (eine gesetzte Grundausrichtung beendet die Steuerung durch den Assistenten); Fehler `invalid_tactic` | diff --git a/src/modern/app/modern_session.cpp b/src/modern/app/modern_session.cpp index 0628cd3..c1dbdd4 100644 --- a/src/modern/app/modern_session.cpp +++ b/src/modern/app/modern_session.cpp @@ -10510,6 +10510,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision const ui::TransferMarketState m = modern::project_transfer_market(g_, revision); std::string feedback; bool bid_pending = false; + const auto saved_poach = poach_; try { if (action == "list") { const std::string id = ui_text(*payload, "playerId"); @@ -10599,11 +10600,121 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision answer = modern::ui_command_result(request_id, previous, revision, {"transfer"}, feedback); std::get(answer.value)["outcome"] = "offer_rejected"; } + } else if (action == "poach" || action == "poachOffer" || action == "poachCancel") { + // Poaching, in two steps as the original has it: + // {action: "poach", playerId}: the checks, the club's answer and the special list row + // (start_poach). The attempt counts from here. Where an offer can be made the offer + // editor stays open and the answer carries what is asked under "poach". + // {action: "poachOffer", fee, monthlySalary, years 1-4}: the offer on the open editor, + // decided at once; a low offer keeps the editor open. + // {action: "poachCancel"}: the editor is closed without an offer. + const auto quote_of = [&](const ui::OutgoingTransferEditorState& e) { + return cli::Json::Object{{"playerId", modern::ui_player_id(g_, e.player)}, {"name", ui::original_to_utf8(e.panel.player_name)}, + {"sellerId", e.seller >= 0 && e.seller < league_clubs() ? cli::Json(modern::ui_team_id(g_, e.seller)) : cli::Json(nullptr)}, + {"askingFee", modern::ui_money(int64_t(e.panel.asking_fee))}, {"askingMonthlySalary", modern::ui_money(int64_t(e.panel.asking_monthly_salary))}, + {"fee", modern::ui_money(int64_t(e.fee))}, {"monthlySalary", modern::ui_money(int64_t(e.monthly_salary))}, + // the bounds the editor accepts for the two sums + {"feeRange", cli::Json::Object{{"min", modern::ui_money(int64_t(e.money_calculators[0].minimum))}, {"max", modern::ui_money(int64_t(e.money_calculators[0].maximum))}}}, + {"salaryRange", cli::Json::Object{{"min", modern::ui_money(int64_t(e.money_calculators[1].minimum))}, {"max", modern::ui_money(int64_t(e.money_calculators[1].maximum))}}}, + {"years", int(e.duration_years)}, {"attemptsLeft", modern::poach_attempts_left(g_, manager)}}; + }; + if (action == "poach") { + if (transfer_offer_editor_ || poach_) return refuse("poach_open", "Ein Abwerbeversuch ist noch offen."); + const std::string id = ui_text(*payload, "playerId"); + int slot = -1; + for (int t = 0; t < league_clubs() && slot < 0; ++t) { + if (t == team) continue; + const SquadRange other = squad_range(t); + for (size_t i = 0; i < other.count; ++i) { + const int p = g_.squad_slots[other.first + i] & 0x0fff; + if (p != 0x0fff && modern::ui_player_id(g_, p) == id) { slot = int(other.first + i); break; } + } + } + if (slot < 0) return refuse("unknown_player", "Dieser Spieler spielt bei keinem anderen Verein der Ligen."); + const auto opened = open_poach(manager, slot, revision, error); + if (!opened) { restore(); poach_ = saved_poach; return refuse("transfer_refused", error); } + std::string text; + for (const auto& line : opened->start.messages) text += (text.empty() ? "" : " ") + ui::original_to_utf8(line); + if (opened->editor) { + revision = previous + 1; + transfer_offer_revision_ = revision; + answer = modern::ui_command_result(request_id, previous, revision, {"transfer"}, text.empty() ? "Der Verein nennt seine Forderung." : text); + auto& out = std::get(answer.value); + out["outcome"] = "poach_open"; + out["poach"] = quote_of(opened->editor->editor); + } else { + revision = opened->start.status == PoachStatus::invalid ? previous : previous + 1; + answer = modern::ui_command_result(request_id, previous, revision, {"transfer"}, text.empty() ? "Abwerben ist hier nicht möglich." : text); + auto& out = std::get(answer.value); + out["outcome"] = "poach_refused"; + out["attemptsLeft"] = modern::poach_attempts_left(g_, manager); + } + } else { + if (!transfer_offer_editor_ || !poach_) return refuse("no_poach", "Es ist kein Abwerbeversuch offen."); + transfer_offer_revision_ = revision; // other commands may have counted on since the editor opened + ui::OutgoingTransferEditorState e = transfer_offer_projection(g_, *transfer_offer_editor_, revision, + g_.memory.u8(::bmh::layout::TextGradientDisabled) == 0); + const auto send = [&](ui::OutgoingTransferRequestKind k, ui::OutgoingTransferField field, uint32_t value) + -> std::optional { + ui::OutgoingTransferRequest r; + r.kind = k; + r.identity = {e.manager_slot, e.runtime_club, e.revision, e.list_entry, e.source_slot, e.player, e.seller, e.bid_slot}; + r.field = field, r.value = value, r.quote_loan = e.quote_loan; + r.fee = e.fee, r.monthly_salary = e.monthly_salary, r.duration_years = e.duration_years, r.bonuses = e.bonuses; + r.quoted_fee = e.panel.quoted_fee, r.quoted_monthly_salary = e.panel.quoted_monthly_salary, r.quoted_years = e.panel.quoted_years; + auto d = dispatch_transfer_offer(r, hooks, revision, error); + if (d) e = d->editor; + return d; + }; + if (action == "poachCancel") { + if (!send(ui::OutgoingTransferRequestKind::cancel, ui::OutgoingTransferField::fee, e.fee)) { restore(); poach_ = saved_poach; return refuse("transfer_refused", error); } + feedback = "Der Abwerbeversuch ist beendet."; + } else { + const auto money_of = [&](const char* key) -> int64_t { + const cli::Json* v = ui_field(*payload, key); + try { + if (!v || ui_text(*v, "currency") != "EUR") return -1; + const auto text = ui_text(*v, "minor"); size_t end = 0; const auto amount = std::stoll(text, &end); + return end == text.size() && amount >= 0 && amount % 100 == 0 && amount / 100 <= std::numeric_limits::max() / 12 * 12 ? amount : -1; + } catch (const std::exception&) { return -1; } + }; + const int64_t fee = money_of("fee"), salary = money_of("monthlySalary"); + const cli::Json* years = ui_field(*payload, "years"); + if (fee < 0 || salary < 0 || salary / 100 > std::numeric_limits::max() / 12 || !years || !years->integer() || *years->integer() < 1 || *years->integer() > 4) + return refuse("invalid_payload", "fee, monthlySalary (Money, ganze Euro) und years 1-4 nötig."); + bool ok = true; + if (ok && e.fee != uint32_t(fee / 100)) { e.fee = uint32_t(fee / 100); ok = bool(send(ui::OutgoingTransferRequestKind::quote_change, ui::OutgoingTransferField::fee, e.fee)); } + if (ok && e.monthly_salary != uint32_t(salary / 100)) { + e.monthly_salary = uint32_t(salary / 100); + ok = bool(send(ui::OutgoingTransferRequestKind::quote_change, ui::OutgoingTransferField::monthly_salary, e.monthly_salary)); + } + if (ok && e.duration_years != uint8_t(*years->integer())) { + e.duration_years = uint8_t(*years->integer()); + ok = bool(send(ui::OutgoingTransferRequestKind::quote_change, ui::OutgoingTransferField::duration_years, e.duration_years)); + } + std::optional sent; + if (ok) sent = send(ui::OutgoingTransferRequestKind::submit, ui::OutgoingTransferField::fee, e.fee); + if (!sent) { restore(); poach_ = saved_poach; return refuse("transfer_refused", error); } + const TransferActionStatus status = sent->action.status; + feedback = status == TransferActionStatus::accepted ? "Angenommen: Der Spieler wechselt zu Ihrem Verein." + : status == TransferActionStatus::offer_too_low ? "Das Angebot ist zu niedrig." + : status == TransferActionStatus::pending ? "Das Angebot ist abgegeben." + : notices.empty() ? "Das Angebot wurde abgelehnt." : ""; + for (const auto& n : notices) feedback += " " + n; + revision = previous + 1; + if (!e.closed) transfer_offer_revision_ = revision; // the editor waits for a better offer + answer = modern::ui_command_result(request_id, previous, revision, {"transfer", "squad", "desktop"}, feedback); + auto& out = std::get(answer.value); + out["outcome"] = status == TransferActionStatus::accepted ? "poach_accepted" : !e.closed ? "poach_open" : status == TransferActionStatus::pending ? "offer_pending" : "poach_rejected"; + if (!e.closed) out["poach"] = quote_of(e); + } + } } else { - return refuse("invalid_payload", "action ist list oder bid."); + return refuse("invalid_payload", "action ist list, bid, poach, poachOffer oder poachCancel."); } } catch (const std::exception& ex) { restore(); + poach_ = saved_poach; if (question) return refuse("decision_pending", "Ein menschlicher Verkäufer müsste gefragt werden (noch nicht unterstützt)."); return refuse("transfer_refused", ex.what()); } diff --git a/src/modern/ui/engine_bridge.hpp b/src/modern/ui/engine_bridge.hpp index 5539eaf..d562f38 100644 --- a/src/modern/ui/engine_bridge.hpp +++ b/src/modern/ui/engine_bridge.hpp @@ -22,6 +22,7 @@ Json engine_training_command(const Json &bundle, const Json &draft, Json engine_bank_projection(const Json &bundle); Json engine_bank_command(const Json &bundle, const Json &payload, const std::string &request_id); Json engine_order_command(const Json &bundle, const std::string &player, int aspect, int value, const std::string &request_id); +Json engine_poach_command(const Json &bundle, const Json &payload, const std::string &request_id); Json engine_set_piece_command(const Json &bundle, const Json &payload, const std::string &request_id); Json engine_credit_projection(const Json &bundle, const Json &read); Json engine_credit_command(const Json &bundle, const Json &read, const Json &edits, const std::string &request_id); diff --git a/src/modern/ui/engine_controls.inc b/src/modern/ui/engine_controls.inc index a6981b0..7041b17 100644 --- a/src/modern/ui/engine_controls.inc +++ b/src/modern/ui/engine_controls.inc @@ -213,6 +213,13 @@ void App::engine_poll() { } refresh(); return; } + if (result.response.value("messageType", "") == "poach_squad") { + // the squad of the club a manager wants to poach from + const auto &read = result.response.at("read"); + if (read.value("messageType", "") == "error" || !read.contains("data")) { engine_notice_ = "Der Kader ist nicht verfügbar."; engine_poach_squad_ = Json(); } + else { engine_poach_squad_ = read.at("data"); if (menu_ == "transfer" && transfer_dialog_ == "poach-clubs") { transfer_dialog_ = "poach-roster"; transfer_view_["poach_top"] = 0; focus_after_render_ = "transfer-poach-back"; } } + refresh(); return; + } if (result.response.value("messageType", "") == "credit_preview") { const auto &read = result.response.at("read"); const auto lender = result.response.value("lender", std::string("bank")); diff --git a/src/modern/ui/engine_dto.cpp b/src/modern/ui/engine_dto.cpp index ce6dac0..50d5266 100644 --- a/src/modern/ui/engine_dto.cpp +++ b/src/modern/ui/engine_dto.cpp @@ -190,6 +190,11 @@ Json engine_order_command(const Json &bundle, const std::string &player, int asp require(projection.at("orders").contains(player) && aspect >= 0 && aspect <= 3 && value >= 2 && value <= 40, "Ungültige Anweisung."); return sports_command(bundle, "lineup.setOrder", {{"playerId", player}, {"aspect", aspect}, {"value", value}}, request_id); } +Json engine_poach_command(const Json &bundle, const Json &payload, const std::string &request_id) { + const auto action = payload.at("action").get(); + require(action == "poach" || action == "poachOffer" || action == "poachCancel", "Ungültiger Abwerbeauftrag."); + return sports_command(bundle, "transfer.submit", payload, request_id); +} Json engine_set_piece_command(const Json &bundle, const Json &payload, const std::string &request_id) { const auto projection = engine_lineup_projection(bundle); require(projection.at("set_pieces").is_object(), "Schützen sind in diesem Kontext nicht verfügbar."); diff --git a/src/modern/ui/engine_state.inc b/src/modern/ui/engine_state.inc index 753daaf..2e68bac 100644 --- a/src/modern/ui/engine_state.inc +++ b/src/modern/ui/engine_state.inc @@ -134,6 +134,10 @@ Json engine_transfer_context_,engine_transfer_value_,engine_transfer_filters_=engine_transfer_filters(); bool engine_transfer_submitting_=false; + // poaching: the squad of the club looked at, what the club asks while an attempt is open + // (with the offer being written), and whether an answer of the game is awaited + Json engine_poach_squad_, engine_poach_quote_; + bool engine_poach_waiting_ = false; void engine_transfer_sync(); Json transfer_data() const; std::string transfer_money(const Json &) const; diff --git a/src/modern/ui/engine_transfer.inc b/src/modern/ui/engine_transfer.inc index b4ace36..ccf2c23 100644 --- a/src/modern/ui/engine_transfer.inc +++ b/src/modern/ui/engine_transfer.inc @@ -36,6 +36,33 @@ void App::engine_transfer_sync() { engine_transfer_projection(engine_data_, engine_transfer_filters_); } catch (const std::exception &) { } + if (engine_poach_waiting_) { + // the game's answer to a step of poaching + engine_poach_waiting_ = false; + const bool refused = engine_response_.value("messageType", "") != "command_result"; + const auto outcome = engine_response_.value("outcome", std::string()); + if (outcome == "poach_open" && engine_response_.contains("poach")) { + const bool again = engine_poach_quote_.is_object(); + Json quote = engine_response_.at("poach"); + // the game names him in its short form; the squad just read has his full name + try { for (const auto &row : engine_poach_squad_.at("players")) if (row.at("player").at("id") == quote.at("playerId")) quote["name"] = engine_text(row.at("player").at("name")); } catch (const std::exception &) {} + // the offer starts at what is asked; a second try keeps what was offered + quote["offer_fee"] = again ? engine_poach_quote_.at("offer_fee") : Json(engine_money_minor(quote.at("askingFee")) / 100); + quote["offer_salary"] = again ? engine_poach_quote_.at("offer_salary") : Json(engine_money_minor(quote.at("askingMonthlySalary")) / 100); + quote["offer_years"] = again ? engine_poach_quote_.at("offer_years") : Json(std::clamp(quote.value("years", 2), 1, 4)); + quote["note"] = again ? engine_notice_ : std::string(); + engine_poach_quote_ = quote; + transfer_dialog_ = "poach-offer"; focus_after_render_ = "transfer-poach-fee"; + } else if (refused && engine_poach_quote_.is_object()) { + engine_poach_quote_["note"] = engine_notice_; // the attempt is still open + transfer_dialog_ = "poach-offer"; + } else { + const bool cancelled = engine_poach_quote_.is_object() && outcome.empty() && !refused; + engine_poach_quote_ = Json(); engine_poach_squad_ = Json(); + if (cancelled) transfer_dialog_.clear(); + else { transfer_dialog_ = "booked"; transfer_notice_ = engine_notice_; focus_after_render_ = "transfer-close"; } + } + } if (engine_transfer_submitting_) { engine_transfer_submitting_ = false; transfer_dialog_ = "booked"; @@ -82,10 +109,91 @@ bool App::engine_transfer_action(const std::string &action, }, true); }; + const auto poach_send = [this](const Json &payload, const char *label) { + if (!engine_fresh_ || engine_busy_) return; + try { + const auto request = engine_poach_command(engine_data_, payload, editor::new_id("request:ui-")); + engine_poach_waiting_ = true; + auto link = engine_link_; + engine_start(label, [link, request] { + const auto reply = link->command(request); + return EngineReply{link, link->snapshot(), reply, nullptr}; + }, true); + } catch (const std::exception &e) { message(e.what()); } + }; if (action == "transfer-close") { + // an open attempt is ended in the game as well + if (engine_poach_quote_.is_object()) { poach_send({{"action", "poachCancel"}}, "Abwerbeversuch wird beendet …"); return true; } close_transfer(); return true; } + if (action == "transfer-poach") { + const auto own = engine_data_.at("desktop").at("meta").at("scope").at("teamId").get(); + const auto *c = world_->find("clubs", own); + transfer_dialog_ = "poach-clubs"; + transfer_poach_league_ = c ? c->value("competition", "") : ""; + transfer_poach_club_.clear(); engine_poach_squad_ = Json(); engine_poach_quote_ = Json(); + transfer_view_["poach_top"] = 0; + transfer_return_focus_ = target ? target->GetId() : "transfer-poach"; + focus_after_render_ = "transfer-poach-country"; + refresh(); + return true; + } + if (action == "transfer-poach-club" && target) { + const auto club = target->GetAttribute("data-club", ""); + if (!world_->find("clubs", club)) return true; + transfer_poach_club_ = club; + auto link = engine_link_; + engine_start("Kader wird gelesen …", [link, club] { + auto response = link->read({{"kind", "squad"}, {"teamId", club}}); + return EngineReply{link, link->snapshot(), {{"messageType", "poach_squad"}, {"read", response}}, nullptr}; + }); + return true; + } + if (action == "transfer-poach-back") { + transfer_dialog_ = "poach-clubs"; engine_poach_squad_ = Json(); + focus_after_render_ = "transfer-poach-club-" + transfer_poach_club_; + refresh(); + return true; + } + if (action == "transfer-poach-player") { + if (transfer_dialog_ != "poach-roster" || id.empty()) return true; + std::string name = id; + try { for (const auto &row : engine_poach_squad_.at("players")) if (row.at("player").at("id") == id) name = engine_text(row.at("player").at("name")); } catch (const std::exception &) {} + confirmation("Bei " + name + " anfragen? Schon die Anfrage zählt als einer der fünf Abwerbeversuche dieser Saison, und jeden Spieler kann man nur einmal je Saison fragen.", + [this, poach_send, id] { poach_send({{"action", "poach"}, {"playerId", id}}, "Der Verein wird gefragt …"); }); + popup_accept_ = "Anfragen"; + return true; + } + if (action == "transfer-poach-amount" && target && engine_poach_quote_.is_object()) { + const std::string field = target->GetAttribute("data-id", ""); + if (field != "offer_fee" && field != "offer_salary") return true; + AmountRequest a; + a.title = field == "offer_fee" ? "Ablöse" : "Monatsgehalt"; a.unit = "€"; a.return_focus = target->GetId(); + a.min = 0; a.max = field == "offer_fee" ? 99999999 : 9999999; a.step = 1; a.review = false; + // what the game's editor accepts + try { + const auto &range = engine_poach_quote_.at(field == "offer_fee" ? "feeRange" : "salaryRange"); + a.min = engine_money_minor(range.at("min")) / 100; a.max = std::max(a.min, engine_money_minor(range.at("max")) / 100); + } catch (const std::exception &) {} + a.value = std::clamp(engine_poach_quote_.at(field).get(), a.min, a.max); + a.suggestion_step = field == "offer_fee" ? 100000 : 1000; + a.accept = [this, field](int64_t value) { if (!engine_poach_quote_.is_object()) return false; engine_poach_quote_[field] = value; refresh(); return true; }; + open_amount(std::move(a)); + return true; + } + if (action == "transfer-poach-years" && target && engine_poach_quote_.is_object()) { + const int years = target->GetAttribute("data-id", 0); + if (years >= 1 && years <= 4) engine_poach_quote_["offer_years"] = years; + focus_after_render_ = target->GetId(); refresh(); + return true; + } + if (action == "transfer-poach-submit" && engine_poach_quote_.is_object()) { + const auto cash = [](int64_t euros) { return Json{{"currency", "EUR"}, {"minorUnits", 2}, {"minor", std::to_string(euros * 100)}}; }; + poach_send({{"action", "poachOffer"}, {"fee", cash(engine_poach_quote_.at("offer_fee").get())}, {"monthlySalary", cash(engine_poach_quote_.at("offer_salary").get())}, + {"years", engine_poach_quote_.at("offer_years")}}, "Das Angebot wird geprüft …"); + return true; + } if (action == "transfer-offer-back") { transfer_dialog_ = "offer"; focus_after_render_ = "transfer-fee"; diff --git a/src/modern/ui/transfer_screens.inc b/src/modern/ui/transfer_screens.inc index aa3d85b..ab491fe 100644 --- a/src/modern/ui/transfer_screens.inc +++ b/src/modern/ui/transfer_screens.inc @@ -330,7 +330,7 @@ std::string App::render_transfer() { pg_button("transfer-offer", mine ? "Verleihen" : "Ausleihen", "tm-deal", "id=\"transfer-offer-loan-lend\" data-kind=\"" + std::string(mine ? "lend" : "loan") + "\" " + std::string(chosen.is_object() && (!engine_mode_ || !mine || !on_list) && (!pending || pending_loan) && (!engine_mode_ || mine || chosen.value("loan_allowed", false)) ? "" : "disabled")) + - pg_button("transfer-poach", "Abwerben", "tm-deal", "id=\"transfer-poach\" " + std::string(engine_mode_ ? "disabled title=\"Noch nicht angebunden\"" : "")) + ""; + pg_button("transfer-poach", "Abwerben", "tm-deal", "id=\"transfer-poach\"") + ""; } out += "