feat(Core/RBAC): Role Based Access Controls (#24641)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com> Co-authored-by: Spp <spp@jorge.gr> Co-authored-by: Spp <spp@tc.plus> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -504,6 +505,35 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
trader->ModifyMoney(-int32(his_trade->GetMoney()));
|
||||
trader->ModifyMoney(my_trade->GetMoney());
|
||||
|
||||
if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
|
||||
{
|
||||
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
|
||||
{
|
||||
if (myItems[i])
|
||||
LOG_GM(GetAccountId(), "GM {} (Account: {}) traded item: {} (Entry: {} Count: {}) to {}",
|
||||
_player->GetName(), GetAccountId(),
|
||||
myItems[i]->GetTemplate()->Name1, myItems[i]->GetEntry(), myItems[i]->GetCount(),
|
||||
trader->GetName());
|
||||
}
|
||||
if (my_trade->GetMoney() > 0)
|
||||
LOG_GM(GetAccountId(), "GM {} (Account: {}) traded money: {} to {}",
|
||||
_player->GetName(), GetAccountId(), my_trade->GetMoney(), trader->GetName());
|
||||
}
|
||||
if (trader->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
|
||||
{
|
||||
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
|
||||
{
|
||||
if (hisItems[i])
|
||||
LOG_GM(trader->GetSession()->GetAccountId(), "GM {} (Account: {}) traded item: {} (Entry: {} Count: {}) to {}",
|
||||
trader->GetName(), trader->GetSession()->GetAccountId(),
|
||||
hisItems[i]->GetTemplate()->Name1, hisItems[i]->GetEntry(), hisItems[i]->GetCount(),
|
||||
_player->GetName());
|
||||
}
|
||||
if (his_trade->GetMoney() > 0)
|
||||
LOG_GM(trader->GetSession()->GetAccountId(), "GM {} (Account: {}) traded money: {} to {}",
|
||||
trader->GetName(), trader->GetSession()->GetAccountId(), his_trade->GetMoney(), _player->GetName());
|
||||
}
|
||||
|
||||
// log completed trade
|
||||
LOG_INFO("entities.player.trade", "Trade: Account: {} (IP: {}), Player [{}] ({}) traded with Player [{}] ({}): gave {} copper, received {} copper, gave item(s) [{}], received item(s) [{}]",
|
||||
GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().GetCounter(),
|
||||
@@ -671,7 +701,9 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId())
|
||||
if (pOther->GetTeamId() != _player->GetTeamId() &&
|
||||
!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);
|
||||
|
||||
Reference in New Issue
Block a user