mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/RBAC: Add permission that prevents getting a battleground deserter debuff.
This commit is contained in:
@@ -473,6 +473,7 @@ INSERT INTO `rbac_linked_permissions` VALUES
|
||||
(192,796),
|
||||
(192,835),
|
||||
(193,48),
|
||||
(193,52),
|
||||
(193,194),
|
||||
(193,197),
|
||||
(194,1),
|
||||
@@ -1171,6 +1172,7 @@ INSERT INTO `rbac_permissions` VALUES
|
||||
(49,'Forces to enter the email for confirmation on password change'),
|
||||
(50,'Allow user to check his own email with .account'),
|
||||
(51,'Allow trading between factions'),
|
||||
(52,'No battleground deserter debuff'),
|
||||
(192,'Role: Sec Level Administrator'),
|
||||
(193,'Role: Sec Level Gamemaster'),
|
||||
(194,'Role: Sec Level Moderator'),
|
||||
@@ -2010,7 +2012,8 @@ INSERT INTO `updates` VALUES
|
||||
('2023_02_05_01_auth.sql','336E62A8850A3E78A1D0BD3E81FFD5769184BDF8','ARCHIVED','2023-02-05 15:58:32',0),
|
||||
('2023_05_05_00_auth.sql','DEEB1D5533658E3479FC3C988EF4B9816C511BC3','ARCHIVED','2023-05-07 11:52:00',0),
|
||||
('2023_06_14_00_auth.sql','BB8A7EB214F4F3632C4F54EA596CB7C8FBA305D5','ARCHIVED','2023-06-14 19:34:24',0),
|
||||
('2023_11_21_00_auth.sql','146E5E6EF94C5DB78343372A8FDB32B062B80040','RELEASED','2023-11-21 11:24:11',0);
|
||||
('2023_11_21_00_auth.sql','146E5E6EF94C5DB78343372A8FDB32B062B80040','RELEASED','2023-11-21 11:24:11',0),
|
||||
('2024_01_06_00_auth.sql','767D697594D5471B67CC0FDF0D7BB15374116A71','RELEASED','2024-01-06 09:53:51',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -2075,7 +2078,7 @@ DROP TABLE IF EXISTS `vw_log_history`;
|
||||
/*!50001 DROP VIEW IF EXISTS `vw_log_history`*/;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
/*!50001 CREATE VIEW `vw_log_history` AS SELECT
|
||||
/*!50001 CREATE VIEW `vw_log_history` AS SELECT
|
||||
1 AS `First Logged`,
|
||||
1 AS `Last Logged`,
|
||||
1 AS `Occurrences`,
|
||||
@@ -2093,7 +2096,7 @@ DROP TABLE IF EXISTS `vw_rbac`;
|
||||
/*!50001 DROP VIEW IF EXISTS `vw_rbac`*/;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
/*!50001 CREATE VIEW `vw_rbac` AS SELECT
|
||||
/*!50001 CREATE VIEW `vw_rbac` AS SELECT
|
||||
1 AS `Permission ID`,
|
||||
1 AS `Permission Group`,
|
||||
1 AS `Security Level`,
|
||||
|
||||
7
sql/updates/auth/3.3.5/2024_01_06_00_auth.sql
Normal file
7
sql/updates/auth/3.3.5/2024_01_06_00_auth.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
--
|
||||
DELETE FROM `rbac_permissions` WHERE `id` = 52;
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (52, "No battleground deserter debuff");
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `linkedId` = 52;
|
||||
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES
|
||||
(193, 52);
|
||||
@@ -102,6 +102,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE = 49,
|
||||
RBAC_PERM_MAY_CHECK_OWN_EMAIL = 50,
|
||||
RBAC_PERM_ALLOW_TWO_SIDE_TRADE = 51,
|
||||
RBAC_PERM_NO_BATTLEGROUND_DESERTER_DEBUFF = 52,
|
||||
|
||||
// Free space for core permissions (till 149)
|
||||
// Roles (Permissions with delegated permissions) use 199 and descending
|
||||
|
||||
@@ -22259,14 +22259,18 @@ uint32 Player::GetBGTeam() const
|
||||
return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam();
|
||||
}
|
||||
|
||||
void Player::LeaveBattleground(bool teleportToEntryPoint)
|
||||
void Player::LeaveBattleground(bool teleportToEntryPoint /*= true*/)
|
||||
{
|
||||
if (Battleground* bg = GetBattleground())
|
||||
{
|
||||
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
|
||||
Battleground* bg = GetBattleground();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
// call after remove to be sure that player resurrected for correct cast
|
||||
if (bg->isBattleground() && !IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
|
||||
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
|
||||
|
||||
// call after remove to be sure that player resurrected for correct cast
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
|
||||
{
|
||||
if (!GetSession()->HasPermission(rbac::RBAC_PERM_NO_BATTLEGROUND_DESERTER_DEBUFF))
|
||||
{
|
||||
if (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)
|
||||
{
|
||||
@@ -22280,16 +22284,16 @@ void Player::LeaveBattleground(bool teleportToEntryPoint)
|
||||
CastSpell(this, 26013, true); // Deserter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// track if player leaves the BG while inside it
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS) &&
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_BG);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
// track if player leaves the BG while inside it
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS) &&
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_BG);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user