Пример #1
0
void CChatChannel::RemoveModerator(CChatMember *pByMember, LPCTSTR pszName)
{
	ADDTOCALLSTACK("CChatChannel::RemoveModerator");

	LPCTSTR pszByName = pByMember->GetChatName();
	if ( !IsModerator(pszByName) )
	{
		pByMember->SendChatMsg(CHATMSG_MustHaveOps);
		return;
	}

	CChatMember *pMember = FindMember(pszName);
	if ( !pMember )
	{
		pByMember->SendChatMsg(CHATMSG_NoPlayer, pszName);
		return;
	}
	pszName = pMember->GetChatName();	// fix case-sensitive mismatch
	if ( !IsModerator(pszName) )
		return;

	SetModerator(pszName, true);
	SendMember(pMember);	// update name color
	Broadcast(CHATMSG_PlayerNoLongerModerator, pszName);
	pMember->SendChatMsg(CHATMSG_RemovedListModerators, pszByName);
}
Пример #2
0
void CChatChannel::KickMember(CChatMember *pByMember, CChatMember *pMember)
{
	ADDTOCALLSTACK("CChatChannel::KickMember");
	ASSERT(pMember);

	LPCTSTR pszByName = "SYSTEM";
	if ( pByMember )
	{
		pszByName = pByMember->GetChatName();
		if ( !IsModerator(pszByName) )
		{
			pByMember->SendChatMsg(CHATMSG_MustHaveOps);
			return;
		}
	}

	// Remove from moderators list
	LPCTSTR pszName = pMember->GetChatName();
	if ( IsModerator(pszName) )
	{
		SetModerator(pszName, true);
		SendMember(pMember);
		Broadcast(CHATMSG_PlayerNoLongerModerator, pszName);
		pMember->SendChatMsg(CHATMSG_RemovedListModerators, pszByName);
	}

	pMember->SendChatMsg(CHATMSG_ModeratorHasKicked, pszByName);
	pMember->SendChatMsg(CHATCMD_ClearMembers);
	Broadcast(CHATMSG_PlayerKicked, pszName);
	RemoveMember(pMember);
}
Пример #3
0
void Channel::SetOwner(Player *p, const char *newname)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		SendToOne(&data,p);
	}
	else if(p->GetSession()->GetSecurity() < 2 && p != owner)
	{
		MakeNotOwner(&data);
		SendToOne(&data,p);
	}
	else 
	{
		Player *newp = objmgr.GetPlayer(newname);
		if(newp == NULL || !IsOn(newp))
		{
			MakeNotOn(&data,newname);
			SendToOne(&data,p);
		}
		else
		{
			MakeChangeOwner(&data,newp);
			SendToAll(&data);

			SetModerator(newp,true);
			owner = newp;
		}
	}
}
Пример #4
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    uint64 guid = player->GetGUID();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

	if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
	{
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
        return;

    Player* newp = sObjectAccessor->FindPlayerByName(p2n);
    uint64 victim = newp ? newp->GetGUID() : 0;

    if (!victim || !IsOn(victim) ||
		(player->GetTeam() != newp->GetTeam() &&
		(!player->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
		!newp->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))

        // 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
    {
        WorldPacket data;
        MakePlayerNotFound(&data, p2n);
        SendToOne(&data, guid);
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #5
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    uint64 guid = player->GetGUID();
    uint32 sec = player->GetSession()->GetSecurity();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

    if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
        return;

    Player* newp = sObjectAccessor->FindPlayerByName(p2n);
    uint64 victim = newp ? newp->GetGUID() : 0;

    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
        ((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
         player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, p2n);
        SendToOne(&data, guid);
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #6
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    ObjectGuid const& guid = player->GetGUID();

    if (!IsOn(guid))
    {
        NotMemberAppend appender;
        ChannelNameBuilder<NotMemberAppend> builder(this, appender);
        SendToOne(builder, guid);
        return;
    }

    PlayerInfo& info = _playersStore.at(guid);
    if (!info.IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
    {
        NotModeratorAppend appender;
        ChannelNameBuilder<NotModeratorAppend> builder(this, appender);
        SendToOne(builder, guid);
        return;
    }

    if (guid == _ownerGuid && p2n == player->GetName() && mod)
        return;

    Player* newp = ObjectAccessor::FindConnectedPlayerByName(p2n);
    ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;

    if (victim.IsEmpty() || !IsOn(victim) ||
        (player->GetTeam() != newp->GetTeam() &&
        (!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
        !newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
    {
        PlayerNotFoundAppend appender(p2n);
        ChannelNameBuilder<PlayerNotFoundAppend> builder(this, appender);
        SendToOne(builder, guid);
        return;
    }

    if (_ownerGuid == victim && _ownerGuid != guid)
    {
        NotOwnerAppend appender;
        ChannelNameBuilder<NotOwnerAppend> builder(this, appender);
        SendToOne(builder, guid);
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #7
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    ObjectGuid guid = player->GetGUID();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

    if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
        return;

    Player* newp = sObjectAccessor->FindPlayerByName(p2n);
    ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;

    if (!victim || !IsOn(victim) ||
        (player->GetTeam() != newp->GetTeam() &&
        (!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
        !newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, p2n);
        SendToOne(&data, guid);
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #8
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    ObjectGuid const& guid = player->GetGUID();

    if (!IsOn(guid))
    {
        WorldPackets::Channel::ChannelNotify notify;
        MakeNotMember(notify);
        player->SendDirectMessage(notify.Write());
        return;
    }

    if (!_playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
    {
        WorldPackets::Channel::ChannelNotify notify;
        MakeNotModerator(notify);
        player->SendDirectMessage(notify.Write());
        return;
    }

    if (guid == _ownerGUID && p2n == player->GetName() && mod)
        return;

    Player* newp = ObjectAccessor::FindConnectedPlayerByName(p2n);
    ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;

    if (victim.IsEmpty() || !IsOn(victim) ||
        (player->GetTeam() != newp->GetTeam() &&
        (!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
        !newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
    {
        WorldPackets::Channel::ChannelNotify notify;
        MakePlayerNotFound(notify, p2n);
        player->SendDirectMessage(notify.Write());
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPackets::Channel::ChannelNotify notify;
        MakeNotOwner(notify);
        player->SendDirectMessage(notify.Write());
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #9
0
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
{
    uint32 sec = 0;
    Player *plr = objmgr.GetPlayer(p);
    if(plr)
        sec = plr->GetSession()->GetSecurity();

    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
    }
    else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, p);
    }
    else
    {
        Player *newp = objmgr.GetPlayer(p2n);
        if(!newp)
            return;

        PlayerInfo inf = players[newp->GetGUID()];
        if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
            return;
        if(newp == NULL || !IsOn(newp->GetGUID()))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
        }
        else if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
        {
            WorldPacket data;
            MakeNotOwner(&data);
            SendToOne(&data, p);
        }
        else
        {
            if(mod)
                SetModerator(newp->GetGUID(), set);
            else
                SetMute(newp->GetGUID(), set);
        }
    }
}
Пример #10
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    uint64 guid = player->GetGUID();
	uint32 sec = player->GetSession()->GetSecurity();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

    if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
        return;

    Player* newp = sObjectAccessor->FindPlayerByName(p2n);
    uint64 victim = newp ? newp->GetGUID() : 0;
	
     if (!victim || !IsOn(victim))
     {
        WorldPacket data;
        MakePlayerNotFound(&data, p2n);
        SendToOne(&data, guid);
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    if (mod)
        SetModerator(newp->GetGUID(), set);
    else
        SetMute(newp->GetGUID(), set);
}
Пример #11
0
void CChatChannel::AddMember(CChatMember *pMember)
{
	ADDTOCALLSTACK("CChatChannel::AddMember");
	pMember->SetChannel(this);
	m_Members.Add(pMember);

	LPCTSTR pszName = pMember->GetChatName();
	if ( !IsModerator(pszName) )
	{
		// Check if only moderators have voice by default
		if ( !m_bDefaultVoice )
			SetVoice(pszName);

		// GMs always have moderation privs
		CClient *pClient = pMember->GetClient();
		if ( pClient && pClient->IsPriv(PRIV_GM) )
			SetModerator(pszName);
	}
}
Пример #12
0
void CChatChannel::KickMember(CChatChanMember *pByMember, CChatChanMember * pMember )
{
	ADDTOCALLSTACK("CChatChannel::KickMember");
	ASSERT( pMember );

	LPCTSTR pszByName;
	if (pByMember) // If NULL, then an ADMIN or a GM did it
	{
		pszByName = pByMember->GetChatName();
		if (!IsModerator(pszByName))
		{
			pByMember->SendChatMsg(CHATMSG_MustHaveOps);
			return;
		}
	}
	else
	{
		pszByName = "SYSTEM";
	}

	LPCTSTR pszName = pMember->GetChatName();

	// Kicking this person...remove from list of moderators first
	if (IsModerator(pszName))
	{
		SetModerator(pszName, false);
		SendThisMember(pMember);
		Broadcast(CHATMSG_PlayerNoLongerModerator, pszName, "");
		pMember->SendChatMsg(CHATMSG_RemovedListModerators, pszByName);
	}

	// Now kick them
	if (m_Members.GetCount() == 1) // If kicking yourself, send out to all clients in a chat that the channel is gone
		g_Serv.m_Chats.SendDeleteChannel(this);
	// Remove them from the channels list of members
	RemoveMember(pMember);
	// Tell the remain members about this
	Broadcast(CHATMSG_PlayerIsKicked, pszName, "");
	// Now clear their channel member list
	pMember->SendChatMsg(CHATMSG_ClearMemberList);
	// And give them the bad news
	pMember->SendChatMsg(CHATMSG_ModeratorHasKicked, pszByName);
}
Пример #13
0
void CChatChannel::RevokeModerator(CChatChanMember * pByMember, LPCTSTR pszName)
{
	ADDTOCALLSTACK("CChatChannel::RevokeModerator");
	if (!IsModerator(pByMember->GetChatName()))
	{
		pByMember->SendChatMsg(CHATMSG_MustHaveOps);
		return;
	}
	CChatChanMember * pMember = FindMember(pszName);
	if (!pMember)
	{
		pByMember->SendChatMsg(CHATMSG_NoPlayer, pszName);
		return;
	}
	if (!IsModerator(pMember->GetChatName()))
		return;
	SetModerator(pszName, false);
	SendThisMember(pMember); // Update the color
	Broadcast(CHATMSG_PlayerNoLongerModerator, pMember->GetChatName(), "", "");
	pMember->SendChatMsg(CHATMSG_RemovedListModerators, pByMember->GetChatName());
}
Пример #14
0
void CChatChannel::GrantModerator(CChatChanMember * pByMember, LPCTSTR pszName)
{
	ADDTOCALLSTACK("CChatChannel::GrantModerator");
	if (!IsModerator(pByMember->GetChatName()))
	{
		pByMember->SendChatMsg(CHATMSG_MustHaveOps);
		return;
	}
	CChatChanMember * pMember = FindMember(pszName);
	if (!pMember)
	{
		pByMember->SendChatMsg(CHATMSG_NoPlayer, pszName);
		return;
	}
	if (IsModerator(pMember->GetChatName()))
		return;
	SetModerator(pszName, true);
	SendThisMember(pMember); // Update the color
	Broadcast(CHATMSG_PlayerIsAModerator, pMember->GetChatName(), "", "");
	pMember->SendChatMsg(CHATMSG_YouAreAModerator, pByMember->GetChatName());
}
Пример #15
0
void Channel::SetMode(Player *p, const char *p2n, bool mod, bool set)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		SendToOne(&data,p);
	}
	else if(!players[p].moderator && p->GetSession()->GetSecurity() < 2)
	{
		MakeNotModerator(&data);
		SendToOne(&data,p);
	}
	else 
	{
		Player *newp = objmgr.GetPlayer(p2n);
		PlayerInfo inf = players[newp];
		if(p == owner && newp == owner && mod)
			return;
		if(newp == NULL || !IsOn(newp))
		{
			MakeNotOn(&data,p2n);
			SendToOne(&data,p);
		}
		else if(owner == newp && owner != p)
		{
			MakeNotOwner(&data);
			SendToOne(&data,p);
		}
		else
		{
			if(mod)
				SetModerator(newp,set);
			else
				SetMute(newp,set);
		}
	}
}
Пример #16
0
void Channel::SetMode(Player* player, const char* targetName, bool moderator, bool set)
{
    ObjectGuid guid = player->GetObjectGuid();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

    if (!m_players[guid].IsModerator() && player->GetSession()->GetSecurity() < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    Player* target = sObjectMgr.GetPlayer(targetName);
    if (!target)
    {
        WorldPacket data;
        MakePlayerNotFound(&data, targetName);
        SendToOne(&data, guid);
        return;
    }

    ObjectGuid targetGuid = target->GetObjectGuid();
    if (moderator && guid == m_ownerGuid && targetGuid == m_ownerGuid)
        return;

    if (!IsOn(targetGuid))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, targetName);
        SendToOne(&data, guid);
        return;
    }

    // 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
    if ((player->GetSession()->GetSecurity() < SEC_GAMEMASTER || target->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
        player->GetTeam() != target->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, targetName);
        SendToOne(&data, guid);
        return;
    }

    if (m_ownerGuid == targetGuid && m_ownerGuid != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    // set channel moderator
    if (moderator)
        SetModerator(targetGuid, set);
    else
        SetMute(targetGuid, set);
}
Пример #17
0
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
    uint64 guid = player->GetGUID();
    uint32 sec = player->GetSession()->GetSecurity();

    if (!IsOn(guid))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, guid);
        return;
    }

    if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, guid);
        return;
    }

    if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
        return;

    Player* newp = ObjectAccessor::FindPlayerByName(p2n, false);
    uint64 victim = newp ? newp->GetGUID() : 0;

    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
        ((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId()))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, p2n);
        SendToOne(&data, guid);
        return;
    }

    if (_ownerGUID == victim && _ownerGUID != guid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, guid);
        return;
    }

    if (mod)
    {
        bool isBadConstantModerator = _channelRights.moderators.find(newp->GetSession()->GetAccountId()) != _channelRights.moderators.end();
        if (!isBadConstantModerator)
            SetModerator(newp->GetGUID(), set);
    }
    else
    {
        bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
        if (!AccountMgr::IsGMAccount(sec) && !isGoodConstantModerator)
        {
            if (_channelRights.flags & CHANNEL_RIGHT_CANT_MUTE)
            {
                WorldPacket data;
                MakeNotModerator(&data);
                SendToOne(&data, guid);
                return;
            }
        }

        SetMute(newp->GetGUID(), set);
    }
}
Пример #18
0
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
{
    Player *plr = sObjectMgr->GetPlayer(p);
    if (!plr)
        return;

    uint32 sec = plr->GetSession()->GetSecurity();

    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
    }
    else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, p);
    }
    else
    {
        Player *newp = sObjectMgr->GetPlayer(p2n);
        if (!newp)
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
            return;

        if (!IsOn(newp->GetGUID()))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        // 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
        if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
            plr->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
        {
            WorldPacket data;
            MakeNotOwner(&data);
            SendToOne(&data, p);
            return;
        }

        if (mod)
            SetModerator(newp->GetGUID(), set);
        else
            SetMute(newp->GetGUID(), set);
    }
}
Пример #19
0
void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
{
    PlayerPointer plr = GetPlayer(p);
    if (!plr.get())
        return;

    uint32 sec = plr->GetSession()->GetSecurity();

    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
    }
    else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, p);
    }
    else
    {
        PlayerPointer newp = GetPlayer(p2n);
        if (!newp.get())
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        PlayerInfo inf = m_players[newp->GetObjectGuid()];
        if (p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
            return;

        if (!IsOn(newp->GetObjectGuid()))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        // 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
        if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
                plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        if (m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
        {
            WorldPacket data;
            MakeNotOwner(&data);
            SendToOne(&data, p);
            return;
        }

        if (mod)
        {
            if (HasFlag(CHANNEL_FLAG_GENERAL) && newp->GetSession()->GetSecurity() < SEC_GAMEMASTER)
                return;

            SetModerator(newp->GetObjectGuid(), set);
        }
        else
            SetMute(newp->GetObjectGuid(), set);
    }
}