/// <summary> /// Build and Send LFG lock player info and reward /// </summary> /// <param name="plr">Player</param> void LFGMgr::SendLfgPlayerInfo(Player *plr) { uint32 rsize = 0; uint32 lsize = 0; LfgDungeonSet *randomlist = GetRandomDungeons(plr->getLevel(), plr->GetSession()->Expansion()); LfgLockStatusSet *lockSet = GetPlayerLockStatusDungeons(plr, m_DungeonsMap[LFG_ALL_DUNGEONS]); if (randomlist) rsize = randomlist->size(); if (lockSet) lsize = lockSet->size(); sLog.outDebug("SMSG_LFG_PLAYER_INFO"); WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (4 + 4)); if (!randomlist) { data << uint8(0); } else { data << uint8(randomlist->size()); // Random Dungeon count for (LfgDungeonSet::iterator it = randomlist->begin(); it != randomlist->end(); ++it) { data << uint32(*it); // Entry BuildRewardBlock(data, *it, plr); } randomlist->clear(); delete randomlist; } BuildPlayerLockDungeonBlock(data, lockSet); plr->GetSession()->SendPacket(&data); }
void BuildPartyLockDungeonBlock(WorldPacket& data, lfg::LfgLockPartyMap const& lockMap) { data << uint8(lockMap.size()); for (lfg::LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it) { data << uint64(it->first); // Player guid BuildPlayerLockDungeonBlock(data, it->second); } }
void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMap) { Log.Debug("LfgHandler", "BUILD PARTY LOCK DUNGEON BLOCK"); data << uint8(lockMap.size()); for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it) { data << uint64(it->first); // Player guid BuildPlayerLockDungeonBlock(data, it->second); } }
void BuildPartyLockDungeonBlock(WorldPacket& data, lfg::LfgLockPartyMap const& lockMap) { data << uint8(lockMap.size()); for (auto lockMapP : lockMap) { data << ObjectGuid(lockMapP.first); // Player guid BuildPlayerLockDungeonBlock(data, lockMapP.second); } }
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap* lockMap) { if (!lockMap || !lockMap->size()) { data << uint8(0); return; } data << uint8(lockMap->size()); for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it) { data << uint64(MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); // Player guid BuildPlayerLockDungeonBlock(data, it->second); } lockMap->clear(); delete lockMap; }
/// <summary> /// Build Party Dungeon lock status packet /// </summary> /// <param name="data">WorldPacket</param> /// <param name="lock">lock status map</param> void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap) { assert(lockMap); data << uint8(lockMap->size()); LfgLockStatusSet *lockSet; uint64 guid; for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it) { guid = it->first; lockSet = it->second; if (!lockSet) continue; data << uint64(guid); // Player guid BuildPlayerLockDungeonBlock(data, lockSet); } lockMap->clear(); delete lockMap; }
void WorldSession::SendLfgPlayerLockInfo() { ObjectGuid guid = GetPlayer()->GetGUID(); // Get Random dungeons that can be done at a certain level and expansion uint8 level = GetPlayer()->getLevel(); lfg::LfgDungeonSet const& randomDungeons = sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion()); // Get player locked Dungeons lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); TC_LOG_DEBUG("lfg", "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str()); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (lfg::LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* quest = NULL; bool done = false; if (reward) { quest = sObjectMgr->GetQuestTemplate(reward->firstQuest); if (quest) { done = !GetPlayer()->CanRewardQuest(quest, false); if (done) quest = sObjectMgr->GetQuestTemplate(reward->otherQuest); } } data << uint8(done); data << uint32(0); // currencyQuantity data << uint32(0); // some sort of overall cap/weekly cap data << uint32(0); // currencyID data << uint32(0); // tier1Quantity data << uint32(0); // tier1Limit data << uint32(0); // overallQuantity data << uint32(0); // overallLimit data << uint32(0); // periodPurseQuantity data << uint32(0); // periodPurseLimit data << uint32(0); // purseQuantity data << uint32(0); // purseLimit data << uint32(0); // some sort of reward for completion data << uint32(0); // completedEncounters data << uint8(0); // Call to Arms eligible for (uint32 i = 0; i < 3; ++i) { data << uint32(0); // Call to Arms Role //if (role) // BuildQuestReward(data, ctaRoleQuest, GetPlayer()); } if (quest) BuildQuestReward(data, quest, GetPlayer()); else { data << uint32(0); // Money data << uint32(0); // XP data << uint8(0); // Reward count } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/) { uint64 guid = GetPlayer()->GetGUID(); sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); // Get Random dungeons that can be done at a certain level and expansion // FIXME - Should return seasonals (when not disabled) 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->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) randomDungeons.insert(dungeon->Entry()); } // Get player locked Dungeons LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) 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); } } if (qRew) { data << uint8(done); data << uint32(qRew->GetRewOrReqMoney()); data << uint32(qRew->XPValue(GetPlayer())); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); data << uint8(qRew->GetRewItemsCount()); if (qRew->GetRewItemsCount()) { ItemTemplate const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewItemId[i]) continue; iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]); data << uint32(qRew->RewItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewItemCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); // Get Random dungeons that can be done at a certain level and expansion LfgDungeonSet randomDungeons; uint8 level = GetPlayer()->getLevel(); uint8 expansion = GetPlayer()->GetSession()->Expansion(); LFGDungeonContainer& LfgDungeons = sLFGMgr->GetLFGDungeonMap(); for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr) { LFGDungeonData const& dungeon = itr->second; if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id))) && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel) randomDungeons.insert(dungeon.Entry()); } // Get player locked Dungeons LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str()); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* quest = NULL; uint8 done = 0; if (reward) { quest = sObjectMgr->GetQuestTemplate(reward->reward[0].questId); if (quest) { done = !GetPlayer()->CanRewardQuest(quest, false); if (done) quest = sObjectMgr->GetQuestTemplate(reward->reward[1].questId); } } if (quest) { data << uint8(done); data << uint32(quest->GetRewOrReqMoney()); data << uint32(quest->XPValue(GetPlayer())); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); data << uint8(quest->GetRewItemsCount()); if (quest->GetRewItemsCount()) { for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) if (uint32 itemId = quest->RewardItemId[i]) { ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId); data << uint32(itemId); data << uint32(item ? item->DisplayInfoID : 0); data << uint32(quest->RewardItemIdCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); // Get Random dungeons that can be done at a certain level and expansion uint8 level = GetPlayer()->getLevel(); lfg::LfgDungeonSet const& randomDungeons = sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion()); // Get player locked Dungeons sLFGMgr->InitializeLockedDungeons(GetPlayer()); // pussywizard lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (lfg::LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); Quest const* quest = NULL; bool done = false; if (reward) { quest = sObjectMgr->GetQuestTemplate(reward->firstQuest); if (quest) { done = !GetPlayer()->CanRewardQuest(quest, false); if (done) quest = sObjectMgr->GetQuestTemplate(reward->otherQuest); } } if (quest) { data << uint8(done); data << uint32(quest->GetRewOrReqMoney()); data << uint32(quest->XPValue(GetPlayer())); data << uint32(0); data << uint32(0); data << uint8(quest->GetRewItemsCount()); if (quest->GetRewItemsCount()) { for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) if (uint32 itemId = quest->RewardItemId[i]) { ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId); data << uint32(itemId); data << uint32(item ? item->DisplayInfoID : 0); data << uint32(quest->RewardItemIdCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/) { uint64 guid = GetPlayer()->GetGUID(); sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); // Get Random dungeons that can be done at a certain level and expansion // FIXME - Should return seasonals (when not disabled) 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->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) randomDungeons.insert(dungeon->Entry()); // Dungeons Seleccionables con el evento en el server correspondiente. (En Dungeon Finder) if (dungeon && dungeon->grouptype == 11 && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) { QueryResult result = WorldDatabase.Query("SELECT dungeonId, eventEntry FROM lfg_dungeon_event"); if (!result) return; Field* fields = NULL; do { fields = result->Fetch(); uint32 dungeonId = fields[0].GetUInt32(); uint32 eventEntry = fields[1].GetUInt32(); if (dungeonId != dungeon->ID ) continue; if (eventEntry && sGameEventMgr->IsActiveEvent(eventEntry)) randomDungeons.insert(dungeon->Entry()); } while (result->NextRow()); } } // Get player locked Dungeons LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) 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); } } if (qRew) { data << uint8(done); data << uint32(qRew->GetRewOrReqMoney()); data << uint32(qRew->XPValue(GetPlayer())); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); data << uint8(qRew->GetRewItemsCount()); if (qRew->GetRewItemsCount()) { ItemPrototype const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewItemId[i]) continue; iProto = ObjectMgr::GetItemPrototype(qRew->RewItemId[i]); data << uint32(qRew->RewItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewItemCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/) { uint64 guid = GetPlayer()->GetGUID(); sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); // Get Random dungeons that can be done at a certain level and expansion // FIXME - Should return seasonals (when not disabled) 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->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) randomDungeons.insert(dungeon->Entry()); if (dungeon && dungeon->grouptype == 11 && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) { uint8 eventEntry = 0; switch (dungeon->ID) { case 285: // The Headless Horseman eventEntry = 12; // Hallow's End break; case 286: // The Frost Lord Ahune eventEntry = 1; // Midsummer Fire Festival break; case 287: // Coren Direbrew eventEntry = 24; // Brewfest break; case 288: // The Crown Chemical Co. eventEntry = 8; // Love is in the Air break; default: break; } if (eventEntry && sGameEventMgr->IsActiveEvent(eventEntry)) randomDungeons.insert(dungeon->Entry()); } } // Get player locked Dungeons LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) 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); } } if (qRew) { data << uint8(done); data << uint32(qRew->GetRewOrReqMoney()); data << uint32(qRew->XPValue(GetPlayer())); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); data << uint8(qRew->GetRewItemsCount()); 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(qRew->RewardItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewardItemIdCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recv_data) { Log.Debug("LfgHandler", "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST"); uint64 guid = GetPlayer()->GetGUID(); Log.Debug("LfgHandler", "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST %u", guid); // Get Random dungeons that can be done at a certain level and expansion // FIXME - Should return seasonals (when not disabled) LfgDungeonSet randomDungeons; uint8 level = GetPlayer()->getLevel(); uint8 expansion = GetPlayer()->GetSession()->GetFlags(); for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { DBC::Structures::LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel) randomDungeons.insert(dungeon->Entry()); } // Get player locked Dungeons LfgLockMap lock = sLfgMgr.GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); Log.Debug("LfgHandler", "SMSG_LFG_PLAYER_INFO %u", guid); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) LfgReward const* reward = sLfgMgr.GetRandomDungeonReward(*it, level); Quest* qRew = NULL; uint8 done = 0; if (reward) { qRew = QuestStorage.LookupEntry(reward->reward[0].questId); if (qRew) { done = GetPlayer()->HasFinishedQuest(qRew->id); if (done) qRew = QuestStorage.LookupEntry(reward->reward[1].questId); } } if (qRew) { data << uint8(done); data << uint32(qRew->reward_money); data << uint32(qRew->reward_xp); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); ///\todo FIXME Linux: error: cast from const uint32* {aka const unsigned int*} to uint8 {aka unsigned char} loses precision /// can someone check this now ? data << uint8(qRew->GetRewardItemCount()); for (uint8 i = 0; i < 4; ++i) if (qRew->reward_item[i] != 0) { ItemPrototype* item = ItemPrototypeStorage.LookupEntry(qRew->reward_item[i]); data << uint32(qRew->reward_item[i]); data << uint32(item ? item->DisplayInfoID : 0); data << uint32(qRew->reward_itemcount[i]); } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { ObjectGuid guid = _player->GetObjectGuid(); sLog.outDebug( "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", guid.GetString().c_str()); // Get Random dungeons that can be done at a certain level and expansion LfgDungeonSet randomDungeons; uint8 level = _player->getLevel(); uint8 expansion = _player->GetSession()->Expansion(); LFGDungeonContainer& LfgDungeons = sLFGMgr.GetLFGDungeonMap(); for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr) { LFGDungeonData const& dungeon = itr->second; if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr.IsSeasonActive(dungeon.id))) && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel) randomDungeons.insert(dungeon.Entry()); } // Get player locked Dungeons LfgLockMap const& lock = sLFGMgr.GetLockedDungeons(guid); uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); sLog.outDebug("SMSG_LFG_PLAYER_INFO %s", _player->GetGuidStr().c_str()); 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)); data << uint8(randomDungeons.size()); // Random Dungeon count for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it) { data << uint32(*it); // Dungeon Entry (id + type) LfgReward const* reward = sLFGMgr.GetRandomDungeonReward(*it, level); Quest const* quest = NULL; bool done = false; if (reward) { quest = sObjectMgr.GetQuestTemplate(reward->firstQuest); if (quest) { done = !_player->CanRewardQuest(quest, false); if (done) quest = sObjectMgr.GetQuestTemplate(reward->otherQuest); } } if (quest) { data << uint8(done); data << uint32(500); // Times precision data << uint32(500); // Available times per week data << uint32(396); // Unknown 4.3.4 data << uint32(0); // Unknown 4.3.4 data << uint32(100000); // Unknown 4.3.4 data << uint32(0); // Unknown 4.3.4 data << uint32(0); // Unknown 4.3.4 data << uint32(0); // Unknown 4.3.4 data << uint32(100000); // Unknown 4.3.4 data << uint32(70000); // Unknown 4.3.4 data << uint32(80000); // Unknown 4.3.4 data << uint32(90000); // Unknown 4.3.4 data << uint32(50000); // isComplited data << uint8(100); // seasonal ? { for (uint8 i = 0; i < 3; ++i) // 3 - Max roles ? { uint8 callToArmsRoleMask = 0; // TODO Call to arms role check (LfgRoles) Not implemented data << uint32(callToArmsRoleMask); if (callToArmsRoleMask > 0) { /* Call to Arms bonus*/ data << uint32(0); // Call to arms Money data << uint32(0); // Call to arms XP uint8 totalRewardCount = uint8(quest->GetRewCurrencyCount() + quest->GetRewItemsCount()); if (totalRewardCount > 16) totalRewardCount = 16; data << uint8(totalRewardCount); if (totalRewardCount) { for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j) { uint32 id = quest->RewCurrencyId[j]; if (!id) continue; uint32 amount = quest->RewCurrencyCount[j]; if (CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id)) amount *= currency->GetPrecision(); data << uint32(id); data << uint32(0); data << uint32(amount); data << uint8(true); // Is currency } ItemPrototype const* iProto = NULL; for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j) { if (!quest->RewItemId[j]) continue; iProto = sObjectMgr.GetItemPrototype(quest->RewItemId[j]); data << uint32(quest->RewItemId[j]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(quest->RewItemCount[j]); data << uint8(false); // Is currency } } } } } data << uint32(quest->GetRewOrReqMoney()); data << uint32(quest->XPValue(_player)); uint8 totalRewardCount = uint8(quest->GetRewCurrencyCount() + quest->GetRewItemsCount()); if (totalRewardCount > 16) totalRewardCount = 16; data << uint8(totalRewardCount); if (totalRewardCount) { for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) { uint32 id = quest->RewCurrencyId[i]; if (!id) continue; uint32 amount = quest->RewCurrencyCount[i]; if (CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id)) amount *= currency->GetPrecision(); data << uint32(id); data << uint32(0); data << uint32(amount); data << uint8(true); // Is currency } ItemPrototype const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!quest->RewItemId[i]) continue; iProto = sObjectMgr.GetItemPrototype(quest->RewItemId[i]); data << uint32(quest->RewItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(quest->RewItemCount[i]); data << uint8(false); // Is currency } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); for (int8 i = 0; i < 9; ++i) data << uint32(0); // Unknown 4.3.4 data << uint8(1); for (int8 i = 0; i < 3; ++i) data << uint32(0); // Unknown 4.3.4 for (int8 i = 0; i < 2; ++i) data << uint32(0); // Unknown 4.3.4 data << uint8(0); } } BuildPlayerLockDungeonBlock(data, lock); SendPacket(&data); }
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data*/) { sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", GetPlayer()->GetGUID()); uint32 rsize = 0; uint32 lsize = 0; LfgDungeonSet* randomlist = sLFGMgr.GetRandomDungeons(GetPlayer()->getLevel(), GetPlayer()->GetSession()->Expansion()); LfgLockStatusSet* lockSet = sLFGMgr.GetPlayerLockStatusDungeons(GetPlayer()); if (randomlist) rsize = randomlist->size(); if (lockSet) lsize = lockSet->size(); sLog.outDebug("SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", GetPlayer()->GetGUID()); 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)); if (!randomlist) data << uint8(0); else { LfgReward const* reward = NULL; Quest const* qRew = NULL; uint8 done; data << uint8(randomlist->size()); // Random Dungeon count for (LfgDungeonSet::iterator it = randomlist->begin(); it != randomlist->end(); ++it) { data << uint32(*it); // Entry reward = sLFGMgr.GetRandomDungeonReward(*it, GetPlayer()->getLevel()); qRew = NULL; 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); } } if (qRew) { data << uint8(done); data << uint32(qRew->GetRewOrReqMoney()); data << uint32(qRew->XPValue(GetPlayer())); data << uint32(reward->reward[done].variableMoney); data << uint32(reward->reward[done].variableXP); data << uint8(qRew->GetRewItemsCount()); if (qRew->GetRewItemsCount()) { ItemPrototype const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { if (!qRew->RewItemId[i]) continue; iProto = ObjectMgr::GetItemPrototype(qRew->RewItemId[i]); data << uint32(qRew->RewItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); data << uint32(qRew->RewItemCount[i]); } } } else { data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint8(0); } } randomlist->clear(); delete randomlist; } BuildPlayerLockDungeonBlock(data, lockSet); SendPacket(&data); }