本文整理汇总了C++中Battleground::GetFlagPickerGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::GetFlagPickerGUID方法的具体用法?C++ Battleground::GetFlagPickerGUID怎么用?C++ Battleground::GetFlagPickerGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battleground
的用法示例。
在下文中一共展示了Battleground::GetFlagPickerGUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleBattlegroundPlayerPositionsOpcode
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
Battleground* bg = _player->GetBattleground();
if (!bg) // can't be received if player not in battleground
return;
uint32 flagCarrierCount = 0;
Player* allianceFlagCarrier = NULL;
Player* hordeFlagCarrier = NULL;
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (allianceFlagCarrier)
++flagCarrierCount;
}
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (hordeFlagCarrier)
++flagCarrierCount;
}
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * flagCarrierCount);
// Used to send several player positions (found used in AV)
data << 0; // CGBattlefieldInfo__m_numPlayerPositions
/*
for (CGBattlefieldInfo__m_numPlayerPositions)
data << guid << posx << posy;
*/
data << flagCarrierCount;
if (allianceFlagCarrier)
{
if (allianceFlagCarrier->SendRealNameQuery())
data << uint64(allianceFlagCarrier->GetGUID() + LIMIT_UINT32);
else
data << uint64(allianceFlagCarrier->GetGUID());
data << float(allianceFlagCarrier->GetPositionX());
data << float(allianceFlagCarrier->GetPositionY());
}
if (hordeFlagCarrier)
{
if (hordeFlagCarrier->SendRealNameQuery())
data << uint64(hordeFlagCarrier->GetGUID() + LIMIT_UINT32);
else
data << uint64(hordeFlagCarrier->GetGUID());
data << float(hordeFlagCarrier->GetPositionX());
data << float(hordeFlagCarrier->GetPositionY());
}
SendPacket(&data);
}
示例2: HandleBattlegroundPlayerPositionsOpcode
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
Battleground* bg = _player->GetBattleground();
if (!bg) // can't be received if player not in battleground
return;
uint32 count = 0;
Player* aplr = NULL;
Player* hplr = NULL;
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
{
aplr = ObjectAccessor::FindPlayer(guid);
if (aplr)
++count;
}
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
{
hplr = ObjectAccessor::FindPlayer(guid);
if (hplr)
++count;
}
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
data << 0;
data << count;
if (aplr)
{
if (aplr->SendRealNameQuery())
data << uint64(aplr->GetGUID() + LIMIT_UINT32);
else
data << uint64(aplr->GetGUID());
data << float(aplr->GetPositionX());
data << float(aplr->GetPositionY());
}
if (hplr)
{
if (hplr->SendRealNameQuery())
data << uint64(hplr->GetGUID() + LIMIT_UINT32);
else
data << uint64(hplr->GetGUID());
data << float(hplr->GetPositionX());
data << float(hplr->GetPositionY());
}
SendPacket(&data);
}
示例3: HandleBattlegroundPlayerPositionsOpcode
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEGROUND_PLAYER_POSITIONS Message");
Battleground* bg = _player->GetBattleground();
if (!bg) // can't be received if player not in battleground
return;
uint32 acount = 0;
uint32 hcount = 0;
Player* aplr = NULL;
Player* hplr = NULL;
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
aplr = ObjectAccessor::FindPlayer(guid);
if (aplr)
++acount;
}
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
hplr = ObjectAccessor::FindPlayer(guid);
if (hplr)
++hcount;
}
ObjectGuid aguid = aplr ? aplr->GetGUID() : 0;
ObjectGuid hguid = hplr ? hplr->GetGUID() : 0;
WorldPacket data(SMSG_BATTLEFIELD_PLAYER_POSITIONS);
data.WriteBits(acount, 22);
for (uint8 i = 0; i < acount; i++)
{
data.WriteBit(aguid[3]);
data.WriteBit(aguid[5]);
data.WriteBit(aguid[1]);
data.WriteBit(aguid[6]);
data.WriteBit(aguid[7]);
data.WriteBit(aguid[0]);
data.WriteBit(aguid[2]);
data.WriteBit(aguid[4]);
}
data.WriteBits(hcount, 22);
for (uint8 i = 0; i < hcount; i++)
{
data.WriteBit(hguid[6]);
data.WriteBit(hguid[5]);
data.WriteBit(hguid[4]);
data.WriteBit(hguid[7]);
data.WriteBit(hguid[2]);
data.WriteBit(hguid[1]);
data.WriteBit(hguid[0]);
data.WriteBit(hguid[3]);
}
data.FlushBits();
for (uint8 i = 0; i < hcount; i++)
{
data.WriteByteSeq(hguid[2]);
data.WriteByteSeq(hguid[1]);
data << float(hplr->GetPositionY());
data.WriteByteSeq(hguid[5]);
data.WriteByteSeq(hguid[4]);
data.WriteByteSeq(hguid[7]);
data.WriteByteSeq(hguid[0]);
data.WriteByteSeq(hguid[6]);
data.WriteByteSeq(hguid[3]);
data << float(hplr->GetPositionX());
}
for (uint8 i = 0; i < acount; i++)
{
data.WriteByteSeq(aguid[6]);
data << float(aplr->GetPositionX());
data.WriteByteSeq(aguid[5]);
data.WriteByteSeq(aguid[3]);
data << float(aplr->GetPositionY());
data.WriteByteSeq(aguid[1]);
data.WriteByteSeq(aguid[7]);
data.WriteByteSeq(aguid[0]);
data.WriteByteSeq(aguid[2]);
data.WriteByteSeq(aguid[4]);
}
SendPacket(&data);
}