aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rw-r--r--src/server/game/Groups/Group.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index bdb6b05253e..f8cf13c1112 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -35,6 +35,7 @@
#include "ObjectMgr.h"
#include "PartyPackets.h"
#include "Pet.h"
+#include "PhasingHandler.h"
#include "Player.h"
#include "Random.h"
#include "UpdateData.h"
@@ -2150,7 +2151,44 @@ void Group::ResetInstances(uint8 method, bool isRaid, bool isLegacy, Player* Sen
{
// do not reset the instance, just unbind if others are permanently bound to it
if (isEmpty && instanceSave->CanReset())
+ {
+ if (map && this->isRaidGroup() && map->IsDungeon() && SendMsgTo)
+ {
+ AreaTriggerStruct const* instanceEntrance = sObjectMgr->GetGoBackTrigger(map->GetId());
+
+ if (!instanceEntrance)
+ TC_LOG_DEBUG("root", "Instance entrance not found for maps %u", map->GetId());
+ else
+ {
+ WorldSafeLocsEntry const* graveyardLocation = sObjectMgr->GetClosestGraveyard(
+ WorldLocation(instanceEntrance->target_mapId, instanceEntrance->target_X, instanceEntrance->target_Y, instanceEntrance->target_Z),
+ SendMsgTo->GetTeam(), nullptr);
+ uint32 const zoneId = sMapMgr->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), graveyardLocation->Loc.GetMapId(),
+ graveyardLocation->Loc.GetPositionX(), graveyardLocation->Loc.GetPositionY(), graveyardLocation->Loc.GetPositionZ());
+
+ for (MemberSlot const& member : GetMemberSlots())
+ {
+ if (!ObjectAccessor::FindConnectedPlayer(member.guid))
+ {
+ CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_POSITION_BY_MAPID);
+
+ stmt->setFloat(0, graveyardLocation->Loc.GetPositionX());
+ stmt->setFloat(1, graveyardLocation->Loc.GetPositionY());
+ stmt->setFloat(2, graveyardLocation->Loc.GetPositionZ());
+ stmt->setFloat(3, instanceEntrance->target_Orientation);
+ stmt->setUInt32(4, graveyardLocation->Loc.GetMapId());
+ stmt->setUInt32(5, zoneId);
+ stmt->setUInt64(6, member.guid.GetCounter());
+ stmt->setUInt32(7, map->GetId());
+
+ CharacterDatabase.Execute(stmt);
+ }
+ }
+ }
+ }
+
instanceSave->DeleteFromDB();
+ }
else
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE);