Beispiel #1
0
void Channel::Join(Player *p, const char *pass)
{	
	WorldPacket data;
	if(IsOn(p))
	{
		MakeAlreadyOn(&data,p);
		SendToOne(&data,p);
	}
	else if(IsBanned(p->GetGUID()))
	{
		MakeYouAreBanned(&data);
		SendToOne(&data,p);
	}
	else if(password.length() > 0 && strcmp(pass,password.c_str()))
	{
		MakeWrongPass(&data);
		SendToOne(&data,p);
	}
	else
	{
		PlayerInfo pinfo; 
		pinfo.player = p;
		pinfo.muted = false;
		pinfo.owner = false;
		pinfo.moderator = false;

		MakeJoined(&data,p);
		p->JoinedChannel(this);

		if(p->m_gmInvisible);
		else if(announce)
			SendToAll(&data);

		data.clear();
		players[p] = pinfo;

		MakeYouJoined(&data, p);
		SendToOne(&data,p);

		if(!IsGeneralChannel() && !constant && owner == NULL)
		{
			SetOwner(p);
			players[p].moderator = true;
		}
		else if(p->GetSession()->GetSecurity() >= 3)
		{
			SetOwner(p);
			players[p].moderator = true;
		}
		else if(p->GetSession()->GetSecurity() >= 1)
			players[p].moderator = true;
	}
}
Beispiel #2
0
void Channel::Join(uint64 p, const char *pass)
{
    WorldPacket data;
    if(IsOn(p))
    {
        if(!IsConstant())                                   // non send error message for built-in channels
        {
            MakeAlreadyOn(&data,p);
            SendToOne(&data,p);
        }
    }
    else if(IsBanned(p))
    {
        MakeYouAreBanned(&data);
        SendToOne(&data,p);
    }
    else if(password.length() > 0 && strcmp(pass,password.c_str()))
    {
        MakeWrongPass(&data);
        SendToOne(&data,p);
    }
    else
    {
        PlayerInfo pinfo;
        pinfo.player = p;
        pinfo.muted = false;
        pinfo.owner = false;
        pinfo.moderator = false;

        Player *plr = objmgr.GetPlayer(p);
        if(plr)
            plr->JoinedChannel(this);

        if(announce)
        {
            MakeJoined(&data,p);
            SendToAll(&data);
        }

        data.clear();
        players[p] = pinfo;

        MakeYouJoined(&data,p);
        SendToOne(&data,p);

        // if no owner first logged will become
        if(!IsConstant() && !m_ownerGUID)
        {
            SetOwner(p, (players.size()>1?true:false));
            players[p].moderator = true;
        }
    }
}