void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock) { data << uint32(lock.size()); // Size of lock dungeons for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it) { data << uint32(it->first); // Dungeon entry (id + type) data << uint32(it->second); // Lock status } }
void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock) { Log.Debug("LfgHandler", "BUILD PLAYER LOCK DUNGEON BLOCK"); data << uint32(lock.size()); // Size of lock dungeons for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it) { data << uint32(it->first); // Dungeon entry (id + type) data << uint32(it->second); // Lock status } }
void WorldSession::SendLfgJoinResult(ObjectGuid jguid, LfgJoinResultData const& joinData) { uint32 size = 0; for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4 + 4 + 4); sLog.outDebug("SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u", _player->GetGuidStr().c_str(), joinData.result, joinData.state); WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size); ObjectGuid joinGuid(jguid); data << uint32(0); // Unk data << uint8(0/*joinData.result*/); // Check Result data << uint32(sLFGMgr.GetOrGenerateQueueId<false>(jguid)); // Queue id data << uint8(joinData.state); // Check Value data << uint32(WorldTimer::getMSTime()); data.WriteGuidMask<2, 7, 3, 0>(joinGuid); data.WriteBits(joinData.lockmap.size(), 24); for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) { ObjectGuid guid(it->first); data.WriteGuidMask<7, 5, 3, 6, 0, 2, 4, 1>(guid); data.WriteBits(it->second.size(), 22); } data.WriteGuidMask<4, 5, 1, 6>(joinGuid); for (LfgLockPartyMap::const_iterator itr = joinData.lockmap.begin(); itr != joinData.lockmap.end(); ++itr) { LfgLockMap second = itr->second; for (LfgLockMap::const_iterator it = second.begin(); it != second.end(); ++it) { data << uint32(it->first); data << uint32(it->second); data << uint32(0); // needed ILvL data << uint32(0); // player ILvL } ObjectGuid guid(itr->first); data.WriteGuidBytes<2, 5, 1, 0, 4, 3, 6, 7>(guid); } data.WriteGuidBytes<1, 4, 3, 5, 0, 7, 2, 6>(joinGuid); SendPacket(&data); }
void WorldSession::SendLfgJoinResult(uint64 guid_, const LfgJoinResultData& joinData) { ObjectGuid guid = guid_; uint32 size = 0; for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4 + 4 + 4); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state); WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size); data << uint32(3); // Some Flags data << uint8(joinData.result); // Check Result data << uint8(joinData.state); // Check Value data << uint32(getMSTime()); // Time data << uint32(0); // Queue Id data.WriteBit(guid[4]); data.WriteBit(guid[6]); data.WriteBit(guid[2]); data.WriteBit(guid[5]); data.WriteBit(guid[0]); data.WriteBit(guid[1]); data.WriteBits(joinData.lockmap.size(), 22); data.WriteBit(guid[3]); for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) { ObjectGuid guid1 = it->first; data.WriteBit(guid1[7]); data.WriteBit(guid1[0]); data.WriteBit(guid1[1]); data.WriteBit(guid1[6]); data.WriteBit(guid1[2]); data.WriteBit(guid1[4]); data.WriteBits(it->second.size(), 20); data.WriteBit(guid1[3]); data.WriteBit(guid1[5]); } data.WriteBit(guid[5]); data.WriteByteSeq(guid[5]); for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) { LfgLockMap second = it->second; for (LfgLockMap::const_iterator itr = second.begin(); itr != second.end(); ++itr) { auto lockData = itr->second; data << uint32(lockData.itemLevel); // Lock status data << uint32(lockData.lockstatus); data << uint32(itr->first); // Dungeon entry (id + type) data << uint32(GetPlayer()->GetAverageItemLevel()); } ObjectGuid guid1 = it->first; uint8 byteOrder[8] = {1, 4, 7, 6, 3, 2, 0, 5}; data.WriteBytesSeq(guid1, byteOrder); } data.WriteByteSeq(guid[0]); data.WriteByteSeq(guid[4]); data.WriteByteSeq(guid[3]); data.WriteByteSeq(guid[7]); data.WriteByteSeq(guid[2]); data.WriteByteSeq(guid[6]); data.WriteByteSeq(guid[1]); SendPacket(&data); }
void WorldSession::HandleLfgLockInfoRequestOpcode(WorldPacket& recvData) { uint8 value; bool groupPacket; recvData >> value; groupPacket = recvData.ReadBit(); ObjectGuid guid = GetPlayer()->GetGUID(); // Get Random dungeons that can be done at a certain level and expansion LfgDungeonSet randomDungeons; uint8 level = GetPlayer()->getLevel(); uint8 expansion = GetPlayer()->GetSession()->Expansion(); for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); if (dungeon && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) { if (dungeon->flags & LFG_FLAG_SEASONAL) { if (HolidayIds holiday = sLFGMgr->GetDungeonSeason(dungeon->ID)) if (holiday == HOLIDAY_WOTLK_LAUNCH || !IsHolidayActive(holiday)) continue; } else if (dungeon->type != TYPEID_RANDOM_DUNGEON) continue; randomDungeons.insert(dungeon->Entry()); } } // Get player locked Dungeons LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4)); bool hasGuid = true; data.WriteBit(hasGuid); if (hasGuid) { uint8 bitOrder[8] = { 0, 6, 7, 5, 2, 4, 1, 3 }; data.WriteBitInOrder(guid, bitOrder); } data.WriteBits(randomDungeons.size(), 17); for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* qRew = NULL; bool done = false; if (reward) { qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId); if (qRew) { done = !GetPlayer()->CanRewardQuest(qRew, false); if (done) qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId); } } data.WriteBits(0, 21); // Unk count data.WriteBits(qRew ? qRew->GetRewCurrencyCount() : 0, 21); data.WriteBits(0, 19); // Unk count 2 - related to call to Arms data.WriteBit(!done); data.WriteBit(0); // some bit data.WriteBits(qRew ? qRew->GetRewItemsCount() : 0, 20); } data.WriteBits(lock.size(), 20); for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* qRew = NULL; uint8 done = 0; if (reward) { qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId); if (qRew) { done = !GetPlayer()->CanRewardQuest(qRew, false); if (done) qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId); } } data << uint32(0); // 11 data << uint32(0); // 12 data << uint32(0); // 15 data << uint32(0); // 16 data << uint32(0); // 17 if (qRew) { if (qRew->GetRewItemsCount()) { ItemTemplate const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewardItemId[i]) continue; iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewardItemIdCount[i]); data << uint32(qRew->RewardItemId[i]); } } if (qRew->GetRewCurrencyCount()) { for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) { if (!qRew->RewardCurrencyId[i]) continue; CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(qRew->RewardCurrencyId[i]); uint32 countCurrency = qRew->RewardCurrencyCount[i] ? qRew->RewardCurrencyCount[i] : 0; if (currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) countCurrency *= 100; data << uint32(qRew->RewardCurrencyId[i]); data << uint32(countCurrency); } } data << uint32(1); // 23 data << uint32(0); // 24 data << uint32(0); // 25 data << uint32(1); // 26 data << uint32(qRew->XPValue(GetPlayer())); data << uint32(0); // 28 data << uint32(0); // 29 data << uint32(0); // 30 data << uint32(0); // 31 data << uint32(0); // 32 data << uint32(qRew->GetRewOrReqMoney()); data << uint32(*it); } else { data << uint32(0); // 23 data << uint32(0); // 24 data << uint32(0); // 25 data << uint32(0); // 26 data << uint32(0); // 27 data << uint32(0); // 28 data << uint32(0); // 29 data << uint32(0); // 30 data << uint32(0); // 31 data << uint32(0); // 32 data << uint32(0); // 33 data << uint32(0); // 34 } } if (hasGuid) { uint8 byteOrder[8] = { 6, 3, 0, 4, 5, 1, 2, 7 }; data.WriteBytesSeq(guid, byteOrder); } for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it) { auto lockData = it->second; data << uint32(it->first); // Dungeon entry (id + type) data << uint32(lockData.itemLevel); data << uint32(lockData.lockstatus); // Lock status data << uint32(GetPlayer()->GetAverageItemLevel()); } /* bool hasGuid = true; data.WriteBit(hasGuid); if (hasGuid) { uint8 bitOrder[8] = {7, 2, 1, 6, 3, 5, 0, 4}; data.WriteBitInOrder(guid, bitOrder); } data.WriteBits(randomDungeons.size(), 17); for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* qRew = NULL; bool done = 0; if (reward) { qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId); if (qRew) { done = !GetPlayer()->CanRewardQuest(qRew, false); if (done) qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId); } } data.WriteBits(0, 21); // Unk count data.WriteBits(qRew ? qRew->GetRewCurrencyCount() : 0, 21); data.WriteBits(0, 19); // Unk count 2 - related to call to Arms data.WriteBit(!done); data.WriteBits(qRew ? qRew->GetRewItemsCount() : 0, 20); data.WriteBit(0); } data.WriteBits(lock.size(), 20); for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* qRew = NULL; uint8 done = 0; if (reward) { qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId); if (qRew) { done = !GetPlayer()->CanRewardQuest(qRew, false); if (done) qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId); } } data << uint32(0); data << uint32(1); if (qRew) { if (qRew->GetRewCurrencyCount()) { for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewardCurrencyId[i]) continue; data << uint32(qRew->RewardCurrencyCount[i]); data << uint32(qRew->RewardCurrencyId[i]); } } data << uint32(0); if (qRew->GetRewItemsCount()) { ItemTemplate const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewardItemId[i]) continue; iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewardItemId[i]); data << uint32(qRew->RewardItemIdCount[i]); } } data << uint32(1); // 1 in sniff data << uint32(1); // 1 in sniff //for (int j = 0; j < info.Count3; ++j) data << uint32(0); // 0 in sniff data << uint32(0); // related to encounter - encounter progress data << uint32(*it); // Dungeon Entry (id + type) - progress data << uint32(1); // 0 in sniff data << uint32(1); // 0 in sniff data << uint32(0); // 0 in sniff data << uint32(0); // 0 in sniff data << uint32(qRew->XPValue(GetPlayer())); data << uint32(0); // 0 in sniff data << uint32(0); // 0 in sniff data << uint32(0); // 0 in sniff data << uint32(qRew->GetRewOrReqMoney()); //data << uint32(qRew->GetRewOrReqMoney()); //data << uint32(qRew->XPValue(GetPlayer())); //data << uint32(reward->reward[done].variableMoney); //data << uint32(reward->reward[done].variableXP); } else { data << uint32(16); data << uint32(1); // 1 in sniff unk4 data << uint32(1); // 1 in sniff unk5 data << uint32(0); // 0 in sniff unk6 data << uint32(0); //related to encounter - encounter progress data << uint32(*it); data << uint32(1); // 0 in sniff unk9 data << uint32(1); // 0 in sniff unk10 data << uint32(0); // 0 in sniff unk11 data << uint32(0); // 0 in sniff unk12 data << uint32(333); // 0 in sniff unk13 // xp data << uint32(0); // 0 in sniff unk14 data << uint32(0); // 0 in sniff unk15 data << uint32(0); // 0 in sniff unk16 data << uint32(666); // money } } for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it) { auto lockData = it->second; data << uint32(lockData.itemLevel); data << uint32(it->first); // Dungeon entry (id + type) data << uint32(lockData.lockstatus); // Lock status data << uint32(GetPlayer()->GetAverageItemLevel()); } if (hasGuid) { uint8 byteOrder[8] = {3, 1, 2, 6, 4, 7, 0, 5}; data.WriteBytesSeq(guid, byteOrder); }*/ SendPacket(&data); }