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


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

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


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

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

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

示例3: Execute

UINT GWTeamAppointHandler::Execute( GWTeamAppoint* 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, "GWTeamAppointHandler...User Sour GUID=%X not find!",
                      sGuid );

        return PACKET_EXE_CONTINUE;
    }

    USER* pDestUser = g_pOnlineUser->FindUser( dGuid );
    if( pDestUser==NULL )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...User Dest GUID=%X not find!",
                      dGuid );

        return PACKET_EXE_CONTINUE;
    }

    if( pSourUser->GetTeamID()==INVALID_ID )
    {   //旧队长不在队伍中
        WGTeamError Msg;
        Msg.SetPlayerID( pSourUser->GetPlayerID() );
        Msg.SetGUID( pSourUser->GetGUID() );
        Msg.SetErrorCode(TEAM_ERROR_APPOINTSOURNOTEAM);
        pSourServerPlayer->SendPacket( &Msg );

        Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...DestInTeam SourGUID=%X DestGUID=%X",
                      sGuid, dGuid );
    }
    else if( pDestUser->GetTeamID()==INVALID_ID )
    {   //新队长不在队伍中
        WGTeamError Msg;
        Msg.SetPlayerID( pSourUser->GetPlayerID() );
        Msg.SetGUID( pSourUser->GetGUID() );
        Msg.SetErrorCode(TEAM_ERROR_APPOINTDESTNOTEAM);
        pSourServerPlayer->SendPacket( &Msg );

        Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...DestInTeam SourGUID=%X DestGUID=%X",
                      sGuid, dGuid );
    }
    else if( pDestUser->GetTeamID()!=pSourUser->GetTeamID() )
    {   //两个人不属于同一个队伍
        WGTeamError Msg;
        Msg.SetPlayerID( pSourUser->GetPlayerID() );
        Msg.SetGUID( pSourUser->GetGUID() );
        Msg.SetErrorCode(TEAM_ERROR_APPOINTNOTSAMETEAM);
        pSourServerPlayer->SendPacket( &Msg );

        Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...DestInTeam SourGUID=%X DestGUID=%X",
                      sGuid, dGuid );
    }
    else
    {   //队伍存在
        if( g_pOnlineUser->AppointTeamLeader(pSourUser, pDestUser) )
        {
            Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...Success!  sGUID=%X dGUID=%X",
                          sGuid, dGuid );
        }
        else
        {
            Log::SaveLog( WORLD_LOGFILE, "GWTeamAppointHandler...Failed!  sGUID=%X dGUID=%X",
                          sGuid, dGuid );
        }
    }

    return PACKET_EXE_CONTINUE;

    __LEAVE_FUNCTION

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

示例4: Execute

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

示例5: Execute


