aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r--src/server/game/Maps/Map.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 23ca8cbba1a..6285d847db3 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3311,7 +3311,7 @@ bool InstanceMap::Reset(uint8 method)
return m_mapRefManager.isEmpty();
}
-void InstanceMap::PermBindAllPlayers(Player* source)
+void InstanceMap::PermBindAllPlayers()
{
if (!IsDungeon())
return;
@@ -3319,31 +3319,36 @@ void InstanceMap::PermBindAllPlayers(Player* source)
InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!save)
{
- TC_LOG_ERROR("maps", "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUID().GetCounter(), source->GetName().c_str(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId());
+ TC_LOG_ERROR("maps", "Cannot bind players to instance map (Name: %s, Entry: %u, Difficulty: %u, ID: %u) because no instance save is available!", GetMapName(), GetId(), GetDifficulty(), GetInstanceId());
return;
}
- Group* group = source->GetGroup();
- // group members outside the instance group don't get bound
+ // perm bind all players that are currently inside the instance
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
Player* player = itr->GetSource();
- // players inside an instance cannot be bound to other instances
- // some players may already be permanently bound, in this case nothing happens
+ // never instance bind GMs with GM mode enabled
+ if (player->IsGameMaster())
+ continue;
+
InstancePlayerBind* bind = player->GetBoundInstance(save->GetMapId(), save->GetDifficulty());
- if (!bind || !bind->perm)
+ if (bind && bind->perm)
+ {
+ TC_LOG_ERROR("maps", "Player (GUID: %u, Name: %s) is in instance map (Name: %s, Entry: %u, Difficulty: %u, ID: %u) that is being bound, but already has a save for the map on ID %u!", player->GetGUID().GetCounter(), player->GetName().c_str(), GetMapName(), GetId(), GetDifficulty(), GetInstanceId(), save->GetInstanceId());
+ }
+ else
{
player->BindToInstance(save, true);
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
data << uint32(0);
player->GetSession()->SendPacket(&data);
- if (!player->IsGameMaster())
- player->GetSession()->SendCalendarRaidLockout(save, true);
- }
+ player->GetSession()->SendCalendarRaidLockout(save, true);
- // if the leader is not in the instance the group will not get a perm bind
- if (group && group->GetLeaderGUID() == player->GetGUID())
- group->BindToInstance(save, true);
+ // if group leader is in instance, group also gets bound
+ if (Group* group = player->GetGroup())
+ if (group->GetLeaderGUID() == player->GetGUID())
+ group->BindToInstance(save, true);
+ }
}
}