I wrote something similar for the 0.12-Branch some time ago:
diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp
index 5a5e9c7..05a57ce 100644 (file)
--- a/src/game/MapManager.cpp
+++ b/src/game/MapManager.cpp
@@ -18,6 +18,7 @@
#include "MapManager.h"
#include "InstanceSaveMgr.h"
+#include "InstanceData.h"
#include "Policies/SingletonImp.h"
#include "Database/DatabaseEnv.h"
#include "Log.h"
@@ -179,6 +180,16 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
}
}
}
+ //The player tries to enter a Instance where a Boss Encouter is in Progress
+ InstanceData* i_data = ((InstanceMap*)GetMap(mapid, player))->GetInstanceData();
+ if (i_data && i_data->IsEncounterInProgress() && !player->isGameMaster())
+ {
+ if (!player->isAlive())
+ player->ResurrectPlayer(30,false);
+ player->GetSession()->SendAreaTriggerMessage("You can not enter Instance %s while Boss Encounter is in Progress", mapName);
+ sLog.outDebug("MAP: Player '%s' can not enter instance of '%s' while boss encounter is in progress",player->GetName(), mapName);
+ return false;
+ }
//The player has a heroic mode and tries to enter into instance which has no a heroic mode
if (!entry->SupportsHeroicMode() && player->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
Guess it won't be able to apply on actual master but this way it works correct.
Just note that you may have to update some Instance-Scripts cause either the IsEncounterInProgress Function isn't declared (correctly) or some Bosses doesn't set their status correctly (gets nasty if they set it to in combat but don't set it to finished, as then nobody will be able to enter the instance)