Core/Dungeon Finder: Fix incorrect Lfg state after multiple actions.

- Clear state after get out DF system
- Fix player not getting reward after finish a random dungeon
- Remove OnDisband Hook, it's already handled by OnRemoveMember

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-09 19:13:11 +01:00
parent 4914ca575b
commit be73926ab3
2 changed files with 8 additions and 19 deletions
+7 -1
View File
@@ -278,8 +278,12 @@ void LFGMgr::Update(uint32 diff)
lowGuid = itPlayers->first;
if (Player* plr = sObjectMgr.GetPlayerByLowGUID(itPlayers->first))
{
plr->SetLfgState(LFG_STATE_PROPOSAL);
if (plr->GetGroup())
{
plr->GetGroup()->SetLfgState(LFG_STATE_PROPOSAL);
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_PROPOSAL_BEGIN, plr->GetLfgDungeons(), plr->GetLfgComment());
}
else
plr->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_PROPOSAL_BEGIN, plr->GetLfgDungeons(), plr->GetLfgComment());
plr->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
@@ -585,6 +589,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, LfgDungeonSet& dungeons, std::string
dungeons.insert(rDungeonId);
}
grp->SetLfgState(LFG_STATE_ROLECHECK);
// Send update to player
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -1055,7 +1060,7 @@ void LFGMgr::UpdateRoleCheck(Group* grp, Player* plr /* = NULL*/, bool newRoleCh
}
}
if (pRoleCheck->result == LFG_ROLECHECK_FINISHED && pRoleCheck->dungeons.size())
if (pRoleCheck->result == LFG_ROLECHECK_FINISHED)
{
grp->SetLfgState(LFG_STATE_QUEUED);
LfgQueueInfo* pqInfo = new LfgQueueInfo();
@@ -1375,6 +1380,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint32 lowGuid, bool accept)
break;
}
grp->SetLfgRoles(plr->GetGUID(), pProposal->players[plr->GetGUIDLow()]->role);
plr->SetLfgState(LFG_STATE_DUNGEON);
}
// Set the dungeon difficulty
+1 -18
View File
@@ -89,6 +89,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod& method,
// Update internal kick cooldown of kicked
*/
plr->ClearLfgState();
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon
sLFGMgr.TeleportPlayer(plr, true);
@@ -100,24 +101,6 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod& method,
void LFGScripts::OnDisband(Group* group)
{
uint64 gguid = group->GetGUID();
if (!gguid)
return;
sLog.outDebug("LFGScripts::OnDisband [" UI64FMTD "]", gguid);
if (group->GetLfgState() == LFG_STATE_QUEUED)
sLFGMgr.Leave(NULL, group);
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player *plrg = itr->getSource())
{
plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_GROUP_DISBAND);
plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
if (plrg->GetMap()->IsDungeon()) // Teleport player out the dungeon
sLFGMgr.TeleportPlayer(plrg, true);
}
}
}
void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)