Core/RBAC: Create new permissions 'Instant .save', 'Allow params with .unstuck', 'Full HP after resurrect'

This commit is contained in:
Spp
2013-02-25 12:23:02 +01:00
parent e6087b5563
commit cb0456fedc
3 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
-- Add new permissions
DELETE FROM `rbac_permissions` WHERE `id` IN (30, 31, 38);
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
(30, 'Save character without delay with .save command'),
(31, 'Use params with .unstuck command'),
(38, 'Resurrect with full Health Points');
-- Add new role
DELETE FROM `rbac_roles` WHERE `id` IN (11, 12, 13);
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
(11, 'Instant .save'),
(12, 'Allow params with .unstuck'),
(13, 'Full HP after resurrect');
-- Add the permission to the role
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (11, 12, 13);
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
(11, 30),
(12, 31),
(13, 38);
-- Add it to all GM+ groups
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
(2, 11),
(3, 11),
(4, 11),
(2, 12),
(3, 12),
(4, 12),
(2, 13),
(3, 13),
(4, 13);

View File

@@ -60,7 +60,10 @@ enum RBACPermissions
RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
RBAC_PERM_LOG_GM_TRADE = 11,
RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY = 30,
RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS = 31,
RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET = 32,
RBAC_PERM_RESURRECT_WITH_FULL_HPS = 38,
RBAC_PERM_MAX
};

View File

@@ -678,7 +678,7 @@ public:
if (target)
{
target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
target->ResurrectPlayer(target->GetSession()->HasPermission(RBAC_PERM_RESURRECT_WITH_FULL_HPS) ? 1.0f : 0.5f);
target->SpawnCorpseBones();
target->SaveToDB();
}
@@ -881,7 +881,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
// save GM account without delay and output message
if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
if (handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY))
{
if (Player* target = handler->getSelectedPlayer())
target->SaveToDB();
@@ -938,8 +938,8 @@ public:
static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
{
//No args required for players
if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
// No args required for players
if (handler->GetSession() && !handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS))
{
// 7355: "Stuck"
if (Player* player = handler->GetSession()->GetPlayer())