Core/Arenas: Drop old .modify arenapoint command, create a new command to add currency to players.

This commit is contained in:
Tuxity
2012-11-22 01:39:54 +01:00
parent 3d314acda8
commit 2f1000a9ed
2 changed files with 32 additions and 23 deletions

View File

@@ -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.');

View File

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