diff options
author | w1sht0l1v3 <w1sht0l1v3@gmail.com> | 2015-04-23 22:10:15 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-11-01 00:30:42 +0100 |
commit | ec567f1c41d9956fa2b63d8dba3c7bcf4f6a6f16 (patch) | |
tree | dc60c41cba4592cf260b4136c39c115468187224 | |
parent | 43cf01d510711c3a848e0ed1010ac218926f58ce (diff) |
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 837a0a75246b177858825caf1861dd61a6b87868)
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 8 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.cpp | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 68798d43e38..0e835e02dc2 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -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; } diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 42e1f4a545f..224cec71d86 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -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") { } |