mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/Instances): Ensure team is acquired before spawning creatures (#21221)
This commit is contained in:
@@ -3020,6 +3020,15 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
m_resetAfterUnload = false;
|
||||
m_unloadWhenEmpty = false;
|
||||
|
||||
if (instance_data && instance_data->IsTwoFactionInstance()
|
||||
&& instance_data->GetTeamIdInInstance() == TEAM_NEUTRAL)
|
||||
{
|
||||
instance_data->SetTeamIdInInstance(player->GetTeamId());
|
||||
if (Group* group = player->GetGroup())
|
||||
if (Player* leader = ObjectAccessor::FindConnectedPlayer(group->GetLeaderGUID()))
|
||||
instance_data->SetTeamIdInInstance(leader->GetTeamId());
|
||||
}
|
||||
|
||||
// this will acquire the same mutex so it cannot be in the previous block
|
||||
Map::AddPlayerToMap(player);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user