示例#1
0
文件: Channel.cpp 项目: vata/prebcwow
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;
		}
	}
}
示例#2
0
void Channel::SetOwner(uint64 p, const char *newname)
{
    uint32 sec = 0;
    Player *plr = objmgr.GetPlayer(p);
    if(plr)
        sec = plr->GetSession()->GetSecurity();

    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data,p);
    }
    else
    {
        Player *newp = objmgr.GetPlayer(newname);
        if(newp == NULL || !IsOn(newp->GetGUID()))
        {
            WorldPacket data;
            MakeNotOn(&data,newname);
            SendToOne(&data,p);
        }
        else
        {
            players[newp->GetGUID()].moderator = true;
            SetOwner(newp->GetGUID());
        }
    }
}
示例#3
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::Invite(Player *p, const char *newname)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		SendToOne(&data,p);
	}
	else 
	{
		Player *newp = objmgr.GetPlayer(newname);
		if(newp == NULL)
		{
			MakeNotOn(&data,newname);
			SendToOne(&data,p);
		}
		else if(IsOn(newp))
		{
			MakeAlreadyOn(&data,newp);
			SendToOne(&data,p);
		}
		else
		{
			MakeInvited(&data,p);
			SendToOne(&data,newp);
			data.clear();
			MakeYouInvited(&data,newp);
			SendToOne(&data,p);
		}
	}
}
示例#4
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::UnBan(Player *good, const char *badname)
{
	WorldPacket data;
	if(!IsOn(good))
	{
		MakeNotOn(&data);
		SendToOne(&data,good);
	}
	else if(!players[good].moderator && good->GetSession()->GetSecurity() < 2)
	{
		MakeNotModerator(&data);
		SendToOne(&data,good);
	}
	else
	{
		Player *bad = objmgr.GetPlayer(badname);
		if(bad == NULL || !IsBanned(bad->GetGUID()))
		{
			MakeNotOn(&data,badname); // Change to <Not Banned> message. Not sure what it is.
			SendToOne(&data,good);
		}
		else
		{
			banned.remove(bad->GetGUID());
			MakeUnbanned(&data,good,bad);
			SendToAll(&data);
		}
	}
}
示例#5
0
void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{
    uint32 sec = 0;
    Player *gplr = objmgr.GetPlayer(good);
    if(gplr)
        sec = gplr->GetSession()->GetSecurity();

    if(!IsOn(good))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,good);
    }
    else if(!players[good].moderator && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data,good);
    }
    else
    {
        Player *bad = objmgr.GetPlayer(badname);
        if(bad == NULL || !IsOn(bad->GetGUID()))
        {
            WorldPacket data;
            MakeNotOn(&data,badname);
            SendToOne(&data,good);
        }
        else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
        {
            WorldPacket data;
            MakeNotOwner(&data);
            SendToOne(&data,good);
        }
        else
        {
            bool changeowner = (m_ownerGUID == bad->GetGUID());

            WorldPacket data;

            if(ban && !IsBanned(bad->GetGUID()))
            {
                banned.push_back(bad->GetGUID());
                MakeBanned(&data,good,bad->GetGUID());
            }
            else
                MakeKicked(&data,good,bad->GetGUID());

            SendToAll(&data);
            players.erase(bad->GetGUID());

            if(changeowner)
            {
                uint64 newowner = players.size() > 0 ? good : false;
                SetOwner(newowner);
            }
        }
    }
}
示例#6
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;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(!players[p].moderator && 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;
            MakeNotOn(&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);
        }
    }
}
示例#7
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::KickOrBan(Player *good, const char *badname, bool ban)
{
	WorldPacket data;
	if(!IsOn(good))
	{
		MakeNotOn(&data);
		SendToOne(&data,good);
	}
	else if(!players[good].moderator && good->GetSession()->GetSecurity() < 2)
	{
		MakeNotModerator(&data);
		SendToOne(&data,good);
	}
	else
	{
		Player *bad = objmgr.GetPlayer(badname);
		if(bad == NULL || !IsOn(bad))
		{
			MakeNotOn(&data,badname);
			SendToOne(&data,good);
		}
		else if(good->GetSession()->GetSecurity() < 2 && bad == owner && good != owner)
		{
			MakeNotOwner(&data);
			SendToOne(&data,good);
		}
		else
		{
			bool changeowner = (owner == bad);

			if(ban && !IsBanned(bad->GetGUID()))
			{
				banned.push_back(bad->GetGUID());
				MakeBanned(&data,good,bad);
			}
			else
				MakeKicked(&data,good,bad);	

			SendToAll(&data);
			players.erase(bad);

			if (!constant && changeowner)
			{
				Player *newowner = players.size() > 0 ? good : NULL;
				SetOwner(newowner);
			}
		}
	}
}
示例#8
0
void Channel::Password(uint64 p, const char *pass)
{
    uint32 sec = 0;
    Player *plr = objmgr.GetPlayer(p);
    if(plr)
        sec = plr->GetSession()->GetSecurity();

    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(!players[p].moderator && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data,p);
    }
    else
    {
        password = pass;

        WorldPacket data;
        MakeSetPassword(&data,p);
        SendToAll(&data);
    }
}
示例#9
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::Leave(Player *p, bool send)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		if(send) SendToOne(&data,p);
	}
	else
	{
		bool changeowner = (owner == p);

		MakeYouLeft(&data);
		if(send)
		{
			SendToOne(&data,p);
			p->LeftChannel(this);
		}
		data.clear();

		players.erase(p);
		MakeLeft(&data,p);
		if(p->m_gmInvisible);
		else if(announce)
			SendToAll(&data);

		if (!constant && changeowner)
		{
			Player *newowner = players.size() > 0 ? players.begin()->second.player : NULL;
			SetOwner(newowner);
		}
	}
}
示例#10
0
void Channel::List(uint64 p)
{
    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else
    {
        WorldPacket data(SMSG_CHANNEL_LIST,1+4+players.size()*(8+1));
        data << (uint8)3 << (uint32)players.size();

        PlayerList::iterator i;
        uint8 mode;
        for(i = players.begin(); i!=players.end(); i++)
        {
            data << i->first;
            mode = 0x00;
            if(i->second.muted)
                mode |= 0x04;
            if(i->second.moderator)
                mode |= 0x02;
            data << mode;
        }
        SendToOne(&data,p);
    }
}
示例#11
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::List(Player *p)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		SendToOne(&data,p);
	}
	else
	{
		data.Initialize(SMSG_CHANNEL_LIST);
		data << (uint8)3 << (uint32)players.size();

		PlayerList::iterator i;
		for(i = players.begin(); i!=players.end(); ++i)
		{
			data << i->first->GetGUID();
			uint8 mode = 0x00;
			if(i->second.muted) 
				mode |= 0x04;
			if(i->second.moderator)
				mode |= 0x02;
			data << mode;
		}
		SendToOne(&data,p);
	}
}
示例#12
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;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(!players[p].moderator && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data,p);
    }
    else
    {
        moderate = !moderate;

        WorldPacket data;
        MakeModerate(&data,p,moderate);
        SendToAll(&data);
    }
}
示例#13
0
文件: Channel.cpp 项目: vata/prebcwow
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);
		}
	}
}
示例#14
0
void Channel::UnBan(uint64 good, const char *badname)
{
    uint32 sec = 0;
    Player *gplr = objmgr.GetPlayer(good);
    if(gplr)
        sec = gplr->GetSession()->GetSecurity();

    if(!IsOn(good))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,good);
    }
    else if(!players[good].moderator && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data,good);
    }
    else
    {
        Player *bad = objmgr.GetPlayer(badname);
        if(bad == NULL || !IsBanned(bad->GetGUID()))
        {
            WorldPacket data;
            MakeNotOn(&data,badname);
            SendToOne(&data,good);
        }
        else
        {
            banned.remove(bad->GetGUID());

            WorldPacket data;
            MakeUnbanned(&data,good,bad->GetGUID());
            SendToAll(&data);
        }
    }
}
示例#15
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::GetOwner(Player *p)
{
	WorldPacket data;
	if(!IsOn(p))
	{
		MakeNotOn(&data);
		SendToOne(&data,p);
	}
	else
	{
		MakeWhoOwner(&data);
		SendToOne(&data,p);
	}
}
示例#16
0
void Channel::Invite(uint64 p, const char *newname)
{
    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else
    {
        Player *newp = objmgr.GetPlayer(newname);
        if(!newp)
        {
            WorldPacket data;
            MakeNotOn(&data,newname);
            SendToOne(&data,p);
        }
        else if(IsOn(newp->GetGUID()))
        {
            WorldPacket data;
            MakeAlreadyOn(&data,newp->GetGUID());
            SendToOne(&data,p);
        }
        else
        {
            WorldPacket data;
            if(!newp->HasInIgnoreList(p))
            {
                MakeInvited(&data,p);
                SendToOne(&data,newp->GetGUID());
                data.clear();
            }
            MakeYouInvited(&data,newp->GetGUID());
            SendToOne(&data,p);
        }
    }
}
示例#17
0
void Channel::GetOwner(uint64 p)
{
    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else
    {
        WorldPacket data;
        MakeWhoOwner(&data);
        SendToOne(&data,p);
    }
}
示例#18
0
void Channel::Say(uint64 p, const char *what, uint32 lang)
{
    if(!what)
        return;
    if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
        lang = LANG_UNIVERSAL;

    uint32 sec = 0;
    Player *plr = objmgr.GetPlayer(p);
    if(plr)
        sec = plr->GetSession()->GetSecurity();

    if(!IsOn(p))
    {
        WorldPacket data;
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(players[p].muted)
    {
        WorldPacket data;
        MakeYouCantSpeak(&data);
        SendToOne(&data,p);
    }
    else if(moderate && !players[p].moderator && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data,p);
    }
    else
    {
        uint32 messageLength = strlen(what) + 1;

        WorldPacket data(SMSG_MESSAGECHAT,1+4+name.size()+1+8+4+messageLength+1);
        data << (uint8)CHAT_MSG_CHANNEL;
        data << (uint32)lang;
        data << name;
        data << p;
        data << messageLength;
        data << what;
        data << uint8(plr ? plr->chatTag() : 0);

        SendToAll(&data,!players[p].moderator ? p : false);
    }
}
示例#19
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::Moderate(Player *p)
{
	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
	{
		moderate = !moderate;
		MakeModerate(&data,p,moderate);
		SendToAll(&data);
	}
}
示例#20
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::Password(Player *p, const char *pass)
{
	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
	{
		password = pass;
		MakeSetPassword(&data,p);
		SendToAll(&data);
	}
}
示例#21
0
void Channel::Leave(uint64 p, bool send)
{
    if(!IsOn(p))
    {
        if(send)
        {
            WorldPacket data;
            MakeNotOn(&data);
            SendToOne(&data,p);
        }
    }
    else
    {
        if(send)
        {
            WorldPacket data;
            MakeYouLeft(&data);
            SendToOne(&data,p);
            Player *plr = objmgr.GetPlayer(p);
            if(plr)
                plr->LeftChannel(this);
            data.clear();
        }

        bool changeowner = players[p].owner;

        players.erase(p);
        if(announce)
        {
            WorldPacket data;
            MakeLeft(&data,p);
            SendToAll(&data);
        }

        if(changeowner)
        {
            uint64 newowner = players.size() > 0 ? players.begin()->second.player : 0;
            SetOwner(newowner);
        }
    }
}
示例#22
0
文件: Channel.cpp 项目: vata/prebcwow
void Channel::Say(Player *p, const char *what)
{
	WorldPacket data;
    if(!IsOn(p))
    {
        MakeNotOn(&data);
        SendToOne(&data,p);
    }
    else if(players[p].muted)
    {
        MakeYouCantSpeak(&data);
        SendToOne(&data,p);
    }
    else if(moderate && !players[p].moderator && p->GetSession()->GetSecurity() < 2)
    {
        MakeNotModerator(&data);
        SendToOne(&data,p);
    }
    else
    {
        uint32 messageLength = strlen((char*)what) + 1;
        uint8 afk = 0;

        data.Initialize(SMSG_MESSAGECHAT);
        data << (uint8)14; // CHAT_MESSAGE_CHANNEL
        data << (uint32)0; // Universal lang
        data << name.c_str();
        data << (uint32)0;
        data << p->GetGUID();
        data << messageLength;
        data << what;
        data << (uint8)0;

        SendToAll(&data);
        
    }
}