Core/RBAC: Add two side trade to RBAC

This commit is contained in:
mthsena
2014-12-21 00:56:01 -02:00
parent 884953942b
commit 3ee2f0d2bf
3 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
-- Add rbac_permissions
DELETE FROM `rbac_permissions` WHERE `id` = 51;
INSERT INTO `rbac_permissions` (`id`,`name`) VALUES
(51, 'Allow trading between factions');
-- Add rbac_linked_permissions
DELETE FROM `rbac_linked_permissions` WHERE `linkedId` = 51;
INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES
(194, 51);

View File

@@ -100,6 +100,7 @@ enum RBACPermissions
RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA = 48,
RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE = 49,
RBAC_PERM_MAY_CHECK_OWN_EMAIL = 50,
RBAC_PERM_ALLOW_TWO_SIDE_TRADE = 51,
// Free space for core permissions (till 149)
// Roles (Permissions with delegated permissions) use 199 and descending

View File

@@ -676,7 +676,9 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam())
if (pOther->GetTeam() != _player->GetTeam() &&
(!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) &&
!GetPlayer()->GetSession()->HasPermission(rbac::RBAC_PERM_ALLOW_TWO_SIDE_TRADE)))
{
info.Status = TRADE_STATUS_WRONG_FACTION;
SendTradeStatus(info);