aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.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/Player.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/Player.cpp')
-rw-r--r--src/game/Player.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 62e128f2787..5d11b8acea9 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1826,7 +1826,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// Check enter rights before map getting to avoid creating instance copy for player
// this check not dependent from map instance copy and same for all instance copies of selected map
- if (!MapManager::Instance().CanPlayerEnter(mapid, this))
+ if (!MapManager::Instance().CanPlayerEnter(mapid, this, false))
return false;
// If the map is not created, assume it is possible to enter it.
@@ -17347,6 +17347,31 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
return true;
}
+bool Player::CheckInstanceLoginValid()
+{
+ if (!GetMap())
+ return false;
+
+ if (!GetMap()->IsDungeon() || isGameMaster())
+ return true;
+
+ if (GetMap()->IsRaid())
+ {
+ // cannot be in raid instance without a group
+ if (!GetGroup())
+ return false;
+ }
+ else
+ {
+ // cannot be in normal instance without a group and more players than 1 in instance
+ if (!GetGroup() && GetMap()->GetPlayersCountExceptGMs() > 1)
+ return false;
+ }
+
+ // do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
+ return MapManager::Instance().CanPlayerEnter(GetMap()->GetId(), this, true);
+}
+
bool Player::_LoadHomeBind(QueryResult_AutoPtr result)
{
PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());