コード例 #1
0
ファイル: charserver.cpp プロジェクト: karlseven/ROED
// When a a client is disconnected
void CCharServer::OnClientDisconnect( CClientSocket* thisclient )
{
    CCharClient* thisclientwc = (CCharClient*)thisclient;
    if(!thisclientwc->logout)
    {
        // Send logout message to friends
        for(UINT i=0; i<thisclientwc->FriendList.size( ); i++)
        {
            CFriendList* Friend = thisclientwc->FriendList.at( i );;
            CCharClient* otherclient = GetClientByID( Friend->id );
            if(otherclient!=NULL)
            {
                ChangeMessengerStatus ( thisclientwc, otherclient, 0x08);
            }
        }
        //set logout messga to clan
        CClans* thisclan = GetClanByID(thisclientwc->clanid);
        if(thisclan==NULL)
            return;
        for(UINT i=0; i<thisclan->ClanMembers.size( ); i++)
        {
            CClanMembers*   ClanMember = thisclan->ClanMembers.at( i );
            CCharClient* otherclient = GetClientByID( ClanMember->id );
            if(otherclient!=NULL)
                ChangeClanStatus (thisclientwc, otherclient, 0xff);
        }

        //LMA: Disconnecting a client from chatroom.
        DisconnectClientFromChat(thisclientwc );
    }
}
コード例 #2
0
ファイル: clan.cpp プロジェクト: L3nn0x/osirosenew
// Logout from clan
bool CCharServer::ClanLogout ( CCharClient* thisclient )
{    
    CClans* thisclan = (CClans*) GetClanByID(thisclient->clanid);             
    if(thisclan!=NULL)
    {       
        for(UINT i=0;i<thisclan->ClanMembers.size();i++)
        {
            CClanMembers* thismember = thisclan->ClanMembers.at( i );
            CCharClient* otherclient = (CCharClient*) GetClientByID ( thismember->id );
            if(otherclient!=NULL)
            {
                ChangeClanStatus (thisclient, otherclient, 0xff);//send channel here
            }
        }        	
    }     
    return true;
}
コード例 #3
0
ファイル: clan.cpp プロジェクト: L3nn0x/osirosenew
// Send Clan information
bool CCharServer::SendClanInfo (CCharClient* thisclient)
{
    if( thisclient->clanid > 0 )
    {
        CClans *thisclan = GetClanByID(thisclient->clanid);
        if(thisclan!=NULL)
        {
            BEGINPACKET( pak, 0x7e0);
            ADDBYTE    ( pak, 0x33);//0x33 you have invited to clan
            ADDWORD    ( pak, thisclan->id);// clan id
            ADDBYTE    ( pak, 0x00);//
            ADDBYTE    ( pak, 0x00);
            ADDWORD    ( pak, thisclan->back);//Clan Background
            ADDWORD    ( pak, thisclan->logo);//Clan logo
            ADDBYTE    ( pak, thisclan->grade);//Clan grade
            ADDBYTE    ( pak, thisclient->clan_rank);// Clan rank (0 = red rokie / 6 = master)
            ADDDWORD    ( pak, thisclan->cp);//Clan Points
            ADDDWORD   ( pak, 0x00000064);
            ADDDWORD   ( pak, 0x00000000); //Clan found
            ADDDWORD   ( pak, 0x00000000);
            ADDBYTE    ( pak, 0x01);
            for(int i=34;i<156;i++)
                ADDBYTE ( pak, 0x00);
            ADDWORD    ( pak, 0x0000);
            ADDBYTE    ( pak, 0x00);
            ADDSTRING  ( pak, thisclan->name);//Clan Name            
            ADDBYTE    ( pak, 0x00);            
            ADDSTRING  ( pak, thisclan->slogan);//Clan slogan
            ADDBYTE    ( pak, 0x00);
            ADDSTRING  ( pak, thisclan->news);//Clan news
            ADDBYTE    ( pak, 0x00);
            thisclient->SendPacket(&pak);	
            
            //Put the player online in clan
            for(UINT i=0;i<thisclan->ClanMembers.size();i++)
        	{		
                CClanMembers*	ClanMember = thisclan->ClanMembers.at( i );;
                CCharClient* otherclient = GetClientByID( ClanMember->id );
                if(otherclient!=NULL)
                    ChangeClanStatus (thisclient, otherclient, thisclient->channel);//send channel here
        	}                      
        }
    }     
    return true;
}