feat(Core/Player): Implement option to convert excess honor points int… (#10565)

This commit is contained in:
Skjalf
2022-02-09 18:04:56 -03:00
committed by GitHub
parent 7a6126ecd6
commit fb890b3310
4 changed files with 28 additions and 0 deletions

View File

@@ -6109,7 +6109,19 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
void Player::SetHonorPoints(uint32 value)
{
if (value > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
{
if (int32 copperPerPoint = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT))
{
// Only convert points on login, not when awarded honor points.
if (isBeingLoaded())
{
int32 excessPoints = value - sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
ModifyMoney(excessPoints * copperPerPoint);
}
}
value = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
}
SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, value);
if (value)
AddKnownCurrency(ITEM_HONOR_POINTS_ID);