Core/RBAC: Add new permissions 'Skip disable map check', 'Skip reset talents when used more than allowed check', 'Skip spam chat check', 'Restore saved gm setting states', 'Use Config option START_GM_LEVEL to assign new character level'
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (20, 21, 22, 39, 41);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(20, 'Skip disable map check'),
|
||||
(21, 'Skip reset talents when used more than allowed check'),
|
||||
(22, 'Skip spam chat check'),
|
||||
(39, 'Restore saved gm setting states'),
|
||||
(41, 'Use Config option START_GM_LEVEL to assign new character level');
|
||||
|
||||
-- Add new role
|
||||
DELETE FROM `rbac_roles` WHERE `id` IN (22, 23, 24, 25, 26);
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES
|
||||
(22, 'Skip disable map check'),
|
||||
(23, 'Skip reset talents when used more than allowed check'),
|
||||
(24, 'Skip spam chat check'),
|
||||
(25, 'Restore saved gm setting states'),
|
||||
(26, 'Use Config option START_GM_LEVEL to assign new character level');
|
||||
|
||||
-- Add the permission to the role
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (22, 23, 24, 25, 26);
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
|
||||
(22, 20),
|
||||
(23, 21),
|
||||
(24, 22),
|
||||
(25, 39),
|
||||
(26, 41);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
DELETE FROM `rbac_role_permissions` WHERE `roleId` IN (22, 23, 24, 25, 26);
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(2, 22),
|
||||
(3, 22),
|
||||
(4, 22),
|
||||
(4, 23),
|
||||
(2, 24),
|
||||
(3, 24),
|
||||
(4, 24),
|
||||
(2, 25),
|
||||
(3, 25),
|
||||
(4, 25),
|
||||
(2, 26),
|
||||
(3, 26),
|
||||
(4, 26);
|
||||
@@ -60,6 +60,9 @@ enum RBACPermissions
|
||||
RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
|
||||
RBAC_PERM_LOG_GM_TRADE = 11,
|
||||
RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
|
||||
RBAC_PERM_SKIP_CHECK_DISABLE_MAP = 20,
|
||||
RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED = 21,
|
||||
RBAC_PERM_SKIP_CHECK_CHAT_SPAM = 22,
|
||||
RBAC_PERM_SKIP_CHECK_OVERSPEED_PING = 23,
|
||||
RBAC_PERM_TWO_SIDE_INTERACTION_MAIL = 27,
|
||||
RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY = 30,
|
||||
@@ -69,6 +72,8 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST = 34,
|
||||
RBAC_PERM_CHAT_USE_STAFF_BADGE = 37,
|
||||
RBAC_PERM_RESURRECT_WITH_FULL_HPS = 38,
|
||||
RBAC_PERM_RESTORE_SAVED_GM_STATE = 39,
|
||||
RBAC_PERM_USE_START_GM_LEVEL = 41,
|
||||
RBAC_PERM_OPCODE_WORLD_TELEPORT = 42,
|
||||
RBAC_PERM_OPCODE_WHOIS = 43,
|
||||
RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE = 44,
|
||||
|
||||
@@ -1018,7 +1018,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
|
||||
? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
|
||||
: sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||
|
||||
if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
|
||||
if (m_session->HasPermission(RBAC_PERM_USE_START_GM_LEVEL))
|
||||
{
|
||||
uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
|
||||
if (gm_level > start_level)
|
||||
@@ -2069,7 +2069,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
|
||||
if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_DISABLE_MAP) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid);
|
||||
SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED);
|
||||
@@ -3120,7 +3120,7 @@ void Player::InitTalentForLevel()
|
||||
// if used more that have then reset
|
||||
if (m_usedTalentCount > talentPointsForLevel)
|
||||
{
|
||||
if (!AccountMgr::IsAdminAccount(GetSession()->GetSecurity()))
|
||||
if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED))
|
||||
resetTalents(true);
|
||||
else
|
||||
SetFreeTalentPoints(0);
|
||||
@@ -17309,7 +17309,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
outDebugValues();
|
||||
|
||||
// GM state
|
||||
if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
|
||||
if (GetSession()->HasPermission(RBAC_PERM_RESTORE_SAVED_GM_STATE))
|
||||
{
|
||||
switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE))
|
||||
{
|
||||
@@ -19628,7 +19628,7 @@ void Player::outDebugValues() const
|
||||
void Player::UpdateSpeakTime()
|
||||
{
|
||||
// ignore chat spam protection for GMs in any mode
|
||||
if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
|
||||
if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_CHAT_SPAM))
|
||||
return;
|
||||
|
||||
time_t current = time (NULL);
|
||||
|
||||
Reference in New Issue
Block a user