Ejemplo n.º 1
0
void Channel::Moderate(uint64 p)
{
    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
    {
        m_moderate = !m_moderate;

        WorldPacket data;
        if (m_moderate)
            MakeModerationOn(&data, p);
        else
            MakeModerationOff(&data, p);
        SendToAll(&data);
        if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0))
            sLog.outDebug("Channel(%s) announce saved", m_name.c_str());
    }
}
Ejemplo n.º 2
0
void Channel::SetOwner(uint64 guid, bool exclaim)
{
    if (m_ownerGUID)
    {
        // [] will re-add player after it possible removed
        PlayerList::iterator p_itr = players.find(m_ownerGUID);
        if (p_itr != players.end())
            p_itr->second.SetOwner(false);
    }

    m_ownerGUID = guid;
    if (m_ownerGUID)
    {
        uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
        players[m_ownerGUID].SetModerator(true);
        players[m_ownerGUID].SetOwner(true);

        WorldPacket data;
        MakeModeChange(&data, m_ownerGUID, oldFlag);
        SendToAll(&data);

        if (exclaim)
        {
            MakeOwnerChanged(&data, m_ownerGUID);
            SendToAll(&data);
        }
        if (m_IsSaved && _UpdateIntInDB("m_moderate", m_moderate ? 1 : 0))
            sLog.outDebug("Channel(%s) moderate saved", m_name.c_str());

    }
}
Ejemplo n.º 3
0
void Channel::Announce(uint64 p)
{
    uint32 sec = 0;
    Player *plr = ObjectAccessor::FindPlayer(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
    {
        m_announce = !m_announce;

        WorldPacket data;
        if (m_announce)
            MakeAnnouncementsOn(&data, p);
        else
            MakeAnnouncementsOff(&data, p);
        SendToAll(&data);
        if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0))
            sLog->outDebug (LOG_FILTER_NETWORKIO, "Channel(%s) announce saved", m_name.c_str());
    }
}