本文整理汇总了C++中USER::IsRefuseTeamInvite方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::IsRefuseTeamInvite方法的具体用法?C++ USER::IsRefuseTeamInvite怎么用?C++ USER::IsRefuseTeamInvite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::IsRefuseTeamInvite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
//.........这里部分代码省略.........