aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 025f883eb20..f0a3628e32c 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -7366,6 +7366,11 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
oldWeekCount = itr->second.weekCount;
}
+ // count can't be more then weekCap.
+ uint32 weekCap = _GetCurrencyWeekCap(currency);
+ if (count > int32(weekCap))
+ count = weekCap;
+
int32 newTotalCount = int32(oldTotalCount) + count;
if (newTotalCount < 0)
newTotalCount = 0;
@@ -7374,12 +7379,16 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
if (newWeekCount < 0)
newWeekCount = 0;
- // TODO: fix conquest points
+ ASSERT(weekCap >= oldWeekCount);
- // if we get more then weekCap just set to limit.
- uint32 weekCap = _GetCurrencyWeekCap(currency);
- if (weekCap && int32(weekCap) < newTotalCount)
+ // TODO: fix conquest points
+ // if we get more then weekCap just set to limit
+ if (weekCap && int32(weekCap) < newWeekCount)
+ {
newWeekCount = int32(weekCap);
+ // weekCap - oldWeekCount alwayt >= 0 as we set limit before!
+ newTotalCount = oldTotalCount + (weekCap - oldWeekCount);
+ }
// if we get more then totalCap set to maximum;
if (currency->TotalCap && int32(currency->TotalCap) < newTotalCount)