mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Scripts/Commands: mod xp command
Closes #13476
(cherry picked from commit 3e03e546d3)
Conflicts:
sql/base/auth_database.sql
src/server/scripts/Commands/cs_modify.cpp
This commit is contained in:
File diff suppressed because one or more lines are too long
9
sql/updates/auth/2014_11_10_01_auth.sql
Normal file
9
sql/updates/auth/2014_11_10_01_auth.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
/* add rbac permissions to new commands */
|
||||
DELETE FROM `rbac_permissions` WHERE `id`=798;
|
||||
INSERT INTO `rbac_permissions` (`id`,`name`) VALUES
|
||||
(798, 'Command: .mod xp');
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `id`=798;
|
||||
INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES
|
||||
/* add mod xp to gms */
|
||||
(194, 798);
|
||||
5
sql/updates/world/2014_11_10_05_world.sql
Normal file
5
sql/updates/world/2014_11_10_05_world.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
DELETE FROM `command` WHERE `name`='pvpstats';
|
||||
INSERT INTO `command` (`name`, `permission`, `help`) VALUES
|
||||
('modify xp', 797, 'Syntax: .modify xp #xp
|
||||
|
||||
Gives experience points to the targeted player or self.');
|
||||
@@ -701,6 +701,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_INSTANCE_SET_BOSS_STATE = 795,
|
||||
RBAC_PERM_COMMAND_INSTANCE_GET_BOSS_STATE = 796,
|
||||
RBAC_PERM_COMMAND_PVPSTATS = 797,
|
||||
RBAC_PERM_COMMAND_MODIFY_XP = 798,
|
||||
|
||||
// custom permissions 1000+
|
||||
RBAC_PERM_MAX
|
||||
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
{ "spell", rbac::RBAC_PERM_COMMAND_MODIFY_SPELL, false, &HandleModifySpellCommand, "", NULL },
|
||||
{ "standstate", rbac::RBAC_PERM_COMMAND_MODIFY_STANDSTATE, false, &HandleModifyStandStateCommand, "", NULL },
|
||||
{ "talentpoints", rbac::RBAC_PERM_COMMAND_MODIFY_TALENTPOINTS, false, &HandleModifyTalentCommand, "", NULL },
|
||||
{ "xp", rbac::RBAC_PERM_COMMAND_MODIFY_XP, false, &HandleModifyXPCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
@@ -1399,6 +1400,37 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// mod xp command
|
||||
static bool HandleModifyXPCommand(ChatHandler *handler, const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 xp = atoi((char*)args);
|
||||
|
||||
if (xp < 1)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||
return false;
|
||||
|
||||
// we can run the command
|
||||
target->GiveXP(xp, nullptr);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_modify_commandscript()
|
||||
|
||||
Reference in New Issue
Block a user