Core/RBAC: Add new Permission "Log gm trade". Config option still active, but will affect only to users with that permission granted
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
-- Add new permission
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (11, 'Log GM trades');
|
||||
|
||||
-- Add new role
|
||||
INSERT INTO `rbac_roles` (`id`, `name`) VALUES (8, 'Log GM trades');
|
||||
|
||||
-- Add the permission to the role
|
||||
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES (8, 11);
|
||||
|
||||
-- Add it to all GM+ groups
|
||||
INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES
|
||||
(2, 8),
|
||||
(3, 8),
|
||||
(4, 8);
|
||||
@@ -58,6 +58,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_MODERATOR_COMMANDS,
|
||||
RBAC_PERM_GAMEMASTER_COMMANDS,
|
||||
RBAC_PERM_ADMINISTRATOR_COMMANDS,
|
||||
RBAC_PERM_LOG_GM_TRADE,
|
||||
RBAC_PERM_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -106,12 +106,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
{
|
||||
bidderAccId = bidder->GetSession()->GetAccountId();
|
||||
bidderName = bidder->GetName();
|
||||
logGmTrade = !AccountMgr::IsPlayerAccount(bidder->GetSession()->GetAccountId());
|
||||
logGmTrade = bidder->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE);
|
||||
}
|
||||
else
|
||||
{
|
||||
bidderAccId = sObjectMgr->GetPlayerAccountIdByGUID(bidderGuid);
|
||||
logGmTrade = !AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(bidderAccId, realmID));
|
||||
logGmTrade = AccountMgr::HasPermission(bidderAccId, RBAC_PERM_LOG_GM_TRADE, realmID);
|
||||
|
||||
if (logGmTrade && !sObjectMgr->GetPlayerNameByGUID(bidderGuid, bidderName))
|
||||
bidderName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
|
||||
|
||||
@@ -983,12 +983,15 @@ void Guild::BankMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData*
|
||||
void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const
|
||||
{
|
||||
MoveItemData::LogAction(pFrom);
|
||||
if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts
|
||||
if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) &&
|
||||
m_pPlayer->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE))
|
||||
{
|
||||
sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(),
|
||||
"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)",
|
||||
m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(),
|
||||
pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(),
|
||||
m_pGuild->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const
|
||||
@@ -1729,7 +1732,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
|
||||
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&amount), 8, true);
|
||||
_BroadcastEvent(GE_BANK_MONEY_CHANGED, 0, aux.c_str());
|
||||
|
||||
if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (player->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(player->GetSession()->GetAccountId(),
|
||||
"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
|
||||
|
||||
@@ -256,12 +256,13 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
|
||||
if (items_count > 0 || money > 0)
|
||||
{
|
||||
bool log = sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && HasPermission(RBAC_PERM_LOG_GM_TRADE);
|
||||
if (items_count > 0)
|
||||
{
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
Item* item = items[i];
|
||||
if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (log)
|
||||
{
|
||||
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
|
||||
GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
|
||||
@@ -281,7 +282,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
needItemDelay = player->GetSession()->GetAccountId() != rc_account;
|
||||
}
|
||||
|
||||
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (log && money > 0)
|
||||
{
|
||||
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
|
||||
GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account);
|
||||
@@ -462,7 +463,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
|
||||
uint32 sender_accId = 0;
|
||||
|
||||
if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
std::string sender_name;
|
||||
if (receive)
|
||||
|
||||
@@ -152,7 +152,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
{
|
||||
// logging
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow());
|
||||
if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
||||
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
|
||||
@@ -170,7 +170,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
{
|
||||
// logging
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow());
|
||||
if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
||||
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
|
||||
@@ -473,16 +473,17 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
moveItems(myItems, hisItems);
|
||||
|
||||
// logging money
|
||||
if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0)
|
||||
if (my_trade->GetMoney() > 0)
|
||||
{
|
||||
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
||||
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
|
||||
my_trade->GetMoney(),
|
||||
trader->GetName().c_str(), trader->GetSession()->GetAccountId());
|
||||
}
|
||||
if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0)
|
||||
|
||||
if (his_trade->GetMoney() > 0)
|
||||
{
|
||||
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
||||
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
|
||||
|
||||
@@ -2763,7 +2763,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
|
||||
if (!item_owner)
|
||||
return;
|
||||
|
||||
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
|
||||
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
|
||||
@@ -2828,7 +2828,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
|
||||
if (!item_owner)
|
||||
return;
|
||||
|
||||
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
|
||||
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
|
||||
@@ -2962,7 +2962,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
|
||||
if (!item_owner)
|
||||
return;
|
||||
|
||||
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
|
||||
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
|
||||
|
||||
Reference in New Issue
Block a user