aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
authorclick <none@none>2010-05-04 18:25:30 +0200
committerclick <none@none>2010-05-04 18:25:30 +0200
commit029e4804543c473f3b8cf98cfbecc91675dc4b78 (patch)
tree5a4f006e4f75d6ba6738b4d868b52b33e30c8936 /src/game/MiscHandler.cpp
parent51d0c07c90690925e03a8d5e75decc2e1410c57e (diff)
Add stricter regulations for instances (login-checks and support for sending unbound player to parent-instance / homebind if not matching criterias)
Patch by Elron103 - closes issue #1323. --HG-- branch : trunk
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 46c822fcbf0..5cc3d6f3e35 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -48,6 +48,8 @@
#include "CreatureAI.h"
#include "DBCEnums.h"
#include "ScriptMgr.h"
+#include "MapManager.h"
+#include "InstanceData.h"
void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
{
@@ -915,6 +917,25 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
if (!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
return;
+ // check if player can enter instance : instance not full, and raid instance not in encounter fight
+ if (Map * newMap = MapManager::Instance().CreateMap(at->target_mapId, GetPlayer(), 0))
+ {
+ if (newMap && newMap->IsDungeon() && ((InstanceMap*)newMap)->GetInstanceData() && ((InstanceMap*)newMap)->GetMapDifficulty())
+ {
+ if (newMap->GetPlayersCountExceptGMs() >= ((InstanceMap*)newMap)->GetMapDifficulty()->maxPlayers)
+ {
+ GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_MAX_PLAYERS);
+ return;
+ }
+
+ if (newMap->IsRaid() && ((InstanceMap*)newMap)->GetInstanceData()->IsEncounterInProgress())
+ {
+ GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_ZONE_IN_COMBAT);
+ return;
+ }
+ }
+ }
+
GetPlayer()->TeleportTo(at->target_mapId,at->target_X,at->target_Y,at->target_Z,at->target_Orientation,TELE_TO_NOT_LEAVE_TRANSPORT);
}