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
+29 -4
View File
@@ -271,7 +271,6 @@ void LFGMgr::Join(Player *plr)
uint64 guid = grp ? grp->GetGUID() : plr->GetGUID(); uint64 guid = grp ? grp->GetGUID() : plr->GetGUID();
LfgJoinResult result = LFG_JOIN_OK; LfgJoinResult result = LFG_JOIN_OK;
// Previous checks before joining // Previous checks before joining
if (m_QueueInfoMap[guid]) if (m_QueueInfoMap[guid])
@@ -700,6 +699,7 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
LfgRoleCheck *pRoleCheck = NULL; LfgRoleCheck *pRoleCheck = NULL;
LfgRolesMap check_roles; LfgRolesMap check_roles;
LfgRoleCheckMap::iterator itRoleCheck = m_RoleChecks.find(rolecheckId); LfgRoleCheckMap::iterator itRoleCheck = m_RoleChecks.find(rolecheckId);
LfgDungeonSet *dungeons = plr->GetLfgDungeons();
bool newRoleCheck = itRoleCheck == m_RoleChecks.end(); bool newRoleCheck = itRoleCheck == m_RoleChecks.end();
if (newRoleCheck) if (newRoleCheck)
{ {
@@ -715,6 +715,31 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
if (Player *plrg = itr->getSource()) if (Player *plrg = itr->getSource())
pRoleCheck->roles[plrg->GetGUIDLow()] = 0; pRoleCheck->roles[plrg->GetGUIDLow()] = 0;
// 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) for (LfgDungeonSet::const_iterator itDungeon = plr->GetLfgDungeons()->begin(); itDungeon != plr->GetLfgDungeons()->end(); ++itDungeon)
pRoleCheck->dungeons.insert(*itDungeon); pRoleCheck->dungeons.insert(*itDungeon);
} }
@@ -1178,9 +1203,9 @@ void LFGMgr::SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pPr
sLog.outDebug("SMSG_LFG_PROPOSAL_UPDATE"); 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)); 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) if (!dLowGuid && plr->GetLfgDungeons()->size() == 1) // New group - select the dungeon the player selected
dungeonId = *plr->GetLfgDungeons()->begin(); // Random dungeon dungeonId = *plr->GetLfgDungeons()->begin();
if (LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(*plr->GetLfgDungeons()->begin())) if (LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
dungeonId = dungeon->Entry(); dungeonId = dungeon->Entry();
data << uint32(dungeonId); // Dungeon data << uint32(dungeonId); // Dungeon
data << uint8(pProp->state); // Result state data << uint8(pProp->state); // Result state
+1 -1
View File
@@ -302,6 +302,7 @@ class LFGMgr
void SendLfgPlayerInfo(Player *plr); void SendLfgPlayerInfo(Player *plr);
void SendLfgPartyInfo(Player *plr); void SendLfgPartyInfo(Player *plr);
bool isRandomDungeon(uint32 dungeonId);
private: private:
void SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp); void SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp);
@@ -314,7 +315,6 @@ class LFGMgr
void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons); void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons);
bool RemoveFromQueue(uint64 guid); bool RemoveFromQueue(uint64 guid);
bool isRandomDungeon(uint32 dungeonId);
void FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals); void FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals);
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true); bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type); void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type);
@@ -43,12 +43,48 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
} }
GetPlayer()->SetLfgRoles(uint8(roles)); GetPlayer()->SetLfgRoles(uint8(roles));
// Check if it's offer continue
Group *grp = GetPlayer()->GetGroup();
if (grp && grp->isLFGGroup())
{
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) for (int8 i = 0 ; i < numDungeons; ++i)
{ {
recv_data >> dungeon; recv_data >> dungeon;
// remove the type from the dungeon entry // remove the type from the dungeon entry
GetPlayer()->GetLfgDungeons()->insert((dungeon & 0x00FFFFFF)); 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 recv_data >> numDungeons; // unk - always 3
for (int8 i = 0 ; i < numDungeons; ++i) for (int8 i = 0 ; i < numDungeons; ++i)