diff options
author | Shauren <shauren.trinity@gmail.com> | 2013-02-01 11:38:55 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2013-02-01 11:38:55 +0100 |
commit | 0bf29d45d112130ee4b03fbb66d888964edadc6a (patch) | |
tree | 60ff8db1548acff802f4216366eb6f5ea139c1cc /src/server/scripts/Commands | |
parent | dc5e9c80fca8a7e17c8d54dd9e7a150c71a7c810 (diff) |
Core/Players: Prevent trading, taking gold from mail and withdrawing from guild bank if it would put the player over gold cap.
Closes #4015
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r-- | src/server/scripts/Commands/cs_modify.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 01648f25cff..eaed64db579 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1046,9 +1046,12 @@ public: ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); if (moneyToAdd >= MAX_MONEY_AMOUNT) - target->SetMoney(MAX_MONEY_AMOUNT); - else - target->ModifyMoney(moneyToAdd); + moneyToAdd = MAX_MONEY_AMOUNT; + + if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd) + moneyToAdd -= targetMoney; + + target->ModifyMoney(moneyToAdd); } sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); |