本文整理汇总了C++中WorldPacket::ReadBit方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldPacket::ReadBit方法的具体用法?C++ WorldPacket::ReadBit怎么用?C++ WorldPacket::ReadBit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldPacket
的用法示例。
在下文中一共展示了WorldPacket::ReadBit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleBlackMarketHelloOpcode
void WorldSession::HandleBlackMarketHelloOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[2]);
uint64 npcGuid = uint64(guid);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_BLACKMARKET);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BLACKMARKET_HELLO - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGuid)));
return;
}
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendBlackMarketHello(npcGuid);
}
示例2: HandleSpiritHealerActivateOpcode
void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
ObjectGuid UnitGUID;
UnitGUID[2] = recvData.ReadBit();
UnitGUID[7] = recvData.ReadBit();
UnitGUID[6] = recvData.ReadBit();
UnitGUID[0] = recvData.ReadBit();
UnitGUID[5] = recvData.ReadBit();
UnitGUID[4] = recvData.ReadBit();
UnitGUID[1] = recvData.ReadBit();
UnitGUID[3] = recvData.ReadBit();
recvData.ReadByteSeq(UnitGUID[1]);
recvData.ReadByteSeq(UnitGUID[5]);
recvData.ReadByteSeq(UnitGUID[6]);
recvData.ReadByteSeq(UnitGUID[3]);
recvData.ReadByteSeq(UnitGUID[2]);
recvData.ReadByteSeq(UnitGUID[0]);
recvData.ReadByteSeq(UnitGUID[7]);
recvData.ReadByteSeq(UnitGUID[4]);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(UnitGUID, UNIT_NPC_FLAG_SPIRITHEALER);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(UnitGUID)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendSpiritResurrect();
}
示例3: HandleLfgLeaveOpcode
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recvData)
{
ObjectGuid leaveGuid;
Group* group = GetPlayer()->GetGroup();
uint64 guid = GetPlayer()->GetGUID();
uint64 gguid = group ? group->GetGUID() : guid;
recvData.read_skip<uint32>(); // Always 8
recvData.read_skip<uint32>(); // Join date
recvData.read_skip<uint32>(); // Always 3
recvData.read_skip<uint32>(); // Queue Id
leaveGuid[4] = recvData.ReadBit();
leaveGuid[5] = recvData.ReadBit();
leaveGuid[0] = recvData.ReadBit();
leaveGuid[6] = recvData.ReadBit();
leaveGuid[2] = recvData.ReadBit();
leaveGuid[7] = recvData.ReadBit();
leaveGuid[1] = recvData.ReadBit();
leaveGuid[3] = recvData.ReadBit();
recvData.ReadByteSeq(leaveGuid[7]);
recvData.ReadByteSeq(leaveGuid[4]);
recvData.ReadByteSeq(leaveGuid[3]);
recvData.ReadByteSeq(leaveGuid[2]);
recvData.ReadByteSeq(leaveGuid[6]);
recvData.ReadByteSeq(leaveGuid[0]);
recvData.ReadByteSeq(leaveGuid[1]);
recvData.ReadByteSeq(leaveGuid[5]);
TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u sent guid " UI64FMTD ".",
GetPlayerInfo().c_str(), group ? 1 : 0, uint64(leaveGuid));
// Check cheating - only leader can leave the queue
if (!group || group->GetLeaderGUID() == guid)
sLFGMgr->LeaveLfg(gguid);
}
示例4: HandleBankerActivateOpcode
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[4]);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendShowBank(guid);
}
示例5: HandleRepairItemOpcode
void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
ObjectGuid npcGuid, itemGuid;
bool guildBank; // new in 2.3.2, bool that means from guild bank money
recvData.ReadGuidMask(itemGuid, 2, 5);
npcGuid[3] = recvData.ReadBit();
guildBank = recvData.ReadBit();
npcGuid[7] = recvData.ReadBit();
itemGuid[4] = recvData.ReadBit();
npcGuid[2] = recvData.ReadBit();
recvData.ReadGuidMask(itemGuid, 0, 3);
recvData.ReadGuidMask(npcGuid, 6, 1, 4);
itemGuid[6] = recvData.ReadBit();
recvData.ReadGuidMask(npcGuid, 5, 0);
recvData.ReadGuidMask(itemGuid, 7, 1);
recvData.ReadByteSeq(itemGuid[2]);
recvData.ReadByteSeq(npcGuid[1]);
recvData.ReadByteSeq(itemGuid[1]);
recvData.ReadGuidBytes(npcGuid, 4, 7, 3, 2);
recvData.ReadByteSeq(itemGuid[7]);
recvData.ReadGuidBytes(npcGuid, 5, 0);
recvData.ReadGuidBytes(itemGuid, 5, 3, 4, 6);
recvData.ReadByteSeq(npcGuid[6]);
recvData.ReadByteSeq(itemGuid[0]);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_REPAIR);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGuid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// reputation discount
float discountMod = _player->GetReputationPriceDiscount(unit);
if (itemGuid)
{
TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGuid), GUID_LOPART(npcGuid));
Item* item = _player->GetItemByGuid(itemGuid);
if (item)
_player->DurabilityRepair(item->GetPos(), true, discountMod, guildBank);
}
else
{
TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGuid));
_player->DurabilityRepairAll(true, discountMod, guildBank);
}
}
示例6: HandleBlackMarketHello
//void called when player click on black market npc
void WorldSession::HandleBlackMarketHello(WorldPacket& recvData)
{
ObjectGuid guid;
guid[4] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[1]);
uint64 npcGuid = uint64(guid);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_BLACK_MARKET);
if (!unit)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBlackMarketHello - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGuid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendBlackMarketHello(npcGuid);
}
示例7: HandleGuildSetNoteOpcode
void WorldSession::HandleGuildSetNoteOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_SET_NOTE");
bool officer;
uint32 noteLen;
std::string name, note;
ObjectGuid targetGuid;
recvPacket.ReadGuidMask<1, 4, 5, 3, 0, 7>(targetGuid);
officer = !recvPacket.ReadBit();
recvPacket.ReadGuidMask<6>(targetGuid);
noteLen = recvPacket.ReadBits(8);
recvPacket.ReadGuidMask<2>(targetGuid);
recvPacket.ReadGuidBytes<4, 5, 0, 3, 1, 6, 7>(targetGuid);
note = recvPacket.ReadString(noteLen);
recvPacket.ReadGuidBytes<2>(targetGuid);
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (!guild->HasRankRight(GetPlayer()->GetRank(), officer ? GR_RIGHT_EOFFNOTE : GR_RIGHT_EPNOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
if (!sObjectMgr.GetPlayerNameByGUID(targetGuid, name))
return;
MemberSlot* slot = guild->GetMemberSlot(targetGuid);
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, ERR_GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if (officer)
slot->SetOFFNOTE(note);
else
slot->SetPNOTE(note);
guild->Roster(this);
}
示例8: HandleTrainerListOpcode
void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
guid[0] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[4]);
SendTrainerList(guid);
}
示例9: 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[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[5]);
TC_LOG_ERROR(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());
}
示例10: HandleBlackMarketRequestItemOpcode
void WorldSession::HandleBlackMarketRequestItemOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
uint32 Timestamp;
recvData >> Timestamp;
guid[2] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[0]);
uint64 NpcGuid = uint64(guid);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(NpcGuid, UNIT_NPC_FLAG_BLACKMARKET);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BLACKMARKET_REQUEST_ITEMS - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(NpcGuid)));
return;
}
SendBlackMarketRequestItemsResult();
}
示例11: HandleGuildSwitchRank
void WorldSession::HandleGuildSwitchRank(WorldPacket& recvPacket)
{
uint32 rank;
bool direction; // if its true, then the rank rises, if no, it goes down
recvPacket >> rank;
direction = recvPacket.ReadBit();
Guild* pGuild = GetPlayer()->GetGuild();
// if(pGuild)
// {
// pGuild->MoveRank(rank,direction);
// }
}
示例12: HandleDuelResponseOpcode
void WorldSession::HandleDuelResponseOpcode(WorldPacket& recvPacket)
{
bool accepted;
ObjectGuid guid;
Player* player;
Player* plTarget;
recvPacket >> guid;
accepted = recvPacket.ReadBit();
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
if (accepted)
{
player = GetPlayer();
plTarget = player->duel->opponent;
if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
return;
//TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_ACCEPTED");
TC_LOG_DEBUG("network", "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str());
TC_LOG_DEBUG("network", "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str());
time_t now = time(NULL);
player->duel->startTimer = now;
plTarget->duel->startTimer = now;
player->SendDuelCountdown(3000);
plTarget->SendDuelCountdown(3000);
} else
{
// player surrendered in a duel using /forfeit
if (GetPlayer()->duel->startTime != 0)
{
GetPlayer()->CombatStopWithPets(true);
if (GetPlayer()->duel->opponent)
GetPlayer()->duel->opponent->CombatStopWithPets(true);
GetPlayer()->CastSpell(GetPlayer(), 7267, true); // beg
GetPlayer()->DuelComplete(DUEL_WON);
return;
}
GetPlayer()->DuelComplete(DUEL_INTERRUPTED);
}
}
示例13: HandleGroupEveryoneIsAssistantOpcode
void WorldSession::HandleGroupEveryoneIsAssistantOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_EVERYONE_IS_ASSISTANT");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
recvData.read_skip<uint8>();
bool apply = recvData.ReadBit();
recvData.FlushBits();
group->ChangeFlagEveryoneAssistant(apply);
}
示例14: HandlePartyAssignmentOpcode
void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSIGNMENT");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
uint64 senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid) && !(group->GetGroupType() & GROUPTYPE_EVERYONE_IS_ASSISTANT))
return;
uint8 assignment;
bool apply;
ObjectGuid guid;
recvData >> assignment;
recvData.read_skip<uint8>(); // Unknown.
guid[0] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
apply = recvData.ReadBit();
guid[4] = recvData.ReadBit();
recvData.FlushBits();
uint8 byteOrder[8] = { 4, 3, 1, 5, 2, 6, 7, 0 };
recvData.ReadBytesSeq(guid, byteOrder);
switch (assignment)
{
case GROUP_ASSIGN_MAINASSIST:
group->RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST);
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_MAINASSIST);
break;
case GROUP_ASSIGN_MAINTANK:
group->RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main assist flag from current if any.
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_MAINTANK);
break;
default: break;
}
group->SendUpdate();
}
示例15: HandleLfgJoinOpcode
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
{
if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER) ||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
(GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
{
recvData.rfinish();
return;
}
uint32 roles;
uint32 numDungeons;
bool QueueAsGroup;
uint8 PartyIndex;
QueueAsGroup = recvData.ReadBit();
uint32 commentLen = recvData.ReadBits(8);
recvData >> PartyIndex;
recvData >> roles;
for (int32 i = 0; i < 3; ++i)
recvData.read_skip<uint32>(); // Needs
recvData >> numDungeons;
std::string comment = recvData.ReadString(commentLen);
if (!numDungeons)
{
TC_LOG_DEBUG("lfg", "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str());
recvData.rfinish();
return;
}
lfg::LfgDungeonSet newDungeons;
for (uint32 i = 0; i < numDungeons; ++i)
{
uint32 dungeon;
recvData >> dungeon;
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
}
TC_LOG_DEBUG("lfg", "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s",
GetPlayerInfo().c_str(), roles, uint8(newDungeons.size()), comment.c_str());
sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment);
}