Allow GMs to bypass instance entry requirements

--HG--
branch : trunk
This commit is contained in:
Tartalo
2010-06-26 14:06:29 +02:00
parent 26da69a544
commit 57687c5c40
+23 -20
View File
@@ -161,14 +161,35 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (!entry->IsDungeon())
return true;
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
if (!instance)
return false;
//The player has a heroic mode and tries to enter into instance which has no a heroic mode
MapDifficulty const* mapDiff = GetMapDifficultyData(entry->MapID,player->GetDifficulty(entry->IsRaid()));
if (!mapDiff)
{
bool isNormalTargetMap = entry->IsRaid()
? (player->GetRaidDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
: (player->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL);
// Send aborted message
// FIX ME: what about absent normal/heroic mode with specific players limit...
player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
return false;
}
//Bypass checks for GMs
if (player->isGameMaster())
return true;
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
Group* pGroup = player->GetGroup();
if (entry->IsRaid())
{
// can only enter in a raid group
// GMs can avoid raid limitations
if ((!pGroup || !pGroup->isRaidGroup()) && !player->isGameMaster() && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_RAID))
if ((!pGroup || !pGroup->isRaidGroup()) && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_RAID))
{
// probably there must be special opcode, because client has this string constant in GlobalStrings.lua
// TODO: this is not a good place to send the message
@@ -178,20 +199,6 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
}
}
//The player has a heroic mode and tries to enter into instance which has no a heroic mode
MapDifficulty const* mapDiff = GetMapDifficultyData(entry->MapID,player->GetDifficulty(entry->IsRaid()));
if (!mapDiff)
{
bool isNormalTargetMap = entry->IsRaid()
? (player->GetRaidDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
: (player->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL);
// Send aborted message
// FIX ME: what about absent normal/heroic mode with specific players limit...
player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
return false;
}
if (!player->isAlive())
{
if (Corpse *corpse = player->GetCorpse())
@@ -221,10 +228,6 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
sLog.outDebug("Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName());
}
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
if (!instance)
return false;
//Get instance where player's group is bound & its map
if (pGroup)
{