//.........这里部分代码省略.........
            pUser->AddRelation( Relation.GetTargetGUID(), &RUser );
            return PACKET_EXE_CONTINUE;
        }
        break;
    case REQ_NEWGOODFRIEND:
        { // 加入一个亲密好友
            pUser->AddGoodFriend( pRelationPacket->m_RelationGUID.GetTargetGUID() );
            return PACKET_EXE_CONTINUE;
        }
        break;
    case REQ_RELATIONONLINE:
        { // 获取密友的在线列表
            Msg.GetRelation()->m_Type = RET_ONLINELIST;
            RETURN_ONLINE_LIST* pSend = &(Msg.GetRelation()->m_RelationOnline);
            pSend->CleanUp();
            pUser->FillOnlineList(pSend);
        }
        break;
    case REQ_MODIFYMOOD:
        {
            pUser->SetMood( pRelationPacket->m_ModifyMood.GetMood() );
            return PACKET_EXE_CONTINUE;
        }
        break;
    case REQ_MODIFYSETTINGS:
        {
            pUser->SetSettings( pRelationPacket->m_Settings.GetSettings() );
            return PACKET_EXE_CONTINUE;
        }
        break;
    case REQ_NOTIFY_ADDTEMPFRIEND:
        {
            REQUEST_VIEW_PLAYER& Recv = pRelationPacket->m_ViewPlayer;

            if ( strlen(Recv.GetTargetName()) > 0 )
            {
                pTargetUser = g_pOnlineUser->FindUser( Recv.GetTargetName() );
            }

            if ( pTargetUser == NULL )
            { // 玩家可能不存在也可能不在线,由 Server 来判断
                Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User GUID=%s not find!",
                    Recv.GetTargetName() );
                return PACKET_EXE_CONTINUE;
            }

            Msg.GetRelation()->m_Type = RET_NOTIFY_ADDTEMPFRIEND;
            REQUEST_VIEW_PLAYER* pSend = &(Msg.GetRelation()->m_PlayerName);
            pSend->CleanUp();
            pSend->SetTargetName( pUser->GetName() );
        }
        break;
    default :
        {
            Assert(FALSE);
            return PACKET_EXE_CONTINUE;
        }
    }

    if ( uErr > 0 )
    {
        Msg.GetRelation()->m_Type = uErr;
    }

    if ( pRelationData != NULL && pTargetUser != NULL )
    {
        pRelationData->SetGUID( pTargetUser->GetGUID() );
        pRelationData->SetName( pTargetUser->GetName() );
        pRelationData->SetLevel( pTargetUser->GetLevel() );
        pRelationData->SetMenPai( pTargetUser->GetMenpai() );
        pRelationData->SetPortrait( pTargetUser->GetPortrait() );
        pRelationData->SetGuildID( pTargetUser->GetGuildID() );
        pRelationData->SetGuildName( g_pGuildManager->GetGuildName(pTargetUser->GetGuildID()) );

        if ( pTargetUser->UserStatus() == US_NORMAL )
        { // 只有在线才发剩余信息
            pRelationData->SetOnlineFlag(1);
            pRelationData->SetMood( pTargetUser->GetMood() );
            pRelationData->SetTitle( pTargetUser->GetTitle() );
            pRelationData->SetSceneID( pTargetUser->GetSceneID() );

            if ( pTargetUser->GetTeamID() != INVALID_ID )
            {
                Team* pTeam = g_pTeamList->GetTeam( pTargetUser->GetTeamID() );
                if ( pTeam != NULL )
                {
                    pRelationData->SetTeamSize( pTeam->MemberCount() );
                }
            }
        }
    }

    pServerPlayer->SendPacket( &Msg );

    return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

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

