diff options
-rw-r--r-- | sql/updates/world/2012_11_22_00_world_command.sql | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_modify.cpp | 51 |
2 files changed, 32 insertions, 23 deletions
diff --git a/sql/updates/world/2012_11_22_00_world_command.sql b/sql/updates/world/2012_11_22_00_world_command.sql new file mode 100644 index 00000000000..74ed29e31ac --- /dev/null +++ b/sql/updates/world/2012_11_22_00_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` = 'modify arenapoints'; + +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('modify currency', 2, 'Syntax: .modify currency #id #value\nAdd $amount (without precision) of $currency to the selected player.'); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 61f90b9d046..dff89821a2a 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -65,11 +65,11 @@ public: { "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL }, { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, - { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, { "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL }, { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, + { "currency", SEC_GAMEMASTER, false, &HandleModifyCurrencyCommand, "", NULL }, { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; @@ -1308,28 +1308,6 @@ public: return true; } - static bool HandleModifyArenaCommand(ChatHandler* handler, const char* args) - { - if (!*args) - return false; - - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - int32 amount = (uint32)atoi(args); - - target->ModifyCurrency(CURRENCY_TYPE_CONQUEST_POINTS, amount, true, true); - - handler->PSendSysMessage(LANG_COMMAND_MODIFY_ARENA, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, false)); - - return true; - } - static bool HandleModifyGenderCommand(ChatHandler* handler, const char* args) { if (!*args) @@ -1405,6 +1383,33 @@ public: return true; } + + static bool HandleModifyCurrencyCommand(ChatHandler* handler, const char* args) + { + if (!*args) + return false; + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currencyId = atoi(strtok((char*)args, " ")); + const CurrencyTypesEntry* currencyType = sCurrencyTypesStore.LookupEntry(currencyId); + if (!currencyType) + return false; + + uint32 amount = atoi(strtok(NULL, " ")); + if (!amount) + return false; + + target->ModifyCurrency(currencyId, amount, true, true); + + return true; + } }; void AddSC_modify_commandscript() |