|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
|
#include "GameTime.h"
|
|
|
|
|
#include "ObjectMgr.h"
|
|
|
|
|
#include "Player.h"
|
|
|
|
|
#include "RBAC.h"
|
|
|
|
|
#include "SocialMgr.h"
|
|
|
|
|
#include "World.h"
|
|
|
|
|
|
|
|
|
@@ -218,7 +219,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
|
|
|
|
|
|
|
|
|
JoinNotify(player);
|
|
|
|
|
|
|
|
|
|
playersStore[guid].SetOwnerGM(player->GetSession()->IsGMAccount());
|
|
|
|
|
playersStore[guid].SetOwnerGM(player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR));
|
|
|
|
|
|
|
|
|
|
// Custom channel handling
|
|
|
|
|
if (!IsConstant())
|
|
|
|
@@ -296,11 +297,11 @@ void Channel::LeaveChannel(Player* player, bool send)
|
|
|
|
|
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
|
|
|
|
|
{
|
|
|
|
|
newowner = itr->second.player;
|
|
|
|
|
if (itr->second.plrPtr->GetSession()->IsGMAccount())
|
|
|
|
|
if (itr->second.plrPtr->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
_isOwnerGM = true;
|
|
|
|
|
else
|
|
|
|
|
_isOwnerGM = false;
|
|
|
|
|
if (!itr->second.plrPtr->GetSession()->GetSecurity())
|
|
|
|
|
if (!itr->second.plrPtr->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
SetOwner(newowner);
|
|
|
|
@@ -324,7 +325,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!playersStore[good].IsModerator() && !player->GetSession()->IsGMAccount())
|
|
|
|
|
if (!playersStore[good].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -347,7 +348,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|
|
|
|
bool isOnChannel = victim && IsOn(victim);
|
|
|
|
|
if (!isOnChannel)
|
|
|
|
|
{
|
|
|
|
|
if (ban && (player->GetSession()->IsGMAccount() || isGoodConstantModerator))
|
|
|
|
|
if (ban && (player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) || isGoodConstantModerator))
|
|
|
|
|
{
|
|
|
|
|
if (ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(badname))
|
|
|
|
|
{
|
|
|
|
@@ -387,7 +388,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|
|
|
|
bool changeowner = _ownerGUID == victim;
|
|
|
|
|
bool isBadConstantModerator = _channelRights.moderators.find(badAccId) != _channelRights.moderators.end();
|
|
|
|
|
|
|
|
|
|
if (!player->GetSession()->IsGMAccount() && !isGoodConstantModerator)
|
|
|
|
|
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && !isGoodConstantModerator)
|
|
|
|
|
{
|
|
|
|
|
if (changeowner && good != _ownerGUID)
|
|
|
|
|
{
|
|
|
|
@@ -405,7 +406,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isBadConstantModerator || bad->GetSession()->IsGMAccount())
|
|
|
|
|
if (isBadConstantModerator || bad->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -454,7 +455,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|
|
|
|
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
|
|
|
|
|
{
|
|
|
|
|
newowner = itr->second.player;
|
|
|
|
|
if (!itr->second.plrPtr->GetSession()->GetSecurity())
|
|
|
|
|
if (!itr->second.plrPtr->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
SetOwner(newowner);
|
|
|
|
@@ -476,7 +477,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!playersStore[good].IsModerator() && !player->GetSession()->IsGMAccount())
|
|
|
|
|
if (!playersStore[good].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -499,7 +500,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
|
|
|
|
|
if (!player->GetSession()->IsGMAccount() && !isConstantModerator)
|
|
|
|
|
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && !isConstantModerator)
|
|
|
|
|
{
|
|
|
|
|
if (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)
|
|
|
|
|
{
|
|
|
|
@@ -544,7 +545,7 @@ void Channel::Password(Player const* player, std::string const& pass)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->IsGMAccount())
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -581,7 +582,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->IsGMAccount())
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -598,7 +599,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|
|
|
|
if (!victim || !IsOn(victim) ||
|
|
|
|
|
// allow make moderator from another team only if both is GMs
|
|
|
|
|
// at this moment this only way to show channel post for GM from another team
|
|
|
|
|
((!player->GetSession()->IsGMAccount() || !newp->GetSession()->IsGMAccount()) && player->GetTeamId() != newp->GetTeamId() &&
|
|
|
|
|
((!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) || !newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL)) && player->GetTeamId() != newp->GetTeamId() &&
|
|
|
|
|
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
@@ -624,7 +625,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
|
|
|
|
|
if (!player->GetSession()->IsGMAccount() && !isGoodConstantModerator)
|
|
|
|
|
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && !isGoodConstantModerator)
|
|
|
|
|
{
|
|
|
|
|
if (_channelRights.flags & CHANNEL_RIGHT_CANT_MUTE)
|
|
|
|
|
{
|
|
|
|
@@ -652,7 +653,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
|
|
|
|
|
if (!player->GetSession()->IsGMAccount() && guid != _ownerGUID && !isGoodConstantModerator)
|
|
|
|
|
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && guid != _ownerGUID && !isGoodConstantModerator)
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotOwner(&data);
|
|
|
|
@@ -706,15 +707,20 @@ void Channel::List(Player const* player)
|
|
|
|
|
std::size_t pos = data.wpos();
|
|
|
|
|
data << uint32(0); // size of list, placeholder
|
|
|
|
|
|
|
|
|
|
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
|
|
|
|
|
|
|
|
|
uint32 count = 0;
|
|
|
|
|
if (!(_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK))
|
|
|
|
|
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
|
|
|
|
|
if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity()))
|
|
|
|
|
{
|
|
|
|
|
data << i->first;
|
|
|
|
|
data << uint8(i->second.flags); // flags seems to be changed...
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
if (Player* member = i->second.plrPtr)
|
|
|
|
|
if ((player->GetSession()->HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) ||
|
|
|
|
|
member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
|
|
|
|
|
member->IsVisibleGloballyFor(player))
|
|
|
|
|
{
|
|
|
|
|
data << i->first;
|
|
|
|
|
data << uint8(i->second.flags); // flags seems to be changed...
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.put<uint32>(pos, count);
|
|
|
|
|
|
|
|
|
@@ -733,7 +739,7 @@ void Channel::Announce(Player const* player)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->IsGMAccount())
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
|
MakeNotModerator(&data);
|
|
|
|
@@ -932,7 +938,7 @@ void Channel::SendToAllWatching(WorldPacket* data)
|
|
|
|
|
|
|
|
|
|
bool Channel::ShouldAnnouncePlayer(Player const* player) const
|
|
|
|
|
{
|
|
|
|
|
return !(player->GetSession()->IsGMAccount() && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
|
|
|
|
|
return !(player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
|
|
|
@@ -1158,7 +1164,7 @@ void Channel::JoinNotify(Player* p)
|
|
|
|
|
{
|
|
|
|
|
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
|
|
|
|
|
return;
|
|
|
|
|
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
|
|
|
|
|
if (p->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
WorldPacket data(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size());
|
|
|
|
@@ -1175,7 +1181,7 @@ void Channel::LeaveNotify(Player* p)
|
|
|
|
|
{
|
|
|
|
|
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
|
|
|
|
|
return;
|
|
|
|
|
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
|
|
|
|
|
if (p->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
|
|
|
|
@@ -1191,7 +1197,7 @@ void Channel::FlagsNotify(Player* p)
|
|
|
|
|
{
|
|
|
|
|
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
|
|
|
|
|
return;
|
|
|
|
|
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
|
|
|
|
|
if (p->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
WorldPacket data(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
|
|
|
|
@@ -1230,8 +1236,7 @@ void Channel::ToggleModeration(Player* player)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const AccountTypes level = static_cast<AccountTypes>(sWorld->getIntConfig(CONFIG_GM_LEVEL_CHANNEL_MODERATION));
|
|
|
|
|
const bool gm = (player->GetSession()->GetSecurity() >= level);
|
|
|
|
|
const bool gm = player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR);
|
|
|
|
|
|
|
|
|
|
if (!playersStore[guid].IsModerator() && !gm)
|
|
|
|
|
{
|
|
|
|
|