本文整理汇总了C++中WorldPacket::FlushBits方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldPacket::FlushBits方法的具体用法?C++ WorldPacket::FlushBits怎么用?C++ WorldPacket::FlushBits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldPacket
的用法示例。
在下文中一共展示了WorldPacket::FlushBits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildAuctionInfo
//this function inserts to WorldPacket auction's data
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
{
Item* item = sAuctionMgr->GetAItem(itemGUIDLow);
if (!item)
{
TC_LOG_ERROR("misc", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", autcionId, itemGUIDLow);
return false;
}
ObjectGuid ownerGUID = MAKE_NEW_GUID(owner, 0, HIGHGUID_PLAYER);
ObjectGuid bidderGUID = MAKE_NEW_GUID(bidder, 0, HIGHGUID_PLAYER);
ObjectGuid itemGUID = MAKE_NEW_GUID(itemGUIDLow, 0, HIGHGUID_ITEM);
ObjectGuid ownerAccountID = 0; // Owner Account ID -- Added in WoD
// Write Item Instances
data << uint32(item->GetEntry());
data << uint32(item->GetItemSuffixFactor());
data << uint32(item->GetItemRandomPropertyId());
data.FlushBits();
data.WriteBit(0); // HasItemBonus -- Added in WoD
data.WriteBit(0); // HasModifications -- Added in WoD
data << int32(item->GetCount());
data << int32(item->GetSpellCharges());
data << int32(PROP_ENCHANTMENT_SLOT_0);
data << int32(0); // flags -- Added in WoD???
data << int32(autcionId);
data << ownerGUID;
data << uint64(startbid);
data << uint64(bid ? GetAuctionOutBid() : 0);
data << uint64(buyout);
data << int32((expire_time - time(NULL)) * IN_MILLISECONDS);
data << uint8(0); // Delete Reason -- Added in WoD
for (uint8 i = 0; i < PROP_ENCHANTMENT_SLOT_0; ++i)
{
data << int32(item->GetEnchantmentId(EnchantmentSlot(i)));
data << uint32(item->GetEnchantmentDuration(EnchantmentSlot(i)));
data << int32(item->GetEnchantmentCharges(EnchantmentSlot(i)));
data << uint8(0); // Slot
}
data.FlushBits();
data.WriteBit(1); // ServerSideInfo -- Disable for more check
data.WriteBit(0); // BidInfo
/* ServerSideInfo Added In WoD
data << _itemGUID;
data << _ownerAccountID;
data << uint32((expire_time) * IN_MILLISECONDS);
*/
data << bidderGUID;
data << int64(bid);
return true;
}
示例2: HandleTaxiNodeStatusQueryOpcode
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
guid[0] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
recvData.FlushBits();
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[3]);
SendTaxiStatus(guid);
}
示例3: HandleLootRoll
void WorldSession::HandleLootRoll(WorldPacket& recvData)
{
ObjectGuid guid;
uint8 itemSlot;
uint8 rollType;
recvData >> rollType; // 0: pass, 1: need, 2: greed
recvData >> itemSlot;
uint8 bitOrder[8] = {5, 4, 2, 1, 7, 0, 3, 6};
recvData.ReadBitInOrder(guid, bitOrder);
recvData.FlushBits();
uint8 byteOrder[8] = {3, 7, 0, 4, 2, 1, 5, 6};
recvData.ReadBytesSeq(guid, byteOrder);
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
group->CountRollVote(GetPlayer()->GetGUID(), itemSlot, rollType);
switch (rollType)
{
case ROLL_NEED:
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
break;
case ROLL_GREED:
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
break;
}
}
示例4: HandleMailMarkAsRead
//called when mail is read
void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
{
ObjectGuid mailbox;
uint32 mailId;
recvData >> mailId;
recvData.ReadGuidMask(mailbox, 0, 2, 3);
recvData.ReadBit();
recvData.ReadGuidMask(mailbox, 4, 6, 7, 1, 5);
recvData.FlushBits();
recvData.ReadGuidBytes(mailbox, 1, 7, 2, 5, 6, 3, 4, 0);
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
if (Mail* mail = _player->GetMail(mailId))
{
if (_player->unReadMails)
--_player->unReadMails;
mail->checked |= MAIL_CHECK_MASK_READ;
mail->state = MAIL_STATE_CHANGED;
_player->m_mailsUpdated = true;
}
}
示例5: HandleActivateTaxiOpcode
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI");
ObjectGuid guid;
std::vector<uint32> nodes;
nodes.resize(2);
recvData >> nodes[0] >> nodes[1];
uint8 bitsOrder[8] = { 3, 6, 0, 7, 4, 1, 5, 2 };
recvData.ReadBitInOrder(guid, bitsOrder);
recvData.FlushBits();
uint8 bytesOrder[8] = { 3, 0, 4, 5, 7, 1, 6, 2 };
recvData.ReadBytesSeq(guid, bytesOrder);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]);
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
return;
}
GetPlayer()->ActivateTaxiPathTo(nodes, npc);
}
示例6: HandleBfQueueInviteResponse
//Send by client when he click on accept for queue
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
ObjectGuid guid;
uint8 bitOrder[8] = {4, 7, 6, 1, 2, 5, 0, 3};
recvData.ReadBitInOrder(guid, bitOrder);
accepted = recvData.ReadBit();
recvData.FlushBits();
uint8 byteOrder[8] = {6, 4, 0, 1, 5, 7, 3, 2};
recvData.ReadBytesSeq(guid, byteOrder);
sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: GUID:" UI64FMTD " Accepted:%u", (uint64)guid, accepted);
if (!accepted)
return;
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
bf->PlayerAcceptInviteToQueue(_player);
}
示例7: HandleSummonResponseOpcode
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
{
if (!_player->isAlive() || _player->isInCombat())
return;
ObjectGuid summonerGuid;
bool agree;
summonerGuid[4] = recvData.ReadBit();
summonerGuid[1] = recvData.ReadBit();
summonerGuid[5] = recvData.ReadBit();
summonerGuid[6] = recvData.ReadBit();
summonerGuid[2] = recvData.ReadBit();
agree = recvData.ReadBit();
summonerGuid[0] = recvData.ReadBit();
summonerGuid[3] = recvData.ReadBit();
summonerGuid[7] = recvData.ReadBit();
recvData.FlushBits();
uint8 bytesOrder[8] = { 3, 7, 1, 2, 0, 5, 4, 6 };
recvData.ReadBytesSeq(summonerGuid, bytesOrder);
_player->SummonIfPossible(agree);
}
示例8: HandleBfEntryInviteResponse
//Send by client on clicking in accept or refuse of invitation windows for join game
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
{
uint8 accepted;
ObjectGuid guid;
guid[1] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
recvData.FlushBits();
uint8 byteOrder[8] = {3, 2, 4, 0, 5, 7, 6, 1};
recvData.ReadBytesSeq(guid, byteOrder);
sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: GUID:" UI64FMTD " Accepted:%u", uint64(guid), accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
if (accepted)
bf->PlayerAcceptInviteToWar(_player);
else
if (_player->GetZoneId() == bf->GetZoneId())
bf->KickPlayerFromBattlefield(_player->GetGUID());
}
示例9: HandleRequestPartyMemberStatsOpcode
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
ObjectGuid Guid;
auto isFull = recvData.read<uint8>();
uint8 bitOrder[8] = { 5, 3, 4, 1, 6, 0, 2, 7 };
recvData.ReadBitInOrder(Guid, bitOrder);
recvData.FlushBits();
uint8 byteOrder[8] = { 0, 3, 1, 2, 7, 5, 4, 6 };
recvData.ReadBytesSeq(Guid, byteOrder);
Player* player = HashMapHolder<Player>::Find(Guid);
if (player && player->GetGroup() != GetPlayer()->GetGroup())
return;
uint32 mask = GROUP_UPDATE_FLAG_STATUS;
if (player)
{
mask |= GROUP_UPDATE_PLAYER;
if (player->GetPet())
mask |= GROUP_UPDATE_PET;
}
WorldPacket data;
BuildPartyMemberStatsChangedPacket(player, &data, mask, Guid, true);
SendPacket(&data);
}
示例10: HandlePetitionDeclineOpcode
void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_DECLINE");
ObjectGuid petitionGuid;
uint8 bitsOrder[8] = { 1, 4, 6, 7, 3, 2, 0, 5 };
recvData.ReadBitInOrder(petitionGuid, bitsOrder);
recvData.FlushBits();
uint8 bytesOrder[8] = { 5, 3, 4, 6, 0, 7, 2, 1 };
recvData.ReadBytesSeq(petitionGuid, bytesOrder);
sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
stmt->setUInt32(0, GUID_LOPART(petitionGuid));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
return;
Field* fields = result->Fetch();
ObjectGuid ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
Player* owner = ObjectAccessor::FindPlayer(ownerGuid);
if (owner)
owner->GetSession()->SendPetitionSignResult(ownerGuid, petitionGuid, PETITION_SIGN_DECLINED);
}
示例11: HandlePetitionShowListOpcode
void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST");
ObjectGuid PetitionGuid;
PetitionGuid[4] = recvData.ReadBit();
PetitionGuid[3] = recvData.ReadBit();
PetitionGuid[2] = recvData.ReadBit();
PetitionGuid[7] = recvData.ReadBit();
PetitionGuid[6] = recvData.ReadBit();
PetitionGuid[1] = recvData.ReadBit();
PetitionGuid[0] = recvData.ReadBit();
PetitionGuid[5] = recvData.ReadBit();
recvData.FlushBits();
recvData.ReadByteSeq(PetitionGuid[5]);
recvData.ReadByteSeq(PetitionGuid[0]);
recvData.ReadByteSeq(PetitionGuid[6]);
recvData.ReadByteSeq(PetitionGuid[2]);
recvData.ReadByteSeq(PetitionGuid[1]);
recvData.ReadByteSeq(PetitionGuid[7]);
recvData.ReadByteSeq(PetitionGuid[3]);
recvData.ReadByteSeq(PetitionGuid[4]);
SendPetitionShowList(PetitionGuid);
}
示例12: HandleGroupAssistantLeaderOpcode
void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
ObjectGuid guid;
bool apply;
uint8 unk = 0;
recvData >> unk;
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
apply = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
recvData.FlushBits();
uint8 byteOrder[8] = { 6, 3, 2, 5, 7, 1, 0, 4 };
recvData.ReadBytesSeq(guid, byteOrder);
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_ASSISTANT);
group->SendUpdate();
}
示例13: HandleBfQueueRequest
void WorldSession::HandleBfQueueRequest(WorldPacket& recvData)
{
ObjectGuid guid;
uint8 bitOrder[8] = {3, 5, 7, 0, 6, 2, 1, 4};
recvData.ReadBitInOrder(guid, bitOrder);
recvData.FlushBits();
uint8 byteOrder[8] = {1, 0, 3, 2, 4, 7, 5, 6};
recvData.ReadBytesSeq(guid, byteOrder);
sLog->outError(LOG_FILTER_GENERAL, "HandleBfQueueRequest: GUID:" UI64FMTD " ", (uint64)guid);
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid))
{
if (bf->IsWarTime())
bf->InvitePlayerToWar(_player);
else
{
uint32 timer = bf->GetTimer() / 1000;
if (timer < 15 * MINUTE)
bf->InvitePlayerToQueue(_player);
}
}
}
示例14: HandleLeaveChannel
void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 channelId;
std::string channelname;
recvPacket >> channelId;
uint32 length = recvPacket.ReadBits(7);
recvPacket.FlushBits();
channelname = recvPacket.ReadString(length);
if (channelname.empty())
return;
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Leave(_player->GetGUID(), true);
cMgr->LeftChannel(channelname);
}
}
示例15: HandleChannelUnban
//Checked
void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
{
time_t now = time(NULL);
if (now - timeLastChannelUnbanCommand < 5)
return;
else
timeLastChannelUnbanCommand = now;
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
size_t nameLength = recvPacket.ReadBits(9);
size_t channelLength = recvPacket.ReadBits(7);
recvPacket.FlushBits();
std::string otp = recvPacket.ReadString(nameLength);
std::string channelname = recvPacket.ReadString(channelLength);
if (!normalizePlayerName(otp))
return;
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->UnBan(_player->GetGUID(), otp.c_str());
}