示例6: Execute

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

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

	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_INFO_NODE *pLeaderInfo = 0;
		pLeaderInfo = (LEADER_INFO_NODE*)g_pTeamRecruitManager->Get(guid,LEADER_RECRUIT);
		LEADER_RECRUIT_ATTRIB *pMyself = &pLeaderInfo->m_LeaderRecruit;

		//查找满足条件的所有玩家
		IDTable* pTable = g_pTeamRecruitManager->GetMemberTable();

		for( uint i=0; i<MAX_TEAMS; i++ )
		{//分页请求,一次最多50条
			if ( Msg.GetMemberCount() >= ONCE_RECRUIT_LIST_LEN)
			{
				break;
			}			
			
			BOOL IsContinue = FALSE;

			MEMBER_INFO_NODE *pMemberInfo = &g_pTeamRecruitManager->GetMemberRecruitInfo(i);
			if ( pMemberInfo->m_NodeState == NODE_NULL )
			{
				continue;
			}

			RECRUIT_OWNER_INFO *pOther = &pMemberInfo->m_OwnerInfo ;

			if ( pOther->m_Level <= pMyself->m_MaxLevel && pOther->m_Level >= pMyself->m_MinLevel )
			{//等级匹配
				for( int i=0;i<COUATTRIBUTE_NUMBER;i++ )
				{
					if ( pMyself->m_IsInCountry[i] == TRUE && i == pOther->m_Country )
					{//国家匹配
						IsContinue = TRUE;
						break;
					}
				}

				if ( IsContinue == FALSE )
					continue ;

				IsContinue = FALSE;

				//组队目的
				for( int i=0;i<TARGET_NUMBER;i++ )
				{
					if ( pMyself->m_IsTarget[i] == TRUE && 
						pMemberInfo->m_MemberRecruit.m_IsTarget[i] == TRUE )
					{//组队目标有一个匹配就OK
						IsContinue = TRUE;
						break;
					}
				}	

				if ( IsContinue == FALSE )
					continue ;

				IsContinue = FALSE;

				//职业范围
				for( int i=0;i<MATTRIBUTE_NUMBER;i++ )
				{
					if ( pMyself->m_IsMenPaiID[i] == TRUE && i == pOther->m_ManPai )
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:wx2Server,代码行数:101,代码来源:GWAskTeamRecruitInfoHandler.cpp

示例7: Execute

uint GWTeamRetApplyHandler::Execute( GWTeamRetApply* pPacket, Player* pPlayer )
{
    __ENTER_FUNCTION

    GUID_t sGuid = pPacket->GetSourGUID();//申请人的GUID
    GUID_t lGuid = pPacket->GetLeaderGUID();//队长的GUID

    USER* pLeaderUser = g_pOnlineUser->FindUser( lGuid );
    if( pLeaderUser==NULL )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...User Leader GUID=%X not find!",
                      lGuid );

        return PACKET_EXE_CONTINUE;
    }

    ServerPlayer* pLeaderServerPlayer = (ServerPlayer*)pPlayer;

    USER* pSourUser = g_pOnlineUser->FindUser( sGuid );
    if( pSourUser==NULL )
    {
        if( pPacket->GetReturn()==TRUE )
        {
            WGTeamError dMsg;
            dMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
            dMsg.SetGUID( pLeaderUser->GetGUID() );
            dMsg.SetErrorCode( TEAM_ERROR_TARGETNOTONLINE );
            pLeaderServerPlayer->SendPacket( &dMsg );
        }

        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...User Sour GUID=%X not find!",
                      sGuid );

        return PACKET_EXE_CONTINUE;
    }

    ID_t SourServerID = pSourUser->GetServerID();
    ServerPlayer* pSourServerPlayer = g_pServerManager->GetServerPlayer( SourServerID );
    if( pSourServerPlayer==NULL )
    {
        Assert(FALSE);
        return PACKET_EXE_CONTINUE;
    }

    if( pLeaderUser->IsEnemy( pSourUser->GetUserCampData() ) )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Lead Name=%s, Invite Name=%s are enemy!",
                      pLeaderUser->GetName(), pSourUser->GetName() );

        return PACKET_EXE_CONTINUE;
    }

    if( pPacket->GetReturn()==FALSE )
    {   //队长不同意
        WGTeamError sMsg;
        sMsg.SetPlayerID( pSourUser->GetPlayerID() );
        sMsg.SetGUID( pLeaderUser->GetGUID() );
        sMsg.SetErrorCode( TEAM_ERROR_APPLYLEADERREFUSE );
        pSourServerPlayer->SendPacket( &sMsg );

        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Leader lGUID=%X Refuse sGUID=%X join team!",
                      lGuid, sGuid );
    }
    else if( pSourUser->GetTeamID() != INVALID_ID )
    {   //申请人已经属于某个队伍
        //WGTeamError sMsg;
        //sMsg.SetPlayerID( pSourUser->m_PlayerID );
        //sMsg.SetErrorCode( TEAM_ERROR_APPLYSOURHASTEAM );
        //pSourServerPlayer->SendPacket( &sMsg );

        WGTeamError lMsg;
        lMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
        lMsg.SetGUID( pLeaderUser->GetGUID() );
        lMsg.SetErrorCode( TEAM_ERROR_APPLYSOURHASTEAM );
        pLeaderServerPlayer->SendPacket( &lMsg );

        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Leader lGUID=%X, sGUID=%X has team!",
                      lGuid, sGuid );
    }
    else
    {   //队伍存在
        TeamID_t tid = pLeaderUser->GetTeamID();
        Team* pTeam = g_pTeamList->GetTeam( tid );
        Assert( pTeam );

        if( pTeam->IsFull() )
        {   //队伍人数已经满了
            WGTeamError sMsg;
            sMsg.SetPlayerID( pSourUser->GetPlayerID() );
            sMsg.SetGUID( pLeaderUser->GetGUID() );
            sMsg.SetErrorCode( TEAM_ERROR_APPLYTEAMFULL );
            pSourServerPlayer->SendPacket( &sMsg );

            WGTeamError lMsg;
            lMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
            lMsg.SetGUID( pLeaderUser->GetGUID() );
            lMsg.SetErrorCode( TEAM_ERROR_TEAMFULL );
            pLeaderServerPlayer->SendPacket( &lMsg );

            Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Team Full  sGUID=%X lGUID=%X",
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:GWTeamRetApplyHandler.cpp

示例8: Execute

UINT GWTeamRetInviteHandler::Execute( GWTeamRetInvite* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    GUID_t sGuid = pPacket->GetSourGUID();//邀请人的GUID
    GUID_t dGuid = pPacket->GetDestGUID();//被邀请人的GUID

    USER* pDestUser = g_pOnlineUser->FindUser( dGuid );
    if( pDestUser==NULL )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...User Dest GUID=%X not find!", 
            dGuid );

        return PACKET_EXE_CONTINUE;
    }

    ServerPlayer* pDestServerPlayer = (ServerPlayer*)pPlayer;

    USER* pSourUser = g_pOnlineUser->FindUser( sGuid );
    if( pSourUser==NULL )
    {
        if( pPacket->GetReturn()==TRUE )
        {
            WGTeamError dMsg;
            dMsg.SetPlayerID( pDestUser->GetPlayerID() );
            dMsg.SetGUID( pDestUser->GetGUID() );
            dMsg.SetErrorCode( TEAM_ERROR_TARGETNOTONLINE );
            pDestServerPlayer->SendPacket( &dMsg );
        }

        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...User Sour GUID=%X not find!", 
            sGuid );
        return PACKET_EXE_CONTINUE;
    }

    if( pSourUser->IsEnemy( pDestUser->GetUserCampData() ) )
    {
        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...Sour Name=%X, Dest Name=%s are enemy!", 
            pSourUser->GetName(), pDestUser->GetName() );

        return PACKET_EXE_CONTINUE;
    }

    ID_t SourServerID = pSourUser->GetServerID();
    ServerPlayer* pSourServerPlayer = g_pServerManager->GetServerPlayer( SourServerID );
    if( pSourServerPlayer==NULL )
    {
        Assert(FALSE);
        return PACKET_EXE_CONTINUE;
    }

    USER* pLeader = NULL;
    ServerPlayer* pLeaderServerPlayer;

    if ( pSourUser->GetTeamID() != INVALID_ID )
    {
        Team* pTeam = g_pTeamList->GetTeam( pSourUser->GetTeamID() );

        if ( pTeam == NULL )
        {
            Assert( pTeam );
            pSourUser->SetTeamID( INVALID_ID );
        }
        else if ( pTeam->Leader()->m_Member != sGuid )
        { // 邀请人不是队长
            pLeader = g_pOnlineUser->FindUser( pTeam->Leader()->m_Member );

            pLeaderServerPlayer = g_pServerManager->GetServerPlayer( pLeader->GetServerID() );
            if ( pLeaderServerPlayer == NULL )
            {
                Assert( FALSE );
                pLeader = NULL;
            }
        }
    }


    if( pPacket->GetReturn()==FALSE )
    {//被邀请人不同意加入队伍
        WGTeamError Msg;
        Msg.SetPlayerID( pSourUser->GetPlayerID() );
        Msg.SetGUID( pDestUser->GetGUID() );
        Msg.SetErrorCode( TEAM_ERROR_INVITEREFUSE );

        pSourServerPlayer->SendPacket( &Msg );

        if ( pLeader != NULL )
        {
            Msg.SetPlayerID( pLeader->GetPlayerID() );
            pLeaderServerPlayer->SendPacket( &Msg );
        }

        Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...Invite Refuse SourGUID=%X DestGUID=%X", 
            sGuid, dGuid );
    }
    else if( pDestUser->GetTeamID() != INVALID_ID )
    {//被邀请人已经有队伍
        WGTeamError Msg;
        Msg.SetPlayerID( pSourUser->GetPlayerID() );
        Msg.SetGUID( pDestUser->GetGUID() );
//.........这里部分代码省略.........
开发者ID:gangzi4494,项目名称:web-pap,代码行数:101,代码来源:GWTeamRetInviteHandler.cpp

示例9: Execute

uint GWSetTeamDistribModeHandler::Execute( GWSetTeamDistribMode* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	BYTE nMode = pPacket->getMode();//mode
	TeamID_t nTeamID = pPacket->getTeamID();//TeamID
	GUID_t LeaderGuid = pPacket->getLeaderID();//Leader的GUID

	USER* pLeaderUser = g_pOnlineUser->FindUser( LeaderGuid );
	if( pLeaderUser==NULL )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWSetTeamDistribMode...User Leader GUID=%X not find!", LeaderGuid );

		return PACKET_EXE_CONTINUE;
	}
	
	if (nMode>=ITEM_DISTRIB_NUM)
	{
		Log::SaveLog( WORLD_LOGFILE, "GWSetTeamDistribMode...MODE=%X error!", nMode );
		return PACKET_EXE_CONTINUE;
	}
	ServerPlayer* pLeaderServerPlayer = (ServerPlayer*)pPlayer;

	if( pLeaderUser->GetTeamID() == INVALID_ID )
	{
		//无队伍
		WGTeamError lMsg;
		lMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
		lMsg.SetErrorCode( TEAM_ERROR_DISTRIBNOLEADER );
		pLeaderServerPlayer->SendPacket( &lMsg );

		Log::SaveLog( WORLD_LOGFILE, "GWSetTeamDistribMode... LeaderGuid=%X!", LeaderGuid );
	}
	else
	{//队伍存在
		TeamID_t tid = pLeaderUser->GetTeamID();
		Team* pTeam = g_pTeamList->GetTeam( tid );
		Assert( pTeam );

		if( pTeam->Leader()->m_Member != LeaderGuid )
		{
			//队长GUID和队伍中记录的队长GUID不符
			WGTeamError sMsg;
			sMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
			sMsg.SetErrorCode( TEAM_ERROR_DISTRIBNOLEADER );
			pLeaderServerPlayer->SendPacket( &sMsg );

			Log::SaveLog( WORLD_LOGFILE, "GWSetTeamDistribMode... LeaderGuid=%X!", LeaderGuid );
		}
		else 
		{//
			pTeam->SetDistribMode(nMode);
			WGRetTeamDistribMode Msg;
			Msg.setLeaderID( pLeaderUser->GetPlayerID() );
			Msg.setTeamID(pLeaderUser->GetTeamID());
			Msg.setMode(nMode);

			pLeaderServerPlayer->SendPacket( &Msg );

		}//end for

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

	}

	return PACKET_EXE_CONTINUE;

	__LEAVE_FUNCTION

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

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

示例11: Execute

uint GWChatHandler::Execute( GWChat* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pSourServerPlayer = (ServerPlayer*)pPlayer ;

	GUID_t SourGUID = pPacket->GetSourGUID() ;

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

	WGChat Msg ;
	Msg.SetChatType( pPacket->GetChatType() ) ;
	Msg.SetContexSize( pPacket->GetContexSize() ) ;
	Msg.SetContex( pPacket->GetContex() ) ;
	Msg.SetSourNameSize( (BYTE)(strlen(pSourUser->GetName())) ) ;
	Msg.SetSourName( pSourUser->GetName() ) ;
	Msg.SetCampID( pSourUser->GetUserCampData()->m_nCampID );
	Msg.SetWorldChatID( g_pChatCenter->NextWorldChatID() ) ;

	switch( pPacket->GetChatType() )
	{
	case CHAT_TYPE_NORMAL:
		{
			Assert(FALSE) ;
		}
		break ;
	case CHAT_TYPE_GUILD:
		{
			Msg.SetGuildID( pPacket->GetGuildID() ) ;
			g_pServerManager->BroadCastServer( &Msg ) ;
		}
		break ;
	case CHAT_TYPE_MENPAI:
		{
			Msg.SetMenpaiID( pPacket->GetMenpaiID() ) ;
			g_pServerManager->BroadCastServer( &Msg ) ;
		}
		break ;
	case CHAT_TYPE_SYSTEM:
	case CHAT_TYPE_SCENE:
		{
			g_pServerManager->BroadCastServer( &Msg ) ;
		}
		break ;
	case CHAT_TYPE_TEAM:
		{
			Team* pTeam = g_pTeamList->GetTeam( pSourUser->GetTeamID() ) ;
			if( pTeam==NULL )
				break ;

			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 ) ;
			}
		}
		break ;
	case CHAT_TYPE_TELL:
		{
			USER* pUser = g_pOnlineUser->FindUser( pPacket->GetTargetName() ) ;

			if( pUser )
			{
				if( pSourUser->IsEnemy( pUser->GetUserCampData() ) )
					pUser = NULL;	//如果是敌对阵营,处理方法跟查无此人相同!!
									//按道理说是不能密的哦~~
			}

			if( pUser==NULL )
			{//如果队员离线,则用户数据是空
				CHAR* szName="system" ;
				CHAR szContex[32] ;
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:GWChatHandler.cpp

示例12: Execute

uint GWTeamInviteHandler::Execute( GWTeamInvite* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	ServerPlayer* pSourServerPlayer = (ServerPlayer*)pPlayer;

	GUID_t sGuid = pPacket->GetSourGUID();

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

		return PACKET_EXE_CONTINUE;
	}

	USER* pDestUser = g_pOnlineUser->FindUser( pPacket->GetDestName() );
	if( pDestUser==NULL )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...User Dest Name=%s not find!", 
			pPacket->GetDestName() );

		return PACKET_EXE_CONTINUE;
	}

	GUID_t dGuid = pDestUser->GetGUID();

	if( pSourUser->IsEnemy( pDestUser->GetUserCampData() ) )
	{
		Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...Sour Name=%s, Dest Name=%s are enemy!", 
			pSourUser->GetName(), pDestUser->GetName() );

		return PACKET_EXE_CONTINUE;
	}

	// 设置了拒绝被邀请
	if( pDestUser->IsRefuseTeamInvite() )
	{
		WGTeamError Msg;
		Msg.SetPlayerID( pSourUser->GetPlayerID() );
		Msg.SetGUID(sGuid);
		Msg.SetErrorCode(TEAM_ERROR_REFUSEINVITESETTING);
		pSourServerPlayer->SendPacket( &Msg );

		Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...DestGUID=%X refuse to be invited. ", 
			dGuid );
		return PACKET_EXE_CONTINUE;
	}

	if( pDestUser->GetTeamID() != INVALID_ID )
	{//被邀请人已经属于某个队伍了
		WGTeamError Msg;
		Msg.SetPlayerID( pSourUser->GetPlayerID() );
		Msg.SetGUID(sGuid);
		Msg.SetErrorCode(TEAM_ERROR_INVITEDESTHASTEAM);
		pSourServerPlayer->SendPacket( &Msg );

		Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...DestInTeam SourGUID=%X DestGUID=%X", 
			sGuid, dGuid );
	}
	else if( sGuid==dGuid && pSourUser->GetTeamID()==INVALID_ID )
	{//邀请人和被邀请人属于同一个人, 且不属于某个队伍
		//自建队伍
		TeamID_t tid = g_pTeamList->CreateTeam( );
		Assert( tid!=INVALID_ID );
		Team* pTeam = g_pTeamList->GetTeam( tid );
		Assert( pTeam );

		//将玩家加入队伍中
		TEAMMEMBER Member;
		Member.m_Member = sGuid;
		pTeam->AddMember( &Member );

		//设置玩家队伍数据
		pSourUser->SetTeamID( tid );

		//返回结果
		WGTeamResult Msg;
		Msg.SetPlayerID( pSourUser->GetPlayerID() );
		Msg.SetReturn( TEAM_RESULT_MEMBERENTERTEAM );
		Msg.SetGUID( sGuid );
		Msg.SetTeamID( tid );
		Msg.SetGUIDEx( pSourUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
		Msg.SetSceneID( pSourUser->GetSceneID() );
		Msg.SetDataID( pSourUser->GetSex() );
		Msg.SetIcon( pSourUser->GetPortrait() );

		pSourServerPlayer->SendPacket( &Msg );

		Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...CreateTeam GUID=%X TeamID=%d", 
			sGuid, tid );
	}
	else
	{
		if ( pSourUser->GetTeamID() != INVALID_ID )
		{
			//邀请人已经有一个队伍
			Team* pTeam = g_pTeamList->GetTeam( pSourUser->GetTeamID() );
			Assert( pTeam );
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:GWTeamInviteHandler.cpp

示例13: Execute

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

	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 ;
	}

	WGTeamResult Msg;
	Msg.SetReturn( TEAM_RESULT_ENTERSCENE );
	Msg.SetTeamID( pUser->GetTeamID() );
	Msg.SetGUID( pPacket->GetGUID() );
	Msg.SetSceneID( pPacket->GetSceneID() );
	Msg.SetGUIDEx( pPacket->GetPlayerID() );
	Msg.SetIcon( pUser->GetPortrait() );
	Msg.SetFamily( pUser->GetMenpai() );
	Msg.SetDataID( pUser->GetSex() );
	Msg.SetLevel( pUser->GetLevel() );

	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 )
		{
			Assert(FALSE);
			continue;
		}

		pServerPlayer = g_pServerManager->GetServerPlayer( pUser->GetServerID() );
		if( pServerPlayer == NULL )
		{
			Assert(FALSE);
			continue;
		}

		Msg.SetPlayerID( pUser->GetServerID() );
		pServerPlayer->SendPacket( &Msg );
	}

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

	return PACKET_EXE_CONTINUE;

