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 /src/server/game/DungeonFinding/LFGScripts.cpp | |
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)
Diffstat (limited to 'src/server/game/DungeonFinding/LFGScripts.cpp')
-rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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") { } |