Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/scripts/Commands/cs_modify.cpp
This commit is contained in:
commit
c757f811f2
20 files changed
+264
-161
No files matched your search
@@ -1003,15 +1003,19 @@ public:
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
int32 addmoney = atoi((char*)args);
|
||||
int64 moneyToAdd = 0;
|
||||
if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c'))
|
||||
moneyToAdd = MoneyStringToMoney(std::string(args));
|
||||
else
|
||||
moneyToAdd = atol(args);
|
||||
|
||||
uint64 moneyuser = target->GetMoney();
|
||||
uint64 targetMoney = target->GetMoney();
|
||||
|
||||
if (addmoney < 0)
|
||||
if (moneyToAdd < 0)
|
||||
{
|
||||
int64 newmoney = int32(moneyuser) + addmoney;
|
||||
int64 newmoney = int64(targetMoney) + moneyToAdd;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(newmoney));
|
||||
if (newmoney <= 0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str());
|
||||
@@ -1025,25 +1029,26 @@ public:
|
||||
if (newmoney > MAX_MONEY_AMOUNT)
|
||||
newmoney = MAX_MONEY_AMOUNT;
|
||||
|
||||
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), handler->GetNameLink(target).c_str());
|
||||
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, uint32(abs(moneyToAdd)), handler->GetNameLink(target).c_str());
|
||||
if (handler->needReportToTarget(target))
|
||||
(ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(addmoney));
|
||||
(ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), uint32(abs(moneyToAdd)));
|
||||
target->SetMoney(newmoney);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(addmoney), handler->GetNameLink(target).c_str());
|
||||
handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(moneyToAdd), handler->GetNameLink(target).c_str());
|
||||
if (handler->needReportToTarget(target))
|
||||
(ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(addmoney));
|
||||
(ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(moneyToAdd));
|
||||
|
||||
if (addmoney >=MAX_MONEY_AMOUNT)
|
||||
if (moneyToAdd >= MAX_MONEY_AMOUNT)
|
||||
target->SetMoney(MAX_MONEY_AMOUNT);
|
||||
else
|
||||
target->ModifyMoney(int64(addmoney));
|
||||
target->ModifyMoney(moneyToAdd);
|
||||
}
|
||||
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, uint32(addmoney), target->GetMoney());
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), uint32(targetMoney), nt32(moneyToAdd), uint32(target->GetMoney()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user