[7803] Prevent ignore max money limit at use .modify money command.

This commit is contained in:
VladimirMangos 2009-05-08 21:31:34 +04:00
parent fffaec6d71
commit 3c057a92f5
2 changed files with 12 additions and 5 deletions

View file

@ -1681,12 +1681,12 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
uint32 moneyuser = chr->GetMoney(); uint32 moneyuser = chr->GetMoney();
if(addmoney < 0) if (addmoney < 0)
{ {
int32 newmoney = moneyuser + addmoney; int32 newmoney = int32(moneyuser) + addmoney;
sLog.outDetail(GetMangosString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); sLog.outDetail(GetMangosString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
if(newmoney <= 0 ) if (newmoney <= 0 )
{ {
PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, GetNameLink(chr).c_str()); PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, GetNameLink(chr).c_str());
if (needReportToTarget(chr)) if (needReportToTarget(chr))
@ -1696,6 +1696,9 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
} }
else else
{ {
if (newmoney > MAX_MONEY_AMOUNT)
newmoney = MAX_MONEY_AMOUNT;
PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), GetNameLink(chr).c_str()); PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), GetNameLink(chr).c_str());
if (needReportToTarget(chr)) if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), abs(addmoney)); ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), abs(addmoney));
@ -1707,7 +1710,11 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, GetNameLink(chr).c_str()); PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, GetNameLink(chr).c_str());
if (needReportToTarget(chr)) if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), addmoney); ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), addmoney);
chr->ModifyMoney( addmoney );
if (addmoney >=MAX_MONEY_AMOUNT)
chr->SetMoney(MAX_MONEY_AMOUNT);
else
chr->ModifyMoney( addmoney );
} }
sLog.outDetail(GetMangosString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() ); sLog.outDetail(GetMangosString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() );

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7802" #define REVISION_NR "7803"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__