mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
fix(Core): Possible DF crashfix (#7684)
This commit is contained in:
@@ -1530,7 +1530,7 @@ namespace lfg
|
||||
void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
|
||||
{
|
||||
LfgGuidList players;
|
||||
LfgGuidList playersToTeleport;
|
||||
GuidUnorderedSet playersToTeleport;
|
||||
|
||||
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
||||
{
|
||||
@@ -1541,7 +1541,7 @@ namespace lfg
|
||||
players.push_back(guid);
|
||||
|
||||
if (proposal.isNew || GetGroup(guid) != proposal.group)
|
||||
playersToTeleport.push_back(guid);
|
||||
playersToTeleport.insert(guid);
|
||||
}
|
||||
|
||||
// Set the dungeon difficulty
|
||||
@@ -1613,30 +1613,33 @@ namespace lfg
|
||||
|
||||
// Select a player inside to be teleported to
|
||||
WorldLocation const* teleportLocation = nullptr;
|
||||
bool leaderTeleportIncluded = false;
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* plr = itr->GetSource();
|
||||
if (plr && plr->GetMapId() == uint32(dungeon->map) && !proposal.isNew)
|
||||
if (plr)
|
||||
{
|
||||
teleportLocation = plr;
|
||||
break;
|
||||
if (grp->IsLeader(plr->GetGUID()) && playersToTeleport.find(plr->GetGUID()) != playersToTeleport.end())
|
||||
{
|
||||
leaderTeleportIncluded = true;
|
||||
}
|
||||
|
||||
if (plr->GetMapId() == uint32(dungeon->map) && !proposal.isNew)
|
||||
{
|
||||
teleportLocation = plr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool randomDungeon = false;
|
||||
// Teleport Player
|
||||
for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
|
||||
for (GuidUnorderedSet::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*it))
|
||||
{
|
||||
if (player->GetGroup() != grp) // pussywizard: could not add because group was full (some shitness happened)
|
||||
continue;
|
||||
|
||||
if (player->GetMapId() == uint32(dungeon->map))
|
||||
{
|
||||
// Remove bind to that map
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), dungeon->map, player->GetDungeonDifficulty(), true);
|
||||
}
|
||||
|
||||
// Add the cooldown spell if queued for a random dungeon
|
||||
// xinef: add aura
|
||||
if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
||||
@@ -1645,6 +1648,25 @@ namespace lfg
|
||||
player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player);
|
||||
}
|
||||
|
||||
if (player->GetMapId() == uint32(dungeon->map))
|
||||
{
|
||||
// check instance id with leader
|
||||
if (!leaderTeleportIncluded)
|
||||
{
|
||||
if (InstancePlayerBind* ilb = sInstanceSaveMgr->PlayerGetBoundInstance(grp->GetLeaderGUID(), dungeon->map, player->GetDungeonDifficulty()))
|
||||
{
|
||||
if (player->GetInstanceId() == ilb->save->GetInstanceId())
|
||||
{
|
||||
// Do not teleport if in the same map and instance as leader
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove bind to that map
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), dungeon->map, player->GetDungeonDifficulty(), true);
|
||||
}
|
||||
|
||||
TeleportPlayer(player, false, teleportLocation);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user