aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-01-11 12:49:50 +0100
committerShauren <shauren.trinity@gmail.com>2022-10-04 00:19:38 +0200
commitddd0c7b152d65b980db0cc2d00f15ae62a602936 (patch)
tree475eeed3e0e514cd480e87133a590dd0de4c2064 /src/server/game/Groups/Group.cpp
parent76be303351ae398b7f9e69e4c472cb5b05fce45e (diff)
Core/Instances: Reimplement resetting instances from UI
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rw-r--r--src/server/game/Groups/Group.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index c799212b059..11f07340955 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -481,12 +481,6 @@ bool Group::AddMember(Player* player)
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
- // reset the new member's instances, unless he is currently in one of them
- // including raid/heroic instances that they are not permanently bound to!
- player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false, false);
- player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, false);
- player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, true);
-
if (player->GetDungeonDifficultyID() != GetDungeonDifficultyID())
{
player->SetDungeonDifficultyID(GetDungeonDifficultyID());
@@ -768,15 +762,11 @@ void Group::Disband(bool hideDestroy /* = false */)
stmt->setUInt32(0, m_dbStoreId);
trans->Append(stmt);
- CharacterDatabase.CommitTransaction(trans);
-
- ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, false, nullptr);
- ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, false, nullptr);
- ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, true, nullptr);
-
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
stmt->setUInt32(0, m_dbStoreId);
- CharacterDatabase.Execute(stmt);
+ trans->Append(stmt);
+
+ CharacterDatabase.CommitTransaction(trans);
sGroupMgr->FreeGroupDbStoreId(this);
}
@@ -1359,8 +1349,30 @@ Difficulty Group::GetDifficultyID(MapEntry const* mapEntry) const
return m_raidDifficulty;
}
-void Group::ResetInstances(InstanceResetMethod /*method*/, bool /*isRaid*/, bool /*isLegacy*/, Player* /*SendMsgTo*/)
+void Group::ResetInstances(InstanceResetMethod method, Player* notifyPlayer)
{
+ for (GroupInstanceReference& ref : m_ownedInstancesMgr)
+ {
+ InstanceMap* map = ref.GetSource();
+ switch (map->Reset(method))
+ {
+ case InstanceResetResult::Success:
+ notifyPlayer->SendResetInstanceSuccess(map->GetId());
+ m_recentInstances.erase(map->GetId());
+ break;
+ case InstanceResetResult::NotEmpty:
+ if (method == InstanceResetMethod::Manual)
+ notifyPlayer->SendResetInstanceFailed(INSTANCE_RESET_FAILED, map->GetId());
+ else if (method == InstanceResetMethod::OnChangeDifficulty)
+ m_recentInstances.erase(map->GetId()); // map might not have been reset on difficulty change but we still don't want to zone in there again
+ break;
+ case InstanceResetResult::CannotReset:
+ m_recentInstances.erase(map->GetId()); // forget the instance, allows retrying different lockout with a new leader
+ break;
+ default:
+ break;
+ }
+ }
}
void Group::LinkOwnedInstance(GroupInstanceReference* ref)