__LEAVE_FUNCTION

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

示例14: Execute

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

	if( pUser->GetTeamID() == INVALID_ID )
	{
		return PACKET_EXE_CONTINUE;
	}

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

		Member.m_Member = pUser->GetGUID();

		if ( pTeam->IsMember( &Member ) == FALSE )
		{ // 某些情况下,玩家保存了过期的队伍号
			AssertEx( FALSE, "过期队伍号,忽略。" );
			return PACKET_EXE_CONTINUE;
		}
	}

	WGTeamList Msg;
	Msg.SetPlayerID(pPacket->GetPlayerID());
	Msg.SetTeamID( pUser->GetTeamID() );
	Msg.SetGUID( guid );
	WGTeamResult MsgtoEveryMember; // 通知其他队员某人进入新场景了
	MsgtoEveryMember.SetReturn( TEAM_RESULT_ENTERSCENE );
	MsgtoEveryMember.SetTeamID( pTeam->GetTeamID() );
	MsgtoEveryMember.SetGUID( pUser->GetGUID() );
	MsgtoEveryMember.SetGUIDEx( pUser->GetPlayerID() );
	MsgtoEveryMember.SetIcon( pUser->GetPortrait() );
	MsgtoEveryMember.SetSceneID( pUser->GetSceneID() );

	for(int i=0; i<pTeam->MemberCount(); ++i)
	{
		TEAMMEMBER* pMember = pTeam->Member( i );
		if( pMember==NULL )
		{
			Assert(FALSE);
			continue;
		}

		USER* pDestUser = g_pOnlineUser->FindUser( pMember->m_Member );
		if( pDestUser==NULL )
		{
			Assert(FALSE);
			continue;
		}

		ID_t ServerID = pDestUser->GetServerID() ;
		ServerPlayer* pDestServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
		if( pDestServerPlayer==NULL )
		{
			Assert(FALSE) ;
			continue ;
		}

		if( pUser->GetGUID() != pDestUser->GetGUID() )
		{
			MsgtoEveryMember.SetPlayerID( pDestUser->GetPlayerID() ) ;
			pDestServerPlayer->SendPacket( &MsgtoEveryMember );
		}

		TEAM_LIST_ENTRY entry;

		entry.SetGUID( pDestUser->GetGUID() );
		entry.SetSceneID( pDestUser->GetSceneID() );
		entry.SetExtraID( pDestUser->GetPlayerID() );
		entry.SetName( pDestUser->GetName() );
		entry.SetIcon( pDestUser->GetPortrait() );
		entry.SetDataID( pDestUser->GetSex() );
		Msg.AddTeamMember( entry );

	}

	pServerPlayer->SendPacket( &Msg );

	if ( pTeam->GetFollowedmemberCount()>0 )
	{
		GUID_t* FollowedMembers = pTeam->GetFollowedMembers();
		BOOL flag;

//.........这里部分代码省略.........
开发者ID:xu561865,项目名称:TL_Server,代码行数:101,代码来源:GWAskTeamInfoHandler.cpp


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