本文整理汇总了C++中USER::GetPlayerID方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::GetPlayerID方法的具体用法?C++ USER::GetPlayerID怎么用?C++ USER::GetPlayerID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::GetPlayerID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 ;
}
示例2: 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 ;
}
示例3: Execute
uint GWCityCloseHandler::Execute( GWCityClose* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
_CITY_GUID CityGuid = pPacket->GetCityGuid();
GUID_t PlayerGuid = pPacket->GetPlayerGuid();
WGCityError MsgError;
USER* pUser = g_pOnlineUser->FindUser( PlayerGuid ) ;
if( pUser==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID=%X not find!",
PlayerGuid) ;
return PACKET_EXE_CONTINUE ;
}
City* pDelCity = g_pCityManager->GetCityByGuid(CityGuid);
if(!pDelCity)
{
Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID world=%d poolpos=%d not find!",
CityGuid.m_World, CityGuid.m_PoolPos) ;
return PACKET_EXE_CONTINUE ;
}
if(pDelCity->IsLock())
{//已经有人删除此城市了
Log::SaveLog( WORLD_LOGFILE, "GWCityCloseHandler...User GUID world=%d poolpos=%d not find!",
CityGuid.m_World, CityGuid.m_PoolPos) ;
return PACKET_EXE_CONTINUE ;
}
pDelCity->SetApplicantGuid(PlayerGuid);
pDelCity->SetLock(TRUE);
WGCityClose MsgToServer;
MsgToServer.SetSceneID(pDelCity->GetSceneID());
MsgToServer.SetPlayerID(pUser->GetPlayerID());
pServerPlayer->SendPacket(&MsgToServer);
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例4: 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 ;
}
示例5: 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 )
//.........这里部分代码省略.........
示例6: Execute
UINT GWFingerHandler::Execute(GWFinger* pPacket,Player* pPlayer)
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
GW_FINGER* pRecv = pPacket->GetFinger();
USER* pUser = g_pOnlineUser->FindUser( pRecv->GetGUID() );
if ( pUser == NULL )
{ //没有发现在“在线用户列表”里对应此 GUID 的用户
Log::SaveLog( WORLD_LOGFILE, "GWFingerHandler...User GUID=%X not find!",
pRecv->GetGUID() );
return PACKET_EXE_CONTINUE;
}
WGFinger Msg;
WG_FINGER* pSend = Msg.GetFinger();
pSend->CleanUp();
pSend->SetPlayerID( pUser->GetPlayerID() );
switch( pRecv->m_Type )
{
case FREQ_GUID: // GUID 搜索
{
GUID_t guid = pRecv->m_FingerByGUID.GetTargetGUID();
BOOL bOnlineFlag = pRecv->m_FingerByGUID.GetOnlineFlag();
USER* pTargetUser;
// 先从 OnlineUser 中查找
pTargetUser = g_pOnlineUser->FindUser(guid);
// 找到了直接返回
if ( pTargetUser != NULL )
{
pSend->m_Type = FRET_PLAYERLIST;
pSend->m_FingerPlayerList.CleanUp();
pSend->m_FingerPlayerList.AddPlayerInfo( pTargetUser->GetUserSimpleData() );
FINGER_PLAYER_INFO* pPlayerInfo;
pPlayerInfo = pSend->m_FingerPlayerList.GetLastPlayerInfo();
Assert( pPlayerInfo );
pPlayerInfo->SetOnlineFlag( TRUE );
pPlayerInfo->SetGuildName( g_pGuildManager->GetGuildName(pPlayerInfo->GetGuildID()) );
}
else if ( bOnlineFlag )
{ // 没有找到则判断是否需要查找离线玩家,不需要返回错误消息
pSend->m_Type = FRET_ERR_NORESULT;
}
else
{ // 需要则从离线玩家中查找
pSend->m_Type = FRET_PLAYERLIST;
pSend->m_FingerPlayerList.CleanUp();
if ( g_pAllUser->Select( guid, &(pSend->m_FingerPlayerList) ) < 1 )
{ // 找到了返回,否则返回错误消息
pSend->m_Type = FRET_ERR_NORESULT;
}
}
}
break;
case FREQ_NAME: // NAME 搜索
{
const CHAR* szName = pRecv->m_FingerByName.GetTargetName();
BOOL bOnlineFlag = pRecv->m_FingerByName.GetOnlineFlag();
BOOL bPreciseFlag = pRecv->m_FingerByName.GetPreciseFlag();
INT nPosition = pRecv->m_FingerByName.GetPosition();
pSend->m_FingerPlayerList.CleanUp();
BOOL bRes;
if ( bOnlineFlag )
{ // 在线查找
bRes = g_pOnlineUser->Select( szName, &(pSend->m_FingerPlayerList), bPreciseFlag, nPosition ) > 0;
}
else
{ // 离线查找
bRes = g_pAllUser->Select( szName, &(pSend->m_FingerPlayerList), bPreciseFlag, nPosition ) > 0;
}
if ( bRes )
{ // 找到了
//用FindUser模糊查找怎么办?,而且pSend->m_FingerPlayerList中已保存有玩家信息。修改:王勇鸷
//USER *pTargetUser = g_pOnlineUser->FindUser(pRecv->m_FingerByName.GetTargetName());
//pSend->m_FingerPlayerList.CleanUp();
//pSend->m_FingerPlayerList.AddPlayerInfo( pTargetUser->GetUserSimpleData() );
//FINGER_PLAYER_INFO* pPlayerInfo;
//pPlayerInfo = pSend->m_FingerPlayerList.GetLastPlayerInfo();
//Assert( pPlayerInfo );
//pPlayerInfo->SetOnlineFlag( TRUE );
pSend->m_Type = FRET_PLAYERLIST;
}
else
{ // 没找到
pSend->m_Type = FRET_ERR_NORESULT;
}
}
break;
case FREQ_ADVANCED: // 高级搜索
{
//.........这里部分代码省略.........
示例7: 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() ) ;
//.........这里部分代码省略.........
示例8: 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",
//.........这里部分代码省略.........
示例9: 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() );
//.........这里部分代码省略.........
示例10: 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 ;
}
示例11: Execute
uint GWAskMailHandler::Execute( GWAskMail* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
if( pUser==NULL )
{
//玩家不在线,邮件暂时不发了
//Assert(FALSE) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskMailHandler...User GUID=%X not find!",
pPacket->GetGUID() );
return PACKET_EXE_CONTINUE ;
}
ID_t ServerID = pUser->GetServerID();
ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
if( pServerPlayer==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_CONTINUE ;
}
WGMail Msg ;
Msg.SetPlayerID( pUser->GetPlayerID() ) ;
if( pPacket->GetAskType()==ASK_TYPE_LOGIN )
{
g_pMailCenter->AskScriptMail( pUser->GetName(), Msg.GetMailList() ) ;
UINT uMailCount = g_pMailCenter->CheckMail(pUser->GetName());
if (uMailCount > 0)
{
WGNotifyMail NotifyMsg;
NotifyMsg.SetPlayerID( pUser->GetPlayerID() );
NotifyMsg.SetMailCount( (UCHAR)(uMailCount>255?255:uMailCount) );
pServerPlayer->SendPacket( &NotifyMsg );
}
if( Msg.GetMailList()->m_Count < 1 )
{ // 如果没有可执行的脚本邮件,则此消息不往回发.否则会转给客户端,把普通邮件的剩余数量错误设置为0
return PACKET_EXE_CONTINUE;
}
}
else if( pPacket->GetAskType()==ASK_TYPE_MAIL )
{
while(g_pMailCenter->AskMail( pUser->GetName(), Msg.GetMailList() ))
{
INT nCount;
nCount = Msg.GetMailList()->m_Count;
if( nCount != 1 )
{ // 这里如果不是 1 封的话处理方式应该有所不同
Assert( nCount == 1 );
return PACKET_EXE_CONTINUE;
}
if( pUser->ValidateMail( &(Msg.GetMailList()->m_aMail[0]) ) == 0 )
{ // 邮件有效
break;
}
else
{ // 无效继续收
Msg.GetMailList()->CleanUp();
}
}
if( Msg.GetMailList()->m_Count < 1 )
{ // 一封有效邮件都没有
return PACKET_EXE_CONTINUE;
}
}
else
{
Assert(FALSE) ;
}
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskMailHandler...Name=%s MailCount=%d LeftCount=%d",
pUser->GetName(), Msg.GetMailList()->m_Count, Msg.GetMailList()->m_TotalLeft );
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例12: 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:
//.........这里部分代码省略.........
示例13: 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() );
//.........这里部分代码省略.........
示例14: 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] ;
//.........这里部分代码省略.........
示例15:
uint GWAskOtherOnlineAttrib_HumanHandler::Execute(GWAskOtherOnlineAttrib_Human* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pSourceServerPlayer = (ServerPlayer*)pPlayer;
Assert( pSourceServerPlayer );
GUID_t guid = pPacket->GetDestGUID();
USER* pDestUser = g_pOnlineUser->FindUser(guid);
if(pDestUser){
WGAskOtherOnlineAttrib_Human Msg;
Msg.SetGUID(pPacket->GetSourceGUID());
Msg.SetSourcePlayerID(pPacket->GetPlayerID());
Msg.SetDestPlayerID(pDestUser->GetPlayerID());
ID_t ServerID = pDestUser->GetServerID() ;
ServerPlayer* pDestServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
if( pDestServerPlayer==NULL )
{
Assert(FALSE);
}
pDestServerPlayer->SendPacket(&Msg);
/*
FULLUSERDATA* pFullUserData = pUser->GetFullUserData();
if(pFullUserData){
// 发送人物基本信息
WGDetailOtherOnlineAttrib_Human Msg;
Msg.SetPlayerID(pPacket->GetPlayerID());//发起查看者的ID
Msg.SetLevel(pFullUserData->m_Human.m_Level);
Msg.SetCountry(pFullUserData->m_Human.m_nCountry);
Msg.SetMenpai(pFullUserData->m_Human.m_MenPai);
Msg.SetDataID(pFullUserData->m_Human.m_Sex);
pServerPlayer->SendPacket(&Msg);
// 发送骑乘信息
INT i=0;
INT j=0;
for(i=0; i<HUMAN_PET_MAX_COUNT; ++i){
if(!pFullUserData->m_PetList.m_aPetDB[i].m_GUID.IsNull()){
WGDetailOtherOnlineAttrib_Horse Msg2;
Msg2.SetPlayerID(pPacket->GetPlayerID());//发起查看者的ID
Msg2.SetGUID(pFullUserData->m_PetList.m_aPetDB[i].m_GUID);
Msg2.SetDataID(pFullUserData->m_PetList.m_aPetDB[i].m_nDataID);
Msg2.SetLevel(pFullUserData->m_PetList.m_aPetDB[i].m_nLevel);
Msg2.SetGenGu(pFullUserData->m_PetList.m_aPetDB[i].m_nGenGu);
Msg2.SetRemainPoint(pFullUserData->m_PetList.m_aPetDB[i].m_nRemainPoint);
Msg2.SetExp(pFullUserData->m_PetList.m_aPetDB[i].m_nExp);
Msg2.SetGeneration(pFullUserData->m_PetList.m_aPetDB[i].m_byGeneration);
Msg2.SetHappiness(pFullUserData->m_PetList.m_aPetDB[i].m_byHappiness);
Msg2.SetSpouseGUID(pFullUserData->m_PetList.m_aPetDB[i].m_SpouseGUID);
Msg2.SetName(pFullUserData->m_PetList.m_aPetDB[i].m_szName);
Msg2.SetNickName(pFullUserData->m_PetList.m_aPetDB[i].m_szNick);
Msg2.SetDexPerception(pFullUserData->m_PetList.m_aPetDB[i].m_iSmartnessPerception);
Msg2.SetStrPerception(pFullUserData->m_PetList.m_aPetDB[i].m_iStrengthPerception);
Msg2.SetIntPerception(pFullUserData->m_PetList.m_aPetDB[i].m_iMindPerception);
Msg2.SetConPerception(pFullUserData->m_PetList.m_aPetDB[i].m_iConstitutionPerception);
Msg2.SetSavvy(pFullUserData->m_PetList.m_aPetDB[i].m_iSavvy);
Msg2.SetMountID(pFullUserData->m_PetList.m_aPetDB[i].m_nDataID);
if(pFullUserData->m_PetList.m_aPetDB[i].m_bMating){
Msg2.SetHorseState(1);
}
if(pFullUserData->m_PetList.m_aPetDB[i].m_bCheckup){
Msg2.SetGrowRate((INT)pFullUserData->m_PetList.m_aPetDB[i].m_fGrowRate);
}
else{
Msg2.SetGrowRate(INVALID_ID);
}
for(j=0; j<PET_MAX_SKILL_COUNT; ++j){
Msg2.SetSkill(j, &(pFullUserData->m_PetList.m_aPetDB[i].m_SkillList[j]) );
}
Msg2.SetCon(pFullUserData->m_PetList.m_aPetDB[i].m_BaseAttrLevel1.Get(CATTR_LEVEL1_CON));
Msg2.SetDex(pFullUserData->m_PetList.m_aPetDB[i].m_BaseAttrLevel1.Get(CATTR_LEVEL1_DEX));
Msg2.SetInt(pFullUserData->m_PetList.m_aPetDB[i].m_BaseAttrLevel1.Get(CATTR_LEVEL1_INT));
Msg2.SetStr(pFullUserData->m_PetList.m_aPetDB[i].m_BaseAttrLevel1.Get(CATTR_LEVEL1_STR));
pServerPlayer->SendPacket(&Msg2);
}
}
// 发送人物装备信息
WGDetailOtherOnlineEquipList_Human Msg3;
Msg3.SetPlayerID(pPacket->GetPlayerID()); //设置发起查看者的ID
Msg3.SetAskMode(ASK_EQUIP_ALL);
for(i=0; i<HEQUIP_NUMBER; i++){
//if(pFullUserData->m_Equip.IsSet((HUMAN_EQUIP)i) == TRUE){
const _ITEM* pEquip = pFullUserData->m_Equip.GetEquipDB((HUMAN_EQUIP)i);
if(pEquip && !pEquip->IsNullType() && (pEquip->ItemClass() == ICLASS_EQUIP) )
Msg3.SetEquipData((HUMAN_EQUIP)i, pEquip);
//}
}
//.........这里部分代码省略.........