mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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") { }
|
||||
|
||||
Reference in New Issue
Block a user