Exclusive sponsor from training camp stays (Modern)
The Middle East camps share their grades but differ in price; a stay
can now bring an exclusive sponsor: 15 / 30 / 45 % per stay (Doha /
Abu Dhabi / Dubai), a shirt (about every third offer) or four boards at
twice the club's best regular offer for 12 months. Accepted on a free
place it starts at once, otherwise it is queued and starts at a month
change once the place is free. The offer goes through the regular
advertising acceptance.
Camp fields sponsor_chance / sponsor_bonus / sponsor_months (data
format F4, editable; built-in values for the Middle East camps), state
saved in state/modern.json, read query {kind: "sponsor"}, session action
dispatch_exclusive_sponsor, tests in modern_camp_tests, SIM_SPONSOR=1.
Sponsor artwork does not exist yet (asset: null, documented).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
44a7a77915
commit
77d1f93e8f
20 files changed
+333
-13
No files matched your search
@@ -8614,6 +8614,22 @@ bool ModernSession::dispatch_toto(const ui::TotoRequest& request, uint64_t& revi
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModernSession::dispatch_exclusive_sponsor(int manager, bool accept, uint64_t& revision, std::string& result,
|
||||
std::string& error) {
|
||||
const int active = int(g_.memory.u8(::bmh::layout::ActiveManager));
|
||||
if (manager != active || manager < 0 || size_t(manager) >= g_.manager_teams.size()) {
|
||||
error = "stale_manager_or_revision"; return false;
|
||||
}
|
||||
switch (modern::answer_exclusive_sponsor(g_, manager, accept)) {
|
||||
case ExclusiveSponsorAnswer::started: result = "started"; break;
|
||||
case ExclusiveSponsorAnswer::queued: result = "queued"; break;
|
||||
case ExclusiveSponsorAnswer::declined: result = "declined"; break;
|
||||
case ExclusiveSponsorAnswer::invalid: error = "no_sponsor_offer"; return false;
|
||||
}
|
||||
++revision;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModernSession::dispatch_pools_columns(int manager, uint32_t stake, const std::vector<std::array<uint8_t, 11>>& columns,
|
||||
uint64_t& revision, std::string& error) {
|
||||
const int active = int(g_.memory.u8(::bmh::layout::ActiveManager));
|
||||
|
||||
@@ -610,6 +610,9 @@ public:
|
||||
// toto_coupon_requires_eleven_matches, invalid_toto_coupon, stale_manager_or_revision.
|
||||
bool dispatch_pools_columns(int manager, uint32_t stake, const std::vector<std::array<uint8_t, 11>>& columns,
|
||||
uint64_t& revision, std::string& error);
|
||||
// The answer to an exclusive sponsor offer from a camp stay (docs/new_engine/trainingslager.md).
|
||||
// `result` is "started" or "queued" when accepted, "declined" otherwise. Error: no_sponsor_offer.
|
||||
bool dispatch_exclusive_sponsor(int manager, bool accept, uint64_t& revision, std::string& result, std::string& error);
|
||||
bool dispatch_tactics(const ui::TacticsRequest&, uint64_t& revision, std::string& error);
|
||||
bool dispatch_lineup(const ui::LineupRequest&, uint64_t& revision, std::string& error);
|
||||
// Source PitchScreen live-match path: apply one user-picked field/bench
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "game/messages.hpp"
|
||||
#include "game/schedule.hpp"
|
||||
#include "game/table.hpp"
|
||||
#include "modern/content/statistics.hpp"
|
||||
@@ -203,6 +204,27 @@ J squad(const ModernState& g, int team) {
|
||||
return O{{"ok", true}, {"club", club_json(g, team)}, {"players", std::move(players)}};
|
||||
}
|
||||
|
||||
// The manager's exclusive sponsor offer or queued contract (docs/new_engine/trainingslager.md).
|
||||
// "asset" stays null: there is no artwork for these sponsors yet.
|
||||
J sponsor(const ModernState& g, int manager) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size()) return error("invalid_manager");
|
||||
J offer = nullptr, queued = nullptr;
|
||||
if (size_t(manager) < g.exclusive_sponsors.size()) {
|
||||
const auto& s = g.exclusive_sponsors[size_t(manager)];
|
||||
if (s.offered || s.queued) {
|
||||
std::string camp_name;
|
||||
for (const auto& c : g.training_camps)
|
||||
if (c.id == s.camp) camp_name = c.name;
|
||||
J row = O{{"kind", s.kind == 1 ? "shirt" : "boards"}, {"boards", s.kind == 1 ? 0 : int(s.units)},
|
||||
{"monthly", int64_t(s.monthly)}, {"months", int(s.months)},
|
||||
{"sponsor", almanac_utf8(message_text(g, ::bmh::layout::Advertising_FormatError_ExecutableField3 + uint32_t(s.sponsor) * 4))},
|
||||
{"asset", nullptr}, {"camp", O{{"id", s.camp}, {"name", camp_name}}}};
|
||||
(s.offered ? offer : queued) = std::move(row);
|
||||
}
|
||||
}
|
||||
return O{{"ok", true}, {"offer", std::move(offer)}, {"queued", std::move(queued)}};
|
||||
}
|
||||
|
||||
// The Toto coupon of the matchday and the manager's columns (docs/new_engine/toto.md).
|
||||
J toto(const ModernState& g, int manager) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size()) return error("invalid_manager");
|
||||
@@ -255,6 +277,7 @@ cli::Json query_projection(const ModernState& g, int manager, const cli::Json& r
|
||||
try {
|
||||
if (k == "status") return status(g, manager);
|
||||
if (k == "toto") return toto(g, manager);
|
||||
if (k == "sponsor") return sponsor(g, manager);
|
||||
if (k == "leagues") return leagues(g);
|
||||
if (k == "table" || k == "fixtures") {
|
||||
const int league = league_of_request(g, field(request, "league"));
|
||||
|
||||
@@ -138,6 +138,13 @@ World read_world(const obw::Documents& documents) {
|
||||
camp.quality[k] = uint8_t(grade);
|
||||
}
|
||||
if (camp.base_price < 0) fail("negative training camp price: " + camp.id);
|
||||
// exclusive sponsor (optional; -1 = not given: the built-in values of the same camp id apply)
|
||||
camp.sponsor_chance = integer(find(c, "sponsor_chance"), -1);
|
||||
camp.sponsor_bonus = integer(find(c, "sponsor_bonus"), 200);
|
||||
camp.sponsor_months = integer(find(c, "sponsor_months"), 12);
|
||||
if (camp.sponsor_chance > 100 || camp.sponsor_bonus < 100 || camp.sponsor_bonus > 500 ||
|
||||
camp.sponsor_months < 1 || camp.sponsor_months > 60)
|
||||
fail("training camp sponsor values out of range: " + camp.id);
|
||||
catalogue.camps.push_back(std::move(camp));
|
||||
}
|
||||
w.camps = std::move(catalogue);
|
||||
|
||||
@@ -462,6 +462,18 @@ void install_training_camps(ModernState& g, const World& world) {
|
||||
if (catalogue.camps.empty()) obw::detail::fail("the training camp catalogue is empty");
|
||||
g.camp_maps = catalogue.maps;
|
||||
g.training_camps = catalogue.camps;
|
||||
// A camp without sponsor values takes those of the built-in camp with the same id (the
|
||||
// Middle East camps), else none.
|
||||
for (TrainingCamp& camp : g.training_camps) {
|
||||
if (camp.sponsor_chance >= 0) continue;
|
||||
camp.sponsor_chance = 0;
|
||||
for (const TrainingCamp& built_in : default_camp_catalogue().camps)
|
||||
if (built_in.id == camp.id) {
|
||||
camp.sponsor_chance = built_in.sponsor_chance;
|
||||
camp.sponsor_bonus = built_in.sponsor_bonus;
|
||||
camp.sponsor_months = built_in.sponsor_months;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace bmh::modern
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#include "content/digest.hpp"
|
||||
#include "content/package.hpp"
|
||||
@@ -44,6 +45,32 @@ std::vector<std::string> strings(const J& value) {
|
||||
}
|
||||
std::string world_identity(const World& world) { return world.id + "@" + world.data_revision; }
|
||||
|
||||
// Exclusive sponsor offers and queued contracts per manager (docs/new_engine/trainingslager.md).
|
||||
J sponsors_json(const std::vector<ModernState::ExclusiveSponsor>& sponsors) {
|
||||
A out;
|
||||
for (const auto& s : sponsors)
|
||||
out.push_back(O{{"offered", s.offered}, {"queued", s.queued}, {"kind", int(s.kind)}, {"units", int(s.units)},
|
||||
{"months", int(s.months)}, {"sponsor", int(s.sponsor)}, {"monthly", int64_t(s.monthly)}, {"score", int(s.score)}, {"camp", s.camp}});
|
||||
return out;
|
||||
}
|
||||
std::vector<ModernState::ExclusiveSponsor> sponsors_json(const J& value) {
|
||||
std::vector<ModernState::ExclusiveSponsor> out;
|
||||
for (const J& row : arr(value)) {
|
||||
ModernState::ExclusiveSponsor s;
|
||||
const J& offered = get(row, "offered");
|
||||
const J& queued = get(row, "queued");
|
||||
if (!std::holds_alternative<bool>(offered.value) || !std::holds_alternative<bool>(queued.value)) fail("invalid sponsor flags");
|
||||
s.offered = std::get<bool>(offered.value), s.queued = std::get<bool>(queued.value);
|
||||
s.kind = uint8_t(num(get(row, "kind"))), s.units = uint8_t(num(get(row, "units")));
|
||||
s.months = uint8_t(num(get(row, "months"))), s.sponsor = uint8_t(num(get(row, "sponsor")));
|
||||
s.monthly = uint32_t(num(get(row, "monthly"))), s.camp = str(get(row, "camp"));
|
||||
s.score = uint16_t(num(get(row, "score")));
|
||||
if (s.kind > 1 || s.units > 14 || s.sponsor > 9) fail("invalid exclusive sponsor");
|
||||
out.push_back(std::move(s));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// The Toto columns 2-6 and the last settlement per manager (docs/new_engine/toto.md).
|
||||
J pools_json(const std::vector<ModernState::PoolsColumns>& pools) {
|
||||
A out;
|
||||
@@ -107,7 +134,8 @@ void save_world_career(const std::filesystem::path& path, const World& world, co
|
||||
{"league_ids", strings(state.world_league_id)},
|
||||
{"league_names", strings(state.world_league_name)},
|
||||
{"generated_players", int64_t(state.almanac.generated_players)},
|
||||
{"pools", pools_json(state.pools)}});
|
||||
{"pools", pools_json(state.pools)},
|
||||
{"exclusive_sponsors", sponsors_json(state.exclusive_sponsors)}});
|
||||
// The almanac: finished seasons unchanged, the running one encoded now.
|
||||
for (const auto& [name, bytes] : state.almanac.finished) docs[name] = bytes;
|
||||
if (state.almanac.current.season >= 0) docs["history/current.bin"] = encode_almanac_season(state.almanac.current);
|
||||
@@ -156,6 +184,7 @@ SavedWorldCareer load_world_career(const std::filesystem::path& path, const Worl
|
||||
out.state.world_league_name = strings(get(modern, "league_names"));
|
||||
out.state.almanac.generated_players = uint32_t(num(get(modern, "generated_players")));
|
||||
out.state.pools = pools_json(get(modern, "pools"));
|
||||
out.state.exclusive_sponsors = sponsors_json(get(modern, "exclusive_sponsors"));
|
||||
for (const auto& [name, bytes] : docs) {
|
||||
if (!name.starts_with("history/season-")) continue;
|
||||
decode_almanac_season(bytes); // a damaged season fails here, not in the almanac screen
|
||||
|
||||
@@ -1481,6 +1481,7 @@ bool book_training_camp(ModernState& g, int manager, int resort, WatcomRandom& r
|
||||
uint8_t& stays = g.manager_records.at(rec + kStays);
|
||||
stays = uint8_t((stays + 1) | 0x80);
|
||||
modern::training_camp_effect(g, manager, resort, rand);
|
||||
modern::roll_exclusive_sponsor(g, manager, resort, rand); // Modern: a chance of an exclusive sponsor
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2159,6 +2160,106 @@ AdvertisingOfferResult accept_advertising_offer(ModernState& g,
|
||||
return result;
|
||||
}
|
||||
|
||||
// --- Exclusive sponsor (Modern) -------------------------------------------------------------
|
||||
// OpenBMH deviates from the original: in Modern a training camp stay can bring an exclusive sponsor (shirt or four boards at twice the best regular offer), taken now or after the running contract.
|
||||
namespace {
|
||||
|
||||
ModernState::ExclusiveSponsor& exclusive_sponsor(ModernState& g, int manager) {
|
||||
if (g.exclusive_sponsors.size() < g.manager_teams.size()) g.exclusive_sponsors.resize(g.manager_teams.size());
|
||||
return g.exclusive_sponsors.at(size_t(manager));
|
||||
}
|
||||
|
||||
// The offer goes through the regular acceptance: it is written over the last offer of its pool
|
||||
// and accepted there, so boards, sorting and group ids follow the original rules. Nothing
|
||||
// changes (the pool offer is restored) when the place is taken.
|
||||
bool install_exclusive_sponsor(ModernState& g, int manager, const ModernState::ExclusiveSponsor& s) {
|
||||
if (!ad_manager_record_valid(g, manager)) return false;
|
||||
const size_t rec = size_t(manager) * kAdRecord;
|
||||
const int group = s.kind == 1 ? 1 : 0;
|
||||
constexpr int kRaw = 9;
|
||||
const size_t at = rec + kAdPool + size_t(group) * 0x78 + size_t(kRaw) * kAdContractBytes;
|
||||
std::array<uint8_t, kAdContractBytes> saved{};
|
||||
std::copy_n(g.manager_records.begin() + std::ptrdiff_t(at), kAdContractBytes, saved.begin());
|
||||
auto& r = g.manager_records;
|
||||
const uint16_t score = s.score;
|
||||
for (size_t i = 0; i < 4; ++i) r.at(at + i) = uint8_t(s.monthly >> (8 * i));
|
||||
r.at(at + 4) = s.kind == 1 ? 1 : s.units;
|
||||
r.at(at + 5) = s.months;
|
||||
r.at(at + 6) = 0;
|
||||
r.at(at + 7) = s.sponsor;
|
||||
r.at(at + 8) = uint8_t(score), r.at(at + 9) = uint8_t(score >> 8);
|
||||
const int display = s.kind == 1 ? 14 : 13;
|
||||
const AdvertisingOfferList view = modern::advertising_offers(g, manager, display);
|
||||
bool accepted = false;
|
||||
for (const AdvertisingOfferCandidate& c : view.offers)
|
||||
if (c.raw_slot == kRaw && c.can_accept) {
|
||||
AdvertisingOfferRequest request;
|
||||
request.manager = manager;
|
||||
request.display_slot = display;
|
||||
request.contract_slot = view.contract_slot;
|
||||
request.expected_contract = view.contract_bytes;
|
||||
request.raw_slot = kRaw;
|
||||
request.expected_offer = c.bytes;
|
||||
accepted = modern::accept_advertising_offer(g, request).status == AdvertisingOfferStatus::accepted;
|
||||
}
|
||||
if (!accepted) std::copy(saved.begin(), saved.end(), r.begin() + std::ptrdiff_t(at));
|
||||
return accepted;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void roll_exclusive_sponsor(ModernState& g, int manager, int resort, WatcomRandom& rand) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size() || resort < 0 || size_t(resort) >= g.training_camps.size())
|
||||
return;
|
||||
const TrainingCamp& camp = g.training_camps[size_t(resort)];
|
||||
if (camp.sponsor_chance <= 0) return; // (no draw: camps without a sponsor keep the stream)
|
||||
ModernState::ExclusiveSponsor& s = exclusive_sponsor(g, manager);
|
||||
if (s.offered || s.queued) return; // one offer or contract at a time
|
||||
if (rand.range(1, 100) > camp.sponsor_chance) return;
|
||||
const AdvertisingBase value = modern::advertising_base(g, manager);
|
||||
const bool shirt = rand.range(0, 2) == 0;
|
||||
// the best regular offer: offer k = 9 at the top of its +-25 % (TransferListCountdown2)
|
||||
int best = shirt ? (value.base >> 2) * (0x50 + 9 * 4) / 100 : ((value.base / 2) / 8) * (0x46 + 9 * 6) / 100;
|
||||
best += best >> 2;
|
||||
s = {};
|
||||
s.offered = true;
|
||||
s.kind = shirt ? 1 : 0;
|
||||
s.units = shirt ? 1 : 4;
|
||||
s.months = uint8_t(std::clamp(camp.sponsor_months, 1, 60));
|
||||
s.sponsor = uint8_t(rand.range(0, 9));
|
||||
s.monthly = uint32_t(std::max(0, int(int64_t(best) * camp.sponsor_bonus / 100)));
|
||||
s.camp = camp.id;
|
||||
s.score = uint16_t(value.score);
|
||||
// (Modern has no text catalogue yet; the sponsor's name is one of the advertising firms)
|
||||
const std::string sponsor = message_text(g, ::bmh::layout::Advertising_FormatError_ExecutableField3 + uint32_t(s.sponsor) * 4);
|
||||
post_composed(g, manager, "Exklusiv-Sponsor: " + sponsor + " bietet Ihnen nach Ihrem Aufenthalt in " + camp.place +
|
||||
(shirt ? " die Trikotwerbung" : " vier Banden") + " f}r " + format_amount(g, int32_t(s.monthly)) +
|
||||
(shirt ? "" : " je Bande") + " monatlich an (" + std::to_string(s.months) + " Monate).");
|
||||
}
|
||||
|
||||
ExclusiveSponsorAnswer answer_exclusive_sponsor(ModernState& g, int manager, bool accept) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size()) return ExclusiveSponsorAnswer::invalid;
|
||||
ModernState::ExclusiveSponsor& s = exclusive_sponsor(g, manager);
|
||||
if (!s.offered) return ExclusiveSponsorAnswer::invalid;
|
||||
if (!accept) {
|
||||
s = {};
|
||||
return ExclusiveSponsorAnswer::declined;
|
||||
}
|
||||
if (install_exclusive_sponsor(g, manager, s)) {
|
||||
s = {};
|
||||
return ExclusiveSponsorAnswer::started;
|
||||
}
|
||||
s.offered = false;
|
||||
s.queued = true;
|
||||
return ExclusiveSponsorAnswer::queued;
|
||||
}
|
||||
|
||||
void start_queued_exclusive_sponsor(ModernState& g, int manager) {
|
||||
if (manager < 0 || size_t(manager) >= g.exclusive_sponsors.size()) return;
|
||||
ModernState::ExclusiveSponsor& s = g.exclusive_sponsors[size_t(manager)];
|
||||
if (s.queued && install_exclusive_sponsor(g, manager, s)) s = {};
|
||||
}
|
||||
|
||||
AdvertisingSpendingView advertising_spending(const ModernState& g, int manager, int target_slot) {
|
||||
AdvertisingSpendingView view;
|
||||
view.manager = manager;
|
||||
|
||||
@@ -307,6 +307,18 @@ AdvertisingOfferList advertising_offers(const ModernState& g, int manager, int d
|
||||
AdvertisingOfferResult accept_advertising_offer(ModernState& g,
|
||||
const AdvertisingOfferRequest& request);
|
||||
|
||||
// Exclusive sponsor from a training camp stay (Modern; docs/new_engine/trainingslager.md).
|
||||
// book_training_camp rolls the camp's sponsor_chance; a hit offers a shirt (about every third
|
||||
// offer) or four boards at sponsor_bonus percent of the club's best regular offer for
|
||||
// sponsor_months months, and posts a message. One offer or queued contract per manager.
|
||||
void roll_exclusive_sponsor(ModernState& g, int manager, int resort, WatcomRandom& rand);
|
||||
enum class ExclusiveSponsorAnswer { declined, started, queued, invalid };
|
||||
// The manager's answer. Accepted: the contract starts now when its place is free (the shirt
|
||||
// without a running contract, enough free boards), else it waits for the place (queued).
|
||||
ExclusiveSponsorAnswer answer_exclusive_sponsor(ModernState& g, int manager, bool accept);
|
||||
// At the month change: a queued contract starts once its place is free.
|
||||
void start_queued_exclusive_sponsor(ModernState& g, int manager);
|
||||
|
||||
// CheckAdvertisingRenewal: a click on a contract whose months ran out (sponsor set, months 0 - the
|
||||
// month change posted "kann verlängert werden", Month_MonthChange_TextPointer). The sponsor's demand (word
|
||||
// +8, the club attraction it wants) is scaled by W(95, 105) % (WatcomRandom); if it stays
|
||||
|
||||
@@ -63,6 +63,20 @@ struct ModernState : GameState {
|
||||
bool operator==(const PoolsColumns&) const = default;
|
||||
};
|
||||
std::vector<PoolsColumns> pools;
|
||||
// Exclusive sponsor from a training camp stay (docs/new_engine/trainingslager.md), per manager.
|
||||
struct ExclusiveSponsor {
|
||||
bool offered = false; // an offer waits for the manager's answer
|
||||
bool queued = false; // accepted while the place was taken: starts when it is free
|
||||
uint8_t kind = 0; // 0 boards, 1 shirt
|
||||
uint8_t units = 0; // boards of a board offer
|
||||
uint8_t months = 0; // contract months
|
||||
uint8_t sponsor = 0; // sponsor name index of the advertising list
|
||||
uint32_t monthly = 0; // per board / for the shirt, per month
|
||||
uint16_t score = 0; // the club's advertising score when offered (offer byte +8)
|
||||
std::string camp; // the camp that brought it
|
||||
bool operator==(const ExclusiveSponsor&) const = default;
|
||||
};
|
||||
std::vector<ExclusiveSponsor> exclusive_sponsors;
|
||||
// Players whose age the data set gives (birth date); the others carry a placeholder the
|
||||
// career start replaces as in the original. Needed only while a career starts (not saved).
|
||||
std::vector<bool> world_age_known;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "modern/game/modern_state.hpp"
|
||||
#include "modern/game/environment.hpp"
|
||||
#include "modern/game/month.hpp"
|
||||
#include "modern/game/desk_actions.hpp"
|
||||
#include "game/trace.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -959,6 +960,8 @@ void month_change(ModernState& g, WatcomRandom& rand, MinuteReport& report, Game
|
||||
else turn_step = "month_change: advertising text", post_text(g, m, text_id(::bmh::layout::Month_MonthChange_TextPointer)); // the contract can be renewed
|
||||
}
|
||||
}
|
||||
// Modern: a queued exclusive sponsor starts once its place is free (trainingslager.md)
|
||||
for (int m = 0; m < managers; m++) modern::start_queued_exclusive_sponsor(g, m);
|
||||
// 2. new players on the transfer list
|
||||
turn_step = "month_change: new list entries";
|
||||
new_list_entries(g, rand, report);
|
||||
|
||||
@@ -39,6 +39,11 @@ const CampCatalogue& default_camp_catalogue() {
|
||||
camp(15, "map:me", "Abu Dhabi Royal Training", "Abu Dhabi", "nation:ae", {6, 6, 6, 6}, 3200000);
|
||||
camp(16, "map:me", "Dubai Platinum Sports Camp", "Dubai", "nation:ae", {6, 6, 6, 6}, 3600000);
|
||||
camp(17, "map:eu", "Riviera Trainingscamp Belek", "Belek", "nation:tr", {5, 5, 5, 4}, 790000);
|
||||
// The Middle East camps share their grades; a stay can bring an exclusive sponsor, the
|
||||
// dearer the camp the likelier (15 / 30 / 45 %; trainingslager.md).
|
||||
c.camps[14].sponsor_chance = 15;
|
||||
c.camps[15].sponsor_chance = 30;
|
||||
c.camps[16].sponsor_chance = 45;
|
||||
return c;
|
||||
}();
|
||||
return catalogue;
|
||||
|
||||
@@ -29,6 +29,9 @@ struct TrainingCamp {
|
||||
std::string name, place, country;
|
||||
int32_t base_price = 0; // the price is base_price + 5000 per squad player
|
||||
std::array<uint8_t, 4> quality{}; // pitch, fitness, catering, lodging (0-6)
|
||||
// Exclusive sponsor (docs/new_engine/trainingslager.md): chance per stay in percent (0 = none),
|
||||
// the offer's amount in percent of the best regular offer, its contract months.
|
||||
int sponsor_chance = 0, sponsor_bonus = 200, sponsor_months = 12;
|
||||
};
|
||||
|
||||
struct CampCatalogue {
|
||||
|
||||
+18
-11
@@ -497,18 +497,8 @@ int club_attraction(const ModernState& g, int team) {
|
||||
return std::clamp(v, 0, 100);
|
||||
}
|
||||
|
||||
void advertising_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteReport& report) {
|
||||
(void)report;
|
||||
if (g.memory.u8(::bmh::layout::CareerDuration) == 1) return;
|
||||
AdvertisingBase advertising_base(ModernState& g, int manager) {
|
||||
Record rec = record(g, manager);
|
||||
if (manager == 0) {
|
||||
// "Es gibt neue Werbeangebote!" to every manager with a free advertising slot
|
||||
uint32_t mask = 0x80000000u;
|
||||
for (size_t m = 0; m < g.manager_teams.size(); m++)
|
||||
for (int k = 0; k < 0x10; k++)
|
||||
if (g.manager_records.at(m * kRecord + 0xa39 + size_t(k) * 0xc) == 0) mask |= 1u << m;
|
||||
if (mask != 0x80000000u) post_text(g, int64_t(mask), text_id(::bmh::layout::Weekly_AdvertisingOffers_TextPointer));
|
||||
}
|
||||
int score = int16_t(int8_t(modern::club_attraction(g, int16_t(rec.u16(0x290)))));
|
||||
if (g.memory.u8(::bmh::layout::GameMode) == 3 && g.league_rounds.at(size_t(league_of(int16_t(rec.u16(0x290))))) > 0x11) {
|
||||
int t = rec.i32(0x320) / 100000;
|
||||
@@ -521,6 +511,23 @@ void advertising_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteR
|
||||
score = int16_t(score) * 100 / 0x78;
|
||||
int base = (int16_t(score) * 60000 + 1000000) / 0xc;
|
||||
base = ((0xb4 - g.level * 5) * base) / 100;
|
||||
return {score, base};
|
||||
}
|
||||
|
||||
void advertising_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteReport& report) {
|
||||
(void)report;
|
||||
if (g.memory.u8(::bmh::layout::CareerDuration) == 1) return;
|
||||
Record rec = record(g, manager);
|
||||
if (manager == 0) {
|
||||
// "Es gibt neue Werbeangebote!" to every manager with a free advertising slot
|
||||
uint32_t mask = 0x80000000u;
|
||||
for (size_t m = 0; m < g.manager_teams.size(); m++)
|
||||
for (int k = 0; k < 0x10; k++)
|
||||
if (g.manager_records.at(m * kRecord + 0xa39 + size_t(k) * 0xc) == 0) mask |= 1u << m;
|
||||
if (mask != 0x80000000u) post_text(g, int64_t(mask), text_id(::bmh::layout::Weekly_AdvertisingOffers_TextPointer));
|
||||
}
|
||||
const AdvertisingBase value = modern::advertising_base(g, manager);
|
||||
const int score = value.score, base = value.base;
|
||||
for (int kind = 0; kind < 3; kind++)
|
||||
for (int k = 0; k < 10; k++) {
|
||||
const size_t o = 0x8cc + size_t(kind) * 0x78 + size_t(k) * 0xc;
|
||||
|
||||
@@ -52,6 +52,11 @@ void season_ticket_compensation(ModernState& g, int manager);
|
||||
void season_ticket_compensation_source(ModernState& g, int manager,
|
||||
const SeasonTicketCompensationNoticeHook& notice = {});
|
||||
void advertising_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteReport& report); // TransferListCountdown2
|
||||
// The club's advertising score and the base of its offers (TransferListCountdown2, no draws): a
|
||||
// board offer is about base / 16 per board and month, a shirt offer base / 4 (offer k: 70 + 6k
|
||||
// resp. 80 + 4k percent of that, then +-25 %).
|
||||
struct AdvertisingBase { int score = 0, base = 0; };
|
||||
AdvertisingBase advertising_base(ModernState& g, int manager);
|
||||
// TransferListCountdown(all): the days left of every listed player count down; at 0 the best bid wins
|
||||
// (with `all`, at the season end, every list is settled at once)
|
||||
void transfer_list_countdown(ModernState& g, GameRandom& game, WatcomRandom& rand, MinuteReport& report, bool all = false,
|
||||
|
||||
Reference in new issue
Block a user