本文整理汇总了C++中USER类的典型用法代码示例。如果您正苦于以下问题:C++ USER类的具体用法?C++ USER怎么用?C++ USER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了USER类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Assert
UINT GWRelationHandler::Execute( GWRelation* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
GW_RELATION* pRelationPacket = pPacket->GetRelation();
WGRelation Msg;
Msg.GetRelation()->CleanUp();
Msg.SetGUID(pRelationPacket->GetGUID());
UCHAR uErr = 0;
_RELATION* pRelationData = NULL;
USER* pTargetUser = NULL;
USER* pUser = g_pOnlineUser->FindUser( pRelationPacket->GetGUID() );
if ( pUser == NULL )
{ //没有发现在“在线用户列表”里对应此 GUID 的用户
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User GUID=%X not find!",
pRelationPacket->GetGUID() );
Assert( FALSE && "找不到信息发送者" );
return PACKET_EXE_CONTINUE;
}
Msg.GetRelation()->SetPlayerID( pUser->GetPlayerID() );
switch( pRelationPacket->m_Type )
{
case REQ_RELATIONINFO:
{
REQUEST_RELATION_INFO& ReqRelation = pRelationPacket->m_RequestInfo;
if ( ReqRelation.GetTargetGUID() != INVALID_ID )
{
pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetGUID() );
}
else if ( strlen(ReqRelation.GetTargetName()) > 0 )
{
pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetName() );
}
if ( pTargetUser == NULL )
{ // 玩家可能不存在也可能不在线,由 Server 来判断
uErr = RET_TARGETNOTONLINE;
Msg.GetRelation()->m_RelationGUID.CleanUp();
Msg.GetRelation()->m_RelationGUID.SetTargetGUID( ReqRelation.GetTargetGUID() );
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User GUID=%X not find!",
ReqRelation.GetTargetGUID() );
break;
}
Msg.GetRelation()->m_Type = RET_RELATIONINFO;
RETURN_RELATION_INFO& Relation = Msg.GetRelation()->m_RelationInfo;
Relation.CleanUp();
pRelationData = Relation.GetRelationData();
// pRelationData 的数据在 switch 之后填充
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...get User info of Name=%s!",
pTargetUser->GetName() );
}
break;
case REQ_VIEWPLAYER:
{
REQUEST_VIEW_PLAYER& Recv = pRelationPacket->m_ViewPlayer;
if ( strlen( Recv.GetTargetName() ) > 0 )
{
pTargetUser = g_pOnlineUser->FindUser( Recv.GetTargetName() );
}
if ( pTargetUser == NULL )
{ // 玩家可能不存在也可能不在线
uErr = RET_ERR_TARGETNOTEXIST;
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s not find!",
Recv.GetTargetName() );
break;
}
Msg.GetRelation()->m_Type = RET_VIEWPLAYER;
RETURN_VIEW_PLAYER& Send = Msg.GetRelation()->m_ViewPlayer;
Send.CleanUp();
// 填充数据
Send.SetGUID( pTargetUser->GetGUID() );
Send.SetName( pTargetUser->GetName() );
// ...
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...View Player: %s!",
pTargetUser->GetName() );
}
break;
case REQ_ADDFRIEND:
case REQ_TEMPFRIEND_TO_FRIEND:
//.........这里部分代码省略.........
开发者ID:gangzi4494,项目名称:web-pap,代码行数:101,代码来源:GWRelationHandler.cpp
示例17: 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
示例18: Assert
UINT GWChannelKickHandler::Execute( GWChannelKick* 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, "GWChannelKickHandler...User Sour GUID=%X not find!",
sGuid ) ;
return PACKET_EXE_CONTINUE ;
}
USER* pDestUser = g_pOnlineUser->FindUser( dGuid ) ;
if( pDestUser==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWChannelKickHandler...User Dest GUID=%X not find!",
dGuid ) ;
return PACKET_EXE_CONTINUE ;
}
if( pSourUser->GetChannelID() == INVALID_ID )
{//踢人者没有创建频道
WGChannelError Msg ;
Msg.SetPlayerID( pSourUser->GetPlayerID() ) ;
Msg.SetGUID( pSourUser->GetGUID() );
Msg.SetErrorCode( CHANNEL_ERROR_NOCHANNEL ) ;
pSourServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWChannelKickHandler...User Sour GUID=%X not channel!",
sGuid ) ;
}
else
{
ChatChannel* pChannel = g_pChatCenter->GetChatChannel( pSourUser->GetChannelID() ) ;
if( pChannel==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_CONTINUE ;
}
if( !pChannel->IsMember( pDestUser->GetGUID() ) )
{//被踢者不在此频道内
WGChannelError Msg ;
Msg.SetPlayerID( pSourUser->GetPlayerID() ) ;
Msg.SetGUID( pSourUser->GetGUID() );
Msg.SetErrorCode( CHANNEL_ERROR_NOTINCHANNEL ) ;
pSourServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWChannelKickHandler...User Dest GUID=%X not in channel!",
dGuid ) ;
}
else
{
WGChannelResult Msg ;
Msg.SetReturn( CHANNEL_RESULT_KICKMEMBER ) ;
Msg.SetChannelID( pSourUser->GetChannelID() ) ;
Msg.SetGUID( pDestUser->GetGUID() ) ;
//通知所有频道内的玩家
for( int i=0; i<pChannel->MemberCount(); i++ )
{
GUID_t guid = pChannel->Member( i ) ;
if( guid==INVALID_ID )
{
Assert(FALSE) ;
continue ;
}
USER* pUser = g_pOnlineUser->FindUser( guid ) ;
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 ) ;
}
//删除频道内数据
pChannel->DelMember( pDestUser->GetGUID() ) ;
//.........这里部分代码省略.........
开发者ID:brock7,项目名称:TianLong,代码行数:101,代码来源:GWChannelKickHandler.cpp
示例19: Assert
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
示例20: 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类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License
|
请发表评论