cc: allow up to 5 event badges to count towards prestige

It gives an incentive to participate while protecting against abuse
This commit is contained in:
Crypto City 2021-01-15 17:37:22 +00:00
parent b4749564a9
commit 7c25eac178
5 changed files with 19 additions and 5 deletions

View File

@ -672,7 +672,7 @@ and a small one for hunting bears and moose otherwise.
0.5% of the the game subsidy goes to the players with the most prestige. Each full set of
coins in a runic cycle (a period of 19 years) gives additional bonuses, as does owning at least
one of each type of gemstone (amethyst, sapphire, emerald, ruby, diamond). Core badges (ie, not
the ones awarded for role playing) give a small prestige bonus.
the ones awarded for role playing) and up to 5 event badges give a small prestige bonus.
<br>
Attributes are role playing style facets of the player, which are dynamically defined by the
game account which runs role playing events. These are intended to add some extra interest in

View File

@ -884,7 +884,7 @@ uint64_t get_gemstone_score(const std::map<uint32_t, uint32_t> &item_balances, c
uint32_t get_level_prestige_bonus_1024(const std::map<uint32_t, std::pair<uint8_t, uint64_t>> &badges)
{
const uint32_t level = get_badge_score(badges, true).second;
const uint32_t level = get_badge_score(badges, MAX_PRESTIGE_EVENT_BADGE).second;
return level * 5 / 2;
}

View File

@ -448,15 +448,28 @@ std::pair<uint64_t, uint32_t> get_badge_score(const std::vector<uint32_t> &badge
return std::make_pair(score, level);
}
std::pair<uint64_t, uint32_t> get_badge_score(const std::map<uint32_t, std::pair<uint8_t, uint64_t>> &badges, bool core_only)
std::pair<uint64_t, uint32_t> get_badge_score(const std::map<uint32_t, std::pair<uint8_t, uint64_t>> &badges, uint32_t max_event_badges)
{
std::vector<uint32_t> badge_count(NUM_BADGE_LEVELS);
std::vector<uint32_t> event_badge_count(NUM_BADGE_LEVELS);
for (const auto &e: badges)
{
CHECK_AND_ASSERT_THROW_MES(e.second.first > 0 && e.second.first <= NUM_BADGE_LEVELS, "Badge level out of range");
if (!core_only || e.first <= BADGE_LAST)
if (e.first >= BADGE_FIRST_EVENT && e.first <= BADGE_LAST_EVENT)
event_badge_count[e.second.first - 1] += 1;
else
badge_count[e.second.first - 1] += 1;
}
int idx = NUM_BADGE_LEVELS - 1;
while (max_event_badges > 0 && idx >= 0)
{
const uint32_t use = std::min(max_event_badges, event_badge_count[idx]);
badge_count[idx] += use;
max_event_badges -= use;
--idx;
}
return get_badge_score(badge_count);
}

View File

@ -93,7 +93,7 @@ bool get_badge_data(const cryptonote::BlockchainDB *db, cc_badge_t badge, cc_bad
const char *get_predefined_badge_name(cc_badge_t badge);
const uint64_t *get_badge_thresholds(cc_badge_t badge);
std::pair<uint64_t, uint32_t> get_badge_score(const std::vector<uint32_t> &badges);
std::pair<uint64_t, uint32_t> get_badge_score(const std::map<uint32_t, std::pair<uint8_t, uint64_t>> &badges, bool core_only = false);
std::pair<uint64_t, uint32_t> get_badge_score(const std::map<uint32_t, std::pair<uint8_t, uint64_t>> &badges, uint32_t max_event_badges = 0);
uint32_t get_attribute_points_for_level(uint32_t level);
std::vector<uint32_t> get_badges_from_score(uint64_t score);

View File

@ -343,3 +343,4 @@ enum Item
#define COIN_COLLECTION_SUBSIDY_PER_THOUSAND 5
#define NUM_PRESTIGE_RANKS 20
#define GEMSTONE_SERIES_PRESTIGE_BONUS 12
#define MAX_PRESTIGE_EVENT_BADGE 5