aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
authorzartech22 <kevin.plestan@outlook.fr>2019-06-22 19:23:42 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-11 23:12:27 +0100
commit1c3c59d7fac0abb02cc1fb433338737ea119831d (patch)
treea4a53f1e1ae95a7ce185c0a7951fad2e13ccaff0 /src/server/game/Groups/Group.cpp
parent799fba7fd12f34968d5ea34aaaed1a14bc20ae3f (diff)
Core/Instance : Fix instance resetting exploit (#23263)
* Push offline players out of instance Push offline players out of instance when reseting dungeon with a raid mode group * Add SQL request to character Add a SQL request to update the position of a player in a specified map * Teleport to graveyard instead (cherry picked from commit 678e0e606aa38e18fd361c33bc91833fdae76735)
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);