diff options
author | treeston <treeston.mmoc@gmail.com> | 2015-12-27 18:03:03 +0100 |
---|---|---|
committer | treeston <treeston.mmoc@gmail.com> | 2015-12-31 01:02:07 +0100 |
commit | 43fa7d48a5650c71f74098f3398cf5aca89c3837 (patch) | |
tree | a6d808e4b447f9df2b1f1cfe0a19483d64fe87d5 /src/server/game/Handlers/MovementHandler.cpp | |
parent | 812809a977e2ba2a53e55c3dfc74bbed9dd59b7a (diff) |
Game/Maps: Clean up instance handling.
- Rename Map::CanEnter to Map::CannotEnter. Return value changed from boolean (true means player can enter) to enum Map::EnterState (CAN_ENTER=0 means player can enter, any other value is a reason for deny).
- Move hack-y player error messages from within Map::CanEnter to the function calling CanEnter as appropriate (primarily WorldSession::HandleAreaTriggerOpcode).
- Modify WorldSession::HandleAreaTriggerOpcode to properly revive the player upon touching the portal leading to the instance they died in even if they are currently unable to zone in. Fixes and closes #15758.
- Modify Player::LoadFromDB to properly spawn players in the instance they logged off in if possible. Fixes and closes #15561.
- Modify permanent save behavior to be blizzlike: Players can always enter an instance they are saved to (assuming there are no map constraints against it), but get a homebind timer if the instance is already in use.
Diffstat (limited to 'src/server/game/Handlers/MovementHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MovementHandler.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 84816bf3f33..33a50fad1f5 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -75,9 +75,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // relocate the player to the teleport destination - // the CanEnter checks are done in TeleporTo but conditions may change + // the CannotEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full - if (!newMap || !newMap->CanEnter(GetPlayer())) + if (!newMap || newMap->CannotEnter(GetPlayer())) { TC_LOG_ERROR("network", "Map %d (%s) could not be created for player %d (%s), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", GetPlayer()->GetGUID().GetCounter(), GetPlayer()->GetName().c_str()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); @@ -142,19 +142,18 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // resurrect character at enter into instance where his corpse exist after add to map - Corpse* corpse = GetPlayer()->GetMap()->GetCorpseByPlayer(GetPlayer()->GetGUID()); - if (corpse && corpse->GetType() != CORPSE_BONES) - { - if (mEntry->IsDungeon()) + + if (mEntry->IsDungeon() && !GetPlayer()->IsAlive()) + if (GetPlayer()->GetCorpseLocation().GetMapId() == mEntry->MapID) { GetPlayer()->ResurrectPlayer(0.5f, false); GetPlayer()->SpawnCorpseBones(); } - } bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena(); if (mInstance) { + // check if this instance has a reset time and send it to player if so Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid()); if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID, diff)) { @@ -167,6 +166,12 @@ void WorldSession::HandleMoveWorldportAckOpcode() } } } + + // check if instance is valid + if (!GetPlayer()->CheckInstanceValidity(false)) + GetPlayer()->m_InstanceValid = false; + + // instance mounting is handled in InstanceTemplate allowMount = mInstance->AllowMount; } |