Core/Players: Prevent trading, taking gold from mail and withdrawing from guild bank if it would put the player over gold cap.

Closes #4015
This commit is contained in:
Shauren
2013-02-01 11:38:55 +01:00
parent dc5e9c80fc
commit 0bf29d45d1
6 changed files with 52 additions and 23 deletions

View File

@@ -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());