mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Arenas: Drop old .modify arenapoint command, create a new command to add currency to players.
This commit is contained in:
4
sql/updates/world/2012_11_22_00_world_command.sql
Normal file
4
sql/updates/world/2012_11_22_00_world_command.sql
Normal 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.');
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user