Bind the six-column Toto coupon to reviewed engine costs and settlement (by Codex)
This commit is contained in:
1 parent
eb140cdb1c
commit
dfb972abbd
27 files changed
+368
-53
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include "modern/content/press_journal.hpp"
|
||||
#include "modern/content/world_expand.hpp"
|
||||
#include "modern/content/world_package.hpp"
|
||||
#include "modern/content/toto_quote.hpp"
|
||||
#include "modern/content/world_save.hpp"
|
||||
#include "modern/game/balance_plan.hpp"
|
||||
#include "modern/game/bank_credit.hpp"
|
||||
@@ -10440,25 +10441,12 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
{"terminationReason", "last_human_resigned"}};
|
||||
} else if (kind == "toto.submit") {
|
||||
// payload {stake: Money per column, columns: [[11 tips: 1 home, 0 draw, 2 away], ... up to 6]}
|
||||
const cli::Json* stake = ui_field(*payload, "stake");
|
||||
const cli::Json* columns = ui_field(*payload, "columns");
|
||||
int64_t cents = -1;
|
||||
try { cents = stake ? std::stoll(ui_text(*stake, "minor")) : -1; } catch (const std::exception&) { cents = -1; }
|
||||
if (cents <= 0 || cents % 100 || !columns || !columns->array()) return refuse("invalid_payload", "stake (Money) und columns nötig.");
|
||||
std::vector<std::array<uint8_t, 11>> tips;
|
||||
for (const auto& column : *columns->array()) {
|
||||
const auto* c = column.array();
|
||||
if (!c || c->size() != 11) return refuse("invalid_payload", "Jede Spalte hat elf Tipps.");
|
||||
std::array<uint8_t, 11> t{};
|
||||
for (size_t i = 0; i < 11; ++i) {
|
||||
if (!(*c)[i].integer() || *(*c)[i].integer() < 0 || *(*c)[i].integer() > 2) return refuse("invalid_payload", "Tipps sind 0, 1 oder 2.");
|
||||
t[i] = uint8_t(*(*c)[i].integer());
|
||||
}
|
||||
tips.push_back(t);
|
||||
}
|
||||
if (!dispatch_pools_columns(manager, uint32_t(cents / 100), tips, revision, error)) { restore(); return refuse("toto_refused", error); }
|
||||
const auto draft=modern::parse_toto_draft(*payload);
|
||||
if(!draft)return refuse("invalid_payload","Ein gültiger Euro-Einsatz und vollständige Spalten sind nötig.");
|
||||
const auto &tips=draft->columns;
|
||||
if (!dispatch_pools_columns(manager, draft->stake, tips, revision, error)) { restore(); return refuse("toto_refused", error); }
|
||||
revision = previous + 1;
|
||||
answer = modern::ui_command_result(request_id, previous, revision, {"toto", "desktop"}, "Tippschein abgegeben.");
|
||||
answer = modern::ui_command_result(request_id, previous, revision, {"toto", "desktop"}, draft->stake==0?"Tippschein zurückgezogen.":"Tippschein abgegeben.");
|
||||
} else if (kind == "sponsor.answer") {
|
||||
// payload {accept: bool}: the answer to the exclusive sponsor offer from a camp stay
|
||||
const cli::Json* accept = ui_field(*payload, "accept");
|
||||
|
||||
Reference in new issue
Block a user