-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[12155] Rewrite Checks required when entering a map
Expected way from now on is: - Test if a map can be entered with Player::GetAreaTriggerLockStatus - IF this doesn't return AREA_LOCKSTATUS_OK, and if wanted, send the fail-message with Player::SendTransferAbortedByLockStatus function. Please feedback any hidden problems! Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
- Loading branch information
1 parent
6bfcef0
commit 3d95311
Showing
11 changed files
with
118 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1244,37 +1244,6 @@ void DungeonMap::InitVisibilityDistance() | |
m_VisibleDistance = World::GetMaxVisibleDistanceInInstances(); | ||
} | ||
|
||
/* | ||
Do map specific checks to see if the player can enter | ||
*/ | ||
bool DungeonMap::CanEnter(Player* player) | ||
{ | ||
if (player->GetMapRef().getTarget() == this) | ||
{ | ||
sLog.outError("DungeonMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); | ||
MANGOS_ASSERT(false); | ||
return false; | ||
} | ||
|
||
// cannot enter if the instance is full (player cap), GMs don't count | ||
uint32 maxPlayers = GetMaxPlayers(); | ||
if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= maxPlayers) | ||
{ | ||
DETAIL_LOG("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName()); | ||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); | ||
return false; | ||
} | ||
|
||
// cannot enter while an encounter in the instance is in progress | ||
if (!player->isGameMaster() && GetInstanceData() && GetInstanceData()->IsEncounterInProgress() && player->GetMapId() != GetId()) | ||
{ | ||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); | ||
return false; | ||
} | ||
|
||
return Map::CanEnter(player); | ||
} | ||
|
||
/* | ||
Do map specific checks and add the player to the map if successful. | ||
*/ | ||
|
@@ -1549,19 +1518,14 @@ void BattleGroundMap::InitVisibilityDistance() | |
|
||
bool BattleGroundMap::CanEnter(Player* player) | ||
{ | ||
if (player->GetMapRef().getTarget() == this) | ||
{ | ||
sLog.outError("BGMap::CanEnter - player %u already in map!", player->GetGUIDLow()); | ||
MANGOS_ASSERT(false); | ||
if (!Map::CanEnter(player)) | ||
return false; | ||
} | ||
|
||
if (player->GetBattleGroundId() != GetInstanceId()) | ||
return false; | ||
|
||
// player number limit is checked in bgmgr, no need to do it here | ||
|
||
return Map::CanEnter(player); | ||
return true; | ||
} | ||
|
||
bool BattleGroundMap::Add(Player* player) | ||
|
@@ -1603,6 +1567,18 @@ void BattleGroundMap::UnloadAll(bool pForce) | |
Map::UnloadAll(pForce); | ||
} | ||
|
||
bool Map::CanEnter(Player* player) | ||
{ | ||
if (player->GetMapRef().getTarget() == this) | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Schmoozerd
Member
|
||
sLog.outError("Map::CanEnter -%s already in map!", player->GetGuidStr().c_str()); | ||
MANGOS_ASSERT(false); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/// Put scripts in the execution queue | ||
bool Map::ScriptsStart(ScriptMapMapName const& scripts, uint32 id, Object* source, Object* target) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
it's wrong. in some cases we give assert while TeleportNear.