void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data) { if (!GetPlayer()) return; if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE) && !sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE)) { recv_data.rfinish(); // prevent additional spam at rejected packet DEBUG_LOG("CMSG_LFG_JOIN %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter()); return; } else DEBUG_LOG("CMSG_LFG_JOIN %u processing...", GetPlayer()->GetObjectGuid().GetCounter()); uint8 numDungeons; uint32 dungeonID; uint32 roles; std::string comment; LFGDungeonSet newDungeons; newDungeons.clear(); recv_data >> roles; // lfg roles recv_data >> Unused<uint8>(); // unk1 (unused?) recv_data >> Unused<uint8>(); // unk2 (unused?) recv_data >> numDungeons; if (!numDungeons) { DEBUG_LOG("CMSG_LFG_JOIN %u no dungeons selected", GetPlayer()->GetObjectGuid().GetCounter()); recv_data.rfinish(); // prevent additional spam at rejected packet return; } for (int8 i = 0 ; i < numDungeons; ++i) { recv_data >> dungeonID; LFGDungeonEntry const* dungeon = sLFGMgr.GetDungeon(dungeonID & 0x00FFFFFF); // remove the type from the dungeon entry if (dungeon) newDungeons.insert(dungeon); } uint8 counter2; // unk - always 3 recv_data >> counter2; for (uint8 i = 0; i < counter2; i++) recv_data >> Unused<uint8>(); // unk (unused?) recv_data >> comment; // lfg comment sLFGMgr.GetLFGPlayerState(GetPlayer()->GetObjectGuid())->SetDungeons(newDungeons); if (GetPlayer()->GetGroup()) if (GetPlayer()->GetObjectGuid() == GetPlayer()->GetGroup()->GetLeaderGuid()) sLFGMgr.GetLFGGroupState(GetPlayer()->GetGroup()->GetObjectGuid())->SetDungeons(newDungeons); sLFGMgr.GetLFGPlayerState(GetPlayer()->GetObjectGuid())->SetRoles(LFGRoleMask(roles)); sLFGMgr.GetLFGPlayerState(GetPlayer()->GetObjectGuid())->SetComment(comment); DEBUG_LOG("CMSG_LFG_JOIN %u as group: %u Dungeons: %u", GetPlayer()->GetObjectGuid().GetCounter(), GetPlayer()->GetGroup() ? 1 : 0, uint8(newDungeons.size())); sLFGMgr.Join(GetPlayer()); }
void WorldSession::HandleLfgJoinOpcode( WorldPacket & recv_data ) { if (!GetPlayer()) return; if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE) && !sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE)) { recv_data.rpos(recv_data.wpos()); DEBUG_LOG("CMSG_LFG_JOIN %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter()); return; } else DEBUG_LOG("CMSG_LFG_JOIN %u processing...", GetPlayer()->GetObjectGuid().GetCounter()); uint8 numDungeons; uint32 dungeon; uint32 roles; std::string comment; LFGDungeonSet* newDungeons = GetPlayer()->GetLFGState()->GetDungeons(); recv_data >> roles; // lfg roles recv_data >> Unused<uint8>(); // unk1 (unused?) recv_data >> Unused<uint8>(); // unk2 (unused?) recv_data >> numDungeons; if (!numDungeons) { DEBUG_LOG("CMSG_LFG_JOIN %u no dungeons selected", GetPlayer()->GetObjectGuid().GetCounter()); recv_data.rpos(recv_data.wpos()); return; } newDungeons->clear(); for (int8 i = 0 ; i < numDungeons; ++i) { recv_data >> dungeon; newDungeons->insert(sLFGMgr.GetDungeon(dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry } uint8 counter2; // unk - always 3 recv_data >> counter2; for (uint8 i = 0; i < counter2; i++) recv_data >> Unused<uint8>(); // unk (unused?) recv_data >> comment; // lfg comment GetPlayer()->GetLFGState()->SetRoles(roles); GetPlayer()->GetLFGState()->SetComment(comment); DEBUG_LOG("CMSG_LFG_JOIN %u as group: %u Dungeons: %u", GetPlayer()->GetObjectGuid().GetCounter(), GetPlayer()->GetGroup() ? 1 : 0, uint8(newDungeons->size())); sLFGMgr.Join(GetPlayer()); }
LFGDungeonSet LFGMgr::GetRandomDungeonsForPlayer(Player* player) { LFGDungeonSet list; list.clear(); for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i)) { if (dungeon && dungeon->type == LFG_TYPE_RANDOM_DUNGEON && GetPlayerLockStatus(player, dungeon) == LFG_LOCKSTATUS_OK) list.insert(dungeon); } } return list; }