Core/LFG: Move code to a better place.

(the case where the last player left inside a dungeon would not be removed from lfg&group when he ports outside)

(cherry picked from commit 837a0a7524)
This commit is contained in:
w1sht0l1v3
2015-04-23 22:10:15 +03:00
committed by Shauren
parent 43cf01d510
commit ec567f1c41
2 changed files with 10 additions and 8 deletions

View File

@@ -1273,14 +1273,6 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
if (player->GetMapId() == uint32(dungeon->map))
player->TeleportToBGEntryPoint();
// in the case were we are the last in lfggroup then we must disband when porting out of the instance
if (group && group->GetMembersCount() == 1)
{
group->Disband();
TC_LOG_DEBUG("lfg.teleport", "Player %s is last in lfggroup so we disband the group.",
player->GetName().c_str());
}
return;
}

View File

@@ -101,7 +101,17 @@ void LFGPlayerScript::OnMapChanged(Player* player)
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
else
{
Group* group = player->GetGroup();
if (group && group->GetMembersCount() == 1)
{
sLFGMgr->LeaveLfg(group->GetGUID());
group->Disband();
TC_LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s(%s) is last in the lfggroup so we disband the group.",
player->GetName().c_str(), player->GetGUID().ToString().c_str());
}
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
}
}
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { }