mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +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)
|
void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
|
||||||
{
|
{
|
||||||
LfgGuidList players;
|
LfgGuidList players;
|
||||||
LfgGuidList playersToTeleport;
|
GuidUnorderedSet playersToTeleport;
|
||||||
|
|
||||||
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -1541,7 +1541,7 @@ namespace lfg
|
|||||||
players.push_back(guid);
|
players.push_back(guid);
|
||||||
|
|
||||||
if (proposal.isNew || GetGroup(guid) != proposal.group)
|
if (proposal.isNew || GetGroup(guid) != proposal.group)
|
||||||
playersToTeleport.push_back(guid);
|
playersToTeleport.insert(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the dungeon difficulty
|
// Set the dungeon difficulty
|
||||||
@@ -1613,30 +1613,33 @@ namespace lfg
|
|||||||
|
|
||||||
// Select a player inside to be teleported to
|
// Select a player inside to be teleported to
|
||||||
WorldLocation const* teleportLocation = nullptr;
|
WorldLocation const* teleportLocation = nullptr;
|
||||||
|
bool leaderTeleportIncluded = false;
|
||||||
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player* plr = itr->GetSource();
|
Player* plr = itr->GetSource();
|
||||||
if (plr && plr->GetMapId() == uint32(dungeon->map) && !proposal.isNew)
|
if (plr)
|
||||||
{
|
{
|
||||||
teleportLocation = plr;
|
if (grp->IsLeader(plr->GetGUID()) && playersToTeleport.find(plr->GetGUID()) != playersToTeleport.end())
|
||||||
break;
|
{
|
||||||
|
leaderTeleportIncluded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plr->GetMapId() == uint32(dungeon->map) && !proposal.isNew)
|
||||||
|
{
|
||||||
|
teleportLocation = plr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool randomDungeon = false;
|
bool randomDungeon = false;
|
||||||
// Teleport Player
|
// 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* player = ObjectAccessor::FindPlayer(*it))
|
||||||
{
|
{
|
||||||
if (player->GetGroup() != grp) // pussywizard: could not add because group was full (some shitness happened)
|
if (player->GetGroup() != grp) // pussywizard: could not add because group was full (some shitness happened)
|
||||||
continue;
|
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
|
// Add the cooldown spell if queued for a random dungeon
|
||||||
// xinef: add aura
|
// xinef: add aura
|
||||||
if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
||||||
@@ -1645,6 +1648,25 @@ namespace lfg
|
|||||||
player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player);
|
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);
|
TeleportPlayer(player, false, teleportLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user