Dungeon Finder: Fix bad dungeon selection being show at offer continue rolechecks

--HG--
branch : trunk
This commit is contained in:
Spp
2010-08-12 00:02:15 +02:00
parent 5b1b713aa6
commit eec9212ee4
3 changed files with 72 additions and 11 deletions

View File

@@ -271,7 +271,6 @@ void LFGMgr::Join(Player *plr)
uint64 guid = grp ? grp->GetGUID() : plr->GetGUID();
LfgJoinResult result = LFG_JOIN_OK;
// Previous checks before joining
if (m_QueueInfoMap[guid])
@@ -700,6 +699,7 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
LfgRoleCheck *pRoleCheck = NULL;
LfgRolesMap check_roles;
LfgRoleCheckMap::iterator itRoleCheck = m_RoleChecks.find(rolecheckId);
LfgDungeonSet *dungeons = plr->GetLfgDungeons();
bool newRoleCheck = itRoleCheck == m_RoleChecks.end();
if (newRoleCheck)
{
@@ -715,8 +715,33 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
if (Player *plrg = itr->getSource())
pRoleCheck->roles[plrg->GetGUIDLow()] = 0;
for (LfgDungeonSet::const_iterator itDungeon = plr->GetLfgDungeons()->begin(); itDungeon != plr->GetLfgDungeons()->end(); ++itDungeon)
pRoleCheck->dungeons.insert(*itDungeon);
// Check if it's offer continue (random + current one)
if (grp->isLFGGroup() && dungeons->size() == 2)
{
LfgDungeonSet::const_iterator itDungeon = dungeons->begin();
uint32 aDungeon = *itDungeon;
uint32 rDungeon = *(++itDungeon);
// it's a Offer to continue (Actual dungeon + random dungeon in the list)
// Rolecheck will be using the actual dungeon - Players random
if (aDungeon == grp->GetLfgDungeonEntry() && isRandomDungeon(rDungeon))
{
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player *plrg = itr->getSource())
{
plrg->GetLfgDungeons()->clear();
plrg->GetLfgDungeons()->insert(rDungeon);
}
}
pRoleCheck->dungeons.insert(aDungeon);
}
}
if (pRoleCheck->dungeons.empty())
for (LfgDungeonSet::const_iterator itDungeon = plr->GetLfgDungeons()->begin(); itDungeon != plr->GetLfgDungeons()->end(); ++itDungeon)
pRoleCheck->dungeons.insert(*itDungeon);
}
else
pRoleCheck = itRoleCheck->second;
@@ -1178,9 +1203,9 @@ void LFGMgr::SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pPr
sLog.outDebug("SMSG_LFG_PROPOSAL_UPDATE");
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + pProp->players.size() * (4 + 1 + 1 + 1 + 1 +1));
if (plr->GetLfgDungeons()->size() == 1 && *plr->GetLfgDungeons()->begin() != pProp->dungeonId)
dungeonId = *plr->GetLfgDungeons()->begin(); // Random dungeon
if (LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(*plr->GetLfgDungeons()->begin()))
if (!dLowGuid && plr->GetLfgDungeons()->size() == 1) // New group - select the dungeon the player selected
dungeonId = *plr->GetLfgDungeons()->begin();
if (LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
dungeonId = dungeon->Entry();
data << uint32(dungeonId); // Dungeon
data << uint8(pProp->state); // Result state

View File

@@ -302,6 +302,7 @@ class LFGMgr
void SendLfgPlayerInfo(Player *plr);
void SendLfgPartyInfo(Player *plr);
bool isRandomDungeon(uint32 dungeonId);
private:
void SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp);
@@ -314,7 +315,6 @@ class LFGMgr
void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons);
bool RemoveFromQueue(uint64 guid);
bool isRandomDungeon(uint32 dungeonId);
void FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals);
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type);

View File

@@ -43,11 +43,47 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
}
GetPlayer()->SetLfgRoles(uint8(roles));
for (int8 i = 0 ; i < numDungeons; ++i)
// Check if it's offer continue
Group *grp = GetPlayer()->GetGroup();
if (grp && grp->isLFGGroup())
{
recv_data >> dungeon;
// remove the type from the dungeon entry
GetPlayer()->GetLfgDungeons()->insert((dungeon & 0x00FFFFFF));
LfgDungeonSet *dungeons = GetPlayer()->GetLfgDungeons();
if (grp->GetLfgStatus() == LFG_STATUS_COMPLETE) // Dungeon complete add all dungeons
{
dungeons->clear();
for (int8 i = 0 ; i < numDungeons; ++i)
{
recv_data >> dungeon;
dungeons->insert((dungeon & 0x00FFFFFF));
}
}
else if (dungeons->size() > 1 || dungeons->size() ==1 && !sLFGMgr.isRandomDungeon(*dungeons->begin()))
{
dungeons->clear();
// ignore the list and select the current dungeon
for (int8 i = 0 ; i < numDungeons; ++i)
recv_data.read_skip<uint32>();
dungeons->insert(grp->GetLfgDungeonEntry());
}
else // currently added to random Dungeon
{
for (int8 i = 0 ; i < numDungeons; ++i)
{
recv_data >> dungeon;
// remove the type from the dungeon entry
GetPlayer()->GetLfgDungeons()->insert((dungeon & 0x00FFFFFF));
}
}
}
else
{
for (int8 i = 0 ; i < numDungeons; ++i)
{
recv_data >> dungeon;
// remove the type from the dungeon entry
GetPlayer()->GetLfgDungeons()->insert((dungeon & 0x00FFFFFF));
}
}
recv_data >> numDungeons; // unk - always 3