本文整理汇总了C++中OutPacket函数的典型用法代码示例。如果您正苦于以下问题:C++ OutPacket函数的具体用法?C++ OutPacket怎么用?C++ OutPacket使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OutPacket函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: swap32
void WorldSession::HandleIgnoreTrade(WorldPacket & recv_data)
{
if(!_player->IsInWorld()) return;
uint32 TradeStatus = TRADE_STATUS_PLAYER_IGNORED;
Player * plr = _player->GetTradeTarget();
if(_player->mTradeTarget == 0 || plr == 0)
{
#ifdef USING_BIG_ENDIAN
TradeStatus = swap32(uint32(TRADE_STATUS_PLAYER_NOT_FOUND));
#else
TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND;
#endif
OutPacket(TRADE_STATUS_PLAYER_NOT_FOUND, 4, &TradeStatus);
return;
}
#ifdef USING_BIG_ENDIAN
swap32(&TradeStatus);
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
swap32(&TradeStatus);
#else
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
#endif
plr->mTradeStatus = TradeStatus;
_player->mTradeStatus = TradeStatus;
plr->mTradeTarget = 0;
_player->mTradeTarget = 0;
}
示例2: ASSERT
void WorldSocket::Authenticate()
{
WorldSession * pSession = mSession;
ASSERT(pAuthenticationPacket);
mQueued = false;
if(!pSession) return;
pSession->deleteMutex.Acquire();
if(pSession->HasFlag(ACCOUNT_FLAG_XPACK_01))
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x01");
else
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x00");
sAddonMgr.SendAddonInfoPacket(pAuthenticationPacket, (uint32)pAuthenticationPacket->rpos(), pSession);
pSession->_latency = _latency;
delete pAuthenticationPacket;
pAuthenticationPacket = 0;
if(mSession)
{
sWorld.AddSession(mSession);
sWorld.AddGlobalSession(mSession);
/* if(pSession->HasFlag(ACCOUNT_FLAG_XTEND_INFO))
sWorld.AddExtendedSession(pSession);*/
if(pSession->HasGMPermissions() && mSession)
sWorld.gmList.insert(pSession);
}
pSession->deleteMutex.Release();
}
示例3: ASSERT
void WorldSocket::Authenticate()
{
WorldSession * pSession = mSession;
ASSERT(pAuthenticationPacket);
mQueued = false;
if(!pSession)
{
DEBUG_LOG( "WorldSocket","Lost Session");
return;
}
if(pSession->HasFlag(ACCOUNT_FLAG_XPACK_02))
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x02");
else if(pSession->HasFlag(ACCOUNT_FLAG_XPACK_01))
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x01");
else
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x00");
sAddonMgr.SendAddonInfoPacket(pAuthenticationPacket, (uint32)pAuthenticationPacket->rpos(), pSession);
pSession->_latency = _latency;
delete pAuthenticationPacket;
pAuthenticationPacket = NULL;
sWorld.AddSession(pSession);
sWorld.AddGlobalSession(pSession);
}
示例4: OutPacket
void WorldSession::HandleBusyTrade(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
uint32 TradeStatus = TRADE_STATUS_PLAYER_BUSY;
Player* plr = _player->GetTradeTarget();
if(_player->mTradeTarget == 0 || plr == 0)
{
TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND;
OutPacket(TRADE_STATUS_PLAYER_NOT_FOUND, 4, &TradeStatus);
return;
}
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->mTradeStatus = TradeStatus;
_player->mTradeStatus = TradeStatus;
plr->mTradeTarget = 0;
_player->mTradeTarget = 0;
}
示例5: CHECK_PACKET_SIZE
void WorldSession::HandleClearTradeItem(WorldPacket & recv_data)
{
CHECK_PACKET_SIZE(recv_data, 1);
if(_player->mTradeTarget == 0)
return;
uint8 TradeSlot = recv_data.contents()[0];
if(TradeSlot > 6)
return;
// clean status
Player * plr = _player->GetTradeTarget();
if ( !plr ) return;
uint32 TradeStatus = TRADE_STATUS_STATE_CHANGED;
#ifdef USING_BIG_ENDIAN
swap32(&TradeStatus);
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
swap32(&TradeStatus);
#else
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
#endif
plr->mTradeStatus = TradeStatus;
_player->mTradeStatus = TradeStatus;
_player->mTradeItems[TradeSlot] = 0;
_player->SendTradeUpdate();
}
示例6: OutPacket
void WorldSession::HandleLfgInviteAccept(WorldPacket & recvPacket)
{
CHECK_INWORLD_RETURN;
_player->PartLFGChannel();
if(_player->m_lfgMatch == NULL && _player->m_lfgInviterGuid == 0)
{
if(_player->m_lfgMatch == NULL)
OutPacket(SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER); // Matched Player(s) have gone offline.
else
OutPacket(SMSG_LFG_AUTOJOIN_FAILED); // Group no longer available.
return;
}
if( _player->m_lfgMatch != NULL )
{
// move into accepted players
_player->m_lfgMatch->lock.Acquire();
_player->m_lfgMatch->PendingPlayers.erase(_player);
if( !_player->GetGroup() )
{
_player->m_lfgMatch->AcceptedPlayers.insert(_player);
if(!_player->m_lfgMatch->PendingPlayers.size())
{
// all players have accepted
Group * pGroup = new Group(true);
for(set<Player*>::iterator itr = _player->m_lfgMatch->AcceptedPlayers.begin(); itr != _player->m_lfgMatch->AcceptedPlayers.end(); ++itr)
pGroup->AddMember((*itr)->m_playerInfo);
_player->m_lfgMatch->pGroup = pGroup;
}
}
_player->m_lfgMatch->lock.Release();
}
else
{
Player * pPlayer = objmgr.GetPlayer(_player->m_lfgInviterGuid);
if( pPlayer == NULL )
{
OutPacket(SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER); // Matched Player(s) have gone offline.
return;
}
if( pPlayer->GetGroup() == NULL || pPlayer->GetGroup()->IsFull() || pPlayer->GetGroup()->GetLeader() != pPlayer->m_playerInfo )
{
OutPacket(SMSG_LFG_AUTOJOIN_FAILED);
return;
}
pPlayer->GetGroup()->AddMember(_player->m_playerInfo);
}
_player->m_lfgInviterGuid = 0;
_player->m_lfgMatch = NULL;
}
示例7: getMSTime
void WorldSocket::OnConnect()
{
sWorld.mAcceptedConnections++;
_latency = getMSTime();
#ifdef USING_BIG_ENDIAN
uint32 swapped = swap32(mSeed);
OutPacket(SMSG_AUTH_CHALLENGE, 4, &swapped);
#else
OutPacket(SMSG_AUTH_CHALLENGE, 4, &mSeed);
#endif
}
示例8: GetPlayer
void WorldSession::HandleBeginTrade(WorldPacket & recv_data)
{
if(!_player->IsInWorld())
{
return;
}
#ifdef FORCED_GM_TRAINEE_MODE
if( CanUseCommand('k') && !HasGMPermissions() )
{
GetPlayer()->BroadcastMessage( "You are not allowed to use this feature" );
return;
}
#endif
if( sWorld.getIntRate( INTRATE_DISABLE_TRADE_FEATURE ) )
{
GetPlayer()->BroadcastMessage( "Trade feature is disabled right now" );
return;
}
sLog.outDebug( "WORLD: got CMSG_BEGIN_TRADE from player %s.", _player->GetName() );
packetSMSG_TRADE_STATUS data;
memset( &data, 0, sizeof( data ) );
data.trade_status = TRADE_STATUS_INITIATED;
data.trade_id = TRADE_ID_CONST; //this the constant used in status update also !
Player * plr = _player->GetTradeTarget();
if(_player->mTradeTarget == 0 || plr == 0)
{
data.trade_status = TRADE_STATUS_PLAYER_NOT_FOUND;
OutPacket(SMSG_TRADE_STATUS,sizeof( packetSMSG_TRADE_STATUS ), &data);
return;
}
// We're too far from target now?
Player * plr2 = objmgr.GetPlayer(_player->mTradeTarget);
if( plr2 == NULL )
{
return; //wtf ? player is inside the map and not in objectmanager ?
}
if( _player->CalcDistance( plr2 ) > 10.0f )
data.trade_status = TRADE_STATUS_TOO_FAR_AWAY;
//send to ourself
OutPacket(SMSG_TRADE_STATUS,sizeof( packetSMSG_TRADE_STATUS ), &data);
//send to our target
plr->m_session->OutPacket(SMSG_TRADE_STATUS,sizeof( packetSMSG_TRADE_STATUS ), &data);
plr->mTradeStatus = data.trade_status;
_player->mTradeStatus = data.trade_status;
// _player->SendTradeUpdate( 0 );
// plr->SendTradeUpdate( 0 );
}
示例9: OutPacket
void WorldSocket::Authenticate()
{
if(m_session->m_accountFlags & 16)
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x02");
else if(m_session->m_accountFlags & 8)
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x01");
else
OutPacket(SMSG_AUTH_RESPONSE, 11, "\x0C\x30\x78\x00\x00\x00\x00\x00\x00\x00\x00");
SendAddonInfoPacket(pAuthenticationPacket, (uint32)pAuthenticationPacket->rpos(), m_session);
delete pAuthenticationPacket;
pAuthenticationPacket = 0;
}
示例10: memset
void WorldSession::HandleCancelTrade(WorldPacket & recv_data)
{
if(!_player->IsInWorld())
{
return;
}
sLog.outDebug( "WORLD: got CMSG_CANCEL_TRADE from player %s.", _player->GetName() );
if(_player->mTradeTarget == 0 || _player->mTradeStatus == TRADE_STATUS_COMPLETE)
{
return;
}
packetSMSG_TRADE_STATUS data;
memset( &data, 0, sizeof( data ) );
data.trade_status = TRADE_STATUS_CANCELLED;
//send to ourself
OutPacket(SMSG_TRADE_STATUS,sizeof( packetSMSG_TRADE_STATUS ), &data);
Player * plr = _player->GetTradeTarget();
if(plr)
{
//send to our target
if(plr->m_session && plr->m_session->GetSocket())
plr->m_session->OutPacket(SMSG_TRADE_STATUS,sizeof( packetSMSG_TRADE_STATUS ), &data);
plr->ResetTradeVariables();
}
_player->ResetTradeVariables();
}
示例11: OutPacket
void WorldServerSocket::OnConnect()
{
sWorld.AcceptedConnections++;
_latency = (uint32)time(NULL);
OutPacket(SMSG_AUTH_CHALLENGE, 4, &mSeed);
}
示例12: swap32
void WorldSession::HandleCancelTrade(WorldPacket & recv_data)
{
if(!_player->IsInWorld()) return;
if(_player->mTradeTarget == 0 || _player->mTradeStatus == TRADE_STATUS_COMPLETE)
return;
#ifdef USING_BIG_ENDIAN
uint32 TradeStatus = swap32(uint32(TRADE_STATUS_CANCELLED));
#else
uint32 TradeStatus = TRADE_STATUS_CANCELLED;
#endif
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
Player * plr = _player->GetTradeTarget();
if(plr)
{
if(plr->m_session && plr->m_session->GetSocket())
plr->m_session->OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
plr->mTradeTarget = 0;
plr->ResetTradeVariables();
}
_player->mTradeTarget = 0;
_player->ResetTradeVariables();
}
示例13: OutPacket
void WorldSession::HandleBeginTrade(WorldPacket& recv_data)
{
CHECK_INWORLD_RETURN
uint32 TradeStatus = TRADE_STATUS_INITIATED;
Player* plr = _player->GetTradeTarget();
if (_player->mTradeTarget == 0 || plr == 0)
{
TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND;
OutPacket(SMSG_TRADE_STATUS, 4, &TradeStatus);
return;
}
// We're too far from target now?
if (_player->CalcDistance(objmgr.GetPlayer(_player->mTradeTarget)) > 10.0f)
TradeStatus = TRADE_STATUS_TOO_FAR_AWAY;
WorldPacket data(SMSG_TRADE_STATUS, 8);
data << uint32(TradeStatus);
data << uint32(0x19);
plr->m_session->SendPacket(&data);
SendPacket(&data);
plr->mTradeStatus = TradeStatus;
_player->mTradeStatus = TradeStatus;
}
示例14: CHECK_PACKET_SIZE
void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data, 8);
uint64 playerGuid = 0;
sLog.outDebug( "WORLD: Recvd Player Logon Message" );
recv_data >> playerGuid; // this is the GUID selected by the player
if(objmgr.GetPlayer((uint32)playerGuid) != NULL || m_loggingInPlayer || _player)
{
// A character with that name already exists 0x3E
uint8 respons = CHAR_LOGIN_DUPLICATE_CHARACTER;
OutPacket(SMSG_CHARACTER_LOGIN_FAILED, 1, &respons);
return;
}
Player* plr = new Player((uint32)playerGuid);
ASSERT(plr);
plr->SetSession(this);
m_bIsWLevelSet = false;
Log.Debug("WorldSession", "Async loading player %u", (uint32)playerGuid);
m_loggingInPlayer = plr;
plr->LoadFromDB((uint32)playerGuid);
}
示例15: OutPacket
void WorldSession::HandleQuestgiverCancelOpcode(WorldPacket & recvPacket)
{
CHECK_INWORLD_RETURN
OutPacket(SMSG_GOSSIP_COMPLETE, 0, NULL);
LOG_DEBUG("WORLD: Sent SMSG_GOSSIP_COMPLETE");
}