当前位置: 首页>>代码示例>>C++>>正文


C++ USER类代码示例

本文整理汇总了C++中USER的典型用法代码示例。如果您正苦于以下问题:C++ USER类的具体用法?C++ USER怎么用?C++ USER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了USER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

UINT GWUpdateTitleHandler::Execute(GWUpdateTitle* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() );
	if( pUser==NULL )
	{//没有发现在“在线用户列表”里对应此GUID的用户
		Log::SaveLog( WORLD_LOGFILE, "GWUpdateTitleHandler...User GUID=%X not find!",
			pPacket->GetGUID() );

		Assert( FALSE && "找不到此人" );
		return PACKET_EXE_CONTINUE;
	}

	pUser->SetTitle( pPacket->GetTitle() );

	Log::SaveLog( WORLD_LOGFILE, "GWUpdateTitleHandler...User GUID=%X Changed Title to Title=%s", 
		pPacket->GetGUID(), pPacket->GetTitle() );

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:brock7,项目名称:TianLong,代码行数:25,代码来源:GWUpdateTitleHandler.cpp

示例2: Assert

uint	GWDetailOtherOnlineAttrib_HorseHandler::Execute(GWDetailOtherOnlineAttrib_Horse* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
	Assert( pServerPlayer );

	GUID_t guid = pPacket->GetPlayerGUID();
	USER* pUser = g_pOnlineUser->FindUser(guid);
	if(pUser){
		ID_t ServerID = pUser->GetServerID() ;
		ServerPlayer* pDestServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
		if( pDestServerPlayer==NULL )
		{
			Assert(FALSE);
		}
		WGDetailOtherOnlineAttrib_Horse Msg;
		Msg.SetPlayerID(pPacket->GetPlayerID());//发起查看者的ID

		Msg.SetGUID(pPacket->GetGUID());
		Msg.SetDataID(pPacket->GetDataID());
		Msg.SetLevel(pPacket->GetLevel());
		Msg.SetGenGu(pPacket->GetGenGu());
		Msg.SetRemainPoint(pPacket->GetRemainPoint());
		Msg.SetExp(pPacket->GetExp());
		Msg.SetGeneration(pPacket->GetGeneration());
		Msg.SetHappiness(pPacket->GetHappiness());
		Msg.SetSpouseGUID(pPacket->GetSpouseGUID());
		Msg.SetName(pPacket->GetName());
		Msg.SetNickName(pPacket->GetNickName());
		Msg.SetDexPerception(pPacket->GetDexPerception());
		Msg.SetStrPerception(pPacket->GetStrPerception());
		Msg.SetIntPerception(pPacket->GetIntPerception());
		Msg.SetConPerception(pPacket->GetConPerception());
		Msg.SetSavvy(pPacket->GetSavvy());
		Msg.SetMountID(pPacket->GetMountID());

		Msg.SetHorseState(pPacket->GetHorseState());
		Msg.SetGrowRate(pPacket->GetGrowRate());

		for(UINT i=0; i<PET_MAX_SKILL_COUNT; ++i){
			Msg.SetSkill(i, pPacket->GetSkill(i));
		}

		Msg.SetCon(pPacket->GetCon());
		Msg.SetDex(pPacket->GetDex());
		Msg.SetInt(pPacket->GetInt());
		Msg.SetStr(pPacket->GetStr());

		pDestServerPlayer->SendPacket(&Msg);

		Log::SaveLog( WORLD_LOGFILE, "GWDetailOtherOnlineAttrib_HorseHandler: ok ");
	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:60,代码来源:GWDetailOtherOnlineAttrib_HorseHandler.cpp

示例3: Execute

UINT GWCallOfHumanHandler::Execute( GWCallOfHuman* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    USER* pUser = g_pOnlineUser->FindUser( pPacket->GetCallOfTargetGUID() ) ;
    if( pUser==NULL )
    {
        Assert(FALSE) ;
        return PACKET_EXE_CONTINUE ;
    }

    ID_t ServerID = pUser->GetServerID() ;
    ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
    if( pServerPlayer==NULL )
    {
        Assert(FALSE) ;
        return PACKET_EXE_CONTINUE ;
    }

    WGCallOfHuman msgCallOfHuman;
    msgCallOfHuman.SetCallOfTargetPlayerID(pUser->GetPlayerID());
    msgCallOfHuman.SetCallOfInfo(pPacket->GetCallOfInfo());
    msgCallOfHuman.SetGUID(pPacket->GetCallOfTargetGUID());
    pServerPlayer->SendPacket(&msgCallOfHuman);

    Log::SaveLog( WORLD_LOGFILE, "GWCallOfHumanHandler" );

    return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:33,代码来源:GWCallOfHumanHandler.cpp

示例4: Execute

uint GWMailHandler::Execute( GWMail* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	USER* pUser = g_pOnlineUser->FindUser( pPacket->GetMail()->m_szDestName );
	if( pUser  && (pUser->UserStatus() != US_OFFLINE) )
	{//当前用户在线
		if( pUser->RecvMail( pPacket->GetMail() ) == FALSE )
		{
			Log::SaveLog( WORLD_LOGFILE, "GWMailHandler...dName=%s refuse sName=%s's mail.",
				pUser->GetName(), pPacket->GetMail()->m_szSourName );

			return PACKET_EXE_CONTINUE;
		}
	}
	else
	{
		g_pMailCenter->MailTo( pPacket->GetMail() );
	}

	Log::SaveLog( WORLD_LOGFILE, "GWMailHandler...sName=%s dName=%s",
		(pPacket->GetMail()->m_SourSize > 0)?pPacket->GetMail()->m_szSourName:"",
		pPacket->GetMail()->m_szDestName );

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:30,代码来源:GWMailHandler.cpp

示例5: Execute

uint GWHeartBeatHandler::Execute( GWHeartBeat* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;

	GUID_t sGUID = pPacket->GetGUID() ;

	USER* pUser = g_pOnlineUser->FindUser( sGUID ) ;
	if( pUser==NULL )
	{
		WGNotifyUser Msg ;
		Msg.SetGUID( sGUID ) ;
		Msg.SetStatus( WGNotifyUser::NUS_REMOVE ) ;

		pServerPlayer->SendPacket( &Msg ) ;
		
		Log::SaveLog( WORLD_LOGFILE, "GWHeartBeatHandler...User GUID=%X not find! Notify server!", 
			sGUID ) ;

		return PACKET_EXE_CONTINUE ;
	}

	pUser->ResetKickTime() ;

	Log::SaveLog( WORLD_LOGFILE, "GWHeartBeatHandler...User GUID=%X Status=%d!", 
		sGUID, pUser->UserStatus() ) ;
	
	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

		return PACKET_EXE_ERROR ;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例6: Assert

// 填充密友在线列表
VOID USER::FillOnlineList( RETURN_ONLINE_LIST* pSend )
{
__ENTER_FUNCTION

    Assert( pSend );
    const _RELATION_USER* pRUser;

    for( INT i=0; i<MAX_RELATION_SIZE; ++i )
    {
        pRUser = &(m_RelationData.m_RelationList.m_RelationUsers[i]);
        if( (pRUser->m_UserGUID != INVALID_ID) && (pRUser->m_nFriendPoint >= g_Config.m_ConfigInfo.m_nPromptPoint) )
        {
            USER* pFriend;

            pFriend = g_pOnlineUser->FindUser( pRUser->m_UserGUID );
            if( pFriend != NULL && pFriend->IsGoodFriend( GetGUID() ) ) // 在线玩家
            {
                _RELATION_ONLINE OnlineRelation;
                OnlineRelation.SetGUID( pFriend->GetGUID() );
                OnlineRelation.SetMood( pFriend->GetMood() );
                pSend->AddOnlineRelation( &OnlineRelation );
            }
        }
    }

__LEAVE_FUNCTION
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:28,代码来源:User.cpp

示例7: Execute

uint GWBatchMailHandler::Execute( GWBatchMail* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	USER* pUser = NULL;
	BATCH_MAIL* pBatchMail = pPacket->GetBatchMail();

	MAIL mail;
	mail.m_GUID = pBatchMail->GetGUID();
	strncpy( mail.m_szSourName, pBatchMail->GetSourName(), MAX_CHARACTER_NAME - 1 );
	mail.m_SourSize = (BYTE)strlen( mail.m_szSourName );
	strncpy( mail.m_szContex, pBatchMail->GetMailContent(), MAX_MAIL_CONTEX - 1 );
	mail.m_ContexSize = (WORD)strlen( mail.m_szContex );
	mail.m_uFlag = pBatchMail->GetMailFlag();
	mail.m_uCreateTime = pBatchMail->GetCreateTime();

	for( BYTE i=0; i<pBatchMail->GetReceiverCount(); ++i )
	{
		strncpy( mail.m_szDestName, pBatchMail->GetDestName(i), MAX_CHARACTER_NAME - 1 );
		mail.m_DestSize = (BYTE)strlen( mail.m_szDestName );

		pUser = g_pOnlineUser->FindUser( mail.m_szDestName );
		if( pUser )
		{//当前用户在线
			if( pUser->RecvMail( &mail ) == FALSE )
			{
				Log::SaveLog( WORLD_LOGFILE, "GWBatchMailHandler...dName=%s refuse sName=%s's mail.",
					pUser->GetName(), mail.m_szSourName );

				return PACKET_EXE_CONTINUE;
			}
		}
		else
		{
			g_pMailCenter->MailTo( &mail );
		}

		Log::SaveLog( WORLD_LOGFILE, "GWBatchMailHandler...sName=%s dName=%s",
			mail.m_szSourName, mail.m_szDestName );

	}

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:xu561865,项目名称:TL_Server,代码行数:48,代码来源:GWBatchMailHandler.cpp

示例8: Execute

uint GWNotifyUserHandler::Execute( GWNotifyUser* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;

	USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
	if( pUser==NULL )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWNotifyUserHandler...User GUID=%X not find!", 
			pPacket->GetGUID(), pPacket->GetStatus() ) ;

		return PACKET_EXE_CONTINUE ;
	}

	if( pPacket->GetStatus()==GWNotifyUser::NUS_NEED_WORLD_KICK )
	{
		g_pOnlineUser->OnUserRemove( pUser );
		g_pOnlineUser->DelUser( pUser ) ;
		Log::SaveLog( WORLD_LOGFILE, "GWNotifyUserHandler...KICK User GUID=%X Status=%d SP=%d DP=%d", 
			pPacket->GetGUID(), pPacket->GetStatus(), pUser->GetPlayerID(), pPacket->GetPlayerID() ) ;
	}

	if( pUser->GetPlayerID() != pPacket->GetPlayerID() )
	{
		Log::SaveLog( WORLD_LOGFILE, "ERROR: GWNotifyUserHandler...User GUID=%X Status=%d SP=%d DP=%d", 
			pPacket->GetGUID(), pPacket->GetStatus(), pUser->GetPlayerID(), pPacket->GetPlayerID() ) ;

		return PACKET_EXE_CONTINUE ;
	}

	if( pPacket->GetStatus()==GWNotifyUser::NUS_DISCONNECT )
	{
		pUser->SetUserStatus( US_OFFLINE );
		pUser->ResetKickTime();
		g_pOnlineUser->OnUserOffLine( pUser );
		Log::SaveLog( WORLD_LOGFILE, "GWNotifyUserHandler...User Is Disconnect GUID=%X Status=%d SP=%d DP=%d", 
			pPacket->GetGUID(), pPacket->GetStatus(), pUser->GetPlayerID(), pPacket->GetPlayerID() ) ;
	}
	else if( pPacket->GetStatus()==GWNotifyUser::NUS_REMOVE )
	{
		g_pOnlineUser->OnUserRemove( pUser );
		g_pOnlineUser->DelUser( pUser ) ;
		Log::SaveLog( WORLD_LOGFILE, "GWNotifyUserHandler...User Is Remove GUID=%X Status=%d SP=%d DP=%d", 
			pPacket->GetGUID(), pPacket->GetStatus(), pUser->GetPlayerID(), pPacket->GetPlayerID() ) ;
	}

	Log::SaveLog( WORLD_LOGFILE, "GWNotifyUserHandler...User GUID=%X Status=%d", 
		pPacket->GetGUID(), pPacket->GetStatus() ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:xu561865,项目名称:TL_Server,代码行数:56,代码来源:GWNotifyUserHandler.cpp

示例9: Execute

uint GWStopTeamFollowHandler::Execute( GWStopTeamFollow* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GUID_t guid = pPacket->GetGUID();

	USER* pUser = g_pOnlineUser->FindUser( guid );
	if ( pUser == NULL )
	{
		Assert(FALSE && "user not find!");
		return PACKET_EXE_CONTINUE;
	}

	if ( pUser->GetTeamID() == INVALID_ID )
	{
		Assert(FALSE && "isn't in a team!");
		return PACKET_EXE_CONTINUE;
	}

	Team* pTeam = g_pTeamList->GetTeam( pUser->GetTeamID() );
	if ( pTeam==NULL )
	{
		Assert(FALSE && "team not found!");
		return PACKET_EXE_CONTINUE;
	}

	if ( pTeam->GetFollowedMembers()[0] == pUser->GetGUID() )
	{ // 队长或者前队长的话
		pTeam->ClearFollowedMembers();
	}
	else
	{
		pTeam->DelFollowedMember(guid);
	}

	Log::SaveLog( WORLD_LOGFILE, "GWStopTeamFollow... GUID=%X stop follow team.", guid);

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:43,代码来源:GWStopTeamFollowHandler.cpp

示例10: Execute

uint GWAskTeamMemberInfoHandler::Execute( GWAskTeamMemberInfo* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

    ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
    GUID_t guid = pPacket->GetGUID(); // 被请求信息的玩家的 GUID
    WGTeamMemberInfo Msg;

    Msg.SetPlayerID( pPacket->GetObjID() );
    Msg.SetGUID( guid );

    USER* pUser = g_pOnlineUser->FindUser( guid );
    if( pUser == NULL )
    {   // 离线状态
        Log::SaveLog( WORLD_LOGFILE, "GWAskTeamInfoHandler...User GUID=%X not find!", guid );
        return PACKET_EXE_CONTINUE;
    }

    Msg.SetFamily( pUser->GetMenpai() );
    Msg.SetLevel( pUser->GetLevel() );

    if( pUser->UserStatus() != US_NORMAL )
    {
        Msg.SetDeadLinkFlag( TRUE );
    }
    else
    {
        Msg.SetDeadLinkFlag( FALSE );
    }

    pServerPlayer->SendPacket( &Msg );
    Log::SaveLog( WORLD_LOGFILE, "GWAskTeamInfoHandler...User GUID=%X was find!", guid );

    return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

    return PACKET_EXE_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:39,代码来源:GWAskTeamMemberInfoHandler.cpp

示例11: InformOfflineMsg

// 通知在线密友下线信息
VOID USER::InformOfflineMsg()
{
__ENTER_FUNCTION

    const _RELATION_USER* pRUser;

    for( INT i=0; i<MAX_RELATION_SIZE; ++i )
    {
        pRUser = &(m_RelationData.m_RelationList.m_RelationUsers[i]);
        if( (pRUser->m_UserGUID != INVALID_ID) && (pRUser->m_nFriendPoint >= g_Config.m_ConfigInfo.m_nPromptPoint) )
        {
            USER* pFriend;

            pFriend = g_pOnlineUser->FindUser( pRUser->m_UserGUID );
            if( pFriend != NULL && pFriend->IsGoodFriend( GetGUID() ) ) // 在线玩家
            {
                pFriend->SendRelationOfflineMsg( this );
            }
        }
    }

__LEAVE_FUNCTION
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:24,代码来源:User.cpp

示例12: Execute

UINT GWCountryInfoRequestHandler::Execute( GWCountryInfoRequest* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

    ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
    GUID_t guid = pPacket->GetGuid();

    USER* pUser = g_pOnlineUser->FindUser( guid );
    if( pUser == NULL )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWCountryInfoRequestHandler...User GUID=%X not find!", 
            guid );
        return PACKET_EXE_CONTINUE;
    }

    _COUNTRY country;
    g_pCountryManager->GetCountryInfo(pUser->GetCountry(), country);   

    WGCountryInfoConfirm Msg;
    Msg.SetPlayerID( pUser->GetPlayerID() );

    COUNTRY_CGW_COUNTRY_INFO info;
    info.m_CountryID    =   pUser->GetCountry();
    memcpy(&info.m_CountryInfo, &country, sizeof(_COUNTRY));
    Msg.SetCountryInfo( &info );
    pServerPlayer->SendPacket( &Msg );

    Log::SaveLog( WORLD_LOGFILE, "GWCountryInfoRequestHandler...User GUID=%X send CountryInfo!", 
        guid );

    return PACKET_EXE_CONTINUE ;

    __LEAVE_FUNCTION

        return PACKET_EXE_ERROR ;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:36,代码来源:GWCountryInfoRequestHandler.cpp

示例13: Execute

UINT GWEnterTeamFollowHandler::Execute( GWEnterTeamFollow* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    GUID_t guid = pPacket->GetGUID();

    USER* pUser = g_pOnlineUser->FindUser( guid );
    if ( pUser == NULL )
    {
        Assert(FALSE && "user not find!");
        return PACKET_EXE_CONTINUE;
    }

    if ( pUser->GetTeamID() == INVALID_ID )
    {
        Assert(FALSE && "isn't in a team!");
        return PACKET_EXE_CONTINUE;
    }

    Team* pTeam = g_pTeamList->GetTeam( pUser->GetTeamID() );
    if( pTeam==NULL )
    {
        Assert(FALSE && "team not found!");
        return PACKET_EXE_CONTINUE;
    }

    pTeam->AddFollowedMember(guid);

    Log::SaveLog( WORLD_LOGFILE, "GWEnterTeamFollow... GUID=%X start follow team.", guid);

    return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:36,代码来源:GWEnterTeamFollowHandler.cpp

示例14: strncpy

uint GWAskUserDataHandler::Execute( GWAskUserData* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;

	USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
	WGRetUserData Msg ;
	if( pUser==NULL )
	{//没有发现在“在线用户列表”里对应此GUID的用户
		
		Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...User GUID=%X not find!", 
			pPacket->GetGUID() ) ;
		//如果是完整的Login 模式
		if( g_Config.m_WorldInfo.m_EnableShareMem )
		{
			Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
			Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;

			pServerPlayer->SendPacket( &Msg ) ;

			return PACKET_EXE_CONTINUE ;
		}

		//不是完整的login 模式
		//测试数据
		pUser = g_pOnlineUser->LoadUser( pPacket->GetGUID(), pPacket->GetCountry(), pPacket->GetProfession(),pPacket->GetAccount()) ;

		if( pUser )
		{
			_HUMAN_DB_LOAD* pDBHuman = &(pUser->GetFullUserData()->m_Human);

			pUser->SetTeamID( pUser->GetFullUserData()->m_Human.m_TeamID );

			//临时测试数据
			strncpy( pDBHuman->m_Name, pPacket->GetAccount(), MAX_CHARACTER_NAME-1 ) ;
			pDBHuman->m_Sex		= (BOOL)(pPacket->GetGender()) ;
			pDBHuman->m_nCountry = pPacket->GetCountry();
			pDBHuman->m_MenPai   = pPacket->GetProfession();
			pDBHuman->m_FaceModel = pPacket->GetFaceModel();
			pUser->SetKey( pPacket->GetKey() );
			//临时测试数据

			g_pOnlineUser->OnUserLogin( pUser ) ;
            g_pCountryManager->AddCountryUser((COUNTRY_ATTRIBUTE)pUser->GetCountry(), pUser->GetGUID());

			Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
			Msg.SetReturn( UDR_USERDATA ) ;
			Msg.SetUserData( pUser->GetFullUserData() ) ;


			//回收数据块, 设置用户状态
			g_pOnlineUser->DelData( pUser->GetFullUserData() ) ; //modified by wuwenbin
			pUser->SetFullUserData( NULL );	//为什么置空,随后FindUser时造成FULLUSERDATA结构为空
			pUser->SetUserStatus( US_NORMAL );
			pUser->ResetKickTime();

			//将用户所在服务器的PlayerID记录到用户数据里
			pUser->SetPlayerID( pPacket->GetPlayerID() );

			pServerPlayer->SendPacket( &Msg ) ;

			Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...Load GUID=%X OK!", 
				pPacket->GetGUID() ) ;
		}
		else
		{
			Log::SaveLog( WORLD_LOGFILE, "ERROR:GWAskUserDataHandler...Load GUID=%X false!", 
				pPacket->GetGUID() ) ;
		}
//测试数据
//

		return PACKET_EXE_CONTINUE ;
	}

	int iUserStatus = pUser->UserStatus() ;

	if( pUser->GetKey() != pPacket->GetKey() )
	{//验证码错误,警报,也许受到攻击
		Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
		Msg.SetReturn( UDR_KEYERROR ) ;

		pServerPlayer->SendPacket( &Msg ) ;

		Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler.Key Error..User GUID=%X Status=%d", 
			pPacket->GetGUID(), iUserStatus ) ;

		return PACKET_EXE_CONTINUE ;
	}

	//将用户所在服务器的PlayerID记录到用户数据里
	pUser->SetPlayerID( pPacket->GetPlayerID() );

	switch( iUserStatus )
	{
	case US_NONE:
		{
			Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
			Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:wx2Server,代码行数:101,代码来源:GWAskUserDataHandler.cpp

示例15: Assert

uint GWTeamKickHandler::Execute( GWTeamKick* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pSourServerPlayer = (ServerPlayer*)pPlayer;

	GUID_t sGuid = pPacket->GetSourGUID(); // 队长
	GUID_t dGuid = pPacket->GetDestGUID(); // 倒霉蛋

	USER* pSourUser = g_pOnlineUser->FindUser( sGuid );
	if( pSourUser==NULL )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User Sour GUID=%X not find!", 
			sGuid );

		return PACKET_EXE_CONTINUE;
	}

	TeamID_t tid = pSourUser->GetTeamID();
	Team* pTeam = g_pTeamList->GetTeam( tid );
	if( pTeam==NULL )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User sGUID=%X TeamID=%d not find team!", 
			sGuid, tid );

		return PACKET_EXE_CONTINUE;
	}

	INT nMemberCount = pTeam->MemberCount();
	INT i;
	for( i=0; i<nMemberCount; ++i )
	{
		if ( pTeam->Member(i)->m_Member == dGuid )
		{
			break;
		}
	}

	if( i >= nMemberCount )
	{ // 被踢者不在队伍里
		Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User dGUID=%X not in sTeamID=%d(sGUID=%X)!", 
			dGuid, tid, sGuid );

		return PACKET_EXE_CONTINUE;
	}

	if( pTeam->Leader()->m_Member != sGuid )
	{ // 踢人者不是队长
		WGTeamError Msg;
		Msg.SetPlayerID( pSourUser->GetPlayerID() );
		Msg.SetGUID( pSourUser->GetGUID() );
		Msg.SetErrorCode( TEAM_ERROR_KICKNOTLEADER );

		pSourServerPlayer->SendPacket( &Msg );

		Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User sGUID=%X TeamID=%d not leader!", 
			sGuid, tid );

		return PACKET_EXE_CONTINUE;
	}

	WGTeamResult Msg;
	Msg.SetReturn( TEAM_RESULT_TEAMKICK );
	Msg.SetGUID( dGuid );
	Msg.SetTeamID( tid );

	//通知所有组内的玩家
	for( int i=0; i<pTeam->MemberCount(); i++ )
	{
		TEAMMEMBER* pMember = pTeam->Member( i );
		if( pMember==NULL )
		{
			Assert(FALSE);
			continue;
		}

		USER* pUser = g_pOnlineUser->FindUser( pMember->m_Member );
		if( pUser==NULL )
		{//如果队员离线,则用户数据是空
			continue;
		}
		
		ID_t ServerID = pUser->GetServerID();
		ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( ServerID );
		if( pServerPlayer==NULL )
		{
			Assert(FALSE);
			continue;
		}

		Msg.SetPlayerID( pUser->GetPlayerID() );

		pServerPlayer->SendPacket( &Msg );
	}

	//剔除队员
	TEAMMEMBER Member;
	Member.m_Member = dGuid;
	pTeam->DelMember( &Member );

//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:GWTeamKickHandler.cpp


注:本文中的USER类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。