diff options
| author | megamage <none@none> | 2009-01-03 10:54:51 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-01-03 10:54:51 -0600 |
| commit | 89fb5ffcd6c6dcf194a957766a37c3fa7b246153 (patch) | |
| tree | 0b40788271639c4eb56871673e53a865687c7fd0 /src/game/Player.cpp | |
| parent | 5d4f8968aefe17794a0349c61935420910b58c2e (diff) | |
*Mangos [7010] Teleport players to the entrance of instances if they are in reset ones at login. By arrai.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
| -rw-r--r-- | src/game/Player.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d928ef4a4ce..6b8bb661245 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14248,7 +14248,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) uint32 transGUID = fields[24].GetUInt32(); Relocate(fields[6].GetFloat(),fields[7].GetFloat(),fields[8].GetFloat(),fields[10].GetFloat()); - SetFallInformation(0, fields[8].GetFloat()); SetMapId(fields[9].GetUInt32()); SetDifficulty(fields[32].GetUInt32()); // may be changed in _LoadGroup @@ -14337,6 +14336,16 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // getmap calls won't create new maps SetInstanceId(map->GetInstanceId()); + // if the player is in an instance and it has been reset in the meantime teleport him to the entrance + if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId())) + { + AreaTrigger const* at = objmgr.GetMapEntranceTrigger(GetMapId()); + if(at) + Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); + else + sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no aretrigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), GetMapId()); + } + SaveRecallPosition(); if (transGUID != 0) @@ -14608,6 +14617,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // flight will started later } + // has to be called after last Relocate() in Player::LoadFromDB + SetFallInformation(0, GetPositionZ()); + _LoadSpellCooldowns(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS)); // Spell code allow apply any auras to dead character in load time in aura/spell/item loading |
