本文整理汇总了C++中USER::GetGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::GetGUID方法的具体用法?C++ USER::GetGUID怎么用?C++ USER::GetGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::GetGUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillOnlineList
// 填充密友在线列表
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
}
示例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 ;
}
示例3: 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;
}
示例4: 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 ) ;
//.........这里部分代码省略.........
示例5: 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 );
//.........这里部分代码省略.........
示例6: Execute
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:
//.........这里部分代码省略.........
示例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",
//.........这里部分代码省略.........
示例8: Execute
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() ) ;
//.........这里部分代码省略.........
示例9:
UINT LWRetBillingKeepHandler::Execute(LWRetBillingKeep* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
enum BillingKeepResult
{
BKR_SUCCESS = 0x01, //计费成功
BKR_NO_POINT = 0x02, //点数不够
BKR_DB_ERROR = 0x03, //数据库错误
BKR_NOT_START = 0x04, //没开始计费
};
Assert(pPacket);
ServerPlayer* pLoginPlayer = (ServerPlayer*)pPlayer ;
Assert(pLoginPlayer);
USER* pUser = g_pOnlineUser->FindUserByAccount(pPacket->GetAccount());
if(pUser)
{
BYTE bResult = pPacket->GetResult();
switch(bResult)
{
case BKR_SUCCESS:
{
////pUser->SetLeftTime(pPacket->GetLeftTime());
////pUser->SetShopPoint(pPacket->GetStorePoint());
////pUser->SetUserPoint(pPacket->GetUserPoint());
////pUser->SetStartTime(pUser->GetEndTime());
////pUser->SetBillingKeepTimes(0);
////g_pLog->FastSaveLog(LOG_FILE_4, "LWRetBillingKeep...acc=%s Success,lt=%d,sp=%d,up=%d,GUID=%X",
//// pPacket->GetAccount(),pUser->GetLeftTime(),pUser->GetShopPoint(),
//// pUser->GetUserPoint(),pUser->GetGUID()) ;
}
break;
case BKR_NO_POINT:
case BKR_DB_ERROR:
case BKR_NOT_START:
{
//WGNotifyUser MsgNotify ;
//MsgNotify.SetGUID( pUser->GetGUID() ) ;
//MsgNotify.SetStatus( WGNotifyUser::NUS_NEED_SERVER_KICK ) ;
//ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( pUser->GetServerID() );
//if( pServerPlayer )
//{
// pServerPlayer->SendPacket( &MsgNotify ) ;
//}
g_pOnlineUser->BeginKickUser(pUser);
g_pLog->FastSaveLog(LOG_FILE_4, "KICK:LWRetBillingKeep...acc=%s Fail,Result=%d,GUID=%X",
pPacket->GetAccount(),bResult,pUser->GetGUID()) ;
}
break;
default:
break;
}
}
else
{
//Assert(FALSE);
}
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例10: Execute
uint GWAskUserDataHandler::Execute( GWAskUserData* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;
USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
PlayerID_t OldPlayerID = INVALID_ID;
USER* pOldUser = g_pOnlineUser->FindUserByAccountName( pPacket->GetAccount() ) ;
if( pOldUser && pOldUser != pUser )
{
OldPlayerID = pOldUser->GetPlayerID();
}
if( pUser==NULL )
{//没有发现在“在线用户列表”里对应此GUID的用户
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...User GUID=%X not find!",
pPacket->GetGUID() ) ;
if( g_Config.m_WorldInfo.m_EnableShareMem )
{
WGRetUserData Msg ;
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;
pServerPlayer->SendPacket( &Msg ) ;
return PACKET_EXE_CONTINUE ;
}
//
//测试数据
pUser = g_pOnlineUser->LoadUser( pPacket->GetGUID() ) ;
if( pUser )
{
_HUMAN_DB_LOAD* pDBHuman = &(pUser->GetFullUserData()->m_Human);
//临时测试数据
strncpy( pDBHuman->m_Name, pPacket->GetAccount(), MAX_ACCOUNT ) ;
pDBHuman->m_Sex = (BOOL)(pPacket->GetGender()) ;
pUser->SetKey( pPacket->GetKey() );
//临时测试数据
g_pOnlineUser->OnUserLogin( pUser ) ;
WGRetUserData Msg ;
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_USERDATA ) ;
Msg.SetUserData( pUser->GetFullUserData() ) ;
Msg.SetPlayerAge( pUser->GetUserAge() );
//回收数据块, 设置用户状态
g_pOnlineUser->DelData( pUser->GetFullUserData() ) ;
pUser->SetFullUserData( NULL );
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() )
{//验证码错误,警报,也许受到攻击
WGRetUserData Msg ;
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() );
//.........这里部分代码省略.........
示例11: 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() );
//.........这里部分代码省略.........
示例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 );
//.........这里部分代码省略.........
示例13: 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;
//.........这里部分代码省略.........
示例14: Execute
UINT GWChannelCreateHandler::Execute( GWChannelCreate* 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, "GWChannelCreateHandler...User GUID=%X not find!",
Guid ) ;
return PACKET_EXE_CONTINUE ;
}
if( pUser->GetChannelID() != INVALID_ID )
{//此用户已经创建了一个聊天频道
WGChannelError Msg ;
Msg.SetPlayerID( pUser->GetPlayerID() ) ;
Msg.SetGUID( pUser->GetGUID() );
Msg.SetErrorCode( CHANNEL_ERROR_HASCHANNEL ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWChannelCreateHandler...GUID=%X has channel! cannot create!",
Guid ) ;
return PACKET_EXE_CONTINUE ;
}
ChannelID_t cid = g_pChatCenter->CreateChatChannel() ;
if( cid==INVALID_ID )
{
WGChannelError Msg ;
Msg.SetPlayerID( pUser->GetPlayerID() ) ;
Msg.SetGUID( pUser->GetGUID() );
Msg.SetErrorCode( CHANNEL_ERROR_CHANNELFULL ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWChannelCreateHandler...GUID=%X create fail !",
Guid ) ;
return PACKET_EXE_CONTINUE ;
}
//设置自建聊天频道信息
pUser->SetChannelID( cid );
//发送结果
WGChannelResult Msg ;
Msg.SetPlayerID( pUser->GetPlayerID() ) ;
Msg.SetReturn( CHANNEL_RESULT_CREATE ) ;
Msg.SetChannelID( pUser->GetChannelID() ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWChannelCreateHandler...GUID=%X ChannelID=%d!",
Guid, cid ) ;
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例15: 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;
}