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


C++ USER::GetCountry方法代码示例

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


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

示例1: 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

示例2: Execute

UINT GWCountryAPHandler::Execute( GWCountryAP* 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, "GWCountryAPHandler...User GUID=%X not find!", 
            guid );
        return PACKET_EXE_CONTINUE;
    }

    INT nCountry = pUser->GetCountry();
    Country *pCountry = g_pCountryManager->GetCountry(nCountry);

    if (pCountry)
    {
        if (pUser->GetGUID() == pCountry->GetCountryInfo()->m_GuoWang)
        {
            BYTE cType  = pPacket->GetType();
            INT nAP     = pPacket->GetAP();

            switch (cType)
            {
            case 0:
                pCountry->AddActionPoint(nAP);
                break;
            case 1:
                pCountry->SubActionPoint(nAP);
                break;
            }

            Log::SaveLog( WORLD_LOGFILE, "GWCountryAPHandler...User GUID=%X ChangeAP = %d", 
                guid, nAP);
        }
    }

    return PACKET_EXE_CONTINUE ;

    __LEAVE_FUNCTION

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

示例3: Execute

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

示例4: Execute

uint GWRegisterTeamRecruitHandler::Execute( GWRegisterTeamRecruit* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

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

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

    if ( pPacket->GetType() == LEADER_RECRUIT )
    {   //队长发布征兵请示
        if( pUser->GetTeamID() == INVALID_ID )
        {
            //Assert( FALSE && "该玩家没有队伍!" );
            return PACKET_EXE_CONTINUE;
        }

        Team* pTeam = g_pTeamList->GetTeam( pUser->GetTeamID() );
        if( pTeam==NULL )
        {
            Assert(FALSE) ;
            return PACKET_EXE_CONTINUE ;
        }

        if ( pTeam->Leader()->m_Member != guid )
        {
            //Assert(FALSE&&"不是队长不可以申请招收队员!") ;
            return PACKET_EXE_CONTINUE ;
        }

        LEADER_RECRUIT_ATTRIB* pRecruit = pPacket->GetLeaderRecruit();

        LEADER_INFO_NODE *pData = g_pTeamRecruitManager->GetLeaderNullNode();
        pData->m_OwnerInfo.m_Level = pUser->GetLevel() ;
        pData->m_OwnerInfo.m_ManPai = pUser->GetMenpai();
        pData->m_OwnerInfo.m_Country = pUser->GetCountry();
        pData->m_OwnerInfo.m_NameLen = (UCHAR)strlen( pUser->GetName() );
        strncpy((char*)pData->m_OwnerInfo.m_szUserName,(char*)pUser->GetName(),pData->m_OwnerInfo.m_NameLen) ;

        pData->SetRecruitData(*pRecruit);
        g_pTeamRecruitManager->Remove(guid,LEADER_RECRUIT);
        g_pTeamRecruitManager->Add(guid,pData,LEADER_RECRUIT);
    }
    else if ( pPacket->GetType() == MEMBER_RECRUIT )
    {   //队员发布征兵请示
        MEMBER_RECRUIT_ATTRIB* pRecruit = pPacket->GetMemberRecruit();

        MEMBER_INFO_NODE *pData = g_pTeamRecruitManager->GetMemberNullNode();

        pData->m_OwnerInfo.m_Level = pUser->GetLevel() ;
        pData->m_OwnerInfo.m_ManPai = pUser->GetMenpai();
        pData->m_OwnerInfo.m_Country = pUser->GetCountry();
        pData->m_OwnerInfo.m_NameLen = (UCHAR)strlen( pUser->GetName() );
        strncpy((char*)pData->m_OwnerInfo.m_szUserName,(char*)pUser->GetName(),pData->m_OwnerInfo.m_NameLen) ;

        pData->SetRecruitData(*pRecruit);
        g_pTeamRecruitManager->Remove(guid,MEMBER_RECRUIT);
        g_pTeamRecruitManager->Add(guid,pData,MEMBER_RECRUIT);
    }
    else
    {
        //Assert(FALSE&&"组队征兵时类型错误");
    }

    Log::SaveLog( WORLD_LOGFILE, "GWRegisterTeamRecruit...Success!  GUID=%X", guid );

    return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

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


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