aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-10-15 11:15:25 -0500
committerSubv <s.v.h21@hotmail.com>2012-10-15 11:15:25 -0500
commitc757f811f265752f2e4dfe1921ace9d7aaf80983 (patch)
tree14b467a51cf38d5e2bc243c78a90102eda6d656f /src/server/scripts/Commands
parent963aa5a159c5541b6c794b42a5f5809bc7a36192 (diff)
parent6f0a8040d8d363064c7d4aa65d3b3d6f40796009 (diff)
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/scripts/Commands/cs_modify.cpp
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index f527d7fb275..c370c70a94a 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -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;
}